query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
dbad71174b8e0f639152bb7907782272
MarshalJSON supports json.Marshaler interface
[ { "docid": "fc921dede94fb3c0bf3c7c360bc84d18", "score": "0.0", "text": "func (v Error) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComvladimirsukiasyanTpDbInternalModels13(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" } ]
[ { "docid": "ede95d8b2a52015c8734420e8f343d19", "score": "0.79136276", "text": "func Marshal(j interface{}) ([]byte, error) {\n\treturn json.Marshal(j)\n}", "title": "" }, { "docid": "ddd512b8b972e516b4663b38a134bdfa", "score": "0.74821985", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "ddd512b8b972e516b4663b38a134bdfa", "score": "0.74821985", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "616d59d555b12f32dc2f1f42c66e3d4c", "score": "0.74242294", "text": "func Marshal(value interface{}) ([]byte, error) {\n\treturn json.Marshal(value)\n}", "title": "" }, { "docid": "abb02f71cf3f85d29743c973b835f2c3", "score": "0.7422612", "text": "func (jc JsonCracker) Marshal(dest interface{}) ([]byte, error) {\n\treturn jc.Json.Marshal(dest)\n}", "title": "" }, { "docid": "325c6b215a2dea0eaeec1b61a9b191c4", "score": "0.7407306", "text": "func Marshal(input interface{}) ([]byte, error) {\n\tbytes, err := json.Marshal(input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn jcs.Transform(bytes)\n}", "title": "" }, { "docid": "a0444612e6d25482c2e352b7195dff71", "score": "0.7407171", "text": "func (m *MyMarshaler) Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "f41ee1c286cfd0688b4329a535690daa", "score": "0.7298552", "text": "func JSONMarshal(t interface{}) ([]byte, error) {\n\tbuf := &bytes.Buffer{}\n\tenc := json.NewEncoder(buf)\n\tenc.SetEscapeHTML(false)\n\terr := enc.Encode(t)\n\t// Make sure to trim the last character in the buffer as json.Encode adds a new line character\n\tbuf.Truncate(buf.Len() - 1)\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "5b58f4626c256a17931fb21f1a7fbbbf", "score": "0.7260543", "text": "func jsonMarshal(t interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(t)\n\treturn buffer.Bytes(), err\n}", "title": "" }, { "docid": "9d414abf150e6d96f55d571f8b420f06", "score": "0.7215733", "text": "func JSONMarshal(t interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(t)\n\treturn buffer.Bytes(), err\n}", "title": "" }, { "docid": "e7d486c47fbe1bad3165ceb34dc4e934", "score": "0.7202888", "text": "func JsonMarshal(v interface{}) ([]byte, error) {\n\tmarshaler := conjson.NewMarshaler(v, transform.ConventionalKeys())\n\treturn json.MarshalIndent(marshaler, \"\", \" \")\n}", "title": "" }, { "docid": "4d052e399547918fc141b7c263b97c3e", "score": "0.71830505", "text": "func (g jsonEncoding) Marshal(objs []interface{}) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tenc := json.NewEncoder(&buf)\n\tfor i, obj := range objs {\n\t\tif err := enc.Encode(obj); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, fmt.Errorf(\"missing argument at index %d of type %T\", i, obj)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"unable to encode argument: %d, %v, with json error: %v\", i, reflect.TypeOf(obj), err)\n\t\t}\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "2c398048364477f6b6af89079b68c135", "score": "0.7173371", "text": "func marshal(i interface{}) []byte {\n\tjsonBytes, err := json.MarshalIndent(i, \"\", \" \")\n\tif err != nil {\n\t\tlog.Println(\"error encoding json:\", err)\n\t}\n\treturn append(jsonBytes, '\\n')\n}", "title": "" }, { "docid": "6ba14019852b1e325ac5f298fe2db828", "score": "0.71396565", "text": "func Marshal(from interface{}, pretty bool) ([]byte, error) {\n\tif pretty {\n\t\treturn json.MarshalIndent(from, \"\", \" \")\n\t}\n\treturn json.Marshal(from)\n}", "title": "" }, { "docid": "5869380c2888de4c2601e29012d598b0", "score": "0.71391565", "text": "func (e *JSONEncoding) Marshal(dataType interface{}) ([]byte, error) {\n\treturn json.Marshal(dataType)\n}", "title": "" }, { "docid": "e6ed5d86df3f3abe440b2d70eac8257c", "score": "0.7132244", "text": "func (j *JSONPb) Marshal(v interface{}) (data []byte, err error) {\n\treturn jsonMarshal(v, true)\n}", "title": "" }, { "docid": "41f5246632c55524d8a89aef0c29359b", "score": "0.70569414", "text": "func Marshal(v interface{}) []byte {\n\tbytes, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn bytes\n}", "title": "" }, { "docid": "64971e58be3cd4c74798c2f43f786e42", "score": "0.70549554", "text": "func marshal(payload interface{}) ([]byte, error) {\n\tb, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "691509cde3df004da920501793eea226", "score": "0.7025248", "text": "func Marshal(obj interface{}) (result string, err error) {\n\tbf := bytes.NewBuffer([]byte{})\n\tjsonEncoder := json.NewEncoder(bf)\n\tjsonEncoder.SetEscapeHTML(false)\n\tjsonEncoder.SetIndent(\"\", \" \")\n\terr = jsonEncoder.Encode(obj)\n\tif err != nil {\n\t\treturn\n\t}\n\tresult = bf.String()\n\treturn\n}", "title": "" }, { "docid": "8d00efc4f4782a235af74ccb344a6c94", "score": "0.69780403", "text": "func Marshal(v absser.Parsable) ([]byte, error) {\n\tif vRef := reflect.ValueOf(v); !vRef.IsValid() || vRef.IsNil() {\n\t\treturn []byte(\"null\"), nil\n\t}\n\n\tserializer, err := absser.DefaultSerializationWriterFactoryInstance.GetSerializationWriter(\"application/json\")\n\tif err != nil {\n\t\tserializer = NewJsonSerializationWriter()\n\t}\n\n\tdefer serializer.Close()\n\n\tif err := v.Serialize(serializer); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn serializer.GetSerializedContent()\n}", "title": "" }, { "docid": "ca48adde7eaef8226e08ee7b67988e87", "score": "0.6915537", "text": "func Marshal(or interface{}) string {\n\tb, err := json.Marshal(or)\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %s\", err)\n\t\treturn \"0\"\n\t}\n\t//fmt.Println(string(b))\n\n\treturn string(b)\n}", "title": "" }, { "docid": "38813c5afd3cdaadc951c3e224fe16a1", "score": "0.691337", "text": "func (sj *SerializerJSON) Marshal(message proto.Message) ([]byte, error) {\n\treturn json.Marshal(message)\n}", "title": "" }, { "docid": "4f08332cec651b44c743c2761e3cbd30", "score": "0.68609536", "text": "func MarshalJSON(v interface{}) ([]byte, error) {\n\tif vm, ok := v.(easyjson.Marshaler); ok {\n\t\tw := &jwriter.Writer{}\n\t\tvm.MarshalEasyJSON(w)\n\t\treturn w.Buffer.BuildBytes(), w.Error\n\t}\n\n\tif vm, ok := v.(json.Marshaler); ok {\n\t\treturn vm.MarshalJSON()\n\t}\n\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "209a19bd592f50836022d884b1a5b76e", "score": "0.683813", "text": "func jsonify(any interface{}) []byte {\n\tbuf, _ := json.Marshal(any)\n\treturn buf\n}", "title": "" }, { "docid": "639c5b8bdf2faa64f6e32c5547d409b3", "score": "0.68301386", "text": "func jsonnetMarshal(v interface{}) ([]byte, error) {\n\tif structs.IsStruct(v) {\n\t\treturn json.Marshal(structs.Map(v))\n\t}\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "ac74e90bb3c7b47f2f499c1e442bfbbb", "score": "0.6817772", "text": "func JSONMarshal(content interface{}, escape bool) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tenc := json.NewEncoder(&buf)\n\tenc.SetEscapeHTML(escape)\n\tif err := enc.Encode(content); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "b33be26c4d9cdad47ff45cdaee7c4070", "score": "0.67922986", "text": "func JSONMarshal(msg drpc.Message, enc drpc.Encoding) ([]byte, error) {\n\tif enc, ok := enc.(interface {\n\t\tJSONMarshal(msg drpc.Message) ([]byte, error)\n\t}); ok {\n\t\treturn enc.JSONMarshal(msg)\n\t}\n\n\t// fallback to normal Marshal + JSON Marshal\n\tbuf, err := enc.Marshal(msg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(buf)\n}", "title": "" }, { "docid": "769502091c7bb3121de03c9a3779166b", "score": "0.6768168", "text": "func (k K8SScheduling) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"default\", k.Default)\n\tif k.AdditionalProperties != nil {\n\t\tfor key, val := range k.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a69f98b0d390f7153aadf2df92e20636", "score": "0.6766549", "text": "func (js JSONSerialization) MarshalJSON() ([]byte, error) {\n\tjs.Type = TypeJSON\n\ttype Alias JSONSerialization\n\treturn json.Marshal(&struct {\n\t\tAlias\n\t}{\n\t\tAlias: (Alias)(js),\n\t})\n}", "title": "" }, { "docid": "f49919f4911bfd39694945ee18fb753d", "score": "0.6755281", "text": "func (sr *SubsonicResponse) MarshalJson() (payload string, err error) {\n var b []byte\n\n b, err = json.MarshalIndent(sr, \"\", \" \")\n if err == nil {\n payload = string(b)\n }\n\n return\n}", "title": "" }, { "docid": "6d343a568ee34fbb393f3482e704718f", "score": "0.67224205", "text": "func JSONMarshal(value lua.LValue) ([]byte, error) {\n\treturn json.Marshal(marshalValue{\n\t\tLValue: value,\n\t\tvisited: make(map[*lua.LTable]bool),\n\t})\n}", "title": "" }, { "docid": "56763769913cef48fbf424eaecd5b78f", "score": "0.67001754", "text": "func (r RawJSON) Marshal() ([]byte, error) {\n\treturn r, nil\n}", "title": "" }, { "docid": "e24ad7c253859a48d0d9597dd9dc7437", "score": "0.6671406", "text": "func encodeJSON(obj interface{}) []byte {\n\tvar buf []byte\n\tenc := codec.NewEncoderBytes(&buf, jsonCodecHandle)\n\tenc.MustEncode(obj)\n\treturn buf\n}", "title": "" }, { "docid": "302bdc96b9e42f96dd48f1299a958f60", "score": "0.66452885", "text": "func marshal(r interface{}) (string, error) {\n\tbytes, err := json.Marshal(r) // marshal to json string\n\tif err != nil {\n\t\treturn \"\", ErrMarshal\n\t}\n\treturn string(bytes), nil\n}", "title": "" }, { "docid": "782a50b6d91d56ef4cdf96d0221953e2", "score": "0.6637604", "text": "func (j JSON) MarshalJSON() ([]byte, error) {\n\tif j.Exists() {\n\t\treturn j.Bytes(), nil\n\t}\n\treturn []byte(\"{}\"), nil\n}", "title": "" }, { "docid": "9b360680f38ac1cb0df5871762514bc1", "score": "0.662012", "text": "func JSON(v interface{}) Serializer {\n\treturn func() (io.WriterTo, error) {\n\t\tdata, err := json.Marshal(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn bytes.NewBuffer(data), nil\n\t}\n}", "title": "" }, { "docid": "a55045799bb9bf4b2e45d6c3b46ff88f", "score": "0.6619126", "text": "func (swap *Swap) Marshal() ([]byte, error) {\n\treturn json.Marshal(swap)\n}", "title": "" }, { "docid": "9769a831260a531896f837bb47c4468b", "score": "0.6619021", "text": "func EncoderEncode(enc *json.Encoder, v interface{}) error", "title": "" }, { "docid": "f422e8ebceef131e79459b3b6b37a555", "score": "0.6605911", "text": "func (p *JSONPack) Marshal(schemaName string, v interface{}) ([]byte, error) {\n\treturn p.Encode(schemaName, v)\n}", "title": "" }, { "docid": "ede842a1e3de6cd11f646ffe200c5043", "score": "0.6593639", "text": "func (f *Formatter) Marshal(v interface{}) ([]byte, error) {\n\tdata, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !f.DisablePretty {\n\t\tdata, err = f.format(data)\n\t}\n\n\treturn data, err\n}", "title": "" }, { "docid": "9a5159968b8ab1e1cab3a5ac61b3c9ed", "score": "0.65897655", "text": "func (v BaseObjectWithName) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC7452bc1EncodeGithubComStek29Vk86(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "3885156143bb58ec2c10650950323026", "score": "0.6588591", "text": "func marshalJSON(src map[string]interface{}) (string, error) {\n\toptions, err := json.Marshal(src)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(options[:]), err\n}", "title": "" }, { "docid": "fac73813e19177178e7cb98720599eb1", "score": "0.6577759", "text": "func (in Anything) MarshalJSON() ([]byte, error) {\n\tif in.Value == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn json.Marshal(in.Value)\n}", "title": "" }, { "docid": "611290914263fed838e2399a2fb88105", "score": "0.65765554", "text": "func Marshal(w io.Writer) {\n\tj, _ := json.Marshal(&Data{\n\t\tID: \"abcde\",\n\t\tName: \"Roy\",\n\t\tEmail: \"roywjy@gmail.com\",\n\t\tWhatever: 100,\n\t})\n\tw.Write(j)\n}", "title": "" }, { "docid": "48f3eb3491050dae4c31924b60df3882", "score": "0.6573558", "text": "func (j *JSON) MarshalJSON() ([]byte, error) {\n\tif j.Exists() {\n\t\treturn []byte(j.String()), nil\n\t}\n\treturn []byte(\"{}\"), nil\n}", "title": "" }, { "docid": "54bf8fe98918caa4e95f2a7ce3ee7e8d", "score": "0.65641487", "text": "func (b *FooJSONBuilder) Marshal(orig *Foo) ([]byte, error) {\n\tret, err := b.Convert(orig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(ret)\n}", "title": "" }, { "docid": "2bbf06e77c11a0e5ad45bc10034ef858", "score": "0.6557803", "text": "func Marshal(in interface{}) ([]byte, error) {\n\treturn y.Marshal(in)\n}", "title": "" }, { "docid": "367eafe3cdda3a3a2098541bef58428b", "score": "0.65500295", "text": "func (j JSONSerialization) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"properties\", j.Properties)\n\tobjectMap[\"type\"] = EventSerializationTypeJSON\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8189d5680044ecef7db5728a8299e28c", "score": "0.6549089", "text": "func Marshal(v data.Value) ([]byte, error) {\n\ta := &fastjson.Arena{}\n\tmval, err := marshalValue(a, v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ta.Reset()\n\treturn mval.MarshalTo(nil), nil\n}", "title": "" }, { "docid": "2bae976e66ada70b8bcaa8618b966770", "score": "0.65362203", "text": "func (s *Machine) JSONMarshal() (p []byte, err error) {\n\treturn json.Marshal(s)\n}", "title": "" }, { "docid": "8bfc7c81a623679484636aca7a7f4c7f", "score": "0.6527229", "text": "func MarshalInterface(in interface{}, out interface{}) (err error) {\n\tinB, err := json.Marshal(in)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\treturn json.Unmarshal(inB, &out)\n}", "title": "" }, { "docid": "c6a7deb3c19277161554cf4a029ece9d", "score": "0.6522299", "text": "func (pc *ProtoCodec) MarshalInterfaceJSON(x proto.Message) ([]byte, error) {\n\tany, err := types.NewAnyWithValue(x)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pc.MarshalJSON(any)\n}", "title": "" }, { "docid": "59f1220608ee1e6d14efd561b7361eb7", "score": "0.6521671", "text": "func (its *jsonElement) marshal() *marshaledJSONType {\n\tforMarshal := its.jsonType.marshal()\n\tforMarshal.T = marshalKeyJSONElement\n\tforMarshal.E = its.getValue()\n\treturn forMarshal\n}", "title": "" }, { "docid": "fdbf38579a19f8b36cc9d243fc32ff70", "score": "0.65119445", "text": "func (v Post) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC7452bc1EncodeGithubComStek29Vk23(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "e8d7bd3f5292c3b47b7e842cad63b6ce", "score": "0.65085506", "text": "func mustMarshalJSON(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(\"marshal: \" + err.Error())\n\t}\n\treturn b\n}", "title": "" }, { "docid": "e8d7bd3f5292c3b47b7e842cad63b6ce", "score": "0.65085506", "text": "func mustMarshalJSON(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(\"marshal: \" + err.Error())\n\t}\n\treturn b\n}", "title": "" }, { "docid": "dfe1aa29b78220e9fdbdaef00745acc7", "score": "0.6508484", "text": "func testJSONMarshal(t *testing.T, v interface{}, want string) {\n\tt.Helper()\n\t// Unmarshal the wanted JSON, to verify its correctness, and marshal it back\n\t// to sort the keys.\n\tu := reflect.New(reflect.TypeOf(v)).Interface()\n\tif err := json.Unmarshal([]byte(want), &u); err != nil {\n\t\tt.Errorf(\"Unable to unmarshal JSON for %v: %v\", want, err)\n\t}\n\tw, err := json.Marshal(u)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %#v\", u)\n\t}\n\n\t// Marshal the target value.\n\tj, err := json.Marshal(v)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %#v\", v)\n\t}\n\n\tif string(w) != string(j) {\n\t\tt.Errorf(\"json.Marshal(%q) returned %s, want %s\", v, j, w)\n\t}\n}", "title": "" }, { "docid": "bce61d1901697f2fc0063044de728741", "score": "0.6502769", "text": "func Marshal(obj interface{}) string {\n\tjsonData, err := json.Marshal(obj)\n\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"marshal(): %w\", err))\n\t}\n\n\tzlibData := bytes.NewBuffer([]byte{})\n\tw := zlib.NewWriter(zlibData)\n\t// we assume the zlib writer would never fail\n\t_, _ = w.Write(jsonData)\n\tw.Close()\n\n\tbase64Data := base64.URLEncoding.EncodeToString(zlibData.Bytes())\n\n\treturn base64Data\n}", "title": "" }, { "docid": "4920e750a986fd74f910a594bd2e7061", "score": "0.6493912", "text": "func (a *marshalAdapter) MarshalJSON() ([]byte, error) {\n\tresult, err := a.object.Marshal()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(result)\n}", "title": "" }, { "docid": "8aaaad36aea14c4b3abb38f9abbdaded", "score": "0.648895", "text": "func (j JSONSerialization) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"properties\", j.Properties)\n\tobjectMap[\"type\"] = EventSerializationTypeJSON\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e154202ecf966cc8ce968b431aa78035", "score": "0.6482891", "text": "func (i Interface) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"etag\", i.Etag)\n\tpopulate(objectMap, \"id\", i.ID)\n\tpopulate(objectMap, \"location\", i.Location)\n\tpopulate(objectMap, \"name\", i.Name)\n\tpopulate(objectMap, \"properties\", i.Properties)\n\tpopulate(objectMap, \"tags\", i.Tags)\n\tpopulate(objectMap, \"type\", i.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "aa575a8a8665cee25393c0394ef9397f", "score": "0.64799875", "text": "func MarshalInterface(in interface{}, out interface{}) (err error) {\n\tinB, err := json.Marshal(in)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn json.Unmarshal(inB, &out)\n}", "title": "" }, { "docid": "ea6deddeb408da251d7322dfd6e56e05", "score": "0.6476929", "text": "func TestJSONEncoding() {\n\tm := message{\"Jacob\", \"HelloWorld\", 45}\n\n\tb, _ := json.Marshal(m)\n\t// convert to string to see legible representation\n\tfmt.Println(string(b))\n}", "title": "" }, { "docid": "f62fd7cbda973ad0abb228d8a2d19569", "score": "0.64654386", "text": "func (v BaseObject) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC7452bc1EncodeGithubComStek29Vk87(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "bf555cf7fdae143007cf3a82346fb24e", "score": "0.6461388", "text": "func (v PrepareForLeakDetectionParams) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory6(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "c9fac8f5212785a4df00eb2bee989808", "score": "0.646123", "text": "func (j JSON) MarshalJSON() ([]byte, error) {\n\tif j == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn j, nil\n}", "title": "" }, { "docid": "9f11ce1c0b175d0811c9aae68d896bb3", "score": "0.64579177", "text": "func (s *Species) Marshal() ([]byte, error) {\n\treturn json.Marshal(s)\n}", "title": "" }, { "docid": "c9b8f482329d4e2f142c1d9386970513", "score": "0.6455858", "text": "func JSONEncoder() Encoder {\n\treturn gJSONEncoder\n}", "title": "" }, { "docid": "4cf3f26d74fdba7f2b93b4a643de2a0a", "score": "0.64536816", "text": "func JSONEncoder(w io.Writer, v interface{}) error {\n\terr := json.NewEncoder(w).Encode(v)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"httpcli:JSONEncoder:%w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "133a25d2d518ae1e3fe5756ebc102dcb", "score": "0.6452365", "text": "func (v MyBody) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson635ef9aeEncodeGithubComUberZanzibarRuntime(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "f4db94a20315e7f36de6926e25e2b73e", "score": "0.64515275", "text": "func (j EncryptedJSON) MarshalJSON() ([]byte, error) {\n\tif j.str == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn []byte(*j.str), nil\n}", "title": "" }, { "docid": "24cf03dc11a8a6c71af8bc7591770bde", "score": "0.6444087", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tb := bytes.NewBuffer([]byte{})\n\tencoder := NewEncoder(b)\n\terr := encoder.Encode(v)\n\treturn b.Bytes(), err\n}", "title": "" }, { "docid": "961f550b7ed6b3571b3742a00500c901", "score": "0.6443747", "text": "func (v User) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson3486653aEncodeCourseraHw3Bench(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "2b197e45c3ba56cc8461881165c28b54", "score": "0.6435989", "text": "func JSONEncode(input interface{}) (string, error) {\n\treturn JSONEncodeIndent(input, ``)\n}", "title": "" }, { "docid": "edd84f69c52d4ea27eb9157ee1d090f2", "score": "0.6435381", "text": "func Marshal(v interface{}) ([]byte, error)", "title": "" }, { "docid": "d765e1a11d6a8225fae9d6aed20b1280", "score": "0.64300793", "text": "func (pub *PublicKey) Marshal(key string) ([]byte, error) {\n\tasymK, err := SymetricEncrypt([]byte(key), nil, pub.AsymPubKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tencryptedVersion, err := SymetricEncrypt([]byte(key), nil, []byte(fmt.Sprintf(\"%v\", KeyVersion)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tname, err := SymetricEncrypt([]byte(key), nil, pub.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tj := jsonPublicKey{\n\t\tKeyLength: pub.KeyLength,\n\t\tVersion: KeyVersion,\n\t\tAsymPubKey: asymK,\n\t\tEncryptedVersion: encryptedVersion,\n\t\tName: name,\n\t}\n\treturn json.Marshal(j)\n}", "title": "" }, { "docid": "0c8b12491ba27bb49385d7dfc42ccf0a", "score": "0.6427098", "text": "func (s *Spec) MarshalJSON() ([]byte, error) {\n\tbuf := bytes.NewBuffer(nil)\n\tstream := jsoniter.ConfigDefault.BorrowStream(buf)\n\ts.MarshalJSONStream(stream)\n\tstream.Flush()\n\terr := stream.Error\n\tjsoniter.ConfigDefault.ReturnStream(stream)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "bb6144d2f3f32b5d6443deaf334f57db", "score": "0.64243907", "text": "func (c *MiscreantCipher) Marshal(s interface{}) (string, error) {\n\t// encode json value\n\tplaintext, err := json.Marshal(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// gunzip the bytes\n\tvar jsonBuffer bytes.Buffer\n\tw := gzip.NewWriter(&jsonBuffer)\n\tw.Write(plaintext)\n\tw.Close()\n\n\t// encrypt the JSON\n\tciphertext, err := c.Encrypt(jsonBuffer.Bytes())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// base64-encode the result\n\tencoded := base64.RawURLEncoding.EncodeToString(ciphertext)\n\treturn encoded, nil\n}", "title": "" }, { "docid": "5af962f75999959b93c329c7ee63af7c", "score": "0.6409051", "text": "func (v BodyTrue) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson69c461c7EncodeCita18(w, v)\n}", "title": "" }, { "docid": "55ce858a9128542f7b5dc4a4bb5112dd", "score": "0.6406825", "text": "func (r *ServiceAPIResource) Marshal() ([]byte, error) {\n\treturn json.Marshal(&r.a)\n}", "title": "" }, { "docid": "4c0dad0942b54894fe55dec4bb0aaca9", "score": "0.6402928", "text": "func (p Pool) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"etag\", p.Etag)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"identity\", p.Identity)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c72b795380053763e3eb2a56af22efbc", "score": "0.6395411", "text": "func (m MigrateSQLServerSQLDbSyncDatabaseInput) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"migrationSetting\", m.MigrationSetting)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"schemaName\", m.SchemaName)\n\tpopulate(objectMap, \"sourceSetting\", m.SourceSetting)\n\tpopulate(objectMap, \"tableMap\", m.TableMap)\n\tpopulate(objectMap, \"targetDatabaseName\", m.TargetDatabaseName)\n\tpopulate(objectMap, \"targetSetting\", m.TargetSetting)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b49afdfd1b0a72726a235e88282947f6", "score": "0.6389667", "text": "func (s ContextSerializationMethods) MarshalToJSONWriter(w *jwriter.Writer, c *Context) {\n\twriteToJSONWriterInternal(w, c, false)\n}", "title": "" }, { "docid": "8936588a0c28355079bf1d7f568fbf7c", "score": "0.6383889", "text": "func (t Any) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(t.toMap())\n}", "title": "" }, { "docid": "98e78db6286cb4b916723dde7878b629", "score": "0.63801813", "text": "func (v BodyTrue) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson69c461c7EncodeCita18(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "5901e240019f25042133a85558518960", "score": "0.6378742", "text": "func (v PhotosetInfo) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson1c889379EncodeGithubComToomoreLazyflickrgoJsonstruct8(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "368cbb02cb3866c0e4d47897157d2fa3", "score": "0.6378412", "text": "func (v User) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson84c0690eEncodeHighloadcup3(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "b6b32de77b22bcdda363724134a9dad8", "score": "0.6369007", "text": "func (j JSONSerializationProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"encoding\", j.Encoding)\n\tpopulate(objectMap, \"format\", j.Format)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "378d029fecbc5dddee189600a18b7031", "score": "0.63689", "text": "func marshalInterface(obj interface{}) (json.RawMessage, error) {\n\tdata, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn json.RawMessage{}, fmt.Errorf(\"failed to marshal json: %w\", err)\n\t}\n\treturn json.RawMessage(data), nil\n}", "title": "" }, { "docid": "ac35d0007d6fcacb594cedbd336c58c4", "score": "0.63669586", "text": "func (s *RequiresItem) MarshalJSON() ([]byte, error) {\n\tbuf := bytes.NewBuffer(nil)\n\tstream := jsoniter.ConfigDefault.BorrowStream(buf)\n\ts.MarshalJSONStream(stream)\n\tstream.Flush()\n\terr := stream.Error\n\tjsoniter.ConfigDefault.ReturnStream(stream)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "d30d9edb9ee98a903d1a5a1391111823", "score": "0.63641584", "text": "func (b *InnerJSONBuilder) Marshal(orig *Inner) ([]byte, error) {\n\tret, err := b.Convert(orig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(ret)\n}", "title": "" }, { "docid": "6e6e406cd98016ceefabc75da4759b16", "score": "0.6362449", "text": "func JSONMarshaler(msg *SinkMessage) ([]byte, error) {\n\tj, err := json.Marshal(msg.Event)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tj = append(j, '\\n')\n\treturn j, err\n}", "title": "" }, { "docid": "d02c278d719709656b5a7cdd926147ed", "score": "0.6362331", "text": "func Marshal(pb proto.Message, options ...MarshalerOption) ([]byte, error) {\n\tm := Marshaler{\n\t\tMarshalOptions: protojson.MarshalOptions{\n\t\t\tAllowPartial: true,\n\t\t},\n\t}\n\tm.ApplyOptions(options...)\n\treturn m.Marshal(pb)\n}", "title": "" }, { "docid": "4ad4d9e469311be67893c89577135257", "score": "0.63577074", "text": "func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {\n\treturn json.MarshalIndent(v, prefix, indent)\n}", "title": "" }, { "docid": "8b038e2f865255f43d1a88033bbb4488", "score": "0.63561475", "text": "func (p ProxyResourceWithWritableName) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e1986f1c62b7696e66df0ac861fd9a27", "score": "0.6355796", "text": "func (m ManagedAPI) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"location\", m.Location)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"tags\", m.Tags)\n\tpopulate(objectMap, \"type\", m.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c9e28afe94b31faecbbc11ae1e9856c1", "score": "0.63554054", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tout := bytes.NewBuffer()\n\tenc := NewEncoder(out)\n\terr := enc.Encode(v)\n\treturn out.Bytes(), err\n}", "title": "" }, { "docid": "7d1dfb4410e14d91c809843fd8ff60dc", "score": "0.6353015", "text": "func (mc Encoder) Marshal(_ any) ([]byte, error) {\n\treturn mc.MarshalResponse, mc.MarshalError\n}", "title": "" }, { "docid": "2bcda4dcf16ed29e3b08fd116c499e9c", "score": "0.63498425", "text": "func (v ResultTransaction) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson69c461c7EncodeCita3(w, v)\n}", "title": "" }, { "docid": "0fc1835705253a409672ae4d7fbda726", "score": "0.63478875", "text": "func Marshal(target interface{}) (string, error) {\n\n\t// don't do anything with invalid interfaces\n\tv := reflect.ValueOf(target)\n\tif isInvalidOrEmptyValue(v) {\n\t\treturn \"\", utils.NewError(Marshal, \"unable to marshal empty or invalid values\", target, nil)\n\t}\n\n\tif encoded, err := encode(v, propertyEncoder, objectEncoder, stringEncoder); err != nil {\n\t\treturn \"\", err\n\t} else if encoded == \"\" {\n\t\treturn \"\", utils.NewError(Marshal, \"unable to encode interface, all methods exhausted\", v.Interface(), nil)\n\t} else {\n\t\treturn encoded, nil\n\t}\n\n}", "title": "" }, { "docid": "ced966c9d916509302d4efff9e1b32db", "score": "0.63424385", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tb := new(bytes.Buffer)\n\terr := NewEncoder(b).Encode(v) // no error possible when using a bytes.Buffer\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b.Bytes(), nil\n}", "title": "" } ]
b5d337db888904a76ff5499c7d3eaec4
returning interface from a struct
[ { "docid": "d4b99252ac906316128c9e292e96395d", "score": "0.0", "text": "func GetStreamApiInterface(ApiStruct *StreamApi) network.Stream {\n\tstreamInterface := ApiStruct.Stream\n\treturn streamInterface\n}", "title": "" } ]
[ { "docid": "eb16540a3624febecdfb8d61b993d141", "score": "0.6300106", "text": "func Interface(o interface{}) *interface{} { return &o }", "title": "" }, { "docid": "81704584a85392efe9d9005e89a52e8a", "score": "0.62110543", "text": "func (*Interface_Subinterface) IsYANGGoStruct() {}", "title": "" }, { "docid": "81704584a85392efe9d9005e89a52e8a", "score": "0.62092394", "text": "func (*Interface_Subinterface) IsYANGGoStruct() {}", "title": "" }, { "docid": "ac6f3c8180ddc1f794480cf3e059317f", "score": "0.6169113", "text": "func (*Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "ac6f3c8180ddc1f794480cf3e059317f", "score": "0.6169113", "text": "func (*Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "008031439b5116f184a2e8011910b3cf", "score": "0.6035969", "text": "func (*NetworkInstance_Protocol_Isis_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "2abeea04e69c0ff7a159f73ea6af180a", "score": "0.5929892", "text": "func (*Interface_Sonet) IsYANGGoStruct() {}", "title": "" }, { "docid": "88dcc2ca16453a5cde1b6767cf8da5ec", "score": "0.58786464", "text": "func (*NetworkInstance_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "99b441dc18143f0375891093872bc26c", "score": "0.5873933", "text": "func Struct(i interface{}) error {\n\treturn New().Struct(i)\n}", "title": "" }, { "docid": "eba2a73e16241139944c0339309e0c19", "score": "0.581878", "text": "func (*Mpls_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "0d14b3effc21905301572b479011a23a", "score": "0.580813", "text": "func (*NetworkInstance_Protocol_Isis_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "f65def5e0c3dccc7621e8bdf027bea08", "score": "0.5726433", "text": "func (*NetworkInstance_Mpls_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "5a0052f55359d7e66bc79c4eb8593540", "score": "0.57237095", "text": "func (*Stp_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "d4fea405f6a571361f5446ceed821883", "score": "0.57232517", "text": "func (*OpenconfigInterfaces_Interfaces_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "d4fea405f6a571361f5446ceed821883", "score": "0.57232517", "text": "func (*OpenconfigInterfaces_Interfaces_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "669cb6b6f0bbd0d765bc079378495945", "score": "0.57212865", "text": "func (*Mpls_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "8ba78ddd30400bad9a014273ffdf3b19", "score": "0.5705883", "text": "func (*Mpls_Global_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "2a55a7a92cbadc6561be25d3423323d9", "score": "0.5665679", "text": "func (*Lacp_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "2a55a7a92cbadc6561be25d3423323d9", "score": "0.5665679", "text": "func (*Lacp_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "90f23a9a951c78f15eead5f6946d8089", "score": "0.56545013", "text": "func (x *fastReflection_Block) Interface() protoreflect.ProtoMessage {\n\treturn (*Block)(x)\n}", "title": "" }, { "docid": "10346e1d4b25418c46d42971a01960cf", "score": "0.56433964", "text": "func (*Acl_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "d72998cd856f617b29fac0e658bf4bb1", "score": "0.5638516", "text": "func (*SrlNokiaInterfaces_Interface_Subinterface) IsYANGGoStruct() {}", "title": "" }, { "docid": "be878343d35a61f74bcdecb0c19231e3", "score": "0.5636745", "text": "func (*Lldp_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "be878343d35a61f74bcdecb0c19231e3", "score": "0.5636745", "text": "func (*Lldp_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "d8baf253f43e41e421dda843c1e6f7f6", "score": "0.5633274", "text": "func (*NetworkInstance_Protocol_Pim_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "9f6833050c06aab9d858ad8134b593ab", "score": "0.56093496", "text": "func (*Interface_Ethernet) IsYANGGoStruct() {}", "title": "" }, { "docid": "9f6833050c06aab9d858ad8134b593ab", "score": "0.56082064", "text": "func (*Interface_Ethernet) IsYANGGoStruct() {}", "title": "" }, { "docid": "3b6d25509b937bcecebb0f1fadb43850", "score": "0.56012416", "text": "func (x *fastReflection_Entry) Interface() protoreflect.ProtoMessage {\n\treturn (*Entry)(x)\n}", "title": "" }, { "docid": "a6210acf2d3ce5681fdc52858bd43c10", "score": "0.5588306", "text": "func (*NetworkInstance_Protocol_Igmp_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "ece73a8ea17575b1203af13dbdebe9aa", "score": "0.5576726", "text": "func (x *fastReflection_Vote) Interface() protoreflect.ProtoMessage {\n\treturn (*Vote)(x)\n}", "title": "" }, { "docid": "04538258c26dcc8c5f7a9f46a71f619c", "score": "0.55717576", "text": "func Interface(dfault interface{}, value interface{}) (result interface{}) {\n\tif value != nil {\n\t\tresult = value\n\t} else {\n\t\tresult = dfault\n\t}\n\treturn\n}", "title": "" }, { "docid": "53bbd7e26e070c2265aceb5f24eb80f2", "score": "0.5570212", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Af) IsYANGGoStruct() {}", "title": "" }, { "docid": "b9bcec4f513927459192c323d4b27681", "score": "0.55670124", "text": "func (*NetworkInstance_Mpls_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "bc29cfa12e1a48369e3629560f88a9f5", "score": "0.5556012", "text": "func (i *Struct) Type() Type { return StructT }", "title": "" }, { "docid": "69084142d77ce38c052966b4862be239", "score": "0.5555233", "text": "func (*SrlNokiaInterfaces_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "86b92161eec1e3bda6b78dfe750915f2", "score": "0.55545723", "text": "func (*Interface_Subinterface_Vlan) IsYANGGoStruct() {}", "title": "" }, { "docid": "86b92161eec1e3bda6b78dfe750915f2", "score": "0.5552833", "text": "func (*Interface_Subinterface_Vlan) IsYANGGoStruct() {}", "title": "" }, { "docid": "239570c6899f3dd64528cae951654e62", "score": "0.5549866", "text": "func (*Interface_Aggregation) IsYANGGoStruct() {}", "title": "" }, { "docid": "da3f60b1e71d2d83f9ef74cdb29ccf82", "score": "0.5548157", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level) IsYANGGoStruct() {}", "title": "" }, { "docid": "239570c6899f3dd64528cae951654e62", "score": "0.55479705", "text": "func (*Interface_Aggregation) IsYANGGoStruct() {}", "title": "" }, { "docid": "311a31397bad1ef16a9d28338040554a", "score": "0.5532427", "text": "func getStruct(s interface{}) reflect.Value {\n\tin := reflect.Indirect(reflect.ValueOf(s))\n\tif in.Kind() != reflect.Struct {\n\t\tpanic(fmt.Sprintf(\"s must be a struct, not %s\\n\", in.Kind()))\n\t}\n\treturn in\n}", "title": "" }, { "docid": "8c4bcc58db054863bcdef3d073f32059", "score": "0.55196345", "text": "func (*NetworkInstance_Protocol_Pim_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "3af0d88bc2c3ace72866baf85760b29f", "score": "0.55192006", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Bfd) IsYANGGoStruct() {}", "title": "" }, { "docid": "aa7c2186474c05965167f52ac95faadc", "score": "0.5519008", "text": "func (*NetworkInstance_Mpls_Global_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "ebf97cdecc2e566f6743e2a4ef2b6122", "score": "0.55179083", "text": "func (*Vlan_Member_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "6dd0fa2918fcc89dc7337763098dd389", "score": "0.549426", "text": "func getStruct(r *http.Request) (*schema.GenericInterface, error) {\n\tvar gs *schema.GenericInterface\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn gs, err\n\t}\n\n\t// unmarshal result - ensures correct json struct (validation)\n\terrs := json.Unmarshal(body, &gs)\n\tif errs != nil {\n\t\treturn gs, errs\n\t}\n\n\treturn gs, nil\n\n}", "title": "" }, { "docid": "fa804d4035914508cab5849ba409d44b", "score": "0.5493539", "text": "func (*OpenconfigInterfaces_Interfaces) IsYANGGoStruct() {}", "title": "" }, { "docid": "fa804d4035914508cab5849ba409d44b", "score": "0.5493539", "text": "func (*OpenconfigInterfaces_Interfaces) IsYANGGoStruct() {}", "title": "" }, { "docid": "77126e88e964ec96e985fb2cfba29650", "score": "0.54907155", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_State) IsYANGGoStruct() {}", "title": "" }, { "docid": "77126e88e964ec96e985fb2cfba29650", "score": "0.54907155", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_State) IsYANGGoStruct() {}", "title": "" }, { "docid": "d22464a2219392bd6b30f7c680c53aea", "score": "0.54730517", "text": "func (r *RedisClient) GetStruct(key string, object interface{}) error {\n\tstrObj, err := r.Get(key).Result()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal([]byte(strObj), object)\n}", "title": "" }, { "docid": "3c763d0b69370b69a1b6be0f73a117b6", "score": "0.5464074", "text": "func GetObjectFromInterface(raw interface{}) (obj *unstructured.Unstructured, err error) {\n\tvar data []byte\n\tif data, err = yaml.Marshal(raw); err == nil {\n\t\tobj = &unstructured.Unstructured{}\n\t\terr = yaml.Unmarshal(data, obj)\n\t}\n\treturn\n}", "title": "" }, { "docid": "228b626a5c2171e37000b4c3be57d7a3", "score": "0.5459166", "text": "func as(in interface{}, as interface{}) interface{} {\n\toutType := reflect.TypeOf(as)\n\n\tif outType.Kind() != reflect.Ptr {\n\t\tpanic(\"outType is not a pointer\")\n\t}\n/* remove conflicting use statement */\n\tif reflect.TypeOf(in).Kind() != reflect.Func {\n\t\tctype := reflect.FuncOf(nil, []reflect.Type{outType.Elem()}, false)\n\n\t\treturn reflect.MakeFunc(ctype, func(args []reflect.Value) (results []reflect.Value) {/* Add Anime Sols support */\n\t\t\tout := reflect.New(outType.Elem())\n\t\t\tout.Elem().Set(reflect.ValueOf(in))\n\n\t\t\treturn []reflect.Value{out.Elem()}/* Release of eeacms/www-devel:19.12.14 */\n\t\t}).Interface()\n\t}\n\n\tinType := reflect.TypeOf(in)\n\n\tins := make([]reflect.Type, inType.NumIn())\n\touts := make([]reflect.Type, inType.NumOut())\n\n\tfor i := range ins {\n\t\tins[i] = inType.In(i)\n\t}\n\touts[0] = outType.Elem()\n\tfor i := range outs[1:] {\n\t\touts[i+1] = inType.Out(i + 1)\n\t}\n/* empty class not applied to fields that have a default value set #2069 */\n\tctype := reflect.FuncOf(ins, outs, false)\n\n\treturn reflect.MakeFunc(ctype, func(args []reflect.Value) (results []reflect.Value) {\t// Kill container if something goes wrong\n\t\touts := reflect.ValueOf(in).Call(args)\n\n\t\tout := reflect.New(outType.Elem())\n\t\tif outs[0].Type().AssignableTo(outType.Elem()) {\n\t\t\t// Out: Iface = In: *Struct; Out: Iface = In: OtherIface\n\t\t\tout.Elem().Set(outs[0])\n\t\t} else {\n\t\t\t// Out: Iface = &(In: Struct)\n\t\t\tt := reflect.New(outs[0].Type())/* Using outlet group feature of power strip. */\n\t\t\tt.Elem().Set(outs[0])\n\t\t\tout.Elem().Set(t)\n\t\t}\n\t\touts[0] = out.Elem()/* Change default configuration to Release. */\n\n\t\treturn outs\n\t}).Interface()\n}", "title": "" }, { "docid": "639d1d40583cdf2afbe5682098ce86e0", "score": "0.5450618", "text": "func (*SrlNokiaInterfaces_Interface_Subinterface_AnycastGw) IsYANGGoStruct() {}", "title": "" }, { "docid": "71634b3bfd334465ebe86312c9445b4b", "score": "0.54453444", "text": "func (*NetworkInstance_PolicyForwarding_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "f12561060698ecab01c9e0314b85dc33", "score": "0.543871", "text": "func (x *fastReflection_Header) Interface() protoreflect.ProtoMessage {\n\treturn (*Header)(x)\n}", "title": "" }, { "docid": "f0e8b7c94a635258319c8417b61e1865", "score": "0.5434631", "text": "func (*Interface_RoutedVlan) IsYANGGoStruct() {}", "title": "" }, { "docid": "f0e8b7c94a635258319c8417b61e1865", "score": "0.54340255", "text": "func (*Interface_RoutedVlan) IsYANGGoStruct() {}", "title": "" }, { "docid": "ab7ba6fdac87527e9916c92fe932b246", "score": "0.5428028", "text": "func Interface(key string, val interface{}) Field {\n\t//return String(key,\"==========================================\")\n\tswitch v := val.(type) {\n\tcase bool:\n\t\treturn Bool(key, v)\n\tcase *bool:\n\t\treturn BoolPtr(key, v)\n\tcase []bool:\n\t\treturn Bools(key, v)\n\tcase uint8:\n\t\treturn Uint8(key, v)\n\tcase *uint8:\n\t\treturn Uint8Ptr(key, v)\n\tcase []uint8:\n\t\treturn Uint8s(key, v)\n\tcase int8:\n\t\treturn Int8(key, v)\n\tcase *int8:\n\t\treturn Int8Ptr(key, v)\n\tcase []int8:\n\t\treturn Int8s(key, v)\n\n\tcase uint16:\n\t\treturn Uint16(key, v)\n\tcase *uint16:\n\t\treturn Uint16Ptr(key, v)\n\tcase []uint16:\n\t\treturn Uint16s(key, v)\n\tcase int16:\n\t\treturn Int16(key, v)\n\tcase *int16:\n\t\treturn Int16Ptr(key, v)\n\tcase []int16:\n\t\treturn Int16s(key, v)\n\n\tcase uint32:\n\t\treturn Uint32(key, v)\n\tcase *uint32:\n\t\treturn Uint32Ptr(key, v)\n\tcase []uint32:\n\t\treturn Uint32s(key, v)\n\tcase int32:\n\t\treturn Int32(key, v)\n\tcase *int32:\n\t\treturn Int32Ptr(key, v)\n\tcase []int32:\n\t\treturn Int32s(key, v)\n\n\tcase uint64:\n\t\treturn Uint64(key, v)\n\tcase *uint64:\n\t\treturn Uint64Ptr(key, v)\n\tcase []uint64:\n\t\treturn Uint64s(key, v)\n\tcase int64:\n\t\treturn Int64(key, v)\n\tcase *int64:\n\t\treturn Int64Ptr(key, v)\n\tcase []int64:\n\t\treturn Int64s(key, v)\n\n\tcase float32:\n\t\treturn Float32(key, v)\n\tcase *float32:\n\t\treturn Float32Ptr(key, v)\n\tcase []float32:\n\t\treturn Float32s(key, v)\n\tcase float64:\n\t\treturn Float64(key, v)\n\tcase *float64:\n\t\treturn Float64Ptr(key, v)\n\tcase []float64:\n\t\treturn Float64s(key, v)\n\n\tcase complex64:\n\t\treturn Complex64(key, v)\n\tcase *complex64:\n\t\treturn Complex64Ptr(key, v)\n\tcase []complex64:\n\t\treturn Complex64s(key, v)\n\tcase complex128:\n\t\treturn Complex128(key, v)\n\tcase *complex128:\n\t\treturn Complex128Ptr(key, v)\n\tcase []complex128:\n\t\treturn Complex128s(key, v)\n\n\tcase string:\n\t\treturn String(key, v)\n\tcase *string:\n\t\treturn StringPtr(key, v)\n\tcase []string:\n\t\treturn Strings(key, v)\n\tcase unsafe.Pointer:\n\t\treturn Ptr(key, v)\n\tcase time.Duration:\n\t\treturn Duration(key, v)\n\tcase []time.Duration:\n\t\treturn Durations(key, v)\n\tcase time.Time:\n\t\treturn Time(key, v)\n\tcase []time.Time:\n\t\treturn Times(key, v)\n\tcase error:\n\t\treturn Err(key, v)\n\tcase []error:\n\t\treturn Errs(key, v)\n\t}\n\n\tif fv, ok := val.(FieldVal); ok {\n\t\treturn Field{Key: key, Val: fv}\n\t}\n\n\treturn Field{Key: key, Val: StringVal(fmt.Sprint(val))}\n}", "title": "" }, { "docid": "d271a44b08ac15ca246fabada16468de", "score": "0.5425299", "text": "func (x *fastReflection_SimpleExample) Interface() protoreflect.ProtoMessage {\n\treturn (*SimpleExample)(x)\n}", "title": "" }, { "docid": "22ff5eac2d829e286c7048ca1eccf7f2", "score": "0.5404685", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "9795d2086f2f281adc3323fd2ad8f1e9", "score": "0.53975934", "text": "func (ii *InterfaceInfo) InterfaceStruct() *StructInfo {\n\tcptr := (*C.GIBaseInfo)(C.g_interface_info_get_iface_struct((*C.GIInterfaceInfo)(ii.c)))\n\tif cptr == nil {\n\t\treturn nil\n\t}\n\tptr := &BaseInfo{cptr}\n\treturn (*StructInfo)(unsafe.Pointer(_SetBaseInfoFinalizer(ptr)))\n}", "title": "" }, { "docid": "93183b97888b2dc8fc3d5dfded919efa", "score": "0.5389518", "text": "func (*NetworkInstance) IsYANGGoStruct() {}", "title": "" }, { "docid": "0b3002de6824543c8166a41aac3f7a23", "score": "0.5384217", "text": "func (x *fastReflection_TallyResult) Interface() protoreflect.ProtoMessage {\n\treturn (*TallyResult)(x)\n}", "title": "" }, { "docid": "7d283ed1cb572df7651dbbf3da23b5eb", "score": "0.5372581", "text": "func (*NetworkInstance_Protocol_Isis) IsYANGGoStruct() {}", "title": "" }, { "docid": "2a5a3c2083418513b4a0d71561384576", "score": "0.5353643", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces) IsYANGGoStruct() {}", "title": "" }, { "docid": "2a5a3c2083418513b4a0d71561384576", "score": "0.5353643", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces) IsYANGGoStruct() {}", "title": "" }, { "docid": "22bd3f9ef7d0a4f4f2048605b90bb7b9", "score": "0.5349958", "text": "func (*Interface_Subinterface_Ipv4) IsYANGGoStruct() {}", "title": "" }, { "docid": "22bd3f9ef7d0a4f4f2048605b90bb7b9", "score": "0.53479236", "text": "func (*Interface_Subinterface_Ipv4) IsYANGGoStruct() {}", "title": "" }, { "docid": "268004b7c540067f5783914bca7116a6", "score": "0.5345427", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface) IsYANGGoStruct() {}", "title": "" }, { "docid": "268004b7c540067f5783914bca7116a6", "score": "0.5345427", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface) IsYANGGoStruct() {}", "title": "" }, { "docid": "07e19c91219b86244ecd34316c4b7259", "score": "0.53425676", "text": "func implements() { //nolint:deadcode,unused\n\tvar t pipe\n\n\t// The pipe type is a cell.\n\t_ = cell.I(&t)\n\n\t// The pipe type is a conduit.\n\t_ = conduit.I(&t)\n}", "title": "" }, { "docid": "384d3578bb1c856428d90557964f5812", "score": "0.53295094", "text": "func (*RelayAgent_Dhcp_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "443cc8dd8446ee8e66ea848a9a13cbd9", "score": "0.5325827", "text": "func (x *fastReflection_MsgVote) Interface() protoreflect.ProtoMessage {\n\treturn (*MsgVote)(x)\n}", "title": "" }, { "docid": "6a09633647b0279082dbd16f2bad59d5", "score": "0.53232116", "text": "func (x *fastReflection_Member) Interface() protoreflect.ProtoMessage {\n\treturn (*Member)(x)\n}", "title": "" }, { "docid": "caee5f9563dbc4c6b13200173b0a300c", "score": "0.5322668", "text": "func (*SrlNokiaBfd_Bfd_Subinterface) IsYANGGoStruct() {}", "title": "" }, { "docid": "280d7895ff5d12501c62028293624061", "score": "0.53220725", "text": "func (rp *RedisPool) GetStruct(key string, result interface{}) (err error, exists bool) {\n\treply, err := rp.GetString(key)\n\tif err != nil || reply == \"\" {\n\t\treturn err, false\n\t}\n\terr = msgpack.Unmarshal([]byte(reply), result)\n\treturn err, true\n}", "title": "" }, { "docid": "8ad1eafdd52858af11b7ae1b7af887be", "score": "0.53139186", "text": "func (*Stp_Rstp_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "d60264a6d75a3455ba1414904be45682", "score": "0.5307486", "text": "func MakeStructInterface() {\n\t//header, imports\n\tstructInterface := \"package structs\\n\"\n\tstructInterface += \"import (\\n\"\n\tstructInterface += \"\\t\\\"github.com/jmoiron/sqlx\\\"\\n\"\n\tstructInterface += \"\\t\\\"encoding/json\\\"\\n\"\n\tstructInterface += \"\\t\\\"net/http\\\"\\n\"\n\tstructInterface += \")\\n\"\n\n\t//makes a function for each object\n\ttableList := sqlParser.GetTableNames()\n\tfor _, table := range tableList {\n\t\t//function declaration\n\t\tstructInterface += \"func EncodeStruct\" + strings.Title(table) + \"(rows *sqlx.Rows, w http.ResponseWriter) {\\n\" //make new array\n\t\tstructInterface += \"\\tsa := make([]\" + strings.Title(table) + \", 0)\\n\"\n\t\t//make new instance\n\t\tstructInterface += \"\\tt := \" + strings.Title(table) + \"{}\\n\\n\"\n\t\t//loops through all columns and translates to JSON\n\t\tstructInterface += \"\\tfor rows.Next() {\\n\"\n\t\tstructInterface += \"\\t\\t rows.StructScan(&t)\\n\"\n\t\tstructInterface += \"\\t\\t sa = append(sa, t)\\n\"\n\t\tstructInterface += \"\\t}\\n\\n\"\n\t\tstructInterface += \"\\tenc := json.NewEncoder(w)\\n\"\n\t\tstructInterface += \"\\tenc.Encode(sa)\\n\"\n\t\tstructInterface += \"}\\n\"\n\t}\n\n\t//writes in relation to home directory\n\tstructBuilder.WriteFile(structInterface, \"./structs/structInterface.go\")\n}", "title": "" }, { "docid": "ee93eb8255b0d64e82a870c00b4c0a12", "score": "0.5306794", "text": "func (x *fastReflection_MsgTake) Interface() protoreflect.ProtoMessage {\n\treturn (*MsgTake)(x)\n}", "title": "" }, { "docid": "9da2e92670a62e496ae87fce27834d3c", "score": "0.53023833", "text": "func (*Lacp_Interface_Member) IsYANGGoStruct() {}", "title": "" }, { "docid": "9da2e92670a62e496ae87fce27834d3c", "score": "0.5300952", "text": "func (*Lacp_Interface_Member) IsYANGGoStruct() {}", "title": "" }, { "docid": "22244b8eda0e179fcf620936b19885ec", "score": "0.52992415", "text": "func (*Component_Backplane) IsYANGGoStruct() {}", "title": "" }, { "docid": "34c38f17b728fd33e6faf65d45a8ce35", "score": "0.5298677", "text": "func interfaceDecode(dec *gob.Decoder) Pythagoras {\n\t// The decode will fail unless the concrete type on the wire has been\n\t// registered. We registered it in the calling function.\n\tvar p Pythagoras\n\terr := dec.Decode(&p)\n\tif err != nil {\n\t\tlog.Fatal(\"decode:\", err)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "7aae176ade618575c3f3ce7763601e2d", "score": "0.5293954", "text": "func (*Component_IntegratedCircuit) IsYANGGoStruct() {}", "title": "" }, { "docid": "77524405bf22623ec56d7011d71bef59", "score": "0.5292284", "text": "func (t *Type) Interface() InterfaceAccessor {\n\tnv := &NullInterface{InterfaceCommon{Error: t.err}}\n\tif !t.rv.IsValid() {\n\t\treturn nv\n\t}\n\tnv.P = t.rv.Interface()\n\treturn nv\n}", "title": "" }, { "docid": "1994b5dfbd77c5b09b9015bbf85357f1", "score": "0.5292191", "text": "func (x *fastReflection_BlockMetadata) Interface() protoreflect.ProtoMessage {\n\treturn (*BlockMetadata)(x)\n}", "title": "" }, { "docid": "1994b5dfbd77c5b09b9015bbf85357f1", "score": "0.5292191", "text": "func (x *fastReflection_BlockMetadata) Interface() protoreflect.ProtoMessage {\n\treturn (*BlockMetadata)(x)\n}", "title": "" }, { "docid": "a63c98aee61e9415192512b2b573fff1", "score": "0.52848935", "text": "func (*FaucetConfiguration_Dps_Interfaces) IsYANGGoStruct() {}", "title": "" }, { "docid": "dd8885b5e66c2ba7eea43caf860c56cc", "score": "0.5284239", "text": "func (*NetworkInstance_Protocol) IsYANGGoStruct() {}", "title": "" }, { "docid": "955d579f6c3c4a5f2a81317e914f6397", "score": "0.52814054", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Authentication) IsYANGGoStruct() {}", "title": "" }, { "docid": "4c9ceb61cbfdc3609f69e6d025320e57", "score": "0.5279616", "text": "func (x *fastReflection_MsgTakeResponse) Interface() protoreflect.ProtoMessage {\n\treturn (*MsgTakeResponse)(x)\n}", "title": "" }, { "docid": "22c796a3016f915ee859a13d3fb4b68e", "score": "0.52757424", "text": "func (*NetworkInstance_Protocol_Igmp_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "8ff1268a94069c723874adb00cd366ce", "score": "0.52747184", "text": "func (*Component_Port) IsYANGGoStruct() {}", "title": "" }, { "docid": "3bab015f51bd08dfbcc036193db67865", "score": "0.5273984", "text": "func (*Acl_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "b185b1d11e6907ce649699b5b3d36d03", "score": "0.52712774", "text": "func (x *fastReflection_MsgVoteResponse) Interface() protoreflect.ProtoMessage {\n\treturn (*MsgVoteResponse)(x)\n}", "title": "" }, { "docid": "1f310b015912ad2f37bec57a7de13cdc", "score": "0.52701914", "text": "func (*NetworkInstance_Encapsulation) IsYANGGoStruct() {}", "title": "" }, { "docid": "399f7e044849c100d94d56676ed934cf", "score": "0.5267074", "text": "func myInterface() {\n\tvar a abser\n\tf := myFloat2(-math.Sqrt2)\n\tv := vertex2{3, 4}\n\n\ta = f // a MyFloat implements abser\n\ta = &v // a *Vertex implements abser\n\n\t// In the following line, v is a vertex (not *vertex)\n\t// and does NOT implement abser.\n\t//a = v\n\n\tfmt.Println(a.abs())\n}", "title": "" }, { "docid": "9980afe71d08c2133da379f40aa59f74", "score": "0.52556705", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_State) IsYANGGoStruct() {}", "title": "" }, { "docid": "9980afe71d08c2133da379f40aa59f74", "score": "0.52556705", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_State) IsYANGGoStruct() {}", "title": "" }, { "docid": "ba2ef516c8a703cd3431b7f78593f4f1", "score": "0.52505", "text": "func (*Interface_HoldTime) IsYANGGoStruct() {}", "title": "" } ]
12f276a8495e20edd2f7916325ee75ee
Mod returns remainder after dividing with Uint
[ { "docid": "2dd4ce172a0f4ad09630562be2efa2af", "score": "0.71966004", "text": "func (i Uint) Mod(i2 Uint) Uint {\n\tif i2.Sign() == 0 {\n\t\tpanic(\"division-by-zero\")\n\t}\n\treturn Uint{mod(i.i, i2.i)}\n}", "title": "" } ]
[ { "docid": "fb4c76760d0a1f52404f9ad8c492874b", "score": "0.715709", "text": "func DivmodU64(a, b uint64) (quo, rem uint64)", "title": "" }, { "docid": "5a2e5ee8377ceff17f706d18fb12417f", "score": "0.7131928", "text": "func (d Uint32) Mod(n uint32) uint32 {\n\tfraction := d.m * uint64(n)\n\tmod, _ := bits.Mul64(fraction, d.d)\n\treturn uint32(mod)\n}", "title": "" }, { "docid": "0ad7ebc983a2b5d0ace27ea9afdb2536", "score": "0.70438856", "text": "func mod(hash uint64, m int) int {\n\treturn int(hash % uint64(m))\n}", "title": "" }, { "docid": "24f33c043c9acae0b7f023804609455d", "score": "0.6905188", "text": "func divmod(q []byte, r []byte, n int, d []byte, t int) {\n\trn := 0\n\tdt := (int(d[t-1]) & 0xFF) << 8\n\tif t > 1 {\n\t\tdt |= int(d[t-2]) & 0xFF\n\t}\n\tfor n--; n >= t-1; n-- {\n\t\tz := (rn << 16) | ((int(r[n]) & 0xFF) << 8)\n\t\tif n > 0 {\n\t\t\tz |= int(r[n-1]) & 0xFF\n\t\t}\n\t\tz /= dt\n\t\trn += mula_small(r, r, n-t+1, d, t, -z)\n\t\tq[n-t+1] = (byte)((z + rn) & 0xFF) /* rn is 0 or -1 (underflow) */\n\t\tmula_small(r, r, n-t+1, d, t, -rn)\n\t\trn = int(r[n]) & 0xFF\n\t\tr[n] = 0\n\t}\n\tr[t-1] = byte(rn)\n}", "title": "" }, { "docid": "63f408a740b148b87e91093974aa755b", "score": "0.6829066", "text": "func (d Uint64) Mod(n uint64) uint64 {\n\thi, lo := bits.Mul64(d.lo, n)\n\thi += d.hi * n\n\tmodlo1, _ := bits.Mul64(lo, d.d)\n\tmod, modlo2 := bits.Mul64(hi, d.d)\n\tvar c uint64\n\t_, c = bits.Add64(modlo1, modlo2, 0)\n\tmod, _ = bits.Add64(mod, 0, c)\n\treturn mod\n}", "title": "" }, { "docid": "178bf966e6c0dfec143ab014dfd3e695", "score": "0.68098396", "text": "func mod(m uint64, n uint64) uint64 {\r\n\treturn ((m % n) + n) % n\r\n}", "title": "" }, { "docid": "ad3ca7b223ef27dd3026c27523fe8a71", "score": "0.6763671", "text": "func (d Uint64) DivMod(n uint64) (q, r uint64) {\n\tdivlo1, lo := bits.Mul64(d.lo, n)\n\tdiv, divlo2 := bits.Mul64(d.hi, n)\n\n\thi, c := bits.Add64(divlo1, divlo2, 0)\n\tdiv, _ = bits.Add64(div, 0, c)\n\tq = uint64(div)\n\n\tmodlo1, _ := bits.Mul64(lo, d.d)\n\tmod, modlo2 := bits.Mul64(hi, d.d)\n\n\t_, c = bits.Add64(modlo1, modlo2, 0)\n\tmod, _ = bits.Add64(mod, 0, c)\n\tr = uint64(mod)\n\n\treturn q, r\n}", "title": "" }, { "docid": "3ab991dc1422a184941314c3f8f6844b", "score": "0.67596424", "text": "func (d Uint32) DivMod(n uint32) (uint32, uint32) {\n\tdiv, fraction := bits.Mul64(d.m, uint64(n))\n\tmod, _ := bits.Mul64(fraction, d.d)\n\treturn uint32(div), uint32(mod)\n}", "title": "" }, { "docid": "a1a2db2bf62cbaf1c73734515532729b", "score": "0.668344", "text": "func mod(val, m int) int {\n\tres := val % m\n\tif res < 0 {\n\t\tres += m\n\t}\n\treturn res\n}", "title": "" }, { "docid": "a1a2db2bf62cbaf1c73734515532729b", "score": "0.668344", "text": "func mod(val, m int) int {\n\tres := val % m\n\tif res < 0 {\n\t\tres += m\n\t}\n\treturn res\n}", "title": "" }, { "docid": "b9ad843316cfbc5fc8ae08f85017b6a5", "score": "0.6667575", "text": "func (self *State)Mod(a,b any)any{\n self.IncOperations(self.coeff[\"%\"]+self.off[\"%\"])\n var t string = fmt.Sprintf(\"%T\", a)\n switch t {\n case \"int\": return a.(int)%b.(int)\n case \"int8\": return a.(int8)%b.(int8)\n case \"int16\": return a.(int16)%b.(int16)\n case \"int32\": return a.(int32)%b.(int32)\n case \"int64\": return a.(int64)%b.(int64)\n case \"uint\": return a.(uint)%b.(uint)\n case \"uint8\": return a.(uint8)%b.(uint8)\n case \"uint16\": return a.(uint16)%b.(uint16)\n case \"uint32\": return a.(uint32)%b.(uint32)\n case \"uint64\": return a.(uint64)%b.(uint64)\n default: fmt.Println(\"Invalid type\")\n }\n return nil\n}", "title": "" }, { "docid": "2a5016cbc3f401efc1af1b87bd55c9a7", "score": "0.6454779", "text": "func posModulo(val, mod int) int {\n result := val % mod\n if result < 0 {\n return result + mod\n }\n return result\n}", "title": "" }, { "docid": "d2fd81909aa57caf6d08f06e6cc91772", "score": "0.64061666", "text": "func (i Uint) ModRaw(i2 uint64) Uint {\n\treturn i.Mod(NewUint(i2))\n}", "title": "" }, { "docid": "17194e72c1ae47abe7dbe6e8c4cb01ca", "score": "0.63328624", "text": "func mod(a, b int) int {\n\tq := int(math.Floor(float64(a) / float64(b)))\n\treturn a - b*q\n}", "title": "" }, { "docid": "4bd96a4e24e83a4b75070e81fd2012dd", "score": "0.63242465", "text": "func (i Uint) Div(i2 Uint) (res Uint) {\n\t// Check division-by-zero\n\tif i2.Sign() == 0 {\n\t\tpanic(\"division-by-zero\")\n\t}\n\treturn Uint{div(i.i, i2.i)}\n}", "title": "" }, { "docid": "89333f475a54b52916e425a853af1096", "score": "0.631146", "text": "func divMod(numerator, denominator int64) (quotient, remainder int64) {\n\tquotient = numerator / denominator // integer division, decimals are truncated\n\tremainder = numerator % denominator\n\treturn\n}", "title": "" }, { "docid": "03a01adbb1d3f092c0de572803e817b1", "score": "0.6291112", "text": "func DivMod(a, b int) (q, r int) {\n\treturn int(a / b), a % b\n}", "title": "" }, { "docid": "3a29a7a9f664b97be32ab26b51c824fe", "score": "0.627609", "text": "func Modulo(x int, y int) int {\n\treturn x % y\n}", "title": "" }, { "docid": "297cd5fc72f4c6430e6e7d09ed090167", "score": "0.62380755", "text": "func mod(a, b int) int {\n\tif b <= 0 {\n\t\treturn -1\n\t}\n\tdiv := a / b\n\treturn a - (div * b)\n}", "title": "" }, { "docid": "dc26a4bd4c8aeccf1c4de75bb74eb1fb", "score": "0.6211822", "text": "func Mod(a, b int) int {\n\tm := a % b\n\tif m < 0 {\n\t\tm += Abs(b)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "d5b4506843d3f81ef63e2baff168904b", "score": "0.61533105", "text": "func modi(val, m int) int {\n\tres := val % m\n\tif res < 0 {\n\t\tres += m\n\t}\n\treturn res\n}", "title": "" }, { "docid": "36b662f4f9f722cf13c61f6883c80a1c", "score": "0.60830307", "text": "func modulo(key uint32, depth int8) int8 {\n\treturn int8(key % uint32(primes[depth]))\n}", "title": "" }, { "docid": "35a79ed1dc7a5ae795ef71cd5d25751c", "score": "0.60705376", "text": "func mod(d, m int) int {\n\tres := d % m\n\tif (res < 0 && m > 0) || (res > 0 && m < 0) {\n\t\treturn res + m\n\t}\n\treturn res\n}", "title": "" }, { "docid": "23d2a27f880156b5d09244124045a794", "score": "0.6041547", "text": "func modll(val, m int64) int64 {\n\tres := val % m\n\tif res < 0 {\n\t\tres += m\n\t}\n\treturn res\n}", "title": "" }, { "docid": "add8a3a2dfd0e3dfe12cb834e52c3d1e", "score": "0.6026154", "text": "func PowModulo(base int64, exponent int64, mod int64) int64 {\n\tres := int64(1)\n\tmul := base % mod\n\tfor exponent > 0 {\n\t\tif exponent&1 != 0 {\n\t\t\tres = (res * mul) % mod\n\t\t}\n\t\tmul = (mul * mul) % mod\n\t\texponent >>= 1\n\t}\n\treturn res % mod\n}", "title": "" }, { "docid": "45ec4a68b2cb7c08b9a834c2321f4124", "score": "0.6011573", "text": "func Divmod(a, b int) (int, int) {\n\treturn a / b, a % b\n}", "title": "" }, { "docid": "da22a38c185f9c4182bea2c11704a759", "score": "0.6009494", "text": "func divu(rd, rs1, rs2 uint32) (code uint32) {\n\tcode = 0b0000001<<25 | rs2<<20 | rs1<<15 | 0b101<<12 | rd<<7 | 0b0110011\n\treturn code\n}", "title": "" }, { "docid": "54450bf9bc452c3cc4ebba96e6bbdfe8", "score": "0.59951496", "text": "func Uint(i uint) bool {\n\treturn i%2 == oddCheckNum\n}", "title": "" }, { "docid": "b098996f90fba8a54da7280b1d6516ab", "score": "0.59574103", "text": "func (d Uint64) Div(n uint64) uint64 {\n\tdivlo1, _ := bits.Mul64(d.lo, n)\n\tdiv, divlo2 := bits.Mul64(d.hi, n)\n\tvar c uint64\n\t_, c = bits.Add64(divlo1, divlo2, 0)\n\tdiv, _ = bits.Add64(div, 0, c)\n\treturn div\n}", "title": "" }, { "docid": "31e45c3f49c8d8e2692a26e4716d2bfc", "score": "0.59416443", "text": "func mod(x, n int) int {\n\treturn ((x % n) + n) % n\n}", "title": "" }, { "docid": "452be9052a9ffffc54e42b890d89ca85", "score": "0.5937565", "text": "func UInt(buffer []byte, index int, value uint64) (len int) {\n\tswitch {\n\tcase value < (1 << 8):\n\t\tbuffer[index+0] = byte(value)\n\t\treturn 1\n\tcase value < (1 << 16):\n\t\tbuffer[index+0] = byte(value >> 8)\n\t\tbuffer[index+1] = byte(value)\n\t\treturn 2\n\tcase value < (1 << 24):\n\t\tbuffer[index+0] = byte(value >> 16)\n\t\tbuffer[index+1] = byte(value >> 8)\n\t\tbuffer[index+2] = byte(value)\n\t\treturn 3\n\tcase value < (1 << 32):\n\t\tbuffer[index+0] = byte(value >> 24)\n\t\tbuffer[index+1] = byte(value >> 16)\n\t\tbuffer[index+2] = byte(value >> 8)\n\t\tbuffer[index+3] = byte(value)\n\t\treturn 4\n\tcase value < (1 << 40):\n\t\tbuffer[index+0] = byte(value >> 32)\n\t\tbuffer[index+1] = byte(value >> 24)\n\t\tbuffer[index+2] = byte(value >> 16)\n\t\tbuffer[index+3] = byte(value >> 8)\n\t\tbuffer[index+4] = byte(value)\n\t\treturn 5\n\tcase value < (1 << 48):\n\t\tbuffer[index+0] = byte(value >> 40)\n\t\tbuffer[index+1] = byte(value >> 32)\n\t\tbuffer[index+2] = byte(value >> 24)\n\t\tbuffer[index+3] = byte(value >> 16)\n\t\tbuffer[index+4] = byte(value >> 8)\n\t\tbuffer[index+5] = byte(value)\n\t\treturn 6\n\tcase value < (1 << 56):\n\t\tbuffer[index+0] = byte(value >> 48)\n\t\tbuffer[index+1] = byte(value >> 40)\n\t\tbuffer[index+2] = byte(value >> 32)\n\t\tbuffer[index+3] = byte(value >> 24)\n\t\tbuffer[index+4] = byte(value >> 16)\n\t\tbuffer[index+5] = byte(value >> 8)\n\t\tbuffer[index+6] = byte(value)\n\t\treturn 7\n\tdefault:\n\t\tbuffer[index+0] = byte(value >> 56)\n\t\tbuffer[index+1] = byte(value >> 48)\n\t\tbuffer[index+2] = byte(value >> 40)\n\t\tbuffer[index+3] = byte(value >> 32)\n\t\tbuffer[index+4] = byte(value >> 24)\n\t\tbuffer[index+5] = byte(value >> 16)\n\t\tbuffer[index+6] = byte(value >> 8)\n\t\tbuffer[index+7] = byte(value)\n\t\treturn 8\n\t}\n}", "title": "" }, { "docid": "804e186410ac265f495280c93be18877", "score": "0.59309095", "text": "func (d Uint32) Div(n uint32) uint32 {\n\tdiv, _ := bits.Mul64(d.m, uint64(n))\n\treturn uint32(div)\n}", "title": "" }, { "docid": "859fdf047ee47c2961fe1ad0b858c4db", "score": "0.59003526", "text": "func Uint(v uint) *uint { return &v }", "title": "" }, { "docid": "96d08ab784f16b56964077de19b3ead1", "score": "0.58905625", "text": "func (n *NumberProtocol) Divmod(obj Object) (Object, error) {\n\tret := C.PyNumber_Divmod(cnp(n), c(obj))\n\treturn obj2ObjErr(ret)\n}", "title": "" }, { "docid": "8a18a1727e2b8d87cb4bacbf0373bc7f", "score": "0.58866274", "text": "func (v *Value) Uint() (uint64, error) {\n\tvar i uint64\n\terr := v.decode(&i)\n\treturn i, err\n}", "title": "" }, { "docid": "8735fbdd7e26a2dbc384ee90f6350167", "score": "0.5876894", "text": "func divmod32(xu, xv, xq, xr *Int128) {\n\tvar u, q [4]uint64\n\tu[0] = xu.lo & mask\n\tu[1] = xu.lo >> 32\n\tu[2] = uint64(xu.hi) & mask\n\tu[3] = uint64(xu.hi) >> 32\n\n\tvar r uint64\n\tfor j := 3; j >= 0; j-- {\n\t\t// r<<32 = r*b where b=2**32\n\t\tq[j] = (r<<32 + u[j]) / xv.lo\n\t\tr = (r<<32 + u[j]) % xv.lo\n\t}\n\txq.hi = int64(q[2] | (q[3] << 32))\n\txq.lo = q[0] | (q[1] << 32)\n\txr.hi = 0\n\txr.lo = r\n\treturn\n}", "title": "" }, { "docid": "d1549801ec12c1a923c62e857cd6902c", "score": "0.5833362", "text": "func ModInt(a, b int) int {\n\t// https://stackoverflow.com/questions/43018206/modulo-of-negative-integers-in-go\n\t// https://www.reddit.com/r/golang/comments/bnvik4/modulo_in_golang/\n\treturn (a%b + b) % b\n}", "title": "" }, { "docid": "86e7f556cec648ad3fe4d4f74ab77c4f", "score": "0.5819638", "text": "func (i BigInt) Mod(i2 BigInt) BigInt {\n\tif i2.Sign() == 0 {\n\t\tpanic(\"division-by-zero\")\n\t}\n\treturn BigInt{mod(i.i, i2.i)}\n}", "title": "" }, { "docid": "f66c43a0db87d22b9da1082bd1d90b9b", "score": "0.5808248", "text": "func Uint(i interface{}) uint {\n\tv, _ := UintE(i)\n\treturn v\n}", "title": "" }, { "docid": "ba5145c0644fc0dbb48b0ede0d93e43e", "score": "0.57622415", "text": "func (p Polynomial) Mod(q Polynomial, m *nt.Integer) Polynomial {\n\n\t_, rem := p.Div(q, m)\n\n\treturn rem\n}", "title": "" }, { "docid": "9661e79ea27e407dde341e216abb5912", "score": "0.5761366", "text": "func (z *Int128) Mod(x, y *Int128) *Int128 {\n\tvar q Int128\n\tq.DivMod(x, y, z)\n\treturn z\n}", "title": "" }, { "docid": "e2880b4e086b90b594709ab28854441a", "score": "0.57612747", "text": "func (i Uint) DivRaw(i2 uint64) Uint {\n\treturn i.Div(NewUint(i2))\n}", "title": "" }, { "docid": "26d656e3fb6597af96af7bbfcb39dc19", "score": "0.5755374", "text": "func modinv(A int, B int) (int, string) {\n divisor, _ := gcd(A, B);\n if (divisor != 1) {\n return 0, \"ERROR: There is no unique inverse\";\n }\n m := B // original mod\n q := 0;\n t := 0;\n x0 := 0;\n x1 := 1;\n for ; A > 1; {\n q = A / B;\n t = B;\n B = A % B;\n A = t;\n t = x0;\n x0 = x1 - q * x0;\n x1 = t;\n }\n\n for ; x1 < 0; {\n x1 += m;\n }\n return x1, \"\";\n}", "title": "" }, { "docid": "6b2e44e74622558b5bb188fc9fbc974a", "score": "0.5723612", "text": "func (decoder *Decoder) Uint() uint {\n\tn, _ := decoder.Uvarint()\n\treturn uint(n)\n}", "title": "" }, { "docid": "cc416107eba3468142338454eef72bc7", "score": "0.571887", "text": "func ModInt64(a, b int64) int64 {\n\t// https://stackoverflow.com/questions/43018206/modulo-of-negative-integers-in-go\n\t// https://www.reddit.com/r/golang/comments/bnvik4/modulo_in_golang/\n\treturn (a%b + b) % b\n}", "title": "" }, { "docid": "6c64f0d5facb9065153d89014c656be1", "score": "0.5693577", "text": "func Uint(in any) (uint64, error) {\n\treturn ToUint(in)\n}", "title": "" }, { "docid": "06846d06c98e5c0a70d0339bd97665b8", "score": "0.5680076", "text": "func polyMod(v []byte) uint64 {\n\tvar c uint64 = 1\n\tfor _, d := range v {\n\t\tc0 := byte(c >> 35)\n\t\tc = ((c & 0x07ffffffff) << 5) ^ uint64(d)\n\t\tif c0&0x01 > 0 {\n\t\t\tc ^= 0x98f2bc8e61\n\t\t}\n\t\tif c0&0x02 > 0 {\n\t\t\tc ^= 0x79b76d99e2\n\t\t}\n\t\tif c0&0x04 > 0 {\n\t\t\tc ^= 0xf33e5fb3c4\n\t\t}\n\t\tif c0&0x08 > 0 {\n\t\t\tc ^= 0xae2eabe2a8\n\t\t}\n\t\tif c0&0x10 > 0 {\n\t\t\tc ^= 0x1e4f43e470\n\t\t}\n\t}\n\treturn c ^ 1\n}", "title": "" }, { "docid": "8b1cdc433525ac1c1067f101d02c48ee", "score": "0.5674309", "text": "func ModulusFromUint64(x uint64) Modulus {\n\tvar m Modulus\n\tm.nat.SetUint64(x)\n\t// edge case for 32 bit limb size\n\tif _W < 64 && len(m.nat.limbs) > 1 && m.nat.limbs[1] == 0 {\n\t\tm.nat.limbs = m.nat.limbs[:1]\n\t}\n\tm.precomputeValues()\n\treturn m\n}", "title": "" }, { "docid": "6307bc3807993b341fb82cdcc2109502", "score": "0.56673265", "text": "func modInverse(a, n int) int {\n\ti := n\n\tv := 0\n\td := 1\n\tfor a > 0 {\n\t\tt := i / a\n\t\tx := a\n\t\ta = i % x\n\t\ti = x\n\t\tx = d\n\t\td = v - t*x\n\t\tv = x\n\t}\n\tv %= n\n\tif v < 0 {\n\t\tv = (v + n) % n\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ccd34e61e381d52ca0dbd58d743ac57b", "score": "0.5638196", "text": "func hashMod(value string) int {\n\tstr := fmt.Sprintf(\"%x\", sha256.Sum256([]byte(value)))\n\tnumHash, err := strconv.ParseInt(str[:2], 16, 10)\n\tif err != nil {\n\t\tlog.Fatal(\"Error:\", err)\n\t}\n\tnumReduce, err := strconv.Atoi(os.Getenv(\"NUM_REDUCE\"))\n\tif err != nil {\n\t\tlog.Fatal(\"Error:\", err)\n\t}\n\tfHash := float64(numHash)\n\tfReduce := float64(numReduce)\n\treturn int(math.Mod(fHash, fReduce))\n}", "title": "" }, { "docid": "1ac3f7586eddb14ae30b2a34d53faff9", "score": "0.5633288", "text": "func modInverse(a uint64, m uint64) uint64 {\n\treturn power(a, m-2, m)\n}", "title": "" }, { "docid": "7a82cf84414925f0b7769901044dfe35", "score": "0.5630263", "text": "func divuw(rd, rs1, rs2 uint32) (code uint32) {\n\tcode = 0b0000001<<25 | rs2<<20 | rs1<<15 | 0b101<<12 | rd<<7 | 0b0111011\n\treturn code\n}", "title": "" }, { "docid": "156bc551d163c2b5499ed1806f29164c", "score": "0.5623393", "text": "func (d Uint32) Divisible(n uint32) bool {\n\treturn d.m*uint64(n) <= d.m-1\n}", "title": "" }, { "docid": "0a83c1eb729deb8c1bd4f471eda67846", "score": "0.5621182", "text": "func Uint(n uint) *uint {\n\treturn &n\n}", "title": "" }, { "docid": "4ed7657e529c2782644ef5b9a25f8f00", "score": "0.56065345", "text": "func PowMod(a, b, m int) int {\n\ta = a % m\n\tp := 1 % m\n\tfor b > 0 {\n\t\tif b&1 != 0 {\n\t\t\tp = (p * a) % m\n\t\t}\n\t\tb >>= 1\n\t\ta = (a * a) % m\n\t}\n\treturn p\n}", "title": "" }, { "docid": "16c11037f5a65b0b1e5c0a22ad9f6945", "score": "0.5603879", "text": "func (f *Field) Uint() (o uint) {\n\tif f == nil || f.Value == nil {\n\t\treturn\n\t}\n\n\to, _ = f.Value.(uint)\n\treturn\n}", "title": "" }, { "docid": "c486b5a973db90d1d49c74c6cc07e734", "score": "0.5588813", "text": "func Uint(output *uint, key string) error {\n\tval, ok, err := GetUint(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ok {\n\t\t*output = val\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5e71d824bbf407fc08949d318062ae4d", "score": "0.55877876", "text": "func (l lnsum) div() byte {\n\treturn byte(l / LAVGN)\n}", "title": "" }, { "docid": "8920020d01007dbe3d95928f1404bbe2", "score": "0.55807614", "text": "func (a *ArithUint256) Div(b *ArithUint256) {\n\tdiv := b.Copy()\n\tnum := a.Copy()\n\tfor i := 0; i < 8; i++ {\n\t\ta.pn[i] = 0\n\t}\n\tnumBits := num.bits()\n\tdivBits := div.bits()\n\tif divBits == 0 {\n\t\tpanic(\"Division by zero\")\n\t}\n\tif divBits > numBits {\n\t\treturn\n\t}\n\tshift := numBits - divBits\n\tdiv.LeftShift(uint32(shift))\n\tfor shift >= 0 {\n\t\tif num.Cmp(div) >= 0 {\n\t\t\tnum.Sub(div)\n\t\t\ta.pn[shift/32] |= 1 << uint32(shift&31)\n\t\t}\n\t\tdiv.RightShift(1) // shift back\n\t\tshift--\n\t}\n}", "title": "" }, { "docid": "58f28e2a8ec65aacb0a35a5ac1a171ba", "score": "0.55797786", "text": "func moduloInt[K int | int64](x, y K) K {\n\tfor x < 0 {\n\t\tx += y\n\t}\n\treturn x % y\n}", "title": "" }, { "docid": "b38dc7aec9188ea2c1da5940bba6e194", "score": "0.55775505", "text": "func divmod(xu, xv, xq, xr *Int128) {\n\tvar v, q, r [4]uint32\n\tvar u [5]uint32\n\tu[0] = uint32(xu.lo & mask)\n\tu[1] = uint32(xu.lo >> 32)\n\tu[2] = uint32(uint64(xu.hi) & mask)\n\tu[3] = uint32(uint64(xu.hi) >> 32)\n\tv[0] = uint32(xv.lo & mask)\n\tv[1] = uint32(xv.lo >> 32)\n\tv[2] = uint32(uint64(xv.hi) & mask)\n\tv[3] = uint32(uint64(xv.hi) >> 32)\n\n\t// D1. Normalize.\n\tn := 4\n\tfor n >= 0 && v[n-1] == 0 {\n\t\tn--\n\t}\n\tshift := leadingZeros(uint32(v[n-1]))\n\tu[4] = u[3] >> (32 - shift)\n\tfor i := 3; i > 0; i-- {\n\t\tu[i] = u[i]<<shift | u[i-1]>>(32-shift)\n\t}\n\tu[0] <<= shift\n\tfor i := n - 1; i > 0; i-- {\n\t\tv[i] = v[i]<<shift | v[i-1]>>(32-shift)\n\t}\n\tv[0] <<= shift\n\n\tvar b uint64 = 1 << 32\n\tvar qhat, rhat uint64\n\n\t// D2. Initialize j. D7. Loop on j.\n\tfor j := 4 - n; j >= 0; j-- {\n\t\t// D3. Calculate qhat.\n\t\tif u[j+n] == v[n-1] {\n\t\t\tqhat = b - 1\n\t\t} else {\n\t\t\tqhat = (uint64(u[j+n])<<32 + uint64(u[j+n-1])) / uint64(v[n-1])\n\t\t}\n\t\trhat = (uint64(u[j+n])<<32 + uint64(u[j+n-1])) - qhat*uint64(v[n-1])\n\t\tfor uint64(v[n-2])*qhat > rhat<<32+uint64(u[j+n-2]) {\n\t\t\tqhat--\n\t\t\trhat += uint64(v[n-1])\n\t\t\tif rhat >= b {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// D4. Multiply and subtract.\n\t\t// u = u - qhat*v\n\t\t// M3. Initialize i.\n\t\tvar p uint64\n\t\tvar k, t int64\n\t\tk = 0\n\t\tfor i := 0; i < n; i++ {\n\t\t\t// M4. Multiply and subtract.\n\t\t\tp = qhat * uint64(v[i])\n\t\t\tt = int64(u[i+j]) - k - int64(p&mask)\n\t\t\tu[i+j] = uint32(t & mask)\n\t\t\tk = int64(p>>32) - t>>32\n\t\t}\n\t\tt = int64(u[j+n]) - k\n\t\tu[j+n] = uint32(t & mask)\n\t\t// D5. Test remainder.\n\t\tq[j] = uint32(qhat)\n\t\tif t < 0 {\n\t\t\t// D6. Add back.\n\t\t\tq[j]--\n\t\t\t// add v to u\n\t\t\tk = 0\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tt = int64(u[i+j]) + int64(v[i]) + k\n\t\t\t\tu[i+j] = uint32(t & mask)\n\t\t\t\tk = t >> 32\n\t\t\t}\n\t\t\tu[j+n] += uint32(k)\n\t\t}\n\t}\n\n\t// D8. Unnormalize.\n\tfor i := 0; i < n-1; i++ {\n\t\tr[i] = u[i]>>shift | u[i+1]<<(32-shift)\n\t}\n\tr[n-1] = u[n-1] >> shift\n\n\txq.hi = int64(uint64(q[2]) | (uint64(q[3]) << 32))\n\txq.lo = uint64(q[0]) | (uint64(q[1]) << 32)\n\txr.hi = int64(uint64(r[2]) | (uint64(r[3]) << 32))\n\txr.lo = uint64(r[0]) | (uint64(r[1]) << 32)\n\treturn\n}", "title": "" }, { "docid": "bd5aaa4f218b918b84804fbfcc6eff12", "score": "0.55596113", "text": "func (z *Int128) DivMod(x, y, r *Int128) (*Int128, *Int128) {\n\tif y.hi == 0 && y.lo == 0 {\n\t\tpanic(\"Division by zero\")\n\t} else if y.lo == 1 && y.hi == 0 {\n\t\tif z != x {\n\t\t\tz.lo = x.lo\n\t\t\tz.hi = x.hi\n\t\t}\n\t\tr.lo = 0\n\t\tr.hi = 0\n\t\treturn z, r\n\t} else if x.lo == 0 && x.hi == 0 {\n\t\tz.lo = 0\n\t\tz.hi = 0\n\t\tr.lo = 0\n\t\tr.hi = 0\n\t\treturn z, r\n\t} else if x == y || (x.lo == y.lo && x.hi == y.hi) {\n\t\tz.lo = 1\n\t\tz.hi = 0\n\t\tr.lo = 0\n\t\tr.hi = 0\n\t\treturn z, r\n\t}\n\tvar u, v, q Int128\n\tu.Abs(x)\n\tv.Abs(y)\n\tif v.Cmp(&u) > 0 {\n\t\tif r != x {\n\t\t\tr.lo = x.lo\n\t\t\tr.hi = x.hi\n\t\t}\n\t\tz.lo = 0\n\t\tz.hi = 0\n\t\treturn z, r\n\t}\n\n\tif u.hi == 0 && v.hi == 0 {\n\t\tq.lo = u.lo / v.lo\n\t\tr.lo = u.lo % v.lo\n\t} else if v.hi == 0 && (v.lo>>32) == 0 {\n\t\tdivmod32(&u, &v, &q, r)\n\t} else {\n\t\tdivmod(&u, &v, &q, r)\n\t}\n\n\tif (x.Sign() < 0) != (y.Sign() < 0) {\n\t\tq.Neg(&q)\n\t}\n\tif x.Sign() < 0 {\n\t\tr.Neg(r)\n\t}\n\tz.lo = q.lo\n\tz.hi = q.hi\n\treturn z, r\n}", "title": "" }, { "docid": "9ffbfb9de789efd96cc09357a32361dd", "score": "0.55428576", "text": "func opI16Mod(inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_i16() % inputs[1].Get_i16()\n\toutputs[0].Set_i16(outV0)\n}", "title": "" }, { "docid": "1dfa07b0e4449ecae4edb39f11a2b9a9", "score": "0.5519723", "text": "func Uint(v uint) *uint {\n\treturn &v\n}", "title": "" }, { "docid": "9f7ee3602d924430f3569a17dbe76b87", "score": "0.5516195", "text": "func div64(v ID, o uint64) ID {\n\tq, _ := quoRem64(v, o)\n\treturn q\n}", "title": "" }, { "docid": "e3fc467ebdcfe9e7ed545b2c387e045c", "score": "0.5515974", "text": "func Modulo(args ...interface{}) Expr { return fn1(\"modulo\", varargs(args...)) }", "title": "" }, { "docid": "d2c79bcccfb570f3ee152b7162e9232b", "score": "0.55090886", "text": "func (m *modSource) Uint64() uint64 {\n\tif *m > modEdge {\n\t\t*m = 0\n\t}\n\tr := maxUint64 - *m\n\t*m++\n\treturn uint64(r)\n}", "title": "" }, { "docid": "a72451978a6354b04b48991ca2bffe3e", "score": "0.54931974", "text": "func moduloFloat64(x, y float64) float64 {\n\tfor x < 0 {\n\t\tx += y\n\t}\n\treturn math.Mod(x, y)\n}", "title": "" }, { "docid": "8d8476f446781c24a01fc70435020e4c", "score": "0.5489003", "text": "func (this DFloat) Uint() (uint64, error) {\n\tif this.Exponent < 0 {\n\t\treturn 0, fmt.Errorf(\"%v cannot fit into uint: Not a whole number\", this)\n\t}\n\tif int(this.Exponent) >= len(exponentMultipliers) {\n\t\treturn 0, fmt.Errorf(\"%v cannot fit into uint: Exponent too big\", this)\n\t}\n\texpMult := exponentMultipliers[this.Exponent]\n\tresult := uint64(this.Coefficient) * expMult\n\tif result/expMult != uint64(this.Coefficient) {\n\t\treturn 0, fmt.Errorf(\"%v cannot fit into uint: Value too big\", this)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c1b653534a824a1119b13ba829b8f452", "score": "0.5487165", "text": "func Uint(v interface{}) uint {\n\tswitch T := v.(type) {\n\tcase UintConverter:\n\t\tif T != nil {\n\t\t\treturn T.Uint(T)\n\t\t}\n\t}\n\treturn uint(Uint64(v))\n}", "title": "" }, { "docid": "5fa66d1d7dfc8515d8e91c981428cbb1", "score": "0.548579", "text": "func Uint(i uint) *uint {\n\treturn &i\n}", "title": "" }, { "docid": "33e0cebedd6cef60de48d2f485202704", "score": "0.54816735", "text": "func (r *Reader) Uint() uint {\r\n\treturn uint(binary.BigEndian.Uint64(r.buffer[r.i0:r.i1]))\r\n}", "title": "" }, { "docid": "1fca956758a789e9ff3dd52ef2605955", "score": "0.5480449", "text": "func Uint(key string, val uint) Field {\n\treturn Field{Key: key, Val: Uint64Value(val)}\n}", "title": "" }, { "docid": "b0e5929844e36f85eab8168bdfb44148", "score": "0.54748785", "text": "func nMod(p int, m int) int {\n\tmodulus := p % m\n\tif signum(modulus) == -1 {\n\t\treturn modulus + m\n\t} else {\n\t\treturn modulus\n\t}\n}", "title": "" }, { "docid": "5b8c9097e9a150b85b5f419685cfe9e0", "score": "0.5455812", "text": "func div(a, b int64) int64 {\n\tif a%b != 0 {\n\t\tpanic(\"not divisible\")\n\t}\n\treturn a / b\n}", "title": "" }, { "docid": "b3f390f8ff6bdee5e1a8bf83083b8f3b", "score": "0.5454912", "text": "func mod_reduce(b, a uint64) uint64 {\n\td := uint32(b >> 32)\n\tc := uint32(b)\n\tif a >= MOD_P { // (x1, x0)\n\t\ta -= MOD_P\n\t}\n\ta = mod_sub(a, uint64(c))\n\ta = mod_sub(a, uint64(d))\n\ta = mod_add(a, uint64(c)<<32)\n\treturn a\n}", "title": "" }, { "docid": "c0d6baf0743d45667581328bbb8ffa31", "score": "0.5444659", "text": "func (i BigInt) ModRaw(i2 int64) BigInt {\n\treturn i.Mod(NewInt(i2))\n}", "title": "" }, { "docid": "3ec7ab0a90cdb77df142be078a5eeef1", "score": "0.54327077", "text": "func Uint(from interface{}) (uint, error) {\n\treturn converter.Uint(from)\n}", "title": "" }, { "docid": "fa7cc94da178d4b066ff723c9c2068d6", "score": "0.5430746", "text": "func (h Hash) Uint(x uint) uintptr {\n\tif ptrSize == 32 {\n\t\treturn linkname.Runtime_int32Hash(uint32(x), h.seed)\n\t}\n\treturn linkname.Runtime_int64Hash(uint64(x), h.seed)\n}", "title": "" }, { "docid": "95444ab8ac39f140af5c6384a79d0106", "score": "0.5430562", "text": "func Hash1Mod(k []byte, size uint64) uint64 {\r\n\thash := Hash1(k)\r\n\treturn hashMod(hash, size)\r\n}", "title": "" }, { "docid": "f62442afbbd94d11261d892613fd0415", "score": "0.5417296", "text": "func (asm *Asm) divrem(z Reg, a Arg, k divkind) *Asm {\n\ttosave := newHwRegs(rDX)\n\trz := asm.reg(z)\n\tif rz != rAX {\n\t\ttosave.Set(rAX)\n\t}\n\ttosave = asm.pushRegs(tosave)\n\tvar b Reg\n\tra := a.reg(asm)\n\tif tosave.Contains(ra) {\n\t\tb = asm.alloc()\n\t\tasm.Load(b, a)\n\t\ta = b\n\t}\n\tasm.mov(rAX, rz) // nop if z == AX\n\n\tswitch a := a.(type) {\n\tcase *Var:\n\t\tif k&unsigned != 0 {\n\t\t\tasm.Bytes(0x31, 0xd2) // xor %edx,%edx\n\t\t\tasm.Bytes(0x48, 0xf7, 0xb7).Idx(a) // divq a(%rdi)\n\t\t} else {\n\t\t\tasm.Bytes(0x48, 0x99) // cqto\n\t\t\tasm.Bytes(0x48, 0xf7, 0xbf).Idx(a) // idivq a(%rdi)\n\t\t}\n\tdefault:\n\t\ttmp, alloc := asm.hwAlloc(a)\n\t\tif k&unsigned != 0 {\n\t\t\tasm.Bytes(0x31, 0xd2) // xor %edx,%edx\n\t\t\tasm.Bytes(0x48+tmp.hi(), 0xf7, 0xf0+tmp.lo()) // div %reg_tmp\n\t\t} else {\n\t\t\tasm.Bytes(0x48, 0x99) // cqto\n\t\t\tasm.Bytes(0x48+tmp.hi(), 0xf7, 0xf8+tmp.lo()) // idiv %reg_tmp\n\t\t}\n\t\tasm.hwFree(tmp, alloc)\n\t}\n\tif b != NoReg {\n\t\tasm.Free(b)\n\t}\n\tif k&rem != 0 {\n\t\tasm.mov(rz, rDX) // nop if z == DX\n\t} else {\n\t\tasm.mov(rz, rAX) // nop if z == AX\n\t}\n\tasm.popRegs(tosave)\n\treturn asm\n}", "title": "" }, { "docid": "441905d766edfa39a217d7f24afa4079", "score": "0.54164517", "text": "func (d *Deserializer) Uint(size byte) uint64 {\n\tvar out uint64\n\tfor i := byte(0); i < size; i++ {\n\t\tout |= uint64(d.Byte()) << (i * 8)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "073dbcdd6758b28ed8a5d46ddb4a7165", "score": "0.5415753", "text": "func PMod(x, y float64) float64 {\n\tr := math.Mod(x, y)\n\tif r < 0 {\n\t\tr += y\n\t}\n\treturn r\n}", "title": "" }, { "docid": "15fda206e052467c052463aaa2066da8", "score": "0.5399718", "text": "func Mod(pos, val int) mod {\n\treturn mod{\n\t\tPos: pos,\n\t\tVal: val,\n\t}\n}", "title": "" }, { "docid": "8935dab275bd1ff9356b503025ef6b62", "score": "0.5395834", "text": "func OneUint() Uint { return Uint{big.NewInt(1)} }", "title": "" }, { "docid": "40539db78a4d36fc1a7b8784621739e2", "score": "0.53948134", "text": "func (d Uint64) Divisible(n uint64) bool {\n\tvar hicheck, locheck, b uint64\n\tlocheck, b = bits.Sub64(d.lo, 1, b)\n\thicheck, _ = bits.Sub64(d.hi, 0, b)\n\thi, lo := bits.Mul64(d.lo, n)\n\thi += d.hi * n\n\treturn (hi < hicheck) || ((hi == hicheck) && (lo <= locheck))\n}", "title": "" }, { "docid": "2a9a2eddcc5484ab2f61eb3ae7aa8615", "score": "0.5394807", "text": "func PutUint(buf []byte, mag uint64) uint {\n\tr, err := writeSignMag(bytes.NewBuffer(buf[:0]), mag, 0, uint(len(buf)))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "8400b24797eab26614857d66f4bc034f", "score": "0.5383435", "text": "func Uint(u uint) *uint {\n\treturn &u\n}", "title": "" }, { "docid": "f5ea6d7872850907effd5078ca10891a", "score": "0.5374427", "text": "func (self IntValue) Mod(other IntValue) (IntValue, error) {\n\tif other.IsZero() {\n\t\treturn IntValue{}, errors.ERR_DIV_MOD_BY_ZERO\n\t}\n\treturn self.intOp(other, func(a, b int64) (int64, bool) {\n\t\treturn a % b, true\n\t}, func(a, b *big.Int) (IntValue, error) {\n\t\treturn IntValFromBigInt(new(big.Int).Rem(a, b))\n\t})\n}", "title": "" }, { "docid": "3f644fc48a706d63f878b69a5daf4f82", "score": "0.537405", "text": "func loop(val, res int) int {\n\tnewval := val % res\n\tif newval < 0 {\n\t\tnewval = res + newval\n\t}\n\treturn newval\n}", "title": "" }, { "docid": "c7f1444affea51dda63d6b4bc42313a0", "score": "0.53683174", "text": "func randomBytesMod(length int, mod byte) (b []byte) {\n\tif length == 0 {\n\t\treturn nil\n\t}\n\tif mod == 0 {\n\t\tpanic(\"captcha: bad mod argument for randomBytesMod\")\n\t}\n\tmaxrb := 255 - byte(256%int(mod))\n\tb = make([]byte, length)\n\ti := 0\n\tfor {\n\t\tr := randomBytes(length + (length / 4))\n\t\tfor _, c := range r {\n\t\t\tif c > maxrb {\n\t\t\t\t// Skip this number to avoid modulo bias.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tb[i] = c % mod\n\t\t\ti++\n\t\t\tif i == length {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "2265179b66faf618344e4ca45e3e4c7c", "score": "0.53572935", "text": "func GetUint(key string) uint { return v.GetUint(key) }", "title": "" }, { "docid": "2265179b66faf618344e4ca45e3e4c7c", "score": "0.53572935", "text": "func GetUint(key string) uint { return v.GetUint(key) }", "title": "" }, { "docid": "2265179b66faf618344e4ca45e3e4c7c", "score": "0.53572935", "text": "func GetUint(key string) uint { return v.GetUint(key) }", "title": "" }, { "docid": "2eaf7e9fd887329a5b00e3fcca77b018", "score": "0.5346654", "text": "func sipHashMod(key string, cardinality int, id [16]byte) int {\n\tif cardinality <= 0 {\n\t\treturn -1\n\t}\n\t// use the faster version as per siphash docs\n\t// https://github.com/dchest/siphash#usage\n\tk0, k1 := binary.LittleEndian.Uint64(id[0:8]), binary.LittleEndian.Uint64(id[8:16])\n\tsum64 := siphash.Hash(k0, k1, []byte(key))\n\treturn int(sum64 % uint64(cardinality))\n}", "title": "" }, { "docid": "8c4be43cb68d77b71ff6a86959b94808", "score": "0.53419334", "text": "func div(rd, rs1, rs2 uint32) (code uint32) {\n\tcode = 0b0000001<<25 | rs2<<20 | rs1<<15 | 0b100<<12 | rd<<7 | 0b0110011\n\treturn code\n}", "title": "" }, { "docid": "bb9eb723f6cdd2d1b6f0fb5556fbc5b1", "score": "0.5334525", "text": "func FindMod(x uint8, z uint8) uint8 {\n\tfor y := 0; y < 256; y++ {\n\t\tif uint8((uint16(x)*uint16(y))&0xff) == z {\n\t\t\treturn uint8(y)\n\t\t}\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "cef247a3f93412e00d7a1e41f23167ab", "score": "0.53336567", "text": "func ModPow(base, exponent, modulo int) (result int) {\n\tresult = 1\n\tfor exponent > 0 {\n\t\tif exponent%2 == 1 {\n\t\t\tresult *= base\n\t\t\tif modulo > 1 {\n\t\t\t\tresult %= modulo\n\t\t\t}\n\t\t}\n\t\tbase *= base\n\t\tif modulo > 1 {\n\t\t\tbase %= modulo\n\t\t}\n\t\texponent /= 2\n\t}\n\treturn\n}", "title": "" }, { "docid": "681fed19824d17f07923cfb7f73ebe00", "score": "0.5333587", "text": "func div(n, d int) (q, r int) { // HL\n\treturn n / d, n % d\n}", "title": "" }, { "docid": "0b53b481e415ebd06b106286c6b5baa1", "score": "0.5318795", "text": "func Uint(n uint64) Token {\n\tif n == 0 {\n\t\treturn zeroNumber\n\t}\n\treturn Token{str: \"u\", num: uint64(n)}\n}", "title": "" } ]
c1e29004603beab2a04e9d6f4de2288a
The CVSS score for this Vulnerability.
[ { "docid": "968fb93cef41185547f845771a0fb1ca", "score": "0.75020057", "text": "func (o VulnerabilityTypeResponseOutput) CvssScore() pulumi.Float64Output {\n\treturn o.ApplyT(func(v VulnerabilityTypeResponse) float64 { return v.CvssScore }).(pulumi.Float64Output)\n}", "title": "" } ]
[ { "docid": "0f8a18a438d6f53fbd3818dd5d1c6605", "score": "0.77343404", "text": "func (o VulnerabilityDetailsResponseOutput) CvssScore() pulumi.Float64Output {\n\treturn o.ApplyT(func(v VulnerabilityDetailsResponse) float64 { return v.CvssScore }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "b0e434cb5da67f9e6dcdcd1123275621", "score": "0.7715946", "text": "func (o VulnerabilityResponseOutput) CvssScore() pulumi.Float64Output {\n\treturn o.ApplyT(func(v VulnerabilityResponse) float64 { return v.CvssScore }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "b976ae50c77c75f9a0f937b2f7b1b1fe", "score": "0.7667121", "text": "func (o VulnerabilityOutput) CvssScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v Vulnerability) *float64 { return v.CvssScore }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "85ab76ff85d34c31ae5f83ac5fe2f693", "score": "0.73475194", "text": "func (o GrafeasV1beta1VulnerabilityDetailsResponseOutput) CvssScore() pulumi.Float64Output {\n\treturn o.ApplyT(func(v GrafeasV1beta1VulnerabilityDetailsResponse) float64 { return v.CvssScore }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "d2e21313bd332c9c2c97b84f4105a86c", "score": "0.72980857", "text": "func (o VulnerabilityTypeOutput) CvssScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v VulnerabilityType) *float64 { return v.CvssScore }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "5a098c16d2c8d543e5e5e1813a3e43df", "score": "0.7234209", "text": "func (o VulnerabilityPtrOutput) CvssScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *Vulnerability) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CvssScore\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "a16a136ce0dc195aad2e06dd027d5ee3", "score": "0.7048099", "text": "func (o VulnerabilityDetailsResponsePtrOutput) CvssScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *VulnerabilityDetailsResponse) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.CvssScore\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "2451e6fb34ac1ae640317fe283a21073", "score": "0.6875416", "text": "func (o VulnerabilityTypeResponsePtrOutput) CvssScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *VulnerabilityTypeResponse) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.CvssScore\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "73039f160b06f7fc40107a62d11dae5e", "score": "0.68028384", "text": "func (o VulnerabilityTypePtrOutput) CvssScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *VulnerabilityType) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CvssScore\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "724713ed02da72333781d595dfc28238", "score": "0.62222314", "text": "func (m Vectors) Score() float64 {\n\tif !math.IsNaN(m.EnvironmentalScore()) {\n\t\treturn m.EnvironmentalScore()\n\t}\n\tif !math.IsNaN(m.TemporalScore()) {\n\t\treturn m.TemporalScore()\n\t}\n\tif !math.IsNaN(m.BaseScore()) {\n\t\treturn m.BaseScore()\n\t}\n\treturn math.NaN()\n}", "title": "" }, { "docid": "fcd2d4412a619a8e26503811826f3450", "score": "0.6160074", "text": "func (s *Solver) Score() int {\n\treturn s.score\n}", "title": "" }, { "docid": "3475b868509c87b3a9ba1df1a4e8e83d", "score": "0.6077976", "text": "func (cs *CountSummary) GetScore() uint {\n\ttotal := (cs.Successes * 2) + cs.Warnings + (cs.Errors * 2)\n\treturn uint((float64(cs.Successes*2) / float64(total)) * 100)\n}", "title": "" }, { "docid": "c00e431b3a9534c9d6a3373c199e6e0f", "score": "0.60469985", "text": "func (inventory *InventoryConfig) Score(config *ScoringConfig) error {\n\tauditResult, err := getViolations(inventory, config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = config.attachViolations(auditResult)\n\n\tif len(auditResult.Violations) > 0 {\n\t\tfmt.Printf(\"\\n\\n%v total issues found\\n\", len(auditResult.Violations))\n\t\tfor _, category := range config.categories {\n\t\t\tfmt.Printf(\"\\n\\n%v: %v issues found\\n\", category.Name, category.Count())\n\t\t\tfmt.Printf(\"----------\\n\")\n\t\t\tfor _, cv := range category.constraints {\n\t\t\t\tfmt.Printf(\"%v: %v issues\\n\", cv.GetName(), cv.Count())\n\t\t\t\tfor _, v := range cv.Violations {\n\t\t\t\t\tfmt.Printf(\"- %v\\n\\n\",\n\t\t\t\t\t\tv.Message,\n\t\t\t\t\t)\n\t\t\t\t\tLog.Debug(\"Violation metadata\", \"metadata\", v.GetMetadata())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfmt.Println(\"No issues found found! You have a perfect score.\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7cbe9f2c35bc6b156c0f2bab3f2b4801", "score": "0.59055173", "text": "func (r Relay) Score() float64 {\n\t// Avoid a division by zero panic.\n\tif r.Max <= 0 {\n\t\treturn 0\n\t}\n\treturn 1.0 - float64(2.0*r.Listeners)/float64(r.Listeners+r.Max)\n}", "title": "" }, { "docid": "cb3aefd27121734fe994cff079d79ba3", "score": "0.58790964", "text": "func Score(pass string) float64 {\n\treturn newScoreBuilder(pass).calc()\n}", "title": "" }, { "docid": "926286121b1e690454dc95cabe5e16c7", "score": "0.58589023", "text": "func (r *WinLossRecord) Score() float64 {\n\treturn float64(1 + r.Wins) / float64(1 + r.Wins + r.Losses)\n}", "title": "" }, { "docid": "44b1fcf9ed289b61d0517e0fc7938748", "score": "0.5767482", "text": "func (b *BNet) Score() float64 {\n\treturn b.score\n}", "title": "" }, { "docid": "123924e99af93ab64621933c73e43b06", "score": "0.57621855", "text": "func (g GameState) Score() float64 {\n\treturn samegame.State(g).Score()\n}", "title": "" }, { "docid": "ac98bc717b50b212cd0e9c51da27a7a4", "score": "0.5741037", "text": "func (koma Koma) GetScore() int {\n\tif koma == Hidden {\n\t\tpanic(\"cannot get the score of Hidden\")\n\t}\n\tif koma == Empty {\n\t\tpanic(\"cannot get the score of Empty\")\n\t}\n\treturn int(math.Floor(float64(koma/2.0))*10 + 10)\n}", "title": "" }, { "docid": "6e3199b49e4cb570b457a2ef0a04304a", "score": "0.5737627", "text": "func (g *Game) Score() int {\n\tscore := 0\n\tframeIndex := 0\n\tfor frame := 0; frame < framesPerGame; frame++ {\n\t\tif g.isSpare(frameIndex) {\n\t\t\tscore += 10 + g.rolls[frameIndex+2]\n\t\t\tframeIndex += 2\n\t\t} else if g.isStrike(frameIndex) {\n\t\t\tscore += 10 + g.rolls[frameIndex+1] + g.rolls[frameIndex+2]\n\t\t\tframeIndex++\n\t\t} else {\n\t\t\tscore += g.rolls[frameIndex] + g.rolls[frameIndex+1]\n\t\t\tframeIndex += 2\n\t\t}\n\t}\n\treturn score\n}", "title": "" }, { "docid": "9425451f3768a744bd6ebc94f32de63b", "score": "0.5685504", "text": "func (r *Reporter) Score() int64 {\n\treturn atomic.LoadInt64(&r.score)\n}", "title": "" }, { "docid": "43e881ad5de679332c819b85c07820bb", "score": "0.5659726", "text": "func (r *RateReporter) Score() int64 {\n\tnow := time.Now().UnixNano()\n\tpassed := now - atomic.SwapInt64(&r.time, now)\n\tif passed < r.unit {\n\t\tatomic.AddInt64(&r.time, -passed)\n\t\treturn atomic.LoadInt64(&r.count) * r.unit / passed\n\t}\n\treturn atomic.SwapInt64(&r.count, 0) * r.unit / passed\n}", "title": "" }, { "docid": "427a90f5f7c93cc8a7a651455e8c7918", "score": "0.56467026", "text": "func (t *Transaction) GetScore() int64 {\n\tif config.DevConfiguration.IsFeeEnabled {\n\t\treturn t.Fee\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "f44313e989e63e249a50db4ad479be12", "score": "0.5608018", "text": "func Score(word string) int {\n\ts := 0\n\tfor i := 0; i < len(word); i++ {\n\t\ts += int(cvalue[word[i]])\n\t}\n\treturn s\n}", "title": "" }, { "docid": "981c42405408053e644beea0364ddc8c", "score": "0.5594869", "text": "func ScoreSeverity(severity SeverityRank) float32 {\n\tswitch severity {\n\tcase SeverityNone:\n\t\treturn SeverityThresholdNone\n\tcase SeverityLow:\n\t\treturn SeverityThresholdLow\n\tcase SeverityMedium:\n\t\treturn SeverityThresholdMedium\n\tcase SeverityHigh:\n\t\treturn SeverityThresholdHigh\n\tcase SeverityCritical:\n\t\treturn SeverityThresholdCritical\n\tdefault:\n\t\treturn SeverityThresholdCritical\n\t}\n}", "title": "" }, { "docid": "860f7f75a59fddf6b6c735a2800256b8", "score": "0.5574063", "text": "func (h Hand) Score() int {\n\tminScore := h.MinScore()\n\tif minScore > 11 {\n\t\treturn minScore\n\t}\n\tfor _, c := range h {\n\t\tif c.Rank == deck.Ace {\n\t\t\t// ace is currently worth 1, and we are changing it to be worth 11\n\t\t\t// 11 - 1 = 10\n\t\t\treturn minScore + 10\n\t\t}\n\t}\n\treturn minScore\n}", "title": "" }, { "docid": "138d8bdb39ea7d1b2cc253edf38b7631", "score": "0.5547577", "text": "func (o CVSSOutput) BaseScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v CVSS) *float64 { return v.BaseScore }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "54aa69b9c309651a7f87cc5464739a94", "score": "0.554226", "text": "func (o VulnerabilityResponseOutput) CvssVersion() pulumi.StringOutput {\n\treturn o.ApplyT(func(v VulnerabilityResponse) string { return v.CvssVersion }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c628605fa8476b8032f64a5d14b5872c", "score": "0.55342484", "text": "func (la *LeastAllocated) Score(ctx context.Context, state *interfaces.CycleState, stack *types.Stack,\n\tsiteCacheInfo *sitecacheinfo.SiteCacheInfo) (int64, *interfaces.Status) {\n\t// la.score favors site with fewer requested resources.\n\t// It calculates the percentage of memory and CPU requested by pods scheduled on the site, and\n\t// prioritizes based on the minimum of the average of the fraction of requested to capacity.\n\t//\n\t// Details:\n\t// (cpu((capacity-sum(requested))/capacity) + memory((capacity-sum(requested))/capacity))/2*weight\n\treturn la.score(stack, siteCacheInfo)\n}", "title": "" }, { "docid": "f2e06cc274af7673da971352ff18b397", "score": "0.5524842", "text": "func Score(x float64, y float64) int {\n\td := x*x + y*y\n\tif d <= 1 {\n\t\treturn 10\n\t} else if d <= 25 {\n\t\treturn 5\n\t} else if d <= 100 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "1cb900bc74528f33eafb3f9325e9c4e1", "score": "0.5520528", "text": "func (h Hand) Score() int {\n\tminScore := h.MinScore()\n\tif minScore > 11 {\n\t\treturn minScore\n\t}\n\tfor _, c := range h {\n\t\tif c.Rank == godeck.Ace {\n\t\t\treturn minScore + 10\n\t\t}\n\t}\n\treturn minScore\n}", "title": "" }, { "docid": "b2c4223c5c7809af4f3b17162c514fc4", "score": "0.5519197", "text": "func (c Client) Score() (string, error) {\n\tvar data struct{ Score string }\n\tc.url.Path = \"/chain/score\"\n\treq, err := c.buildReq(nil, nil, http.MethodGet)\n\tif err != nil {\n\t\treturn data.Score, err\n\t}\n\tbody, err := c.request(req)\n\tif err != nil {\n\t\treturn data.Score, err\n\t}\n\tif err := json.Unmarshal(body, &data); err != nil {\n\t\treturn data.Score, nil\n\t}\n\treturn data.Score, nil\n}", "title": "" }, { "docid": "13ff628c41828793dbaf09aafb471220", "score": "0.55111754", "text": "func (p *Player) Score() int {\n\treturn int(p.score)\n}", "title": "" }, { "docid": "69781ef8ed3c1e9c0d6d256078bb1f9a", "score": "0.5495411", "text": "func Score(x, y float64) int {\n\tsquareSum := x*x + y*y\n\tswitch {\n\tcase squareSum > 10.0*10.0:\n\t\treturn 0\n\tcase squareSum > 5.0*5.0:\n\t\treturn 1\n\tcase squareSum > 1.0*1.0:\n\t\treturn 5\n\tdefault:\n\t\treturn 10\n\t}\n}", "title": "" }, { "docid": "4f4d7f593a2047bb097c59536da362a6", "score": "0.54828393", "text": "func AggregateScore(vulnerabilities []Vulnerability) float32 {\n\tif len(vulnerabilities) == 0 {\n\t\treturn 0\n\t}\n\tsort.Sort(ByScore(vulnerabilities))\n\treturn vulnerabilities[0].Score\n}", "title": "" }, { "docid": "210b1e4865eb0084e7af832e4424fe22", "score": "0.5479418", "text": "func (o CVSSResponseOutput) BaseScore() pulumi.Float64Output {\n\treturn o.ApplyT(func(v CVSSResponse) float64 { return v.BaseScore }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "5eca49d0e92dcc7f21f2441f92f844c8", "score": "0.5468025", "text": "func (o VulnerabilityOutput) CvssVersion() VulnerabilityCvssVersionPtrOutput {\n\treturn o.ApplyT(func(v Vulnerability) *VulnerabilityCvssVersion { return v.CvssVersion }).(VulnerabilityCvssVersionPtrOutput)\n}", "title": "" }, { "docid": "80300676dc2daf3dd3fc3393c785d620", "score": "0.54601806", "text": "func (e *Entry) Score() float64 {\n\tif e == nil {\n\t\treturn 0\n\t}\n\n\tvar childPoints float64 = 0\n\tif e.Child() != nil {\n\t\tchildPoints = DECAY * e.Child().recursivePoints()\n\t}\n\n\treturn round(e.score(childPoints), 8)\n}", "title": "" }, { "docid": "ee0535395d76d38103805fb00a8920e3", "score": "0.54517317", "text": "func (s CvssScore) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "af2664680fdb0c449833a2c3a9ef726e", "score": "0.5440339", "text": "func (p *peerInfo) Score() PeerScore {\n\tvar score PeerScore\n\tif p.Persistent {\n\t\tscore += PeerScorePersistent\n\t}\n\treturn score\n}", "title": "" }, { "docid": "18d53e2c3ccb4e545ac4e6a65c01c01a", "score": "0.5434096", "text": "func Score(w string) (score int) {\n\tw = strings.ToLower(w)\n\tfor _, r := range []rune(w) {\n\t\tscore += scores[r]\n\t}\n\treturn score\n}", "title": "" }, { "docid": "42a92a9f7c69b6ae012359c3c4a4dc33", "score": "0.5402442", "text": "func (s *SummaryCve) GetCvss2() string {\n\tif s == nil || s.Cvss2 == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Cvss2\n}", "title": "" }, { "docid": "c1322c4e1b117d061050efed716222d0", "score": "0.5393246", "text": "func (o GrafeasV1beta1VulnerabilityDetailsResponseOutput) CvssVersion() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GrafeasV1beta1VulnerabilityDetailsResponse) string { return v.CvssVersion }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0cc1df532e6293b4dcf59fd9cfdaa54f", "score": "0.5392697", "text": "func (s *DynamicPeerScore) Score(t time.Time) int64 {\n\ts.mtx.Lock()\n\tr := s.score(t)\n\ts.mtx.Unlock()\n\treturn r\n}", "title": "" }, { "docid": "b27abd925fca58fe61754c09b6855808", "score": "0.5383863", "text": "func Score(isFemale bool, bw, total float64) float64 {\n\treturn coefficient(isFemale, bw) * total\n}", "title": "" }, { "docid": "248247898f03c6f26d8f0af22c1a7e27", "score": "0.5383782", "text": "func Score(x, y float64) (score int) {\n\tcoords := math.Pow(y, 2) + math.Pow(x, 2)\n\tscore = 0\n\n\tif coords <= 1e2 {\n\t\tscore = 1\n\t}\n\n\tif coords <= 25 {\n\t\tscore = 5\n\t}\n\n\tif coords <= 1 {\n\t\tscore = 10\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fc5c5cacd237515173e563c3d025b728", "score": "0.5375756", "text": "func (o *RiskAssessment) GetRiskScore() float32 {\n\tif o == nil || o.RiskScore == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\treturn *o.RiskScore\n}", "title": "" }, { "docid": "ea60269b448fb16e67c1d3981fb91048", "score": "0.53561324", "text": "func (o CVSSv3ResponseOutput) BaseScore() pulumi.Float64Output {\n\treturn o.ApplyT(func(v CVSSv3Response) float64 { return v.BaseScore }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "f19cb7f76d6cb301d86d4f102bc75b2c", "score": "0.53501856", "text": "func Score(pos *chess.Position) float32 {\n\tboard := pos.Board().SquareMap()\n\tvar score float32\n\n\tfor square, piece := range board {\n\t\tscore += scorePiece(piece, square)\n\t}\n\n\treturn score\n}", "title": "" }, { "docid": "a8fca34d9dbc453171d79ba3540c7c4c", "score": "0.53480256", "text": "func Score(str string) (score int) {\n\tfor _, r := range strings.ToLower(str) {\n\t\tval, found := scoreValues[r]\n\t\tif found {\n\t\t\tscore += val\n\t\t}\n\t}\n\treturn score\n}", "title": "" }, { "docid": "4ab46ae3f1d5e4e1b0143795e79fa238", "score": "0.53345853", "text": "func Score(input string) int {\n\tinput = strings.ToUpper(input)\n\n\tvar score int\n\tfor _, ele := range input {\n\t\tscore += scores[string(ele)]\n\t}\n\treturn score\n}", "title": "" }, { "docid": "acb6f99cb643b2a9339c3d713954ea12", "score": "0.53286797", "text": "func Score(word string) int {\n\n\tcaps := strings.ToUpper(word)\n\tvalue := 0\n\tfor _, key := range caps {\n\t\tswitch key {\n\t\tcase 'A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T':\n\t\t\tvalue++\n\t\tcase 'D', 'G':\n\t\t\tvalue += 2\n\t\tcase 'B', 'C', 'M', 'P':\n\t\t\tvalue += 3\n\t\tcase 'F', 'H', 'V', 'W', 'Y':\n\t\t\tvalue += 4\n\t\tcase 'K':\n\t\t\tvalue += 5\n\t\tcase 'J', 'X':\n\t\t\tvalue += 8\n\t\tcase 'Q', 'Z':\n\t\t\tvalue += 10\n\t\t}\n\t}\n\treturn value\n}", "title": "" }, { "docid": "135aaeeaefbc8cc91d0ce4c0e5071894", "score": "0.5325224", "text": "func (m Vectors) ExploitabilitySubScore() float64 {\n\treturn round(m.exploitability())\n}", "title": "" }, { "docid": "003dd69a92c8521c1219ad9514e5b155", "score": "0.53217393", "text": "func (o GrafeasV1beta1VulnerabilityDetailsResponseOutput) CvssV2() CVSSResponseOutput {\n\treturn o.ApplyT(func(v GrafeasV1beta1VulnerabilityDetailsResponse) CVSSResponse { return v.CvssV2 }).(CVSSResponseOutput)\n}", "title": "" }, { "docid": "75cef43cabf5ed866adff3f8cdb4d19b", "score": "0.5312771", "text": "func Score(player int8, state mcts.GameState) float64 {\n\ts := state.(*GoState)\n\tscore := s.Score()\n\tif player == W {\n\t\tscore *= -1\n\t}\n\treturn score\n}", "title": "" }, { "docid": "81847b13de9eeba0a5ae153473ef9e5c", "score": "0.53094107", "text": "func Score(word string) int {\n\tcounts := make(map[rune]int)\n\tfor _, r := range word {\n\t\tcounts[unicode.ToUpper(r)] += 1\n\t}\n\n\tvalue := 0\n\tfor r, count := range counts {\n\t\tswitch {\n\t\tcase strings.ContainsRune(\"AEIOULNRST\", r):\n\t\t\tvalue += 1 * count\n\t\tcase strings.ContainsRune(\"DG\", r):\n\t\t\tvalue += 2 * count\n\t\tcase strings.ContainsRune(\"BCMP\", r):\n\t\t\tvalue += 3 * count\n\t\tcase strings.ContainsRune(\"FHVWY\", r):\n\t\t\tvalue += 4 * count\n\t\tcase strings.ContainsRune(\"K\", r):\n\t\t\tvalue += 5 * count\n\t\tcase strings.ContainsRune(\"JX\", r):\n\t\t\tvalue += 8 * count\n\t\tcase strings.ContainsRune(\"QZ\", r):\n\t\t\tvalue += 10 * count\n\t\t}\n\t}\n\treturn value\n}", "title": "" }, { "docid": "af15d852a0667bac7464b75c408d19b1", "score": "0.5302636", "text": "func (a *Alchemist) Score(atlas *hobbit.Atlas, race hobbit.RaceI) int {\n\tcoins := 2\n\treturn coins\n}", "title": "" }, { "docid": "77228a4983169b4fdd3362fbfaf78258", "score": "0.529952", "text": "func Score(word string) int {\n\n\tvar scrabbleScore int\n\tfor _, i := range strings.ToUpper(word) {\n\t\tscrabbleScore += letVal[i]\n\t}\n\n\treturn scrabbleScore\n}", "title": "" }, { "docid": "f7362960f2e7196b8f22631599490df4", "score": "0.5297211", "text": "func (k *IDField) GetScore() int64 {\n\treturn 0\n}", "title": "" }, { "docid": "f2bb21e3b68a45cce929c1378ebd859d", "score": "0.52952963", "text": "func (hand Hand) Score(starter Card, isCrib bool) (scores []Score, total int) {\n\tgrossScores := []Score{}\n\tif len(hand) != 4 {\n\t\treturn\n\t}\n\tsizedHand := append(hand[:4], starter)\n\tpairings := sizedHand.BuildPairings()\n\n\tgrossScores = append(grossScores, hand[:4].NobsScore(starter))\n\tgrossScores = append(grossScores, pairings.OfAKindScores()...)\n\tgrossScores = append(grossScores, pairings.FifteenScores()...)\n\tgrossScores = append(grossScores, pairings.RunScores()...)\n\tgrossScores = append(grossScores, pairings.FlushScores(isCrib)...)\n\n\tscores = []Score{}\n\tfor _, score := range grossScores {\n\t\tif score.Value > 0 {\n\t\t\ttotal += score.Value\n\t\t\tscores = append(scores, score)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f0d17aa098bf201e170cda4b16546cf7", "score": "0.5285575", "text": "func (s *Score) Value() float64 {\n\tif s.TotalMoves == 0 {\n\t\treturn 0\n\t}\n\n\treturn s.PlayerTotal / s.TotalMoves\n}", "title": "" }, { "docid": "398e58541053c6a068caed3c5777a614", "score": "0.5230905", "text": "func (o CVSSv3Output) BaseScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v CVSSv3) *float64 { return v.BaseScore }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "d78740981dba143fbc33b35224759850", "score": "0.5204301", "text": "func (s *Server) CountScore() {\n\tvar sum float32 = 0.0\n\tfor _, client := range s.Clients {\n\t\tsum += float32(client.Score)\n\t}\n\ts.AvgScore = sum\n}", "title": "" }, { "docid": "c7eb873c44f5c88c61d27f5954f69ce0", "score": "0.5199139", "text": "func (sev *Matrix) CalculateScore() int {\n\tscore := 0\n\tfor k := range sev.Count {\n\t\tscore += SeverityTable[k]\n\t}\n\treturn score\n}", "title": "" }, { "docid": "7a9726c87c4c9bc3e177465bc23b7045", "score": "0.5195549", "text": "func Score(x, y float64) int {\n\tdistance := math.Sqrt(math.Pow(x, 2) + math.Pow(y, 2))\n\tswitch {\n\tcase distance > 10:\n\t\treturn 0\n\tcase distance > 5 && distance <= 10:\n\t\treturn 1\n\tcase distance > 1 && distance <= 5:\n\t\treturn 5\n\tdefault:\n\t\treturn 10\n\t}\n}", "title": "" }, { "docid": "d15b2819861ada5aee0cefea8f2a0db9", "score": "0.51923996", "text": "func (o CVSSPtrOutput) BaseScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *CVSS) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.BaseScore\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "f43aa57a350a5a32eabbfbc8b42f39cb", "score": "0.5179604", "text": "func severityFromCVSSv2Score(score float64) severity {\n\tif score >= 9.0 {\n\t\treturn severityCritical\n\t}\n\tif score >= 7.0 {\n\t\treturn severityHigh\n\t}\n\tif score >= 4.0 {\n\t\treturn severityMedium\n\t}\n\tif score >= 0.1 {\n\t\treturn severityLow\n\t}\n\treturn severityNegligible\n}", "title": "" }, { "docid": "7f01696652d1a9d1961766fe8be70a20", "score": "0.51695246", "text": "func Score(message []byte) float64 {\n\tfreq := make(map[string]float64)\n\n\tfor _, byt := range message {\n\t\tch := strings.ToLower(string([]byte{byt}))\n\t\tfreq[ch] += 1.0 / float64(len(message))\n\t}\n\n\tvar penalties float64\n\n\tfor _, byt := range message {\n\t\tif _, ok := EnglishByteFrequency[byt]; !ok {\n\t\t\tpenalties -= 1.0 / float64(len(message))\n\t\t}\n\t}\n\n\treturn 1 - MapDifference(freq, EnglishCharFrequency)\n}", "title": "" }, { "docid": "0aa8dd922902cbad91da8f202eac8b15", "score": "0.51633584", "text": "func Score(input string) (points int) {\n\tfor _, letter := range input {\n\t\tswitch unicode.ToUpper(letter) {\n\t\tcase 'A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T':\n\t\t\tpoints++\n\t\tcase 'D', 'G':\n\t\t\tpoints += 2\n\t\tcase 'B', 'C', 'M', 'P':\n\t\t\tpoints += 3\n\t\tcase 'F', 'H', 'V', 'W', 'Y':\n\t\t\tpoints += 4\n\t\tcase 'K':\n\t\t\tpoints += 5\n\t\tcase 'J', 'X':\n\t\t\tpoints += 8\n\t\tcase 'Q', 'Z':\n\t\t\tpoints += 10\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "58a0c6231f3a49f9554af204565bac2a", "score": "0.5161335", "text": "func Score(input string) int {\n\n\tsum := 0\n\n\tfor _, c := range input {\n\t\tsum = sum + scoreMap[c]\n\t}\n\n\treturn sum\n}", "title": "" }, { "docid": "83f1fad99f74ad3c35d608c317783746", "score": "0.5159983", "text": "func (o *ActivityZone) GetScore() int32 {\n\tif o == nil || o.Score == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Score\n}", "title": "" }, { "docid": "3f4ff0a67ac13c4b30119ca3a0cac1eb", "score": "0.51529074", "text": "func (g *Grid) CalcScenicScore(sx, sy int) int {\n\tme := g.Cells[sy][sx]\n\t// Left\n\tvar left int\n\tfor x := sx - 1; x >= 0; x-- {\n\t\tleft++\n\t\tif g.Cells[sy][x] >= me {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Right\n\tvar right int\n\tfor x := sx + 1; x < g.Width; x++ {\n\t\tright++\n\t\tif g.Cells[sy][x] >= me {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Up\n\tvar up int\n\tfor y := sy - 1; y >= 0; y-- {\n\t\tup++\n\t\tif g.Cells[y][sx] >= me {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Down\n\tvar down int\n\tfor y := sy + 1; y < g.Height; y++ {\n\t\tdown++\n\t\tif g.Cells[y][sx] >= me {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tg.ScenicScores[sy][sx] = left * right * up * down\n\treturn g.ScenicScores[sy][sx]\n}", "title": "" }, { "docid": "63698cffb7901fdde08699a89ec254db", "score": "0.5145587", "text": "func (o GrafeasV1beta1VulnerabilityDetailsOutput) CvssV2() CVSSPtrOutput {\n\treturn o.ApplyT(func(v GrafeasV1beta1VulnerabilityDetails) *CVSS { return v.CvssV2 }).(CVSSPtrOutput)\n}", "title": "" }, { "docid": "de859580d98563598f64883957409c97", "score": "0.51425713", "text": "func (o orcheImpl) GetScore(devID string) (scoreValue float64, err error) {\n\treturn o.scoringIns.GetScore(devID)\n}", "title": "" }, { "docid": "f85f322b4ddeac14d06451a4f3289989", "score": "0.51301783", "text": "func (e *ELM) Score(d *DataSet) float64 {\n\tvar data mat.Dense\n\n\ttestArray := e.GetAddBiasArray(d)\n\tdata.Mul(&e.W, testArray.T())\n\n\tgData := SetSigmoid(data)\n\tvar result mat.Dense\n\tresult.Mul(gData.T(), &e.Beta)\n\treturn evaluationCheck(result, d.Y)\n}", "title": "" }, { "docid": "c12c6be0d6984fadd6dceeae47ab71f8", "score": "0.51270413", "text": "func (pl *ImageLocality) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status) {\n\tnodeInfo, err := pl.handle.SnapshotSharedLister().NodeInfos().Get(nodeName)\n\tif err != nil {\n\t\treturn 0, framework.AsStatus(fmt.Errorf(\"getting node %q from Snapshot: %w\", nodeName, err))\n\t}\n\n\tnodeInfos, err := pl.handle.SnapshotSharedLister().NodeInfos().List()\n\tif err != nil {\n\t\treturn 0, framework.AsStatus(err)\n\t}\n\ttotalNumNodes := len(nodeInfos)\n\n\tscore := calculatePriority(sumImageScores(nodeInfo, pod.Spec.Containers, totalNumNodes), len(pod.Spec.Containers))\n\n\treturn score, nil\n}", "title": "" }, { "docid": "8be42a9563ede5c5a8155d02b740f8f1", "score": "0.51268065", "text": "func Score(word string) int {\n\tvalue := 0\n\tfor _, c := range []byte(word) {\n\t\tvalue += valor(c)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "b3a8eb3073670e7f46ca9d483127db8a", "score": "0.5124601", "text": "func (m *FileSecurityState) GetRiskScore()(*string) {\n val, err := m.GetBackingStore().Get(\"riskScore\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "0a61a309ac7de2c43967f4b27690d4ca", "score": "0.5120975", "text": "func Score(x int, n int) (upper float64, lower float64) {\n\tnf := float64(n)\n\tpHat := float64(x) / nf\n\tdelta := z * math.Sqrt((pHat*(1-pHat)+z*z/(4*nf))/nf)\n\tupper = (pHat + (z*z)/(2*nf) + delta) / (1 + z*z/nf)\n\tlower = (pHat + (z*z)/(2*nf) - delta) / (1 + z*z/nf)\n\treturn\n}", "title": "" }, { "docid": "58a125b42be47af427360de0f22b60be", "score": "0.51100624", "text": "func (report *Report) MsiScore() float64 {\n\ttotal := report.TotalCount()\n\n\tif total == 0 {\n\t\treturn 0.0\n\t}\n\n\treturn float64(report.Stats.KilledCount+report.Stats.ErrorCount+report.Stats.SkippedCount) / float64(total)\n}", "title": "" }, { "docid": "33b3bc768f05b3cc592e499014b3e1db", "score": "0.5102964", "text": "func Score(data clusters.Observations, k int, m Partitioner) (float64, error) {\n\tcc, err := m.Partition(data, k)\n\tif err != nil {\n\t\treturn -1.0, err\n\t}\n\n\tvar si float64\n\tvar sc int64\n\tfor ci, c := range cc {\n\t\tfor _, p := range c.Observations {\n\t\t\tai := clusters.AverageDistance(p, c.Observations)\n\t\t\t_, bi := cc.Neighbour(p, ci)\n\n\t\t\tsi += (bi - ai) / math.Max(ai, bi)\n\t\t\tsc++\n\t\t}\n\t}\n\n\treturn si / float64(sc), nil\n}", "title": "" }, { "docid": "33b3bc768f05b3cc592e499014b3e1db", "score": "0.5102964", "text": "func Score(data clusters.Observations, k int, m Partitioner) (float64, error) {\n\tcc, err := m.Partition(data, k)\n\tif err != nil {\n\t\treturn -1.0, err\n\t}\n\n\tvar si float64\n\tvar sc int64\n\tfor ci, c := range cc {\n\t\tfor _, p := range c.Observations {\n\t\t\tai := clusters.AverageDistance(p, c.Observations)\n\t\t\t_, bi := cc.Neighbour(p, ci)\n\n\t\t\tsi += (bi - ai) / math.Max(ai, bi)\n\t\t\tsc++\n\t\t}\n\t}\n\n\treturn si / float64(sc), nil\n}", "title": "" }, { "docid": "3d0596157186a3bfeb39fe00675e84bc", "score": "0.50995195", "text": "func Score(text string) int {\n\ttext = strings.ToLower(text)\n\tresult := 0\n\tfor _, key := range text {\n\t\tresult += defineValue(key)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4bb5c53d82c580b5df7f06357b1e289c", "score": "0.509429", "text": "func (o VulnerabilityResponseOutput) CvssV2() CVSSResponseOutput {\n\treturn o.ApplyT(func(v VulnerabilityResponse) CVSSResponse { return v.CvssV2 }).(CVSSResponseOutput)\n}", "title": "" }, { "docid": "1665f796ea133a2e18b6d4bf3e99973a", "score": "0.5091324", "text": "func (s CvssScoreDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d626d65d3af4e2d566d65f2ccd73f03b", "score": "0.5084468", "text": "func (cs *supply) GetScore(req Request) Score {\n\tscore := &score{\n\t\tsupply: cs,\n\t\treq: req,\n\t}\n\n\tcr := req.(*request)\n\tfull, part := cr.full, cr.fraction\n\tif full == 0 && part == 0 {\n\t\tpart = 1\n\t}\n\n\tscore.reserved = cs.AllocatableReservedCPU()\n\tscore.shared = cs.AllocatableSharedCPU()\n\n\tif cr.CPUType() == cpuReserved {\n\t\t// calculate free reserved capacity\n\t\tscore.reserved -= part\n\t} else {\n\t\t// calculate isolated node capacity CPU\n\t\tif cr.isolate {\n\t\t\tscore.isolated = cs.isolated.Size() - full\n\t\t}\n\n\t\t// if we don't want isolated or there is not enough, calculate slicable capacity\n\t\tif !cr.isolate || score.isolated < 0 {\n\t\t\tscore.shared -= 1000 * full\n\t\t}\n\n\t\t// calculate fractional capacity\n\t\tscore.shared -= part\n\t}\n\n\t// calculate colocation score\n\tfor _, grant := range cs.node.Policy().allocations.grants {\n\t\tif cr.CPUType() == grant.CPUType() && grant.GetCPUNode().NodeID() == cs.node.NodeID() {\n\t\t\tscore.colocated++\n\t\t}\n\t}\n\n\t// calculate real hint scores\n\thints := cr.container.GetTopologyHints()\n\tscore.hints = make(map[string]float64, len(hints))\n\n\tfor provider, hint := range cr.container.GetTopologyHints() {\n\t\tif provider == topology.ProviderKubelet {\n\t\t\tlog.Warn(\" - ignoring topology pseudo-hint from kubelet allocation %s\", hint)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Debug(\" - evaluating topology hint %s\", hint)\n\t\tscore.hints[provider] = cs.node.HintScore(hint)\n\t}\n\n\treturn score\n}", "title": "" }, { "docid": "f7ae08a617fed8aa3162fcdfa482dc89", "score": "0.50737745", "text": "func (mb *MagicBlockMap) GetScore() int64 {\n\treturn 0\n}", "title": "" }, { "docid": "c7a8f61a36ec81a8ce3cac7e65db8fbe", "score": "0.507025", "text": "func (s *Service) ScoreCurrent(c context.Context, mid int64) (res *model.ScoreCurrentResp, err error) {\n\tcurrent, err := s.lastestScore(c, mid)\n\tif err != nil || current == nil {\n\t\treturn\n\t}\n\tres = &model.ScoreCurrentResp{\n\t\tDate: current.ScoreDate.Unix(),\n\t\tCredit: &model.ScoreCurrent{Current: current.CreditScore, Diff: current.CreditScore},\n\t\tInfluence: &model.ScoreCurrent{Current: current.InfluenceScore, Diff: current.InfluenceScore},\n\t\tCreativity: &model.ScoreCurrent{Current: current.CreativityScore, Diff: current.CreativityScore},\n\t}\n\tprev, err := s.upScore(c, mid, prevComputation(current.ScoreDate))\n\tif err != nil {\n\t\treturn\n\t}\n\tif prev != nil {\n\t\tres.Credit.Diff = current.CreditScore - prev.CreditScore\n\t\tres.Influence.Diff = current.InfluenceScore - prev.InfluenceScore\n\t\tres.Creativity.Diff = current.CreativityScore - prev.CreativityScore\n\t}\n\treturn\n}", "title": "" }, { "docid": "deb3fab15ced774715655c4bc572e212", "score": "0.50676274", "text": "func (self *SentimentalAnalyzer) Score(text string) int {\n\tscore := 0\n\twordCounts := countWords(getWords(text))\n\n\tfor _, rankedWord := range self.words {\n\t\tcount := getWordCount(rankedWord.word, wordCounts)\n\t\tscore += (count * rankedWord.score)\n\t}\n\n\treturn score\n}", "title": "" }, { "docid": "f9f03edfc6a525d2de0180ac94e244e6", "score": "0.505957", "text": "func (o CVSSv3PtrOutput) BaseScore() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *CVSSv3) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.BaseScore\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "f7ecec0a492cc2b1ddd9f3708d7b635b", "score": "0.5057568", "text": "func (e *Entry) score(childPoints float64) float64 {\n\tif e == nil {\n\t\treturn 0\n\t}\n\n\treturn (float64(e.Upvotes-e.Downvotes) + childPoints + 1e-3) / math.Pow(time.Since(e.Created).Seconds()/(60*60)+2, 1.8)\n}", "title": "" }, { "docid": "69d623b8a77847754133e0f7818a4a7d", "score": "0.50465405", "text": "func (o VulnerabilityPtrOutput) CvssVersion() VulnerabilityCvssVersionPtrOutput {\n\treturn o.ApplyT(func(v *Vulnerability) *VulnerabilityCvssVersion {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CvssVersion\n\t}).(VulnerabilityCvssVersionPtrOutput)\n}", "title": "" }, { "docid": "c56deb5d51c9813d670c5bc901825c15", "score": "0.50429034", "text": "func CheckDetectionScore(detection *pb.Detection) error {\n\tif detection == nil {\n\t\treturn nil\n\t}\n\tvar score float64\n\tswitch val := detection.GetResponse().(type) {\n\tcase *pb.Detection_ImgManip:\n\t\tscore = detection.GetImgManip().GetScore()\n\tcase *pb.Detection_VidManip:\n\t\tscore = detection.GetVidManip().GetScore()\n\tcase *pb.Detection_ImgSplice:\n\t\tscore = detection.GetImgSplice().GetLink().GetScore()\n\tcase *pb.Detection_ImgCamMatch:\n\t\tscore = detection.GetImgCamMatch().GetScore()\n\tdefault:\n\t\treturn errors.Errorf(\"Unknown response type %T\", val)\n\t}\n\tif score < 0 || score > 1 {\n\t\treturn errors.Errorf(\"score %v not in [0, 1]\", score)\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "524b72b071ff021a760d196805149107", "score": "0.49955952", "text": "func (o *Employer) GetConfidenceScore() float64 {\n\tif o == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\n\treturn o.ConfidenceScore\n}", "title": "" }, { "docid": "0dffe78344a2a8bf02e43c7098abfabc", "score": "0.49930492", "text": "func (o GrafeasV1beta1VulnerabilityDetailsResponseOutput) CvssV3() CVSSResponseOutput {\n\treturn o.ApplyT(func(v GrafeasV1beta1VulnerabilityDetailsResponse) CVSSResponse { return v.CvssV3 }).(CVSSResponseOutput)\n}", "title": "" }, { "docid": "4690440f2622406a517bf5307f4b0e0e", "score": "0.4987079", "text": "func (la *LeastAllocated) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status) {\n\tnodeInfo, err := la.handle.SnapshotSharedLister().NodeInfos().Get(nodeName)\n\tif err != nil {\n\t\treturn 0, framework.NewStatus(framework.Error, fmt.Sprintf(\"getting node %q from Snapshot: %v\", nodeName, err))\n\t}\n\n\t// LeastRequestedPriorityMap does not use priority metadata, hence we pass nil here\n\ts, err := priorities.LeastRequestedPriorityMap(pod, nil, nodeInfo)\n\treturn s.Score, migration.ErrorToFrameworkStatus(err)\n}", "title": "" }, { "docid": "c127278cecdcf30863286fe1d9c2f542", "score": "0.49717116", "text": "func Score(text string) (total int) {\n\tfor _, r := range text {\n\t\tswitch unicode.ToLower(r) {\n\t\tcase 'a', 'e', 'i', 'o', 'u', 'l', 'n', 'r', 's', 't':\n\t\t\ttotal++\n\t\tcase 'd', 'g':\n\t\t\ttotal += 2\n\t\tcase 'b', 'c', 'm', 'p':\n\t\t\ttotal += 3\n\t\tcase 'f', 'h', 'v', 'w', 'y':\n\t\t\ttotal += 4\n\t\tcase 'k':\n\t\t\ttotal += 5\n\t\tcase 'j', 'x':\n\t\t\ttotal += 8\n\t\tcase 'q', 'z':\n\t\t\ttotal += 10\n\t\t}\n\t}\n\treturn total\n}", "title": "" }, { "docid": "2aa34d020c72e841c9bf99a7d2e5e214", "score": "0.49536246", "text": "func Score(input string) int {\n\ttotal := 0\n\tfor _, char := range input {\n\t\tfor key, value := range values {\n\t\t\tconvertedChar := string(char)\n\t\t\tif strings.Contains(key, strings.ToUpper(convertedChar)) {\n\t\t\t\ttotal += value\n\t\t\t}\n\t\t}\n\t}\n\n\treturn total\n}", "title": "" }, { "docid": "706c2420ca0781fe6d88b991fb549152", "score": "0.49524352", "text": "func Score(str string) (score int) {\n\tstr = strings.ToLower(str)\n\tfor _, x := range str {\n\t\tscore += dict[string(x)]\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "50f9cce896bb715a0d81e8876a77f311", "score": "0.4951424", "text": "func (o VulnerabilityOutput) CvssV2() CVSSPtrOutput {\n\treturn o.ApplyT(func(v Vulnerability) *CVSS { return v.CvssV2 }).(CVSSPtrOutput)\n}", "title": "" } ]
d02a49550556d7dba86e06c2d9e0dc82
Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. Solidity: function transfer(_to address, _value uint256) returns(bool)
[ { "docid": "e5e96a5ce05adad0ae1bc0ae9543f329", "score": "0.691623", "text": "func (_IxoERC20Token *IxoERC20TokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _IxoERC20Token.Contract.Transfer(&_IxoERC20Token.TransactOpts, _to, _value)\n}", "title": "" } ]
[ { "docid": "04d4843c5a5863d04b94ee06862dafe8", "score": "0.7595012", "text": "func (_Usdc *UsdcTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Usdc.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "521881bd2d1fd53441f69e3d6022bfff", "score": "0.7520903", "text": "func (_StableToken *StableTokenTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _StableToken.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "29a52a86043aa8b1bd21728856bfb1fb", "score": "0.7518809", "text": "func (_Mpe *MpeTransactor) Transfer(opts *bind.TransactOpts, receiver common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Mpe.contract.Transact(opts, \"transfer\", receiver, value)\n}", "title": "" }, { "docid": "4581c8fe2df83b7c43fa6555dad740cc", "score": "0.75009114", "text": "func (_BurnableToken *BurnableTokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "70c85e3982ee52bddf0cef10d94fea4c", "score": "0.74723226", "text": "func (_Pancake *PancakeTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Pancake.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "42705d4c7e26f2704a33ae454ab20e08", "score": "0.74345213", "text": "func (_Bt *BtTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Bt.Contract.Transfer(&_Bt.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "beef4c6f64cb4ec7ebeb813b68d5f64d", "score": "0.7429388", "text": "func (_Swap *SwapTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Swap.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "450ca716c59f653d92c4923b20c9656d", "score": "0.7426068", "text": "func (wallet *EthereumWallet) Transfer(to string, value *big.Int, spendAll bool, fee big.Int) (common.Hash, error) {\n\ttoAddress := common.HexToAddress(to)\n\treturn wallet.client.Transfer(wallet.account, toAddress, value, spendAll, fee)\n}", "title": "" }, { "docid": "d5f1ce9ffb04b427ed618fab85b4d773", "score": "0.7424586", "text": "func (_Usdc *UsdcTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Usdc.Contract.Transfer(&_Usdc.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "1fe45b08501e88e42f0f6cde4287d5db", "score": "0.7404034", "text": "func (t *Transaction) Transfer(to string, value int64) *Transaction {\n\tt.value = value\n\tt.to = chPrefix(to)\n\tt.isValue = true\n\treturn t\n}", "title": "" }, { "docid": "ec4aff6832958ad073a805257b7bcb3b", "score": "0.7403248", "text": "func (_Mpe *MpeTransactorSession) Transfer(receiver common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Mpe.Contract.Transfer(&_Mpe.TransactOpts, receiver, value)\n}", "title": "" }, { "docid": "2cd8c35eed68cf391c19dbb49120156e", "score": "0.7398825", "text": "func (_DJTERC721Implementation *DJTERC721ImplementationTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _tokenId *big.Int) (*types.Transaction, error) {\n\treturn _DJTERC721Implementation.contract.Transact(opts, \"transfer\", _to, _tokenId)\n}", "title": "" }, { "docid": "7800723d94b0bebf860147f924a36e07", "score": "0.739804", "text": "func (_TobaToken *TobaTokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _TobaToken.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "55f3b666ddabac080c13cd18e31d35dd", "score": "0.7395926", "text": "func (_Swap *SwapTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Swap.Contract.Transfer(&_Swap.TransactOpts, to, value)\n}", "title": "" }, { "docid": "ed98443583344a03637b527596a9a87e", "score": "0.7390111", "text": "func (_Pancake *PancakeTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Pancake.Contract.Transfer(&_Pancake.TransactOpts, to, value)\n}", "title": "" }, { "docid": "56c44beeb3ad75c07964aec76b2790e0", "score": "0.7386847", "text": "func (_BurnableToken *BurnableTokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.Contract.Transfer(&_BurnableToken.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "b57e14ead085607ade545c437234bafa", "score": "0.73807937", "text": "func (_Bt *BtTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Bt.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "fc7ee6c2c196d3ab76f55398d47e0544", "score": "0.7374147", "text": "func (_IWETH *IWETHTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _IWETH.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "4d03b8319c0638fc8c7d7e26925bb03b", "score": "0.7369236", "text": "func (_Usdc *UsdcSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Usdc.Contract.Transfer(&_Usdc.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "a5d2b0005cb980f234ac59406216820d", "score": "0.7352339", "text": "func (_Bt *BtSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _Bt.Contract.Transfer(&_Bt.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "9ee673f55be4e85d057a052a0d950565", "score": "0.73509693", "text": "func (_Swap *SwapSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Swap.Contract.Transfer(&_Swap.TransactOpts, to, value)\n}", "title": "" }, { "docid": "301bae1734bfd3b8fa002fa5b82afecc", "score": "0.73444104", "text": "func (_StableToken *StableTokenTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _StableToken.Contract.Transfer(&_StableToken.TransactOpts, to, value)\n}", "title": "" }, { "docid": "93ff0da0cb9ac86e73ab213b1970231d", "score": "0.7344383", "text": "func (_Pancake *PancakeSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Pancake.Contract.Transfer(&_Pancake.TransactOpts, to, value)\n}", "title": "" }, { "docid": "2f8edef2db5659ac503e39d955e12a9d", "score": "0.7344239", "text": "func (_IToken *ITokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _IToken.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "af424286deca3366f16ff9a03bd0d37f", "score": "0.7339777", "text": "func (_Mpe *MpeSession) Transfer(receiver common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Mpe.Contract.Transfer(&_Mpe.TransactOpts, receiver, value)\n}", "title": "" }, { "docid": "61448241e59346bdb6d29532c41ad4f9", "score": "0.7336224", "text": "func (_BurnableToken *BurnableTokenSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _BurnableToken.Contract.Transfer(&_BurnableToken.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "bf5cfa0cf88bce2b525ff8271e18f001", "score": "0.7332537", "text": "func (_Epk *EpkTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Epk.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "f80d69db542167c7945ebb2d95815c23", "score": "0.7331207", "text": "func (_ProjectWallet *ProjectWalletTransactor) Transfer(opts *bind.TransactOpts, _receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _ProjectWallet.contract.Transact(opts, \"transfer\", _receiver, _amt)\n}", "title": "" }, { "docid": "8fd764e8a1f51afc80f57ab427ec97d5", "score": "0.7328998", "text": "func (_BasicProjectWallet *BasicProjectWalletTransactor) Transfer(opts *bind.TransactOpts, _receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _BasicProjectWallet.contract.Transact(opts, \"transfer\", _receiver, _amt)\n}", "title": "" }, { "docid": "10339693090cbe06ad3d2aa857ae5588", "score": "0.73168993", "text": "func (_ERC20Mintable *ERC20MintableTransactorSession) Transfer(to common.Address, value *big.Int) (*ethTypes.Transaction, error) {\n\treturn _ERC20Mintable.Contract.Transfer(&_ERC20Mintable.TransactOpts, to, value)\n}", "title": "" }, { "docid": "6c450806154d22fd68cbaaf638924bcf", "score": "0.7316123", "text": "func (_TobaToken *TobaTokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _TobaToken.Contract.Transfer(&_TobaToken.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "9aa44357f303c2f2759b48d4947a4232", "score": "0.7306649", "text": "func (_ERC20 *ERC20TransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.Contract.Transfer(&_ERC20.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "cdcf4203cd6537771b06eb3d2d74e88f", "score": "0.72999585", "text": "func (_TestERC20 *TestERC20Session) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _TestERC20.Contract.Transfer(&_TestERC20.TransactOpts, to, value)\n}", "title": "" }, { "docid": "d87e7ec51095e79a1fb8f6c0e99d0880", "score": "0.72999424", "text": "func (_ERC20Mintable *ERC20MintableSession) Transfer(to common.Address, value *big.Int) (*ethTypes.Transaction, error) {\n\treturn _ERC20Mintable.Contract.Transfer(&_ERC20Mintable.TransactOpts, to, value)\n}", "title": "" }, { "docid": "589950a256b499258bfc726b86092a94", "score": "0.7294991", "text": "func (_Control *ControlTransactorSession) Transfer(owner string, to string, value *big.Int) (*types.RawTransaction, error) {\n\treturn _Control.Contract.Transfer(&_Control.TransactOpts, owner, to, value)\n}", "title": "" }, { "docid": "61dc2d3c9baf724a9a6ab0c37b0965e0", "score": "0.7290522", "text": "func (acc *account) Transfer(ctx context.Context, to btctypes.Address, value btctypes.Amount, speed types.TxSpeed, all bool) (types.TxHash, error) {\n\tutxos, err := acc.UTXOs(ctx)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error fetching utxos: %v\", err)\n\t}\n\n\tfee := acc.Client.SuggestGasPrice(context.Background(), speed, acc.Client.EstimateTxSize(len(utxos), 2))\n\tif all {\n\t\tvalue = utxos.Sum() - fee\n\t}\n\n\t// Check if we have enough funds\n\tbalance := utxos.Sum()\n\tif balance < value+fee {\n\t\treturn \"\", ErrInsufficientBalance(fmt.Sprintf(\"%v\", value), fmt.Sprintf(\"%v\", balance))\n\t}\n\n\t// todo : select some utxos from all the utxos we have.\n\ttx, err := acc.Client.BuildUnsignedTx(utxos, btctypes.Recipients{{Address: to, Amount: value}}, acc.Address(), fee)\n\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error building unsigned tx: %v\", err)\n\t}\n\n\tif err := tx.Sign(acc.key); err != nil {\n\t\treturn \"\", fmt.Errorf(\"error signing tx: %v\", err)\n\t}\n\n\t// Submit the signed tx\n\treturn acc.Client.SubmitSignedTx(ctx, tx)\n}", "title": "" }, { "docid": "ca6ef654b7872b8c1c80a7e121f8f8d1", "score": "0.7289466", "text": "func (_IWETH *IWETHTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _IWETH.Contract.Transfer(&_IWETH.TransactOpts, to, value)\n}", "title": "" }, { "docid": "d1e72d4b1db3c8e646f38d34987c571a", "score": "0.72891843", "text": "func (_TestERC20 *TestERC20TransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _TestERC20.Contract.Transfer(&_TestERC20.TransactOpts, to, value)\n}", "title": "" }, { "docid": "b6d11c5e1bd9ec4af4519ecb8ea1e1db", "score": "0.7277984", "text": "func (_ERC20 *ERC20Session) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.Contract.Transfer(&_ERC20.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "c1dc758b46a9f0f1fd2c24d6cc8d03ee", "score": "0.72554934", "text": "func (_IToken *ITokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _IToken.Contract.Transfer(&_IToken.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "a86cecfca2d91ce33d3de2b789a76f7a", "score": "0.72544056", "text": "func (_StableToken *StableTokenSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _StableToken.Contract.Transfer(&_StableToken.TransactOpts, to, value)\n}", "title": "" }, { "docid": "cbe4e969c568f87dcb4561cb02936327", "score": "0.7251899", "text": "func (_GoldToken *GoldTokenTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _GoldToken.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "dc2fea3f94f5a1720e084a08b2077903", "score": "0.72516125", "text": "func (_Control *ControlTransactor) Transfer(opts *bind.TransactOpts, owner string, to string, value *big.Int) (*types.RawTransaction, error) {\n\treturn _Control.contract.Transact(opts, \"transfer\", owner, to, value)\n}", "title": "" }, { "docid": "ba37374666dc4e8b4902aac9b47c8cfe", "score": "0.724656", "text": "func (_Epk *EpkTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Epk.Contract.Transfer(&_Epk.TransactOpts, to, value)\n}", "title": "" }, { "docid": "0655943a40747e3c1d619f24fc75638a", "score": "0.72450185", "text": "func (_TNT *TNTTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _TNT.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "7bfa2eb284b8d089f2febe404ceaee9a", "score": "0.72439176", "text": "func (_ERC20Mintable *ERC20MintableTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*ethTypes.Transaction, error) {\n\treturn _ERC20Mintable.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "e2c616fe20f1956e947ce4dfb0d2402d", "score": "0.7242284", "text": "func (_TobaToken *TobaTokenSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _TobaToken.Contract.Transfer(&_TobaToken.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "4ed4a56e0e7683badcb8c0c88699d624", "score": "0.72414947", "text": "func (_IWETH *IWETHSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _IWETH.Contract.Transfer(&_IWETH.TransactOpts, to, value)\n}", "title": "" }, { "docid": "5ee4150e208d0f5bd173bad5f9d0bb2e", "score": "0.72370064", "text": "func (_ERC20 *ERC20Transactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "f79db383a936d74f35f0844e8d607b94", "score": "0.7229426", "text": "func (_ImoDollar *ImoDollarTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ImoDollar.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "8e8152786f5032a2f64bfa120d45bbb1", "score": "0.7219358", "text": "func (_ERC827 *ERC827Transactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int, _data []byte) (*types.Transaction, error) {\n\treturn _ERC827.contract.Transact(opts, \"transfer\", _to, _value, _data)\n}", "title": "" }, { "docid": "bcd5a783f60f627d91a6652ed85d1936", "score": "0.7219263", "text": "func (b *client) Transfer(to common.Address, from *bind.TransactOpts, value *big.Int) error {\n\ttransactor := &bind.TransactOpts{\n\t\tFrom: from.From,\n\t\tNonce: from.Nonce,\n\t\tSigner: from.Signer,\n\t\tValue: value,\n\t\tGasPrice: from.GasPrice,\n\t\tGasLimit: 30000,\n\t\tContext: from.Context,\n\t}\n\n\t// Why is there no ethclient.Transfer?\n\tbound := bind.NewBoundContract(to, abi.ABI{}, nil, b.client, nil)\n\ttx, err := bound.Transfer(transactor)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = b.WaitTillMined(context.Background(), tx)\n\treturn err\n}", "title": "" }, { "docid": "8b1b1085aadba3d82b4c030363e206f2", "score": "0.7212394", "text": "func (_BasicProjectWallet *BasicProjectWalletTransactorSession) Transfer(_receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _BasicProjectWallet.Contract.Transfer(&_BasicProjectWallet.TransactOpts, _receiver, _amt)\n}", "title": "" }, { "docid": "c791e8a7c5d4bea0e286a1f9af9ae08b", "score": "0.7202297", "text": "func (_ProjectWallet *ProjectWalletTransactorSession) Transfer(_receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _ProjectWallet.Contract.Transfer(&_ProjectWallet.TransactOpts, _receiver, _amt)\n}", "title": "" }, { "docid": "aae284b2471dd84541d7b61da0cf7ce0", "score": "0.71755767", "text": "func (_Control *ControlSession) Transfer(owner string, to string, value *big.Int) (*types.RawTransaction, error) {\n\treturn _Control.Contract.Transfer(&_Control.TransactOpts, owner, to, value)\n}", "title": "" }, { "docid": "a265285e01401ded2f18fb429c34bb4f", "score": "0.7174344", "text": "func (_Token *TokenTransactor) Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Token.contract.Transact(opts, \"transfer\", to, amount)\n}", "title": "" }, { "docid": "6adec733a4a418a5c313959d36df003f", "score": "0.7174266", "text": "func (_MarketToken *MarketTokenTransactor) Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _MarketToken.contract.Transact(opts, \"transfer\", to, amount)\n}", "title": "" }, { "docid": "60b7707724894e1fb3f93988ba2c4b82", "score": "0.7170852", "text": "func (_BasicProjectWallet *BasicProjectWalletSession) Transfer(_receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _BasicProjectWallet.Contract.Transfer(&_BasicProjectWallet.TransactOpts, _receiver, _amt)\n}", "title": "" }, { "docid": "e2a4d3885d15c4a074f0c24c40a01510", "score": "0.7167974", "text": "func (_DJTERC721Implementation *DJTERC721ImplementationTransactorSession) Transfer(_to common.Address, _tokenId *big.Int) (*types.Transaction, error) {\n\treturn _DJTERC721Implementation.Contract.Transfer(&_DJTERC721Implementation.TransactOpts, _to, _tokenId)\n}", "title": "" }, { "docid": "f49197f040d7eb1602ffb8b1ab58a20c", "score": "0.71676445", "text": "func (_Eth *EthTransactor) Transfer(opts *bind.TransactOpts, to common.Address, tokens *big.Int) (*types.Transaction, error) {\n\treturn _Eth.contract.Transact(opts, \"transfer\", to, tokens)\n}", "title": "" }, { "docid": "495c967e12dcaf2249a0c445c2a0d606", "score": "0.7164037", "text": "func (_TNT *TNTTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _TNT.Contract.Transfer(&_TNT.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "361eb1cee0b3a159b08c1db3c477eb5a", "score": "0.7158327", "text": "func (api *API) Transfer(ctx context.Context, sender, receiver, amount, memo, privKeyHex string) (*model.BroadcastResponse, errors.Error) {\n\tresp, _, err := api.GuaranteeBroadcast(ctx, sender, func(seq uint64) ([]byte, errors.Error) {\n\t\treturn api.MakeTransferMsg(sender, receiver, amount, memo, privKeyHex, seq)\n\t})\n\treturn resp, err\n}", "title": "" }, { "docid": "1b33a118f8141f02bb046740d39ce14f", "score": "0.7144685", "text": "func (_MarketToken *MarketTokenTransactorSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _MarketToken.Contract.Transfer(&_MarketToken.TransactOpts, to, amount)\n}", "title": "" }, { "docid": "308f3338659c760e53f3a9c33a22e119", "score": "0.7144261", "text": "func (_Epk *EpkSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _Epk.Contract.Transfer(&_Epk.TransactOpts, to, value)\n}", "title": "" }, { "docid": "cdbdb69375b72a152272a6c50095865b", "score": "0.71386254", "text": "func (_ProjectWallet *ProjectWalletSession) Transfer(_receiver common.Address, _amt *big.Int) (*types.Transaction, error) {\n\treturn _ProjectWallet.Contract.Transfer(&_ProjectWallet.TransactOpts, _receiver, _amt)\n}", "title": "" }, { "docid": "b26607f8384f7a27435712a773ea6577", "score": "0.7134679", "text": "func (_DJTERC721Implementation *DJTERC721ImplementationSession) Transfer(_to common.Address, _tokenId *big.Int) (*types.Transaction, error) {\n\treturn _DJTERC721Implementation.Contract.Transfer(&_DJTERC721Implementation.TransactOpts, _to, _tokenId)\n}", "title": "" }, { "docid": "d2a36102ff5786df7c9e6c9eda2f603e", "score": "0.7128143", "text": "func (_IToken *ITokenSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _IToken.Contract.Transfer(&_IToken.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "088b4d05a12c68ae161ad85837a98566", "score": "0.71192443", "text": "func (_GoldToken *GoldTokenTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _GoldToken.Contract.Transfer(&_GoldToken.TransactOpts, to, value)\n}", "title": "" }, { "docid": "19522f98fd6597f3f64b2eaf52836f88", "score": "0.71049476", "text": "func (_TestERC20 *TestERC20Transactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _TestERC20.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "2974b6383e3861f2d3f38a4cadb9f499", "score": "0.7088746", "text": "func (_ImoDollar *ImoDollarTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ImoDollar.Contract.Transfer(&_ImoDollar.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "3ec95df3ce695fef0d76212bafb356ef", "score": "0.7088367", "text": "func _transfer(from, to []byte, value uint64) {\n\taddress.ValidateAddress(from)\n\taddress.ValidateAddress(to)\n\n\tfromInitialBalance := readAccountBalance(from)\n\tnewFromBalance := safeuint64.Sub(fromInitialBalance, value)\n\twriteAccountBalance(from, newFromBalance)\n\n\ttoInitialBalance := readAccountBalance(to)\n\tnewToBalance := safeuint64.Add(toInitialBalance, value)\n\twriteAccountBalance(to, newToBalance)\n\tevents.EmitEvent(Transfer, from, to, value)\n}", "title": "" }, { "docid": "a97c4724b55afb849d22e47dc509ad99", "score": "0.7085476", "text": "func (_IERC20 *IERC20TransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _IERC20.Contract.Transfer(&_IERC20.TransactOpts, to, value)\n}", "title": "" }, { "docid": "68c3e86aa784a7019792de05eb55df87", "score": "0.7083919", "text": "func (_ERC827 *ERC827Session) Transfer(_to common.Address, _value *big.Int, _data []byte) (*types.Transaction, error) {\n\treturn _ERC827.Contract.Transfer(&_ERC827.TransactOpts, _to, _value, _data)\n}", "title": "" }, { "docid": "19103a7e03b5c27b90f93f419ad53cc8", "score": "0.70697856", "text": "func (_ImoDollar *ImoDollarSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _ImoDollar.Contract.Transfer(&_ImoDollar.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "25653a831114e9019f0f9265a936b342", "score": "0.7052178", "text": "func (_ERC827 *ERC827TransactorSession) Transfer(_to common.Address, _value *big.Int, _data []byte) (*types.Transaction, error) {\n\treturn _ERC827.Contract.Transfer(&_ERC827.TransactOpts, _to, _value, _data)\n}", "title": "" }, { "docid": "4983f3516a2d7968f4d83d4665f38461", "score": "0.70499015", "text": "func (_MarketToken *MarketTokenSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _MarketToken.Contract.Transfer(&_MarketToken.TransactOpts, to, amount)\n}", "title": "" }, { "docid": "56705e1c8732fd05ad010406dc919464", "score": "0.7048587", "text": "func (etcd *Etcd) Transfer(from string, to string, value string) (success bool, err error) {\n\tvar txnResponse *clientv3.TxnResponse\n\n\tctx, cancelFunc := context.WithTimeout(context.Background(), etcd.timeout)\n\tdefer cancelFunc()\n\n\ttxn := etcd.client.Txn(ctx)\n\ttxnResponse, err = txn.If(\n\t\tclientv3.Compare(clientv3.Value(from), \"=\", value)).\n\t\tThen(\n\t\t\tclientv3.OpDelete(from),\n\t\t\tclientv3.OpPut(to, value),\n\t\t).Commit()\n\n\tif err != nil {\n\t\treturn\n\t}\n\tsuccess = txnResponse.Succeeded\n\treturn\n}", "title": "" }, { "docid": "cf02748d8d8bebfb219fee5a9870429c", "score": "0.7042724", "text": "func (_GoldToken *GoldTokenSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _GoldToken.Contract.Transfer(&_GoldToken.TransactOpts, to, value)\n}", "title": "" }, { "docid": "32ad5df2566ffa485d8e93d3dedab8cf", "score": "0.7041561", "text": "func (_Eth *EthTransactorSession) Transfer(to common.Address, tokens *big.Int) (*types.Transaction, error) {\n\treturn _Eth.Contract.Transfer(&_Eth.TransactOpts, to, tokens)\n}", "title": "" }, { "docid": "68f8d0a193d1ded6e98a2802d2c9e452", "score": "0.70329624", "text": "func (_IERC20 *IERC20Session) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _IERC20.Contract.Transfer(&_IERC20.TransactOpts, to, value)\n}", "title": "" }, { "docid": "97d996166573a45c692b0540e317b1f1", "score": "0.7025548", "text": "func (_IERC20 *IERC20Transactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _IERC20.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "c5a3197d2b76ea5bf6a05844302f06d1", "score": "0.6998995", "text": "func (_MIPS *MIPSTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _MIPS.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "69709e44731a55d2f413276c0677bb03", "score": "0.69987357", "text": "func (_DIAToken *DIATokenTransactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _DIAToken.contract.Transact(opts, \"transfer\", recipient, amount)\n}", "title": "" }, { "docid": "129a4bbd846b258d5632cd6e5d539662", "score": "0.6989359", "text": "func (_TNT *TNTSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _TNT.Contract.Transfer(&_TNT.TransactOpts, _to, _value)\n}", "title": "" }, { "docid": "7e0cb5a0cf388d63a988a1f13417ed78", "score": "0.6979251", "text": "func (_CBAT *CBATTransactor) Transfer(opts *bind.TransactOpts, dst common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _CBAT.contract.Transact(opts, \"transfer\", dst, amount)\n}", "title": "" }, { "docid": "98d39fa5f3661840ae039a5a8cb88b32", "score": "0.69731444", "text": "func (_Eth *EthSession) Transfer(to common.Address, tokens *big.Int) (*types.Transaction, error) {\n\treturn _Eth.Contract.Transfer(&_Eth.TransactOpts, to, tokens)\n}", "title": "" }, { "docid": "451632174eb0655855a5fea112b6c66c", "score": "0.69488895", "text": "func (_ERC20Burnable *ERC20BurnableTransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Burnable.Contract.Transfer(&_ERC20Burnable.TransactOpts, recipient, amount)\n}", "title": "" }, { "docid": "f6ffa5168f65475dfe8129ea84bff7b3", "score": "0.6948371", "text": "func (_IxoERC20Token *IxoERC20TokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _IxoERC20Token.contract.Transact(opts, \"transfer\", _to, _value)\n}", "title": "" }, { "docid": "80c08ce05b04e7326f3b2eac50640ae2", "score": "0.6935548", "text": "func (s *SmartContract) Transfer(ctx contractapi.TransactionContextInterface, receiver cid.ClientIdentity, numTokens int) error {\n\ttoken, err := s.getToken(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsender := ctx.GetClientIdentity()\n\tif numTokens > token.Balances[sender] {\n\t\treturn fmt.Errorf(\"Sender does not have enough balance to transfer desired amount\")\n\t}\n\ttoken.Balances[sender] = token.Balances[sender] - numTokens\n\ttoken.Balances[receiver] = token.Balances[receiver] + numTokens\n\ttokenBytes, err := json.Marshal(token)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error converting Token to bytes: %s\", err.Error())\n\t}\n\terr = ctx.GetStub().PutState(tokenKey, tokenBytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error writing Token bytes to state: %s\", err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d233ac5a74c3b932cd760ced7e8b0cd1", "score": "0.6934599", "text": "func (_BridgeToken *BridgeTokenTransactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _BridgeToken.contract.Transact(opts, \"transfer\", recipient, amount)\n}", "title": "" }, { "docid": "30ec054a94c169f9438196dcdf03dee2", "score": "0.69279444", "text": "func TransferTo(value *big.Int, toAddr, eth string) error {\n\n\tclient, err := ethclient.Dial(eth)\n\tif err != nil {\n\t\tfmt.Println(\"rpc.Dial err\", err)\n\t\tlog.Fatal(err)\n\t}\n\n\t//account0 cb61e1519b560d994e4361b34c181656d916beb68513cff06c37eb7d258bf93d\n\t//account2 920ffe90f05741f3b27aeec8a843f870d51b2a2d30d65afcb7390c0851af39f3\n\tprivateKey, err := crypto.HexToECDSA(\"cb61e1519b560d994e4361b34c181656d916beb68513cff06c37eb7d258bf93d\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tpublicKey := privateKey.Public()\n\tpublicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey)\n\tif !ok {\n\t\tlog.Fatal(\"error casting public key to ECDSA\")\n\t}\n\n\tfromAddress := crypto.PubkeyToAddress(*publicKeyECDSA)\n\tfmt.Println(\"from addr:\", fromAddress.String())\n\n\tgasLimit := uint64(23000) // in units\n\tgasPrice := big.NewInt(30000000000) // in wei (30 gwei)\n\n\ttoAddress := common.HexToAddress(toAddr[2:])\n\tlog.Println(\"toAddress: \", toAddress)\n\n\tvar chainID *big.Int\n\tnetworkID, err := client.NetworkID(context.Background())\n\tif err != nil {\n\t\tfmt.Println(\"client.NetworkID error,use the default chainID\")\n\t\tchainID = big.NewInt(666)\n\t}\n\tlog.Println(\"networkID: \", networkID)\n\n\tlog.Println(\"constructing and sending tx..\")\n\n\tnonce, err := client.PendingNonceAt(context.Background(), fromAddress)\n\tif err != nil {\n\t\treturn err\n\t\t//continue\n\t}\n\n\tgasPrice, err = client.SuggestGasPrice(context.Background())\n\tif err != nil {\n\t\treturn err\n\t\t//continue\n\t}\n\n\t// construct tx\n\ttx := types.NewTransaction(nonce, toAddress, value, gasLimit, gasPrice, nil)\n\n\t// sign tx\n\t//log.Println(\"chainID: \", chainID)\n\tsignedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainID), privateKey)\n\tif err != nil {\n\t\tlog.Println(\"sign transaction failed\")\n\t\treturn err\n\t\t//continue\n\t}\n\n\t// send tx\n\terr = client.SendTransaction(context.Background(), signedTx)\n\tif err != nil {\n\t\tlog.Println(\"send transcation failed:\", err)\n\t\treturn err\n\t\t//continue\n\t}\n\tlog.Println(\"send transaction success\")\n\t/*\n\t\tlog.Println(\"quering balance ...\")\n\n\t\t//balance, _ := QueryBalance(addr, eth)\n\t\tbalance, err := QueryBalance(addr)\n\t\tif err != nil {\n\t\t\tlog.Println(\"query balance error\")\n\t\t} else {\n\t\t\tlog.Println(\"query balance success\")\n\t\t}\n\n\t\tlog.Println(\"balance:\", balance)\n\t\tlog.Println(\"value\", value)\n\n\t\tlog.Println(addr, \"'s Balance now:\", balance.String())\n\t*/\n\n\t// wait 200 seconds?\n\t/*\n\t\tfmt.Println(addr, \"'s Balance now:\", balance.String(), \", waiting for transfer success\")\n\t\tt := 20 * (qCount + 1)\n\t\ttime.Sleep(time.Duration(t) * time.Second)\n\t*/\n\n\tlog.Println(\"transfer \", value.String(), \"wei to\", toAddr, \"complete\")\n\treturn nil\n}", "title": "" }, { "docid": "c1e317652a50e9e982ea94d8e2388d99", "score": "0.6918353", "text": "func (_DIAToken *DIATokenTransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _DIAToken.Contract.Transfer(&_DIAToken.TransactOpts, recipient, amount)\n}", "title": "" }, { "docid": "291bcb4432a922069efdeff88a82a954", "score": "0.68949324", "text": "func (_ERC20Burnable *ERC20BurnableSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Burnable.Contract.Transfer(&_ERC20Burnable.TransactOpts, recipient, amount)\n}", "title": "" }, { "docid": "80cc7bba3bded9bc3d35e09414680c44", "score": "0.68940306", "text": "func (_DIAToken *DIATokenSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _DIAToken.Contract.Transfer(&_DIAToken.TransactOpts, recipient, amount)\n}", "title": "" }, { "docid": "9bf8124d1178ad99c102ebbfbae7591b", "score": "0.68774223", "text": "func (_BridgeToken *BridgeTokenTransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _BridgeToken.Contract.Transfer(&_BridgeToken.TransactOpts, recipient, amount)\n}", "title": "" }, { "docid": "2a9243f54e83d048862eae4707eddeea", "score": "0.68720156", "text": "func (_CBAT *CBATTransactorSession) Transfer(dst common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _CBAT.Contract.Transfer(&_CBAT.TransactOpts, dst, amount)\n}", "title": "" }, { "docid": "8c2bfa56ab4e39a0cbdd9fbf1c7c2fcc", "score": "0.6866892", "text": "func (_ImmutableAPI *ImmutableAPITransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ImmutableAPI.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "1ea0aa0f0877aa96c08b6c68ad6bf822", "score": "0.6860547", "text": "func (_MIPS *MIPSRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _MIPS.Contract.MIPSTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3fe24a7c7f8b1d04098f61e4b868a7f6", "score": "0.6857243", "text": "func Transfer(db evm.StateDB, sender, recipient common.Address, amount *big.Int) {\n\tdb.SubBalance(sender, amount)\n\tdb.AddBalance(recipient, amount)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6855673", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" } ]
122ed200fcaf366d30465a9e05151f77
MaxAllocated reports the maximum amount of allocated memory at any point in the query.
[ { "docid": "64a78fadd91247c40609bb172b461d0d", "score": "0.7965823", "text": "func (a *Allocator) MaxAllocated() int64 {\n\treturn atomic.LoadInt64(&a.maxAllocated)\n}", "title": "" } ]
[ { "docid": "d8c4b324f34d454a4b207e4f567d64d1", "score": "0.7191319", "text": "func (c *Cluster) MaxAlloc() reflow.Resources {\n\treturn maxResources\n}", "title": "" }, { "docid": "df843a73d029a020a75079aab2069553", "score": "0.65605295", "text": "func getMaxAllocatableMemory(ctx context.Context, clientset v1.CoreV1Interface, numNodes int32) (*models.MaxAllocatableMemResponse, error) {\n\tif numNodes == 0 {\n\t\treturn nil, errors.New(\"error NumNodes must be greated than 0\")\n\t}\n\n\t// get all nodes from cluster\n\tnodes, err := clientset.Nodes().List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tavailableMemSizes := []int64{}\nOUTER:\n\tfor _, n := range nodes.Items {\n\t\t// Don't consider node if it has a NoSchedule or NoExecute Taint\n\t\tfor _, t := range n.Spec.Taints {\n\t\t\tswitch t.Effect {\n\t\t\tcase corev1.TaintEffectNoSchedule:\n\t\t\t\tcontinue OUTER\n\t\t\tcase corev1.TaintEffectNoExecute:\n\t\t\t\tcontinue OUTER\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif quantity, ok := n.Status.Allocatable[corev1.ResourceMemory]; ok {\n\t\t\tavailableMemSizes = append(availableMemSizes, quantity.Value())\n\t\t}\n\t}\n\n\tmaxAllocatableMemory := getMaxClusterMemory(numNodes, availableMemSizes)\n\n\tres := &models.MaxAllocatableMemResponse{\n\t\tMaxMemory: maxAllocatableMemory,\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "68ac0a989f75a66e6422950c7fafeb87", "score": "0.645662", "text": "func (h *Host) MaxMemory() (int, error) {\n\treturn h.intAttribute(\"HOST_SHARE/MAX_MEM\")\n}", "title": "" }, { "docid": "66d49170ef509db59938a197cde85e96", "score": "0.6095647", "text": "func (o OceanAutoscalerResourceLimitsOutput) MaxMemoryGib() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v OceanAutoscalerResourceLimits) *int { return v.MaxMemoryGib }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "c44c4bcdd145b647aa1856da83d52064", "score": "0.6012795", "text": "func (mig *gceMig) MaxSize() int {\n\treturn mig.maxSize\n}", "title": "" }, { "docid": "4f0a5fb508db4b205613da86cced6239", "score": "0.60121435", "text": "func (o LookupInstanceResultOutput) MaxCapacityGb() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) string { return v.MaxCapacityGb }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a48cab4be518f0ce6e74a8a7355835dc", "score": "0.60080814", "text": "func (o OceanAutoscalerResourceLimitsPtrOutput) MaxMemoryGib() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *OceanAutoscalerResourceLimits) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxMemoryGib\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "47db9efaf0f62c4436cbd23be5ebe025", "score": "0.59511346", "text": "func (r *sharedResource) MaxCapacity() uint32 {\n\tsharedCapacity := atomic.LoadUint32(&r.sharedCapacity)\n\tmax := r.factor * maxPartitions\n\tif sharedCapacity > max {\n\t\tsharedCapacity = max\n\t}\n\treturn sharedCapacity + atomic.LoadUint32(&r.reservedCapacity)\n}", "title": "" }, { "docid": "130067fff762df1a299ce80c9796091c", "score": "0.5943021", "text": "func (o FleetLocationCapacityOutput) MaxSize() pulumi.IntOutput {\n\treturn o.ApplyT(func(v FleetLocationCapacity) int { return v.MaxSize }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "8c31286bc2a4dfa03c9e5de986667a1e", "score": "0.587157", "text": "func (o VappContainerOutput) MemoryLimit() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *VappContainer) pulumi.IntPtrOutput { return v.MemoryLimit }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "a20cb39b85480a4fe171b962cca4482f", "score": "0.58634835", "text": "func (as *AgentPool) MaxSize() int {\n\treturn as.maxSize\n}", "title": "" }, { "docid": "3f3bcacd4207b6b9ff82351a9ee88aff", "score": "0.5847552", "text": "func (p *Pool) MaximumCapacity() int { return cap(p.getConns()) }", "title": "" }, { "docid": "c5a7e487dfe93ac2e6ba5964eab06f7d", "score": "0.5836141", "text": "func (o FleetLocationCapacityPtrOutput) MaxSize() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *FleetLocationCapacity) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.MaxSize\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "99402c82c730257da1d0f13a8878fe61", "score": "0.58112437", "text": "func (v *Vector) Allocated() int {\n\treturn cap(v.data) + cap(v.area)\n}", "title": "" }, { "docid": "13efbf851cef1e8e9d270374621e7a26", "score": "0.5800762", "text": "func (r *Runtime) GetAllocatedMemoryLength() int {\n\tlength := C.get_allocated_memory_length(r.Ptr())\n\treturn int(length)\n}", "title": "" }, { "docid": "5fcaf2541633f6063d9f40a2117a3484", "score": "0.579675", "text": "func (o OceanFiltersPtrOutput) MaxMemoryGib() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *OceanFilters) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxMemoryGib\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "a1db980034594174f4d8c5827d8f364e", "score": "0.5767931", "text": "func (mm *MemoryManager) MemoryLimit() uint64 {\n\treturn mm.limit\n}", "title": "" }, { "docid": "b6c859d549644495f89339884602081b", "score": "0.57642174", "text": "func (mm *MemoryManager) expandMaxMemory(amount uint64) {\n\n\tmm.lock.Lock()\n\tdefer mm.lock.Unlock()\n\n\t// 1. change max memory available\n\tamountIncreased := amount - mm.limit\n\tmm.limit = amount\n\n\t// 2. check and handle memory underflow\n\tif mm.underflow > 0 {\n\t\tif amountIncreased >= mm.underflow {\n\t\t\tamountIncreased -= mm.underflow\n\t\t\tmm.underflow = 0\n\t\t} else {\n\t\t\tmm.underflow -= amountIncreased\n\t\t\tamountIncreased = 0\n\t\t}\n\t}\n\n\t// 3. increase the available memory\n\tmm.available += amountIncreased\n\n\t// 4. check waitlist\n\tmm.waitlistCheck()\n}", "title": "" }, { "docid": "c174f9c02301e489b934418a6661ac09", "score": "0.5754613", "text": "func (o OceanFiltersOutput) MaxMemoryGib() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v OceanFilters) *float64 { return v.MaxMemoryGib }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "fe1287410b485586dc16a17e73194873", "score": "0.57496", "text": "func (c *cgroupV2) MemoryLimit() (uint64, error) {\n\tlimStr, err := getValue(c.MakePath(\"\"), \"memory.max\")\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tlimStr = strings.TrimSpace(limStr)\n\tif limStr == \"max\" {\n\t\treturn math.MaxUint64, nil\n\t}\n\treturn strconv.ParseUint(limStr, 10, 64)\n}", "title": "" }, { "docid": "ee5dc965199b048c9c5e6f63dd13ed81", "score": "0.5733749", "text": "func (o LookupScheduledActionResultOutput) MaxSize() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v LookupScheduledActionResult) *int { return v.MaxSize }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "59ee2c0ee2486ac08773587068e21f42", "score": "0.57141334", "text": "func (o LookupFunctionResultOutput) AvailableMemoryMb() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupFunctionResult) int { return v.AvailableMemoryMb }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "59ee2c0ee2486ac08773587068e21f42", "score": "0.57141334", "text": "func (o LookupFunctionResultOutput) AvailableMemoryMb() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupFunctionResult) int { return v.AvailableMemoryMb }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "7afd1a762caba06a21653b930a69d271", "score": "0.568994", "text": "func (mm *MemoryManager) MaxResidentSetSize() uint64 {\n\tmm.activeMu.RLock()\n\tdefer mm.activeMu.RUnlock()\n\treturn mm.maxRSS\n}", "title": "" }, { "docid": "559a4475a94fb09ba4a1617c2a25e325", "score": "0.568845", "text": "func (clng *NodeGroup) MaxSize() int {\n\tglog.V(4).Infof(\"MaxSize(%v.%v)\", clng.deploymentID, clng.scaleGroup)\n\tscaleGroup, err := clng.client.GetDeploymentScaleGroup(clng.deploymentID, clng.scaleGroup)\n\tif err != nil {\n\t\tglog.Errorf(\"Issues with get limits:%+v\", clng.scaleGroup)\n\t\treturn 0\n\t}\n\tvar size = scaleGroup.Properties.MaxInstances\n\tif size < 0 {\n\t\t// unlimited is 100 nodes, by default\n\t\tsize = 100\n\t}\n\tglog.Warningf(\"MaxSize(%v.%v):%+v\", clng.deploymentID, clng.scaleGroup, size)\n\treturn size\n}", "title": "" }, { "docid": "38802d992f58d4cb6797685becbb9fce", "score": "0.5656722", "text": "func (m *MemoryAllocationManager) TotalAllocatedMiB() int64 {\n\treturn m.allocateMiB * int64(m.NumOfAllocators())\n}", "title": "" }, { "docid": "f35e77861b20fc0b94cd4c95a407584f", "score": "0.5602206", "text": "func (o NodePoolManagementPtrOutput) MaxUnavailable() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *NodePoolManagement) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.MaxUnavailable\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "76c31aa26ace88224258d4bd31c97e63", "score": "0.55991805", "text": "func (a *Allocator) Allocated() int64 {\n\treturn atomic.LoadInt64(&a.bytesAllocated)\n}", "title": "" }, { "docid": "8bf1a3b66eca59e72650d2d31c514368", "score": "0.559618", "text": "func (o LookupElasticPoolResultOutput) MaxSizeGb() pulumi.Float64Output {\n\treturn o.ApplyT(func(v LookupElasticPoolResult) float64 { return v.MaxSizeGb }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "eedd5787879977ad2b0f750861739b55", "score": "0.55896807", "text": "func (o ScheduledActionOutput) MaxSize() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ScheduledAction) pulumi.IntPtrOutput { return v.MaxSize }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "f8c5033abf8216196624f44c72fd3a7c", "score": "0.557749", "text": "func (o *VolumeCreateRequest) MaxWriteAllocBlocks() int {\n\tr := *o.MaxWriteAllocBlocksPtr\n\treturn r\n}", "title": "" }, { "docid": "9c08543d8ef6d36b6bd316e0f2cd68c8", "score": "0.5568206", "text": "func (o LookupInstanceResultOutput) MemorySizeGb() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) int { return v.MemorySizeGb }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "20d19e12879d89129ba0751d41df353c", "score": "0.55371654", "text": "func (o DriverSchedulingConfigResponseOutput) MemoryMb() pulumi.IntOutput {\n\treturn o.ApplyT(func(v DriverSchedulingConfigResponse) int { return v.MemoryMb }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "b51dd27bdb66f1197b3ce9c7a6105b74", "score": "0.5523745", "text": "func getMaxClusterMemory(numNodes int32, nodesMemorySizes []int64) int64 {\n\tif int32(len(nodesMemorySizes)) < numNodes || numNodes == 0 {\n\t\treturn 0\n\t}\n\n\t// sort nodesMemorySizes int64 array\n\tsort.Slice(nodesMemorySizes, func(i, j int) bool { return nodesMemorySizes[i] < nodesMemorySizes[j] })\n\tmaxIndex := 0\n\tmaxAllocatableMemory := nodesMemorySizes[maxIndex]\n\n\tfor i, size := range nodesMemorySizes {\n\t\t// maxAllocatableMemory is the minimum value of nodesMemorySizes array\n\t\t// only within the size of numNodes, if more nodes are available\n\t\t// then the maxAllocatableMemory is equal to the next minimum value\n\t\t// on the sorted nodesMemorySizes array.\n\t\t// e.g. with numNodes = 4;\n\t\t// \t\t\tmaxAllocatableMemory of [2,4,8,8] => 2\n\t\t// \t\tmaxAllocatableMemory of [2,4,8,8,16] => 4\n\t\tif int32(i) < numNodes {\n\t\t\tmaxAllocatableMemory = min(maxAllocatableMemory, size)\n\t\t} else {\n\t\t\tmaxIndex++\n\t\t\tmaxAllocatableMemory = nodesMemorySizes[maxIndex]\n\t\t}\n\t}\n\treturn maxAllocatableMemory\n}", "title": "" }, { "docid": "3db85cb703f7cb793a56b740e50dd77c", "score": "0.5503876", "text": "func DefaultMaxSize() int64 {\n\treturn 1048576\n}", "title": "" }, { "docid": "77d489cbfbdff06876d030a3113ce120", "score": "0.5496332", "text": "func (p *WorkerPool) MaxCapacity() int {\n\treturn p.maxCapacity\n}", "title": "" }, { "docid": "fb17213eb4f790bc69aaf41ad97472ab", "score": "0.54939604", "text": "func (o RegionBackendServiceCircuitBreakersPtrOutput) MaxRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *RegionBackendServiceCircuitBreakers) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxRequests\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "b233d727bfa58dfaefc468de4a268ff2", "score": "0.5485449", "text": "func (LinuxCurrentSystemState) AllocatedMemoryPercents() (uint, error) {\n\tin := syscall.Sysinfo_t{}\n\terr := syscall.Sysinfo(&in)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn uint((in.Totalram - in.Freeram) * 100 / in.Totalram), nil\n}", "title": "" }, { "docid": "d9e5cde09b2b0ba22934b5070e6a055c", "score": "0.5478329", "text": "func (o DriverSchedulingConfigOutput) MemoryMb() pulumi.IntOutput {\n\treturn o.ApplyT(func(v DriverSchedulingConfig) int { return v.MemoryMb }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "4b6f8439bae6b127b8600d72adca6678", "score": "0.5471578", "text": "func (c *Cache) MaxCapacity() int64 {\n\tif c == nil {\n\t\treturn 0\n\t}\n\treturn c.policy.MaxCost()\n}", "title": "" }, { "docid": "0d766ff0471566e1fc768a54aea11a2a", "score": "0.54615456", "text": "func (o BeanstalkOutput) MaxSize() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *Beanstalk) pulumi.IntOutput { return v.MaxSize }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "5c21845310f57a5cfd288d10f11a50ef", "score": "0.54595435", "text": "func (o BackendServiceCircuitBreakersPtrOutput) MaxRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BackendServiceCircuitBreakers) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxRequests\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "3c85ed66ee3e892ccea7c220bccbd7ab", "score": "0.5424184", "text": "func (c *CgroupV1) SetMemoryMaxUsageInBytes(i uint64) error {\n\treturn c.memory.WriteUint(\"memory.max_usage_in_bytes\", i)\n}", "title": "" }, { "docid": "de6e536d851b2dc1bc29e29bbcf4fc6d", "score": "0.5412084", "text": "func (o RegionBackendServiceCircuitBreakersPtrOutput) MaxPendingRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *RegionBackendServiceCircuitBreakers) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxPendingRequests\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "1c6812a528ed3997e13a4d4b895aec64", "score": "0.5404837", "text": "func MemoryConstraints() system.MemoryConstraints {\n\tconstraints := system.GetMemoryConstraints()\n\tlog.Infow(\"memory limits initialized\",\n\t\t\"max_mem_heap\", constraints.MaxHeapMem,\n\t\t\"total_system_mem\", constraints.TotalSystemMem,\n\t\t\"effective_mem_limit\", constraints.EffectiveMemLimit)\n\treturn constraints\n}", "title": "" }, { "docid": "04a436848ca543a32fcf0789ec524922", "score": "0.5403422", "text": "func (n *NodeGroup) MaxSize() int64 {\n\treturn n.maxSize\n}", "title": "" }, { "docid": "0b9b380d79a6b133c42ac33a2d9596bc", "score": "0.54028165", "text": "func (space *Space) Max() Vector {\n\treturn space.max\n}", "title": "" }, { "docid": "d505f109e755c65ac821e5fc38fe0269", "score": "0.5399509", "text": "func (o DriverSchedulingConfigPtrOutput) MemoryMb() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DriverSchedulingConfig) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.MemoryMb\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "e5f5687a64b0c9d0ea960f8a69e82558", "score": "0.5398287", "text": "func (o *ViewProjectScheduleEntry) SetAllocatedMinutes(v int32) {\n\to.AllocatedMinutes = &v\n}", "title": "" }, { "docid": "d10c2f607c1de2cccc9ac10d3ab5e6e9", "score": "0.53953826", "text": "func (o ClusterServerlessV2ScalingConfigurationPtrOutput) MaxCapacity() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *ClusterServerlessV2ScalingConfiguration) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxCapacity\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "c23994e5672f92bd93e41e0fa329eae7", "score": "0.5391801", "text": "func (r *ReplicationInstance) AllocatedStorage() pulumi.IntOutput {\n\treturn (pulumi.IntOutput)(r.s.State[\"allocatedStorage\"])\n}", "title": "" }, { "docid": "b611b894412cf4bf41c7ab18cdfca607", "score": "0.5389929", "text": "func (o ClusterServerlessV2ScalingConfigurationOutput) MaxCapacity() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v ClusterServerlessV2ScalingConfiguration) *float64 { return v.MaxCapacity }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "2a07ef92966c7e36d93315c5f46b38a7", "score": "0.5386546", "text": "func (r *RADIUSCounters) IPAllocated(nasIdentifier string) {\n\tr.Alloc.With(prometheus.Labels{\"nas\": nasIdentifier}).Inc()\n\tr.Free.With(prometheus.Labels{\"nas\": nasIdentifier}).Dec()\n}", "title": "" }, { "docid": "c50bf2ecf21fbfe2f8705c60386bbcd5", "score": "0.53802013", "text": "func (o NodePoolManagementOutput) MaxUnavailable() pulumi.IntOutput {\n\treturn o.ApplyT(func(v NodePoolManagement) int { return v.MaxUnavailable }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "178966c768eee05856c3d840718d96e6", "score": "0.53775096", "text": "func (d *DeviceManager) MaxMetricSize() int {\n\treturn maxMetricSizeFile\n}", "title": "" }, { "docid": "c6445324843fa0d5608b46ce1b206f73", "score": "0.53765595", "text": "func (o BackendServiceCircuitBreakersPtrOutput) MaxPendingRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BackendServiceCircuitBreakers) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxPendingRequests\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "c9b5e9709e2e7eb32a074f7209843c5a", "score": "0.5373287", "text": "func (o LookupElasticPoolResultOutput) PerDbMaxCapacity() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupElasticPoolResult) int { return v.PerDbMaxCapacity }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "64573980b75c3f4d53c0cd7d5c72bae6", "score": "0.5365375", "text": "func (p *Pod) MemoryLimit() uint64 {\n\tresLim := p.ResourceLim()\n\tif resLim.Memory == nil || resLim.Memory.Limit == nil {\n\t\treturn 0\n\t}\n\treturn uint64(*resLim.Memory.Limit)\n}", "title": "" }, { "docid": "e8cfe58209f6faedbed77377167b4870", "score": "0.5340101", "text": "func (o GetInstanceTypeGpusOutput) MemorySize() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetInstanceTypeGpus) int { return v.MemorySize }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "7ff20b651ed63150f81bbee50fa3a845", "score": "0.5332497", "text": "func GetAvailableMemory()uint64{\n\t// Check memory limit (ulimit -v call with Getrlimit)\n\tvar r syscall.Rlimit\n\n\tif err := syscall.Getrlimit(syscall.RLIMIT_AS,&r) ; err == nil {\n\t\treturn r.Cur / 2\n\t}\n\t// Check /proc/meminfo\n\tcmdGrep := exec.Command(\"grep\", \"MemTotal\", \"/proc/meminfo\")\n\tcmdAwk := exec.Command(\"gawk\", \"{print $2}\")\n\tcmdAwk.Stdin, _ = cmdGrep.StdoutPipe()\n\tbuf := bytes.NewBuffer(make([]byte, 0))\n\tcmdAwk.Stdout = buf\n\t// Run asynchrone and wait Grep output\n\tcmdAwk.Start()\n\tcmdGrep.Run()\n\tcmdAwk.Wait()\n\tif mem, err := strconv.ParseInt(strings.Trim(string(buf.Bytes()), \"\\n\"), 10, 0) ; err == nil {\n\t\t// Mem get in Kilo bytes, convert to bytes\n\t\treturn uint64(mem / 2) * 1024\n\t}\n\treturn defaultMemory\n}", "title": "" }, { "docid": "7ad3b4f35fb9981159444e9ae3caebe2", "score": "0.5327977", "text": "func (o RegionBackendServiceCircuitBreakersOutput) MaxPendingRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RegionBackendServiceCircuitBreakers) *int { return v.MaxPendingRequests }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "50f797bca4daca6c0762a663f5ca402a", "score": "0.53200346", "text": "func (o RegionBackendServiceCircuitBreakersOutput) MaxRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RegionBackendServiceCircuitBreakers) *int { return v.MaxRequests }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "80850bec372a0ae76e0d20ea9a2bed4e", "score": "0.5317638", "text": "func (o PrometheusSpecQueryPtrOutput) MaxConcurrency() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *PrometheusSpecQuery) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxConcurrency\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "a1ef31c669bdfbe5e0152386c1481577", "score": "0.5316293", "text": "func (o BackendServiceCircuitBreakersOutput) MaxPendingRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceCircuitBreakers) *int { return v.MaxPendingRequests }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "1cf2dceaf375d948e8c7364625070dc1", "score": "0.53103393", "text": "func (o BackendServiceCircuitBreakersOutput) MaxRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceCircuitBreakers) *int { return v.MaxRequests }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "e6d20a9229fab8b592e7a083c5ad127c", "score": "0.5305008", "text": "func (o PrometheusSpecQueryOutput) MaxConcurrency() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v PrometheusSpecQuery) *int { return v.MaxConcurrency }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "7b26fbb3723692c70a5099f9a32edcad", "score": "0.5284212", "text": "func (o EndpointConfigurationProductionVariantServerlessConfigPtrOutput) MemorySizeInMb() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *EndpointConfigurationProductionVariantServerlessConfig) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.MemorySizeInMb\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "66ddef7ec9e88cc9e25e4fc5cb589937", "score": "0.52788347", "text": "func (o EndpointConfigurationProductionVariantServerlessConfigOutput) MemorySizeInMb() pulumi.IntOutput {\n\treturn o.ApplyT(func(v EndpointConfigurationProductionVariantServerlessConfig) int { return v.MemorySizeInMb }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "cb3d56b0e8d6bb7101add6318d8d418c", "score": "0.5275449", "text": "func (k Keeper) MaxEntries(ctx sdk.Context) (res uint32) {\n\tk.paramstore.Get(ctx, types.KeyMaxEntries, &res)\n\treturn\n}", "title": "" }, { "docid": "0481b90870fc143b13c82ca737ae7d79", "score": "0.52702105", "text": "func (o VpcIpamPoolOutput) AllocationMaxNetmaskLength() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *VpcIpamPool) pulumi.IntPtrOutput { return v.AllocationMaxNetmaskLength }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "c9ec8fac71a313619339aa540027f96a", "score": "0.5265313", "text": "func (n *NodeGroup) MaxSize() int64 {\n\treturn awsapi.Int64Value(n.asg.MaxSize)\n}", "title": "" }, { "docid": "d196b177e165063d4d5e1104070a9879", "score": "0.5264917", "text": "func (o EndpointConfigurationShadowProductionVariantServerlessConfigOutput) MemorySizeInMb() pulumi.IntOutput {\n\treturn o.ApplyT(func(v EndpointConfigurationShadowProductionVariantServerlessConfig) int { return v.MemorySizeInMb }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "eab2215786d83342a2db870a67fae5d6", "score": "0.52624655", "text": "func (o EndpointConfigurationShadowProductionVariantServerlessConfigPtrOutput) MemorySizeInMb() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *EndpointConfigurationShadowProductionVariantServerlessConfig) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.MemorySizeInMb\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "f9e525b527b21ddabed6479d8882f18c", "score": "0.5261841", "text": "func (m *MaxHeap) Size() int {\n\treturn len(m.data)\n}", "title": "" }, { "docid": "f449f9a9acfcb9ad6d3bbd7c74db8e08", "score": "0.5255562", "text": "func (me XsdGoPkgHasAttr_AllocationSize_XsdtInteger_1) AllocationSizeDefault() xsdt.Integer {\n\treturn xsdt.Integer(1)\n}", "title": "" }, { "docid": "ba3d4c62fcd9ac754c9b54b6f49c58a6", "score": "0.5255298", "text": "func (q *queryMemoryManager) giveMemory(want, unused int64) int64 {\n\t// If we can safely double the limit, then just do that.\n\tif q.limit > want && q.limit < unused {\n\t\tif q.limit*2 <= q.m.memoryBytesQuotaPerQuery {\n\t\t\treturn q.limit\n\t\t}\n\t\t// Doubling the limit sends us over the quota.\n\t\t// Determine what would be our maximum amount.\n\t\tmax := q.m.memoryBytesQuotaPerQuery - q.limit\n\t\tif max > want {\n\t\t\treturn max\n\t\t}\n\t}\n\n\t// If we can't double because there isn't enough space\n\t// in unused, maybe we can just use everything.\n\tif unused > want && unused < q.limit {\n\t\treturn unused\n\t}\n\n\t// Otherwise we have already determined we can give the\n\t// wanted number of bytes so just give that.\n\treturn want\n}", "title": "" }, { "docid": "2c8b0dc3921dc59816c2880f0c71111e", "score": "0.5255031", "text": "func (h *Host) MaxCPU() (int, error) {\n\treturn h.intAttribute(\"HOST_SHARE/MAX_CPU\")\n}", "title": "" }, { "docid": "f02c1f9034277cb85d5f256f8233b3a2", "score": "0.5246176", "text": "func (m *metricOracledbPgaMemory) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "title": "" }, { "docid": "2d4ba005aa434ec8e04c28c1b25eac57", "score": "0.52209884", "text": "func (o *ViewProjectScheduleEntry) GetAllocatedMinutes() int32 {\n\tif o == nil || o.AllocatedMinutes == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.AllocatedMinutes\n}", "title": "" }, { "docid": "cbc95d60ef645c5d9bb0355416062230", "score": "0.52197987", "text": "func (o RegionBackendServiceCircuitBreakersPtrOutput) MaxConnections() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *RegionBackendServiceCircuitBreakers) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxConnections\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "272d6729855849e338169112f1e231ef", "score": "0.5215185", "text": "func (px *Paxos) Max() int {\n\t// Your code here.\n\treturn px.pNmu\n}", "title": "" }, { "docid": "7279f00bfea68af680dbd0da1d1ad9f9", "score": "0.52122504", "text": "func (mm *MemoryManager) MemoryAvailable() uint64 {\n\treturn mm.available\n}", "title": "" }, { "docid": "fc9f3ba82cc19e7635531fa216af0bab", "score": "0.52113867", "text": "func (o RegionBackendServiceBackendOutput) MaxConnections() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RegionBackendServiceBackend) *int { return v.MaxConnections }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "4a296c3dcf2cc5331cc21d87515525c9", "score": "0.520832", "text": "func (b *Buffer) Allocated() int {\n\treturn (int)(b.allocated)\n}", "title": "" }, { "docid": "4a296c3dcf2cc5331cc21d87515525c9", "score": "0.520832", "text": "func (b *Buffer) Allocated() int {\n\treturn (int)(b.allocated)\n}", "title": "" }, { "docid": "d818334f16b3b8f6ecec7b87d0dce1c4", "score": "0.5207273", "text": "func (o NodePoolScalingConfigPtrOutput) MaxSize() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *NodePoolScalingConfig) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.MaxSize\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "e9b2017534231ef0699fc262c1096d36", "score": "0.5201424", "text": "func (o BackendServiceCircuitBreakersPtrOutput) MaxConnections() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BackendServiceCircuitBreakers) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxConnections\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "8c6058c11ccb279c4b9ede12b504bd56", "score": "0.5187915", "text": "func (_Bindings *BindingsSession) MaxAssets() (*big.Int, error) {\n\treturn _Bindings.Contract.MaxAssets(&_Bindings.CallOpts)\n}", "title": "" }, { "docid": "22095dc910771d972b9a8b739cb4c466", "score": "0.5183869", "text": "func (px *Paxos) Max() int {\n px.mu.Lock()\n defer px.mu.Unlock()\n return px.max\n}", "title": "" }, { "docid": "2b0ab52bf73ca89f301810b2ec91355e", "score": "0.5182916", "text": "func (o AppLimitsPtrOutput) MaximumDuration() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *AppLimits) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaximumDuration\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "7d9f2ac9c1956de554bce10929b1f39d", "score": "0.518224", "text": "func (mm *MemoryManager) shrinkMaxMemory(amount uint64) {\n\tmm.lock.Lock()\n\tdefer mm.lock.Unlock()\n\n\t// 1. change max memory available\n\tamountDecreased := mm.limit - amount\n\tmm.limit = amount\n\n\t// 2. check and handle memory underflow. Change available memory\n\tif mm.underflow > 0 {\n\t\tmm.underflow += amountDecreased\n\t} else if amountDecreased > mm.available {\n\t\tmm.underflow += amountDecreased - mm.available\n\t\tmm.available = 0\n\t} else {\n\t\tmm.available -= amountDecreased\n\t}\n}", "title": "" }, { "docid": "ca08fbd89541163c65e1f77cc590fc94", "score": "0.5174248", "text": "func (self *TMemoryCache) Max(max ...int) int {\n\tif len(max) > 0 {\n\t\tself.config.max = max[0]\n\t}\n\n\treturn self.config.max\n}", "title": "" }, { "docid": "052f033e703a85a5df105bd59be7eaa0", "score": "0.51730114", "text": "func maxConstraint(limitType string, resourceName string, enforced resource.Quantity, request api.ResourceList, limit api.ResourceList) error {\n\treq, reqExists := request[api.ResourceName(resourceName)]\n\tlim, limExists := limit[api.ResourceName(resourceName)]\n\tobservedReqValue, observedLimValue, enforcedValue := requestLimitEnforcedValues(req, lim, enforced)\n\n\tif !limExists {\n\t\treturn fmt.Errorf(\"maximum %s usage per %s is %s. No limit is specified\", resourceName, limitType, enforced.String())\n\t}\n\tif observedLimValue > enforcedValue {\n\t\treturn fmt.Errorf(\"maximum %s usage per %s is %s, but limit is %s\", resourceName, limitType, enforced.String(), lim.String())\n\t}\n\tif reqExists && (observedReqValue > enforcedValue) {\n\t\treturn fmt.Errorf(\"maximum %s usage per %s is %s, but request is %s\", resourceName, limitType, enforced.String(), req.String())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bed44175fcb37b9a62090258679e0461", "score": "0.51589525", "text": "func (c *Cache) MaxSize() int64 {\n\tif c == nil {\n\t\treturn 0\n\t}\n\treturn c.maxSize\n}", "title": "" }, { "docid": "4229fb40f8d4e5c1c0e3ab33decdeb5c", "score": "0.51563686", "text": "func MaxMessageSize() uint32 {\n\t// Return HugePageSize - PageSize so that when flipcall packet window is\n\t// created with MaxMessageSize() + flipcall header size + channel header\n\t// size, HugePageSize is allocated and can be backed by a single huge page\n\t// if supported by the underlying memfd.\n\treturn uint32(hostarch.HugePageSize - os.Getpagesize())\n}", "title": "" }, { "docid": "777e2db8ab9c0a22c6bcba90d7bf3368", "score": "0.5155337", "text": "func (o BackendServiceBackendOutput) MaxConnections() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceBackend) *int { return v.MaxConnections }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "780091419efc5752ebd678885fcfa083", "score": "0.51502174", "text": "func (o GoogleCloudDataplexV1EnvironmentInfrastructureSpecComputeResourcesPtrOutput) MaxNodeCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudDataplexV1EnvironmentInfrastructureSpecComputeResources) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxNodeCount\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "f41ab84f11609c8b7b3ede0e9468ee2b", "score": "0.5149412", "text": "func (o BrokeredInfraConfigSpecBrokerPtrOutput) GlobalMaxSize() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BrokeredInfraConfigSpecBroker) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.GlobalMaxSize\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d112b75fcb3ebb6fa7f92871f29e28ab", "score": "0.5148248", "text": "func LargestFreeGPUSlots() (cnt uint) {\n\tgpuAllocs.Lock()\n\tdefer gpuAllocs.Unlock()\n\n\tfor _, alloc := range gpuAllocs.Allocs {\n\t\tif alloc.FreeSlots > cnt {\n\t\t\tcnt = alloc.FreeSlots\n\t\t}\n\t}\n\treturn cnt\n}", "title": "" }, { "docid": "aa4fd66343cf699173cc1ec231a02181", "score": "0.5139946", "text": "func (d *DeviceManager) MaxRequestsSize() int {\n\treturn maxRequestsSizeFile\n}", "title": "" } ]
bdbffec6c1a9448898ff22846c10aa2f
ListLoadBalancersWithResponse request returning ListLoadBalancersResponse
[ { "docid": "a45fd2935fd7983f77c20c61198a78d8", "score": "0.7809611", "text": "func (c *ClientWithResponses) ListLoadBalancersWithResponse(ctx context.Context) (*ListLoadBalancersResponse, error) {\n\trsp, err := c.ListLoadBalancers(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseListLoadBalancersResponse(rsp)\n}", "title": "" } ]
[ { "docid": "dcb0251f7fb28bdf8f676e6627efe50e", "score": "0.74384165", "text": "func (lb *LoadBalancerService) List(context context.Context) (*[]LoadBalancer, error) {\n\tdata := struct {\n\t\tResponse struct {\n\t\t\tLoadBalancers []LoadBalancer\n\t\t}\n\t}{}\n\terr := lb.client.get(context, \"loadbalancer/list\", &data)\n\treturn &data.Response.LoadBalancers, err\n}", "title": "" }, { "docid": "ccf42528ff4d493393e0425576abcac3", "score": "0.73680764", "text": "func ParseListLoadBalancersResponse(rsp *http.Response) (*ListLoadBalancersResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &ListLoadBalancersResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest struct {\n\t\t\tLoadBalancers *[]LoadBalancer `json:\"load-balancers,omitempty\"`\n\t\t}\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "89cd5b30d2d65e2fca59a51270d8c96e", "score": "0.7239358", "text": "func (googleloadbalancer *Googleloadbalancer) Listloadbalancer(request interface{}) (resp interface{}, err error) {\n\n\toptions := request.(map[string]string)\n\n\turl := \"https://www.googleapis.com/compute/beta/projects/\" + options[\"Project\"] + \"/regions/\" + options[\"Region\"] + \"/targetPools/\"\n\n\t// url := \"https://www.googleapis.com/compute/beta/projects/\" + Project + \"/regions/\" + Region + \"/targetPools\"\n\n\tclient := googleauth.SignJWT()\n\n\tListloadbalancerrequest, err := http.NewRequest(\"GET\", url, nil)\n\tListloadbalancerrequest.Header.Set(\"Content-Type\", \"application/json\")\n\n\tListloadbalancerresp, err := client.Do(Listloadbalancerrequest)\n\n\tdefer Listloadbalancerresp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(Listloadbalancerresp.Body)\n\n\tListloadbalancerresponse := make(map[string]interface{})\n\tListloadbalancerresponse[\"status\"] = Listloadbalancerresp.StatusCode\n\tListloadbalancerresponse[\"body\"] = string(body)\n\tresp = Listloadbalancerresponse\n\treturn resp, err\n}", "title": "" }, { "docid": "edf8268c49a7dc854caa4b7656e02622", "score": "0.70649475", "text": "func (r Account) GetLoadBalancers() (resp []datatypes.Network_LoadBalancer_VirtualIpAddress, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Account\", \"getLoadBalancers\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ab435ece0300a694a3c7ca7be8e1d544", "score": "0.70277405", "text": "func (s *DigitalOceanService) LoadBalancers() map[LoadBalancerCounter]int {\n\treturn s.Buffer.LoadBalancers\n}", "title": "" }, { "docid": "d405f093546814a477726a6da45b0213", "score": "0.70229095", "text": "func (c *Client) ListLoadbalancers(dcid string) (*Loadbalancers, error) {\n\n\turl := loadbalancersPath(dcid)\n\tret := &Loadbalancers{}\n\terr := c.Get(url, ret, http.StatusOK)\n\treturn ret, err\n}", "title": "" }, { "docid": "faec88fbe02df29e5263bd968909d248", "score": "0.68541074", "text": "func (elb *ELB) DescribeLoadBalancers(names ...string) (*DescribeLoadBalancerResp, error) {\n\tparams := map[string]string{\"Action\": \"DescribeLoadBalancers\"}\n\tfor i, name := range names {\n\t\tindex := fmt.Sprintf(\"LoadBalancerNames.member.%d\", i+1)\n\t\tparams[index] = name\n\t}\n\tresp := new(DescribeLoadBalancerResp)\n\tif err := elb.query(params, resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "06db9b6dd14d7cb3c486957ac7beeb27", "score": "0.66998845", "text": "func GetLoadBalancers(client *gophercloud.ServiceClient, opts loadbalancers.ListOpts) ([]loadbalancers.LoadBalancer, error) {\n\tmc := metrics.NewMetricContext(\"loadbalancer\", \"list\")\n\tallPages, err := loadbalancers.List(client, opts).AllPages()\n\tif mc.ObserveRequest(err) != nil {\n\t\treturn nil, err\n\t}\n\tallLoadbalancers, err := loadbalancers.ExtractLoadBalancers(allPages)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn allLoadbalancers, nil\n}", "title": "" }, { "docid": "18f2395c369825ca20d84cb4c9c7511f", "score": "0.6658928", "text": "func (os *OpenStack) GetLoadbalancers(project string) ([]loadbalancers.LoadBalancer, error) {\n\topts := loadbalancers.ListOpts{}\n\tif project != \"\" {\n\t\topts = loadbalancers.ListOpts{ProjectID: project}\n\t}\n\n\tallPages, err := loadbalancers.List(os.Octavia, opts).AllPages()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tallLoadbalancers, err := loadbalancers.ExtractLoadBalancers(allPages)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn allLoadbalancers, nil\n}", "title": "" }, { "docid": "09fac42224d5767222dc2b6daad49d97", "score": "0.65372086", "text": "func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := rootURL(c)\n\tif opts != nil {\n\t\tquery, err := opts.ToLoadBalancerListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\treturn pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn LoadBalancerPage{pagination.LinkedPageBase{PageResult: r}}\n\t})\n}", "title": "" }, { "docid": "bb109b8f14bf77d05be97daf6ba2108b", "score": "0.6394149", "text": "func (r Account) GetAdcLoadBalancers() (resp []datatypes.Network_Application_Delivery_Controller_LoadBalancer_VirtualIpAddress, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Account\", \"getAdcLoadBalancers\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "2a32f8bf9c0d91550ff59b19228f0cbb", "score": "0.6274392", "text": "func (c *Client) GetLoadBalancerList(ctx context.Context) ([]LoadBalancer, error) {\n\tr := gsRequest{\n\t\turi: apiLoadBalancerBase,\n\t\tmethod: http.MethodGet,\n\t\tskipCheckingRequest: true,\n\t}\n\tvar response LoadBalancers\n\tvar loadBalancers []LoadBalancer\n\terr := r.execute(ctx, *c, &response)\n\tfor _, properties := range response.List {\n\t\tloadBalancers = append(loadBalancers, LoadBalancer{Properties: properties})\n\t}\n\treturn loadBalancers, err\n}", "title": "" }, { "docid": "84e71292053be69b2538d70b29903723", "score": "0.623679", "text": "func (a *ClusterControllerApiService) GetClusterLoadBalancers(ctx _context.Context, account string, application string, clusterName string, type_ string) apiGetClusterLoadBalancersRequest {\n\treturn apiGetClusterLoadBalancersRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\taccount: account,\n\t\tapplication: application,\n\t\tclusterName: clusterName,\n\t\ttype_: type_,\n\t}\n}", "title": "" }, { "docid": "a52a85020f428c895a2b2bc47542688f", "score": "0.61430705", "text": "func CreateDescribeVPCRelatedLoadBalancersResponse() (response *DescribeVPCRelatedLoadBalancersResponse) {\n\tresponse = &DescribeVPCRelatedLoadBalancersResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "675b5d99f237a0479cae94bf7a9cc9c5", "score": "0.60745555", "text": "func (c *Cloud) describeLoadBalancersHelper(input *elbv2.DescribeLoadBalancersInput) (result []*elbv2.LoadBalancer, err error) {\n\terr = c.elbv2.DescribeLoadBalancersPages(input, func(output *elbv2.DescribeLoadBalancersOutput, _ bool) bool {\n\t\tif output == nil {\n\t\t\treturn false\n\t\t}\n\t\tresult = append(result, output.LoadBalancers...)\n\t\treturn true\n\t})\n\treturn result, err\n}", "title": "" }, { "docid": "027bbe7e18c50954742015f77da0b53d", "score": "0.6065209", "text": "func RunLoadBalancerList(c *CmdConfig) error {\n\tlbs := c.LoadBalancers()\n\tlist, err := lbs.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\titem := &displayers.LoadBalancer{LoadBalancers: list}\n\treturn c.Display(item)\n}", "title": "" }, { "docid": "c4861b0384aea7c104f76ad0acbb9b4e", "score": "0.6040388", "text": "func (balancer *LoadBalancersV2) getAll(configObj config.Config) ([]*string, error) {\n\tresult, err := balancer.Client.DescribeLoadBalancers(&elbv2.DescribeLoadBalancersInput{})\n\tif err != nil {\n\t\treturn nil, errors.WithStackTrace(err)\n\t}\n\n\tvar arns []*string\n\tfor _, balancer := range result.LoadBalancers {\n\t\tif configObj.ELBv2.ShouldInclude(config.ResourceValue{\n\t\t\tName: balancer.LoadBalancerName,\n\t\t\tTime: balancer.CreatedTime,\n\t\t}) {\n\t\t\tarns = append(arns, balancer.LoadBalancerArn)\n\t\t}\n\t}\n\n\treturn arns, nil\n}", "title": "" }, { "docid": "0fac248c5c969fb8e6b620fe7b4575d4", "score": "0.59994227", "text": "func (c *Client) ListNetworkLoadBalancers(ctx context.Context, zone string) ([]*NetworkLoadBalancer, error) {\n\tlist := make([]*NetworkLoadBalancer, 0)\n\n\tresp, err := c.ListLoadBalancersWithResponse(apiv2.WithZone(ctx, zone))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.JSON200.LoadBalancers != nil {\n\t\tfor i := range *resp.JSON200.LoadBalancers {\n\t\t\tlist = append(list, nlbFromAPI(&(*resp.JSON200.LoadBalancers)[i], zone))\n\t\t}\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "cbfa7237bc75303e079ce04bc6806e92", "score": "0.59078026", "text": "func (s *ClusterScope) APIServerLoadbalancers() *infrav1.DOLoadBalancer {\n\treturn &s.DOCluster.Spec.Network.APIServerLoadbalancers\n}", "title": "" }, { "docid": "e5aed291863a7c1a73bba216a225523b", "score": "0.5882684", "text": "func NewListLoadBalancersRequest(server string) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/load-balancer\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "65a2702b8fdedafcfe04ba2ddff23753", "score": "0.5839846", "text": "func (*ListNetworkLoadBalancersResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_loadbalancer_v1_network_load_balancer_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6e5215be739cdd6170ea03c71cdc2d56", "score": "0.5722284", "text": "func (m *MarathonFinder) Balancers() ([]Balancer, error) {\n\tapps, err := m.fetcher.FetchApps(map[string]string{\"zoidberg_balancer_for\": m.balancer})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbalancers := []Balancer{}\n\tfor _, app := range apps {\n\t\tif len(app.Ports) == 0 {\n\t\t\tlog.Printf(\"app %s has no ports\", app.ID)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, task := range app.Tasks {\n\t\t\tbalancers = append(balancers, Balancer{\n\t\t\t\tHost: task.Host,\n\t\t\t\tPort: task.Ports[0],\n\t\t\t})\n\t\t}\n\t}\n\n\treturn balancers, nil\n}", "title": "" }, { "docid": "1e12d272204a60a37a918d1c79a19f84", "score": "0.568918", "text": "func monitorVpcLoadBalancers(c *Cloud, services *v1.ServiceList, status map[string]string, triggerEvent EventRecorder) {\n\tklog.Info(\"Monitoring VPC Load Balancers...\")\n\n\t// Build a map of all Kubernetes load balancer service objects\n\tserviceMap := map[string]*v1.Service{}\n\tfor _, svc := range services.Items {\n\t\tif svc.Spec.Type == v1.ServiceTypeLoadBalancer {\n\t\t\tlbSvc := svc\n\t\t\tserviceMap[string(svc.UID)] = &lbSvc\n\t\t}\n\t}\n\n\t// Return if there are no load balancer services to monitor\n\tif len(serviceMap) == 0 {\n\t\tklog.Info(\"No Load Balancers to monitor, exiting...\")\n\t\treturn\n\t}\n\n\tcommand := \"MONITOR\"\n\toutArray, err := execVpcCommand(command, []string{\"KUBECONFIG=\" + c.Config.Kubernetes.ConfigFilePaths[0]})\n\tif err != nil {\n\t\tklog.Errorf(\"Error calling vpcctl binary: %s\", err)\n\t\treturn\n\t}\n\n\t// Generate events based on response from 'vpcctl' binary\n\tfor _, line := range outArray {\n\t\tklog.Info(\"Processing line: \", line)\n\t\tif len(line) < 2 || !strings.Contains(line, \": \") {\n\t\t\tcontinue\n\t\t}\n\t\tlineType := strings.Split(line, \":\")[0] // Grab first part of the output line\n\t\tlineData := strings.TrimPrefix(line, lineType+\": \") // Remainder of the output line\n\n\t\tswitch lineType {\n\t\tcase \"INFO\":\n\t\t\t// A corresponding VPC load balancer exists in RIaaS. We need to further parse binary response and generate\n\t\t\t// events based on load balancer status\n\n\t\t\t// Obtain information necessary for event creation\n\t\t\tserviceID := findField(lineData, vpcLBServiceIDPrefix)\n\t\t\tservice, exists := serviceMap[serviceID]\n\t\t\tif !exists {\n\t\t\t\t// We do not have a load balancer service associated with this service UID returned from the binary\n\t\t\t\t// OR this is a line without data (ex: \"INFO: Entering monitor\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tnewStatus := findField(lineData, vpcLBStatusPrefix) // Looking for Status:<status-data>\n\t\t\toldStatus, oldStatusExists := status[serviceID]\n\n\t\t\tif oldStatusExists {\n\t\t\t\t// We have prior state for this load balancer from a previous call to monitorVpcLoadBalancer()\n\t\t\t\t// Compare current VPC LB status with the previous VPC LB status and trigger events for a variety of cases\n\t\t\t\tklog.Infof(\"Previous State: %s Current State: %s\", oldStatus, newStatus)\n\n\t\t\t\t// If the status of the VPC load balancer is transitioning from any\n\t\t\t\t// non active state to 'online/active' --> NORMAL EVENT.\n\t\t\t\tif newStatus == vpcStatusOnlineActive {\n\t\t\t\t\tif oldStatus != vpcStatusOnlineActive {\n\t\t\t\t\t\t// If this is a network load balancer, we don't want to signal the NORMAL EVENT\n\t\t\t\t\t\t// (and potentially wake up some application that is waiting for this normal even to appear)\n\t\t\t\t\t\t// unless EnsureLoadBalancer has set the hostname and static IP address in the service spec\n\t\t\t\t\t\tif isFeatureEnabled(service, networkLoadBalancerFeature) {\n\t\t\t\t\t\t\tif service.Status.LoadBalancer.Ingress == nil || service.Status.LoadBalancer.Ingress[0].Hostname == \"\" {\n\t\t\t\t\t\t\t\t// Ignore this new status and wait for EnsureLoadBalancer to set the hostname\n\t\t\t\t\t\t\t\tnewStatus = oldStatus\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttriggerEvent(c.Recorder, service, newStatus)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttriggerEvent(c.Recorder, service, newStatus)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If the status of the VPC load balancer is not 'online/active'\n\t\t\t\t\t// on consecutive calls to Monitor --> EVENT (Normal OR Warning)\n\t\t\t\t\tif oldStatus == newStatus {\n\t\t\t\t\t\ttriggerEvent(c.Recorder, service, newStatus)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if newStatus == vpcStatusOnlineActive && isNewLoadBalancer(service) {\n\t\t\t\t// We do not have prior state for this load balancer, either because it was recently created or\n\t\t\t\t// the CCM was restarted due to failure/rolling update\n\n\t\t\t\t// Handle the case when the VPC load balancer is fully created in between successive calls to Monitor\n\t\t\t\t// 'offline/create_pending` state could be lost so trigger event to ensure\n\t\t\t\t// Ingress does not miss notification of newly created LB\n\t\t\t\tklog.Info(\"New VPC load balancer has no prior state. Triggering event in case load balancer creation began and completed in between monitor\")\n\t\t\t\ttriggerEvent(c.Recorder, service, newStatus)\n\t\t\t}\n\n\t\t\t// Store status in data map so its available to the next call to monitorVpcLoadBalancers()\n\t\t\tstatus[serviceID] = newStatus\n\n\t\tcase \"NOT_FOUND\":\n\t\t\t// Unable to find VPC load balancer object in RIaaS which corresponds to this Kubernetes service object.\n\t\t\t// Obtain information necessary for event creation\n\t\t\tserviceID := findField(lineData, vpcLBServiceIDPrefix)\n\t\t\tservice, exists := serviceMap[serviceID]\n\t\t\tif !exists {\n\t\t\t\t// We do not have a load balancer service associated with this service UID returned from the binary\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tnewStatus := vpcStatusOfflineNotFound\n\t\t\toldStatus, oldStatusExists := status[serviceID]\n\n\t\t\t// Avoid Not Found event generation while waiting for cluster creation.\n\t\t\t// This requires that a load balancer be assigned a non-empty status\n\t\t\t// before the monitor will keep track of not_found status\n\t\t\tif oldStatusExists {\n\t\t\t\t// If the status of the VPC load balancer is found in state 'offline/not_found'\n\t\t\t\t// on consecutive calls to Monitor() --> NOT FOUND EVENT\n\t\t\t\tif newStatus == oldStatus {\n\t\t\t\t\ttriggerEvent(c.Recorder, service, newStatus)\n\t\t\t\t}\n\n\t\t\t\tstatus[serviceID] = newStatus\n\t\t\t}\n\n\t\t\tklog.Infof(\"Corresponding VPC load balancer not found for service: %s\", serviceID)\n\t\tdefault:\n\t\t\t// Log unexpected information from binary\n\t\t\tklog.Error(line)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9fbb57800162ea23eae3aa840b5c2391", "score": "0.5673078", "text": "func ParseGetLoadBalancerResponse(rsp *http.Response) (*GetLoadBalancerResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetLoadBalancerResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest LoadBalancer\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "ad22965d4ef5aa514f34f2c7f283a000", "score": "0.5591854", "text": "func NewLoadBalancersService(client *godo.Client) LoadBalancersService {\n\treturn &loadBalancersService{\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "0dd1d480d98c2e3ce7416f8b74399526", "score": "0.55808616", "text": "func (VPCLoadBalancer) cleanup(options *CleanupOptions) error {\n\tresourceLogger = logrus.WithFields(logrus.Fields{\"resource\": options.Resource.Name})\n\tresourceLogger.Info(\"Cleaning up the load balancers\")\n\tclient, err := NewVPCClient(options)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"couldn't create VPC client\")\n\t}\n\n\tvar deletedLBList []string\n\tvar errs []error\n\n\tf := func(start string) (bool, string, error) {\n\t\tlistLbOpts := &vpcv1.ListLoadBalancersOptions{}\n\t\tif start != \"\" {\n\t\t\tlistLbOpts.Start = &start\n\t\t}\n\n\t\tloadBalancers, _, err := client.ListLoadBalancers(listLbOpts)\n\t\tif err != nil {\n\t\t\treturn false, \"\", errors.Wrap(err, \"failed to list the load balancers\")\n\t\t}\n\n\t\tif loadBalancers == nil || len(loadBalancers.LoadBalancers) <= 0 {\n\t\t\tresourceLogger.Info(\"there are no available load balancers to delete\")\n\t\t\treturn true, \"\", nil\n\t\t}\n\n\t\tfor _, lb := range loadBalancers.LoadBalancers {\n\t\t\tif *lb.ResourceGroup.ID == client.ResourceGroupID {\n\t\t\t\tif _, err := client.DeleteLoadBalancer(&vpcv1.DeleteLoadBalancerOptions{\n\t\t\t\t\tID: lb.ID,\n\t\t\t\t}); err != nil {\n\t\t\t\t\tresourceLogger.WithField(\"name\", *lb.Name).Error(\"failed to delete load balancer\")\n\t\t\t\t\terrs = append(errs, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdeletedLBList = append(deletedLBList, *lb.ID)\n\t\t\t\tresourceLogger.WithField(\"name\", *lb.Name).Info(\"load balancer deletetion triggered\")\n\t\t\t}\n\t\t}\n\n\t\tif loadBalancers.Next != nil && *loadBalancers.Next.Href != \"\" {\n\t\t\treturn false, *loadBalancers.Next.Href, nil\n\t\t}\n\n\t\treturn true, \"\", nil\n\t}\n\n\tif err = pagingHelper(f); err != nil {\n\t\terrs = append(errs, errors.Wrapf(err, \"failed to delete the load balancers\"))\n\t}\n\n\t// check if the LBs are properly deleted\n\tcheckLBs(deletedLBList, client, &errs)\n\n\tif len(errs) > 0 {\n\t\treturn kerrors.NewAggregate(errs)\n\t}\n\n\tresourceLogger.Info(\"Successfully deleted the load balancers\")\n\treturn nil\n}", "title": "" }, { "docid": "d45565af68a0ec14a069a9c0c7616906", "score": "0.55804145", "text": "func (a *Client) ListLoadBalancerServices(params *ListLoadBalancerServicesParams, authInfo runtime.ClientAuthInfoWriter) (*ListLoadBalancerServicesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListLoadBalancerServicesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ListLoadBalancerServices\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/loadbalancer/services\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListLoadBalancerServicesReader{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.(*ListLoadBalancerServicesOK), nil\n\n}", "title": "" }, { "docid": "fb4abae84f35870f11fedf1a3649f1e0", "score": "0.557305", "text": "func (a *Client) ListLoadBalancerPools(params *ListLoadBalancerPoolsParams, authInfo runtime.ClientAuthInfoWriter) (*ListLoadBalancerPoolsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListLoadBalancerPoolsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ListLoadBalancerPools\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/loadbalancer/pools\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListLoadBalancerPoolsReader{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.(*ListLoadBalancerPoolsOK), nil\n\n}", "title": "" }, { "docid": "04ccbd07b2b8d1d8b55e35f00c133a63", "score": "0.5482453", "text": "func NewLoadBalancersClient(environment *azureclient.AROEnvironment, subscriptionID string, authorizer autorest.Authorizer) LoadBalancersClient {\n\tclient := mgmtnetwork.NewLoadBalancersClientWithBaseURI(environment.ResourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\n\treturn &loadBalancersClient{\n\t\tLoadBalancersClient: client,\n\t}\n}", "title": "" }, { "docid": "23987371895eccb3330575a35cdcf3f1", "score": "0.5461449", "text": "func newLoadbalancers(client *gv.Client) cloudprovider.LoadBalancer {\n\treturn &loadbalancers{client: client}\n}", "title": "" }, { "docid": "9b92d3046a8a95c0b25102ef0286c0ee", "score": "0.5448282", "text": "func (a *Alb) DescribeLoadBalancer(region, lbID, name, protocolLayer string) (*cloud.LoadBalanceObject, error) {\n\tif lbID != \"\" {\n\t\tname = lbID\n\t}\n\tswitch protocolLayer {\n\tcase constant.ProtocolLayerTransport:\n\t\tloadBalancer, err := a.sdkWrapper.GetLoadBalancer(region, name)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"get load balancer'%s/%s' failed\", region, name)\n\t\t}\n\t\tretLb := &cloud.LoadBalanceObject{\n\t\t\tLbID: *loadBalancer.Name,\n\t\t\tRegion: *loadBalancer.Location,\n\t\t\tName: *loadBalancer.Name,\n\t\t\tAzureLBType: constant.LoadBalancerTypeLoadBalancer,\n\t\t}\n\t\treturn retLb, nil\n\tcase constant.ProtocolLayerApplication:\n\t\tappGateway, err := a.sdkWrapper.GetApplicationGateway(region, name)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"get application gateway'%s/%s' failed\", region, name)\n\t\t}\n\t\tretLb := &cloud.LoadBalanceObject{\n\t\t\tLbID: *appGateway.Name,\n\t\t\tRegion: *appGateway.Location,\n\t\t\tName: *appGateway.Name,\n\t\t\tAzureLBType: constant.LoadBalancerTypeApplicationGateway,\n\t\t}\n\t\treturn retLb, nil\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unsupport protocol layer: %s\", protocolLayer)\n\t}\n}", "title": "" }, { "docid": "639ff0b0bb11d5c9b6bdfd1d8a6450e8", "score": "0.5430883", "text": "func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := listURL(c)\n\tif opts != nil {\n\t\tquery, err := opts.ToSubnetPoolListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\treturn pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn SubnetPoolPage{pagination.LinkedPageBase{PageResult: r}}\n\t})\n}", "title": "" }, { "docid": "8136c623694d2a463712a253c40f3138", "score": "0.5379947", "text": "func newLoadBalancers(resources *resources, region string) cloudprovider.LoadBalancer {\n\treturn &loadBalancers{\n\t\tresources: resources,\n\t\tregion: region,\n\t\tlbActiveTimeout: defaultActiveTimeout,\n\t\tlbActiveCheckTick: defaultActiveCheckTick,\n\t}\n}", "title": "" }, { "docid": "053f38984be5573705979dd6cd05e4fd", "score": "0.53633404", "text": "func NewLoadBalancer(db squirrel.DBProxyBeginner, mc *ModelConfig) *LoadBalancer {\n\to := new(LoadBalancer)\n\to.db = db\n\to.mc = mc\n\n\to.builder = squirrel.StatementBuilder.PlaceholderFormat(squirrel.Dollar).RunWith(db)\n\to.rec = structable.New(db, dbFlavor).Bind(\"load_balancers\", o)\n\to.State = \"initializing\"\n\treturn o\n}", "title": "" }, { "docid": "608bd786f15ffdbb50c61f1e92126a29", "score": "0.5355956", "text": "func (client *Client) DescribeVPCRelatedLoadBalancersWithCallback(request *DescribeVPCRelatedLoadBalancersRequest, callback func(response *DescribeVPCRelatedLoadBalancersResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeVPCRelatedLoadBalancersResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeVPCRelatedLoadBalancers(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "cf7a7ab18a43a2a4e7938c56c06aab33", "score": "0.53491104", "text": "func Balancers(balancers ...GroupBalancer) GroupOpt {\n\treturn groupOpt{func(cfg *groupConsumer) { cfg.balancers = balancers }}\n}", "title": "" }, { "docid": "718450216d478e2026406ea091ead1af", "score": "0.53406644", "text": "func (client *Client) DescribeVPCRelatedLoadBalancersWithChan(request *DescribeVPCRelatedLoadBalancersRequest) (<-chan *DescribeVPCRelatedLoadBalancersResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeVPCRelatedLoadBalancersResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeVPCRelatedLoadBalancers(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "811cbe675a58656f9f6b2bac8ca65761", "score": "0.53394234", "text": "func (r DescribeLoadBalancersRequest) Send(ctx context.Context) (*DescribeLoadBalancersResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DescribeLoadBalancersResponse{\n\t\tDescribeLoadBalancersOutput: r.Request.Data.(*DescribeLoadBalancersOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "1d5235a851a9bf40b556dc6265bfd176", "score": "0.53172696", "text": "func (s *ClusterScope) APIServerLoadbalancersRef() *infrav1.DOResourceReference {\n\treturn &s.DOCluster.Status.Network.APIServerLoadbalancersRef\n}", "title": "" }, { "docid": "d1b95f51220a8d67467ff7dd252a0161", "score": "0.53004587", "text": "func (l *loadbalancers) GetLoadBalancer(_ context.Context, clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error) {\n\treturn nil, false, cloud.ErrNotImplemented\n}", "title": "" }, { "docid": "dc467f0cf49d41ece141e2c9732bd84a", "score": "0.5273911", "text": "func (c *Cloud) getVpcLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error) {\n\tlbName := c.getVpcLoadBalancerName(service)\n\tklog.Infof(\"GetLoadBalancer(%v, %v)\", lbName, clusterName)\n\n\tcommand := \"STATUS-LB \" + lbName\n\toutArray, err := execVpcCommand(command, []string{\"KUBECONFIG=\" + c.Config.Kubernetes.ConfigFilePaths[0]})\n\tif err != nil {\n\t\treturn nil, false, c.Recorder.VpcLoadBalancerServiceWarningEvent(\n\t\t\tservice, GettingCloudLoadBalancerFailed, lbName,\n\t\t\tfmt.Sprintf(\"Failed executing command [%s]: %v\", command, err),\n\t\t)\n\t}\n\tfor _, line := range outArray {\n\t\tif len(line) < 2 || !strings.Contains(line, \": \") {\n\t\t\tcontinue\n\t\t}\n\t\tlineType := strings.Split(line, \":\")[0] // Grab first part of the output line\n\t\tlineData := strings.TrimPrefix(line, lineType+\": \") // Remainder of the output line\n\t\tswitch lineType {\n\t\tcase \"ERROR\":\n\t\t\tklog.Error(lineData)\n\t\t\treturn nil, false, c.Recorder.VpcLoadBalancerServiceWarningEvent(\n\t\t\t\tservice, GettingCloudLoadBalancerFailed, lbName,\n\t\t\t\tfmt.Sprintf(\"Failed getting LoadBalancer: %v\", lineData))\n\t\tcase \"INFO\":\n\t\t\tklog.Info(lineData)\n\t\tcase \"NOT_FOUND\":\n\t\t\tklog.Infof(\"Load balancer %v not found\", lbName)\n\t\t\treturn nil, false, nil\n\t\tcase \"PENDING\":\n\t\t\tklog.Warningf(\"Load balancer %s is busy: %v\", lbName, lineData)\n\t\t\tvar lbStatus *v1.LoadBalancerStatus\n\t\t\tif service.Status.LoadBalancer.Ingress != nil {\n\t\t\t\tlbStatus = getVpcLoadBalancerStatus(service, service.Status.LoadBalancer.Ingress[0].Hostname)\n\t\t\t} else {\n\t\t\t\tlbStatus = &v1.LoadBalancerStatus{}\n\t\t\t}\n\t\t\treturn lbStatus, true, nil\n\t\tcase \"SUCCESS\":\n\t\t\tklog.Infof(\"Load balancer %v found. Hostname: %v\", lbName, lineData)\n\t\t\treturn getVpcLoadBalancerStatus(service, lineData), true, nil\n\t\tdefault:\n\t\t\tklog.Warning(line)\n\t\t}\n\t}\n\treturn nil, false, c.Recorder.VpcLoadBalancerServiceWarningEvent(\n\t\tservice, GettingCloudLoadBalancerFailed, lbName,\n\t\t\"Invalid response from command\")\n}", "title": "" }, { "docid": "4ddbde55c7382d2493a8c007a32dc762", "score": "0.5267635", "text": "func (l *loadBalancers) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error) {\n\treturn nil, false, nil\n}", "title": "" }, { "docid": "80be60c14ef25332e8e54ed17a34fc33", "score": "0.5250666", "text": "func (googleloadbalancer *Googleloadbalancer) Creatloadbalancer(request interface{}) (resp interface{}, err error) {\n\n\tvar option TargetPools\n\tvar Project string\n\tvar Region string\n\n\tparam := request.(map[string]interface{})\n\n\tfor key, value := range param {\n\t\tswitch key {\n\t\tcase \"Project\":\n\t\t\tProject, _ = value.(string)\n\n\t\tcase \"Name\":\n\t\t\tname, _ := value.(string)\n\t\t\toption.Name = name\n\n\t\tcase \"Region\":\n\t\t\tRegionV, _ := value.(string)\n\t\t\tRegion = RegionV\n\n\t\tcase \"healthChecks\":\n\t\t\tHealthChecksV, _ := value.([]string)\n\t\t\toption.HealthChecks = HealthChecksV\n\n\t\tcase \"description\":\n\t\t\tDescriptionV, _ := value.(string)\n\t\t\toption.Description = DescriptionV\n\n\t\tcase \"BackupPool\":\n\t\t\tBackupPoolV, _ := value.(string)\n\t\t\toption.BackupPool = BackupPoolV\n\n\t\tcase \"failoverRatio\":\n\t\t\tFailoverRatioV, _ := value.(int)\n\t\t\toption.FailoverRatio = FailoverRatioV\n\n\t\tcase \"id\":\n\t\t\tIDV, _ := value.(string)\n\t\t\toption.ID = IDV\n\n\t\tcase \"Instances\":\n\t\t\tInstancesV, _ := value.([]string)\n\t\t\toption.Instances = InstancesV\n\n\t\tcase \"kind\":\n\t\t\tKindV, _ := value.(string)\n\t\t\toption.Kind = KindV\n\n\t\tcase \"sessionAffinity\":\n\t\t\tSessionAffinityV, _ := value.(string)\n\t\t\toption.SessionAffinity = SessionAffinityV\n\n\t\tcase \"region\":\n\t\t\tRegionV, _ := value.(string)\n\t\t\tRegion = RegionV\n\n\t\tcase \"selfLink\":\n\t\t\tSelfLinkV, _ := value.(string)\n\t\t\toption.SelfLink = SelfLinkV\n\n\t\t}\n\t}\n\n\toption.Region = \"https://www.googleapis.com/compute/v1/projects/\" + Project + \"zones/\" + Region\n\n\toption.CreationTimestamp = time.Now().UTC().Format(time.RFC3339)\n\n\tCreatloadbalancerjsonmap := make(map[string]interface{})\n\n\tCreatloadbalancerdictnoaryconvert(option, Creatloadbalancerjsonmap)\n\n\tCreatloadbalancerjson, _ := json.Marshal(Creatloadbalancerjsonmap)\n\n\tCreatloadbalancerjsonstring := string(Creatloadbalancerjson)\n\n\tvar Creatloadbalancerstringbyte = []byte(Creatloadbalancerjsonstring)\n\n\turl := \"https://www.googleapis.com/compute/beta/projects/\" + Project + \"/regions/\" + Region + \"/targetPools\"\n\n\tclient := googleauth.SignJWT()\n\n\tCreatloadbalancerrequest, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(Creatloadbalancerstringbyte))\n\n\tCreatloadbalancerrequest.Header.Set(\"Content-Type\", \"application/json\")\n\n\tCreatloadbalancerresp, err := client.Do(Creatloadbalancerrequest)\n\n\tdefer Creatloadbalancerresp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(Creatloadbalancerresp.Body)\n\n\tCreatloadbalancerresponse := make(map[string]interface{})\n\tCreatloadbalancerresponse[\"status\"] = Creatloadbalancerresp.StatusCode\n\tCreatloadbalancerresponse[\"body\"] = string(body)\n\tresp = Creatloadbalancerresponse\n\treturn resp, err\n}", "title": "" }, { "docid": "b93be1b23a5fcf9368cd75c5efff8f19", "score": "0.5243694", "text": "func (ac *Client) Healthcheck(ctx context.Context, kclient k8s.Client) error {\n\tinput := &elb.DescribeLoadBalancersInput{}\n\t_, err := ac.elbClient.DescribeLoadBalancers(input)\n\n\treturn err\n}", "title": "" }, { "docid": "7eb8bbf900a0a16ab3f0767a0fa1e6fb", "score": "0.52303153", "text": "func (c *ClientWithResponses) GetLoadBalancerWithResponse(ctx context.Context, id string) (*GetLoadBalancerResponse, error) {\n\trsp, err := c.GetLoadBalancer(ctx, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseGetLoadBalancerResponse(rsp)\n}", "title": "" }, { "docid": "40986086f1cf64a9ee8f9e11d27f1cff", "score": "0.52266747", "text": "func (*ListNetworkLoadBalancersRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_loadbalancer_v1_network_load_balancer_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "2ab31f3df8f32c326577a65cdbe0a11a", "score": "0.5203056", "text": "func (c *Client) GetLoadBalancersUsage(ctx context.Context, queryLevel usageQueryLevel, fromTime GSTime, toTime *GSTime, withoutDeleted bool, intervalVariable string) (LoadBalancersUsage, error) {\n\tqueryParam := map[string]string{\n\t\t\"from_time\": fromTime.String(),\n\t\t\"without_deleted\": strconv.FormatBool(withoutDeleted),\n\t\t\"interval_variable\": intervalVariable,\n\t}\n\tif toTime != nil {\n\t\tqueryParam[\"to_time\"] = toTime.String()\n\t}\n\tvar uri string\n\tswitch queryLevel {\n\tcase ProjectLevelUsage:\n\t\turi = apiProjectLevelUsage\n\tcase ContractLevelUsage:\n\t\turi = apiContractLevelUsage\n\tdefault:\n\t\treturn LoadBalancersUsage{}, invalidUsageQueryLevel\n\t}\n\tr := gsRequest{\n\t\turi: path.Join(uri, \"load_balancers\"),\n\t\tmethod: http.MethodGet,\n\t\tskipCheckingRequest: true,\n\t\tqueryParameters: queryParam,\n\t}\n\tvar response LoadBalancersUsage\n\terr := r.execute(ctx, *c, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "25f802279f7ff5a7eefa6805e8b573a3", "score": "0.5194347", "text": "func ParseListInstancePoolsResponse(rsp *http.Response) (*ListInstancePoolsResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &ListInstancePoolsResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest struct {\n\t\t\tInstancePools *[]InstancePool `json:\"instance-pools,omitempty\"`\n\t\t}\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "d6fa1e78d9400cec54d61e4f5b3e144c", "score": "0.51916873", "text": "func (client *Client) DescribeVPCRelatedLoadBalancers(request *DescribeVPCRelatedLoadBalancersRequest) (response *DescribeVPCRelatedLoadBalancersResponse, err error) {\n\tresponse = CreateDescribeVPCRelatedLoadBalancersResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "00f48e283c367805b6aaccb882ea02bc", "score": "0.5168025", "text": "func LookupLoadBalancer(ctx *pulumi.Context, args *GetLoadBalancerArgs) (*GetLoadBalancerResult, error) {\n\tinputs := make(map[string]interface{})\n\tif args != nil {\n\t\tinputs[\"name\"] = args.Name\n\t\tinputs[\"tags\"] = args.Tags\n\t}\n\toutputs, err := ctx.Invoke(\"aws:elasticloadbalancing/getLoadBalancer:getLoadBalancer\", inputs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &GetLoadBalancerResult{\n\t\tAccessLogs: outputs[\"accessLogs\"],\n\t\tAvailabilityZones: outputs[\"availabilityZones\"],\n\t\tConnectionDraining: outputs[\"connectionDraining\"],\n\t\tConnectionDrainingTimeout: outputs[\"connectionDrainingTimeout\"],\n\t\tCrossZoneLoadBalancing: outputs[\"crossZoneLoadBalancing\"],\n\t\tDnsName: outputs[\"dnsName\"],\n\t\tHealthCheck: outputs[\"healthCheck\"],\n\t\tIdleTimeout: outputs[\"idleTimeout\"],\n\t\tInstances: outputs[\"instances\"],\n\t\tInternal: outputs[\"internal\"],\n\t\tListeners: outputs[\"listeners\"],\n\t\tName: outputs[\"name\"],\n\t\tSecurityGroups: outputs[\"securityGroups\"],\n\t\tSourceSecurityGroup: outputs[\"sourceSecurityGroup\"],\n\t\tSourceSecurityGroupId: outputs[\"sourceSecurityGroupId\"],\n\t\tSubnets: outputs[\"subnets\"],\n\t\tTags: outputs[\"tags\"],\n\t\tZoneId: outputs[\"zoneId\"],\n\t\tId: outputs[\"id\"],\n\t}, nil\n}", "title": "" }, { "docid": "5ee5801fe0f7206a8e6eda6b1d09a14b", "score": "0.5158769", "text": "func ParseCreateLoadBalancerResponse(rsp *http.Response) (*CreateLoadBalancerResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &CreateLoadBalancerResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest Operation\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "01a1a12270c37fa2f18ce8ffa50f477b", "score": "0.5154426", "text": "func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersPostExecute(r ApiDatacentersApplicationloadbalancersPostRequest) (ApplicationLoadBalancer, *APIResponse, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ApplicationLoadBalancer\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersPost\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/datacenters/{datacenterId}/applicationloadbalancers\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(r.datacenterId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.applicationLoadBalancer == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"applicationLoadBalancer is required and must be specified\")\n\t}\n\n\tif r.pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*r.pretty, \"\"))\n\t} else {\n\t\tdefaultQueryParam := a.client.cfg.DefaultQueryParams.Get(\"pretty\")\n\t\tif defaultQueryParam == \"\" {\n\t\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(true, \"\"))\n\t\t}\n\t}\n\tif r.depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*r.depth, \"\"))\n\t} else {\n\t\tdefaultQueryParam := a.client.cfg.DefaultQueryParams.Get(\"depth\")\n\t\tif defaultQueryParam == \"\" {\n\t\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(0, \"\"))\n\t\t}\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.xContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*r.xContractNumber, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.applicationLoadBalancer\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Token Authentication\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req)\n\n\tlocalVarAPIResponse := &APIResponse{\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tRequestTime: httpRequestTime,\n\t\tOperation: \"DatacentersApplicationloadbalancersPost\",\n\t}\n\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tstatusCode: localVarHTTPResponse.StatusCode,\n\t\t\tbody: localVarBody,\n\t\t\terror: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)),\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error())\n\t\t\treturn localVarReturnValue, localVarAPIResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tstatusCode: localVarHTTPResponse.StatusCode,\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "47b42a407bfe4a9fd05dd0a057d93d8b", "score": "0.5099429", "text": "func (p *LoadBalancersCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "e58162d73fbfde60a828e7757dca180c", "score": "0.5098535", "text": "func TestLoadBalancer(t *testing.T) {\n\n\tmgr, err := NewMockClientLoadBalancerMgr()\n\tif err != nil {\n\t\tt.Fatal(fmt.Sprintf(\"create client manager fail. [%s]\\n\", err.Error()))\n\t}\n\n\tservice := &v1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: \"default\",\n\t\t\tName: \"service-test\",\n\t\t\tUID: types.UID(\"1f11ce6d-5782-11ea-ae49-00163f00bfd3\"),\n\t\t\tAnnotations: map[string]string{},\n\t\t},\n\t\tSpec: v1.ServiceSpec{\n\t\t\tType: \"LoadBalancer\",\n\t\t},\n\t}\n\t//prid := \"cn-hangzhou.i-bp15ekjuuvrwuxjowxcc\"\n\t/*node := []*v1.Node{\n\t\t{\n\t\t\tObjectMeta: metav1.ObjectMeta{Name: prid},\n\t\t\tSpec: v1.NodeSpec{\n\t\t\t\tProviderID: prid,\n\t\t\t},\n\t\t},\n\t}*/\n\t//test findLoadBalancer\n\texists, lbs, err := mgr.LoadBalancers().findLoadBalancer(service)\n\tif err != nil {\n\t\tt.Errorf(\"findLoadBalancer error: %s\\n\", err.Error())\n\t}\n\tif exists {\n\t\tfmt.Println(\"findLoadBalancer\", lbs)\n\t} else {\n\t\tfmt.Println(\"findLoadBalancer: no loadbalancer\")\n\t}\n\n\tdef, _ := ExtractServiceAnnotation(service)\n\tfmt.Println(def)\n\tfmt.Println(def.Loadbalancerid)\n\n\t//test findLoadBalancerByID\n\tlbid := \"lb-bp1umlml75qdkig2ggf5y\"\n\texists, lbs, err = mgr.LoadBalancers().findLoadBalancerByID(lbid)\n\tif err != nil {\n\t\tt.Errorf(\"findLoadBalancer by id error: %s\\n\", err.Error())\n\t}\n\tif exists {\n\t\tfmt.Println(\"findLoadBalancer by id :\", lbs)\n\t} else {\n\t\tfmt.Println(\"findLoadBalancer by id: no loadbalancer\")\n\t}\n\n\t/*test ensureLoadBalancer\n\texists, lbs, err = mgr.LoadBalancers().ensureLoadBalancer(service, node)\n\tif err != nil {\n\t\tt.Errorf(\"ensureLoadBalancer error: %s\\n\", err.Error())\n\t}\n\tif exists {\n\t\tfmt.Println(\"ensureLoadBalancer:\", lbs)\n\t} else {\n\t\tfmt.Println(\"ensureLoadBalancer: no loadbalancer\")\n\t}*/\n}", "title": "" }, { "docid": "2248686c1cc0d8152100b742c607f8a2", "score": "0.5095712", "text": "func (vs *VSphere) LoadBalancer() (cloudprovider.LoadBalancer, bool) {\n\tif vs.isLoadBalancerSupportEnabled() {\n\t\treturn vs.loadbalancer, true\n\t}\n\tklog.Warning(\"The vSphere cloud provider does not support load balancers\")\n\treturn nil, false\n}", "title": "" }, { "docid": "5f22e6bdda75b5c59fa3c6bc09149149", "score": "0.5077269", "text": "func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := listURL(c)\n\tif opts != nil {\n\t\tquery, err := opts.ToSubnetListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\treturn pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn SubnetPage{pagination.LinkedPageBase{PageResult: r}}\n\t})\n}", "title": "" }, { "docid": "39d814a03a800deaef2fe5cc243ef591", "score": "0.506797", "text": "func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := listURL(c)\n\tif opts != nil {\n\t\tquery, err := opts.ToSubnetListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\n\treturn pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn SubnetPage{pagination.LinkedPageBase{PageResult: r}}\n\t})\n}", "title": "" }, { "docid": "4d15412150e16e3495a508c2650e932a", "score": "0.50581646", "text": "func CreateDescribeLoadBalancerAttributeResponse() (response *DescribeLoadBalancerAttributeResponse) {\n\tresponse = &DescribeLoadBalancerAttributeResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "a4cfcb661ac2f74331f6e65e2e7d5c4e", "score": "0.5044945", "text": "func (*AwsLoadBalancerPolicyImporter) Describe(meta interface{}) ([]*core.Instance, error) {\n\tsvc := meta.(*AWSClient).elbconn\n\n\telbs := make([]*elb.LoadBalancerDescription, 0)\n\terr := svc.DescribeLoadBalancersPages(nil, func(o *elb.DescribeLoadBalancersOutput, lastPage bool) bool {\n\t\telbs = append(elbs, o.LoadBalancerDescriptions...)\n\t\treturn true // continue paging\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances := make([]*core.Instance, 0)\n\tfor _, instance := range elbs {\n\t\tinput := &elb.DescribeLoadBalancerPoliciesInput{\n\t\t\tLoadBalancerName: instance.LoadBalancerName,\n\t\t}\n\t\tresult, err := svc.DescribeLoadBalancerPolicies(input)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, policy := range result.PolicyDescriptions {\n\t\t\tid := aws.StringValue(instance.LoadBalancerName) + \":\" + aws.StringValue(policy.PolicyName)\n\t\t\ti := &core.Instance{\n\t\t\t\tName: core.Format(id),\n\t\t\t\tID: id,\n\t\t\t}\n\t\t\tinstances = append(instances, i)\n\t\t}\n\t}\n\n\treturn instances, nil\n}", "title": "" }, { "docid": "479922f6add775e036c0bfbf2b3faea5", "score": "0.50312805", "text": "func CreateDescribeLoadBalancerListenersExResponse() (response *DescribeLoadBalancerListenersExResponse) {\n\tresponse = &DescribeLoadBalancerListenersExResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "37fa635d859f80bc0af8bde01e0aef1d", "score": "0.5026821", "text": "func (nc *client) ListLoadBalancerPools() (*models.LbPoolListResult, error) {\n\tparams := svc.NewListLoadBalancerPoolsParams()\n\tres, err := nc.client.Services.ListLoadBalancerPools(params, nc.auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.Payload, nil\n}", "title": "" }, { "docid": "6c64d711914385f78f87cd2ac4d0cfbd", "score": "0.5010146", "text": "func (p *elbPlugin) Routes() ([]loadbalancer.Route, error) {\n\toutput, err := p.client.DescribeLoadBalancers(&elb.DescribeLoadBalancersInput{\n\t\tLoadBalancerNames: []*string{aws.String(p.name)},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\troutes := []loadbalancer.Route{}\n\n\tif len(output.LoadBalancerDescriptions) > 0 && output.LoadBalancerDescriptions[0].ListenerDescriptions != nil {\n\t\tfor _, listener := range output.LoadBalancerDescriptions[0].ListenerDescriptions {\n\t\t\troutes = append(routes, loadbalancer.Route{\n\t\t\t\tPort: int(*listener.Listener.InstancePort),\n\t\t\t\tProtocol: loadbalancer.ProtocolFromString(*listener.Listener.Protocol),\n\t\t\t\tLoadBalancerPort: int(*listener.Listener.LoadBalancerPort),\n\t\t\t\tCertificate: listener.Listener.SSLCertificateId,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn routes, nil\n}", "title": "" }, { "docid": "49125c0ad41326fb8e75af04b9bcbabd", "score": "0.5007214", "text": "func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersGetExecute(r ApiDatacentersApplicationloadbalancersGetRequest) (ApplicationLoadBalancers, *APIResponse, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ApplicationLoadBalancers\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersGet\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/datacenters/{datacenterId}/applicationloadbalancers\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"datacenterId\"+\"}\", _neturl.PathEscape(parameterToString(r.datacenterId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*r.pretty, \"\"))\n\t} else {\n\t\tdefaultQueryParam := a.client.cfg.DefaultQueryParams.Get(\"pretty\")\n\t\tif defaultQueryParam == \"\" {\n\t\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(true, \"\"))\n\t\t}\n\t}\n\tif r.depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*r.depth, \"\"))\n\t} else {\n\t\tdefaultQueryParam := a.client.cfg.DefaultQueryParams.Get(\"depth\")\n\t\tif defaultQueryParam == \"\" {\n\t\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(0, \"\"))\n\t\t}\n\t}\n\tif r.offset != nil {\n\t\tlocalVarQueryParams.Add(\"offset\", parameterToString(*r.offset, \"\"))\n\t} else {\n\t\tdefaultQueryParam := a.client.cfg.DefaultQueryParams.Get(\"offset\")\n\t\tif defaultQueryParam == \"\" {\n\t\t\tlocalVarQueryParams.Add(\"offset\", parameterToString(0, \"\"))\n\t\t}\n\t}\n\tif r.limit != nil {\n\t\tlocalVarQueryParams.Add(\"limit\", parameterToString(*r.limit, \"\"))\n\t} else {\n\t\tdefaultQueryParam := a.client.cfg.DefaultQueryParams.Get(\"limit\")\n\t\tif defaultQueryParam == \"\" {\n\t\t\tlocalVarQueryParams.Add(\"limit\", parameterToString(1000, \"\"))\n\t\t}\n\t}\n\tif r.orderBy != nil {\n\t\tlocalVarQueryParams.Add(\"orderBy\", parameterToString(*r.orderBy, \"\"))\n\t}\n\tif r.maxResults != nil {\n\t\tlocalVarQueryParams.Add(\"maxResults\", parameterToString(*r.maxResults, \"\"))\n\t}\n\tif len(r.filters) > 0 {\n\t\tfor k, v := range r.filters {\n\t\t\tfor _, iv := range v {\n\t\t\t\tlocalVarQueryParams.Add(k, iv)\n\t\t\t}\n\t\t}\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.xContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*r.xContractNumber, \"\")\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Token Authentication\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req)\n\n\tlocalVarAPIResponse := &APIResponse{\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tRequestTime: httpRequestTime,\n\t\tOperation: \"DatacentersApplicationloadbalancersGet\",\n\t}\n\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tstatusCode: localVarHTTPResponse.StatusCode,\n\t\t\tbody: localVarBody,\n\t\t\terror: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)),\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error())\n\t\t\treturn localVarReturnValue, localVarAPIResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tstatusCode: localVarHTTPResponse.StatusCode,\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "618e1be88e3d2c28aa5c21e80a529413", "score": "0.49989066", "text": "func (o GetLoadBalancersResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLoadBalancersResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "49eacdd4a6aa6271afcf88af5e4b4262", "score": "0.49821708", "text": "func (o IngressStatusOutput) LoadBalancer() corev1.LoadBalancerStatusPtrOutput {\n\treturn o.ApplyT(func(v IngressStatus) *corev1.LoadBalancerStatus { return v.LoadBalancer }).(corev1.LoadBalancerStatusPtrOutput)\n}", "title": "" }, { "docid": "efc5c850b5a12479687ef958f024733a", "score": "0.49753606", "text": "func (nc *client) ListLoadBalancerServices() (*models.LbServiceListResult, error) {\n\tparams := svc.NewListLoadBalancerServicesParams()\n\tres, err := nc.client.Services.ListLoadBalancerServices(params, nc.auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.Payload, nil\n}", "title": "" }, { "docid": "34f1a74bf8122928e7cb84189da0c691", "score": "0.4974264", "text": "func CreateDescribeVPCRelatedLoadBalancersRequest() (request *DescribeVPCRelatedLoadBalancersRequest) {\n\trequest = &DescribeVPCRelatedLoadBalancersRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Slb\", \"2014-05-15\", \"DescribeVPCRelatedLoadBalancers\", \"slb\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "f03e6b3cafc820a6d91b0ff32736fce1", "score": "0.49732724", "text": "func (page AgentPoolListResultPage) Response() AgentPoolListResult {\n\treturn page.aplr\n}", "title": "" }, { "docid": "f49fc4e8d1954e0533a3bb05c376502f", "score": "0.49560404", "text": "func (*LoadBalanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_lb_v1_load_balancer_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "b97fbe5a8c27dd94303cc3b4f6c97aae", "score": "0.4946924", "text": "func (a *Client) ListLoadBalancerVirtualServers(params *ListLoadBalancerVirtualServersParams, authInfo runtime.ClientAuthInfoWriter) (*ListLoadBalancerVirtualServersOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListLoadBalancerVirtualServersParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ListLoadBalancerVirtualServers\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/loadbalancer/virtual-servers\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListLoadBalancerVirtualServersReader{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.(*ListLoadBalancerVirtualServersOK), nil\n\n}", "title": "" }, { "docid": "30dd8b4676ce0d2f96a4a14240231aaf", "score": "0.4938619", "text": "func (m *BalancerManager) AddBalancers(balancers []*kglb_pb.BalancerState) error {\n\tfor _, balancer := range balancers {\n\t\tif err := m.AddBalancer(balancer); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to add balancer: %+v\", balancer)\n\t\t} else {\n\t\t\tdlog.Infof(\"Balancer has been added: %s\", balancer.GetName())\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7829c4b18a766927255180208d7f43e", "score": "0.49223146", "text": "func RunLoadBalancerGet(c *CmdConfig) error {\n\terr := ensureOneArg(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tid := c.Args[0]\n\n\tlbs := c.LoadBalancers()\n\tlb, err := lbs.Get(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\titem := &displayers.LoadBalancer{LoadBalancers: do.LoadBalancers{*lb}}\n\treturn c.Display(item)\n}", "title": "" }, { "docid": "cc055edf041754882575f8f5df83c72f", "score": "0.49162292", "text": "func (l *loadbalancers) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error) {\n\tif service.Spec.LoadBalancerClass != nil {\n\t\treturn nil, false, nil\n\t}\n\n\tlb, err := l.fetchLoadBalancer(ctx, clusterName, service)\n\tif err != nil {\n\t\tif err == LoadBalancerNotFound {\n\t\t\tklog.Infof(\"no load balancer found for service %s\", service.Name)\n\t\t\treturn nil, false, nil\n\t\t}\n\n\t\tklog.Errorf(\"error getting load balancer for service %s: %v\", service.Name, err)\n\t\treturn nil, false, err\n\t}\n\n\tstatus := &v1.LoadBalancerStatus{}\n\tstatus.Ingress = make([]v1.LoadBalancerIngress, len(lb.IP))\n\tfor idx, ip := range lb.IP {\n\t\tif getUseHostname(service) {\n\t\t\tstatus.Ingress[idx].Hostname = ip.Reverse\n\t\t} else {\n\t\t\tstatus.Ingress[idx].IP = ip.IPAddress\n\t\t}\n\t}\n\n\treturn status, true, nil\n}", "title": "" }, { "docid": "cc055edf041754882575f8f5df83c72f", "score": "0.49162292", "text": "func (l *loadbalancers) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error) {\n\tif service.Spec.LoadBalancerClass != nil {\n\t\treturn nil, false, nil\n\t}\n\n\tlb, err := l.fetchLoadBalancer(ctx, clusterName, service)\n\tif err != nil {\n\t\tif err == LoadBalancerNotFound {\n\t\t\tklog.Infof(\"no load balancer found for service %s\", service.Name)\n\t\t\treturn nil, false, nil\n\t\t}\n\n\t\tklog.Errorf(\"error getting load balancer for service %s: %v\", service.Name, err)\n\t\treturn nil, false, err\n\t}\n\n\tstatus := &v1.LoadBalancerStatus{}\n\tstatus.Ingress = make([]v1.LoadBalancerIngress, len(lb.IP))\n\tfor idx, ip := range lb.IP {\n\t\tif getUseHostname(service) {\n\t\t\tstatus.Ingress[idx].Hostname = ip.Reverse\n\t\t} else {\n\t\t\tstatus.Ingress[idx].IP = ip.IPAddress\n\t\t}\n\t}\n\n\treturn status, true, nil\n}", "title": "" }, { "docid": "736ad7e4ba6cc86e9681a24fa8443e99", "score": "0.49097595", "text": "func (c *Cloud) ensureVpcLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) {\n\tlbName := c.getVpcLoadBalancerName(service)\n\tklog.Infof(\n\t\t\"EnsureLoadBalancer(%v, %v, %v) - Service Name: %v - Selector: %v\",\n\t\tlbName,\n\t\tclusterName,\n\t\tservice.Annotations,\n\t\tservice.Name,\n\t\tservice.Spec.Selector,\n\t)\n\n\tcommand := c.determineCreateCommand(service, lbName)\n\toutArray, err := execVpcCommand(command, c.determineVpcEnvSettings(service))\n\tif err != nil {\n\t\treturn nil, c.Recorder.VpcLoadBalancerServiceWarningEvent(\n\t\t\tservice, CreatingCloudLoadBalancerFailed, lbName,\n\t\t\tfmt.Sprintf(\"Failed executing command [%s]: %v\", command, err),\n\t\t)\n\t}\n\tfor _, line := range outArray {\n\t\tif len(line) < 2 || !strings.Contains(line, \": \") {\n\t\t\tcontinue\n\t\t}\n\t\tlineType := strings.Split(line, \":\")[0] // Grab first part of the output line\n\t\tlineData := strings.TrimPrefix(line, lineType+\": \") // Remainder of the output line\n\t\tswitch lineType {\n\t\tcase \"ERROR\":\n\t\t\tklog.Error(lineData)\n\t\t\treturn nil, c.Recorder.VpcLoadBalancerServiceWarningEvent(\n\t\t\t\tservice, CreatingCloudLoadBalancerFailed, lbName,\n\t\t\t\tfmt.Sprintf(\"Failed ensuring LoadBalancer: %v\", lineData))\n\t\tcase \"INFO\":\n\t\t\tklog.Info(lineData)\n\t\tcase \"PENDING\":\n\t\t\tklog.Warningf(\"Load balancer %v is busy: %v\", lbName, lineData) // Not sure what to return in this case\n\t\t\tif isFeatureEnabled(service, networkLoadBalancerFeature) {\n\t\t\t\t// For NLB, we are going to return PENDING until the VPC LB goes to online/active state.\n\t\t\t\t// Don't generate a WARNING event for this case since this is part of the normal Create NLB code path\n\t\t\t\t//\n\t\t\t\t// Note: A warning event IS still be generated by Kubernetes because we are returning an error back on this EnsureLoadBalancer function\n\t\t\t\tmessage := fmt.Sprintf(\"%v for service %v is busy: %v\",\n\t\t\t\t\tlbName, types.NamespacedName{Namespace: service.ObjectMeta.Namespace, Name: service.ObjectMeta.Name}, lineData)\n\t\t\t\treturn nil, errors.New(message)\n\t\t\t}\n\t\t\treturn nil, c.Recorder.VpcLoadBalancerServiceWarningEvent(\n\t\t\t\tservice, CreatingCloudLoadBalancerFailed, lbName,\n\t\t\t\tfmt.Sprintf(\"LoadBalancer is busy: %v\", lineData))\n\t\tcase \"SUCCESS\":\n\t\t\tklog.Infof(\"Load balancer %v created. Hostname: %v\", lbName, lineData)\n\t\t\treturn getVpcLoadBalancerStatus(service, lineData), nil\n\t\tdefault:\n\t\t\tklog.Warning(line)\n\t\t}\n\t}\n\treturn nil, c.Recorder.VpcLoadBalancerServiceWarningEvent(\n\t\tservice, CreatingCloudLoadBalancerFailed, lbName,\n\t\t\"Invalid response from command\")\n}", "title": "" }, { "docid": "b8c9e572947ff470cf383e796575dbf3", "score": "0.49097216", "text": "func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersGet(ctx _context.Context, datacenterId string) ApiDatacentersApplicationloadbalancersGetRequest {\n\treturn ApiDatacentersApplicationloadbalancersGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tdatacenterId: datacenterId,\n\t\tfilters: _neturl.Values{},\n\t}\n}", "title": "" }, { "docid": "c5fc734e8d9bda2d551560c58bd2e27b", "score": "0.49061728", "text": "func ListELBV2s(cloud fi.Cloud, clusterName string) ([]*resources.Resource, error) {\n\telbv2s, _, err := DescribeELBV2s(cloud)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resourceTrackers []*resources.Resource\n\tfor _, elb := range elbv2s {\n\t\tid := aws.StringValue(elb.LoadBalancerName)\n\t\tresourceTracker := &resources.Resource{\n\t\t\tName: id,\n\t\t\tID: string(*elb.LoadBalancerArn),\n\t\t\tType: TypeLoadBalancer,\n\t\t\tDeleter: DeleteELBV2,\n\t\t\tDumper: DumpELB,\n\t\t\tObj: elb,\n\t\t}\n\n\t\tvar blocks []string\n\t\tfor _, sg := range elb.SecurityGroups {\n\t\t\tblocks = append(blocks, \"security-group:\"+aws.StringValue(sg))\n\t\t}\n\n\t\tblocks = append(blocks, \"vpc:\"+aws.StringValue(elb.VpcId))\n\n\t\tresourceTracker.Blocks = blocks\n\n\t\tresourceTrackers = append(resourceTrackers, resourceTracker)\n\t}\n\n\treturn resourceTrackers, nil\n}", "title": "" }, { "docid": "3500ceca932cb93755e29d6ad26aa471", "score": "0.4900175", "text": "func (o IngressStatusPtrOutput) LoadBalancer() corev1.LoadBalancerStatusPtrOutput {\n\treturn o.ApplyT(func(v IngressStatus) *corev1.LoadBalancerStatus { return v.LoadBalancer }).(corev1.LoadBalancerStatusPtrOutput)\n}", "title": "" }, { "docid": "8ea589e11d421cfccdf304491d214c5b", "score": "0.48649734", "text": "func (info *BaseServiceInfo) LoadBalancerSourceRanges() []string {\n\treturn info.loadBalancerSourceRanges\n}", "title": "" }, { "docid": "919ffdd2f391817401bae476933fd60f", "score": "0.48490638", "text": "func (client VirtualNetworkClient) ListSubnets(ctx context.Context, request ListSubnetsRequest) (response ListSubnetsResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listSubnets, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = ListSubnetsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListSubnetsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListSubnetsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListSubnetsResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "cd75c05e6ba0a729dd2f9ce87d861d4e", "score": "0.48358706", "text": "func getVpcLoadBalancerStatus(service *v1.Service, hostname string) *v1.LoadBalancerStatus {\n\tlbStatus := &v1.LoadBalancerStatus{}\n\tif strings.Contains(hostname, \",\") {\n\t\tipArray := strings.Split(hostname, \",\")\n\t\tfor _, ipArrayItem := range ipArray {\n\t\t\tipArrayItem = strings.TrimSpace(ipArrayItem)\n\t\t\tingressObject := v1.LoadBalancerIngress{IP: ipArrayItem}\n\t\t\tlbStatus.Ingress = append(lbStatus.Ingress, ingressObject)\n\t\t}\n\t\treturn lbStatus\n\t}\n\tlbStatus.Ingress = []v1.LoadBalancerIngress{{Hostname: hostname}}\n\tif isFeatureEnabled(service, networkLoadBalancerFeature) {\n\t\t// IF the hostname and static IP address are already stored in the service, then don't\n\t\t// repeat the overhead of the DNS hostname resolution again\n\t\tif service.Status.LoadBalancer.Ingress != nil &&\n\t\t\tlen(service.Status.LoadBalancer.Ingress) == 1 &&\n\t\t\tservice.Status.LoadBalancer.Ingress[0].Hostname == hostname &&\n\t\t\tservice.Status.LoadBalancer.Ingress[0].IP != \"\" {\n\t\t\tlbStatus.Ingress[0].IP = service.Status.LoadBalancer.Ingress[0].IP\n\t\t} else {\n\t\t\tipAddrs, err := net.LookupIP(hostname)\n\t\t\tif err == nil && len(ipAddrs) > 0 && len(ipAddrs[0]) == net.IPv4len {\n\t\t\t\tlbStatus.Ingress[0].IP = ipAddrs[0].String()\n\t\t\t}\n\t\t}\n\t}\n\treturn lbStatus\n}", "title": "" }, { "docid": "2a6972c35ca4f1230edf25b2d5e68a32", "score": "0.48322248", "text": "func GetLoadbalancerByName(client *gophercloud.ServiceClient, name string) (*loadbalancers.LoadBalancer, error) {\n\topts := loadbalancers.ListOpts{\n\t\tName: name,\n\t}\n\tmc := metrics.NewMetricContext(\"loadbalancer\", \"list\")\n\tallPages, err := loadbalancers.List(client, opts).AllPages()\n\tif mc.ObserveRequest(err) != nil {\n\t\treturn nil, err\n\t}\n\tloadbalancerList, err := loadbalancers.ExtractLoadBalancers(allPages)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(loadbalancerList) > 1 {\n\t\treturn nil, cpoerrors.ErrMultipleResults\n\t}\n\tif len(loadbalancerList) == 0 {\n\t\treturn nil, cpoerrors.ErrNotFound\n\t}\n\n\treturn &loadbalancerList[0], nil\n}", "title": "" }, { "docid": "8fd93cb0e5d6cb5f41187dd4408193ec", "score": "0.48281294", "text": "func (c *Client) GetLoadBalancerEventList(ctx context.Context, id string) ([]Event, error) {\n\tif !isValidUUID(id) {\n\t\treturn nil, errors.New(\"'id' is invalid\")\n\t}\n\tr := gsRequest{\n\t\turi: path.Join(apiLoadBalancerBase, id, \"events\"),\n\t\tmethod: http.MethodGet,\n\t\tskipCheckingRequest: true,\n\t}\n\tvar response EventList\n\tvar loadBalancerEvents []Event\n\terr := r.execute(ctx, *c, &response)\n\tfor _, properties := range response.List {\n\t\tloadBalancerEvents = append(loadBalancerEvents, Event{Properties: properties})\n\t}\n\treturn loadBalancerEvents, err\n}", "title": "" }, { "docid": "1845108c1c723cf18769e9a3372dede9", "score": "0.482607", "text": "func (balancer *LoadBalancer_Spec_ARM) GetType() string {\n\treturn \"Microsoft.Network/loadBalancers\"\n}", "title": "" }, { "docid": "bad6b106af95a1e652733dd549da783a", "score": "0.4817733", "text": "func GetElasticLoadBalancingLoadBalancerConfig(e *elasticloadbalancing.LoadBalancer) []AWSResourceConfig {\n\tcf := ElasticLoadBalancingLoadBalancerConfig{\n\t\tConfig: Config{\n\t\t\tName: e.LoadBalancerName,\n\t\t\tTags: e.Tags,\n\t\t},\n\t}\n\n\tif e.AccessLoggingPolicy != nil {\n\t\tcf.AccessLoggingPolicy = ELBAccessLoggingPolicyConfig{\n\t\t\tEnabled: e.AccessLoggingPolicy.Enabled,\n\t\t}\n\t}\n\n\tif e.Listeners != nil {\n\t\tlc := make([]ELBListenerConfig, 0)\n\t\tfor _, listener := range e.Listeners {\n\t\t\tlc = append(lc, ELBListenerConfig{\n\t\t\t\tInstanceProtocol: listener.InstanceProtocol,\n\t\t\t\tLBProtocol: listener.Protocol,\n\t\t\t})\n\t\t}\n\t\tcf.Listeners = lc\n\t}\n\n\treturn []AWSResourceConfig{{\n\t\tResource: cf,\n\t\tMetadata: e.AWSCloudFormationMetadata,\n\t}}\n}", "title": "" }, { "docid": "107a6d26d381dd6d3a1047558b41e972", "score": "0.48165682", "text": "func LoadBalancer() *Command {\n\tcmd := &Command{\n\t\tCommand: &cobra.Command{\n\t\t\tUse: \"load-balancer\",\n\t\t\tShort: \"Display commands to manage load balancers\",\n\t\t\tLong: `The sub-commands of ` + \"`\" + `doctl compute load-balancer` + \"`\" + ` manage your load balancers.\n\nWith the load-balancer command, you can list, create, or delete load balancers, and manage their configuration details.`,\n\t\t},\n\t}\n\n\tforwardingRulesTxt := \"A comma-separated list of key-value pairs representing forwarding rules, which define how traffic is routed, e.g.: `entry_protocol:tcp,entry_port:3306,target_protocol:tcp,target_port:3306`.\"\n\tCmdBuilder(cmd, RunLoadBalancerGet, \"get <id>\", \"Retrieve a load balancer\", \"Use this command to retrieve information about a load balancer instance, including:\\n\\n\"+lbDetail, Writer,\n\t\taliasOpt(\"g\"), displayerType(&displayers.LoadBalancer{}))\n\n\tcmdRecordCreate := CmdBuilder(cmd, RunLoadBalancerCreate, \"create\",\n\t\t\"Create a new load balancer\", \"Use this command to create a new load balancer on your account. Valid forwarding rules are:\\n\"+forwardingDetail, Writer, aliasOpt(\"c\"))\n\tAddStringFlag(cmdRecordCreate, doctl.ArgLoadBalancerName, \"\", \"\",\n\t\t\"The load balancer's name\", requiredOpt())\n\tAddStringFlag(cmdRecordCreate, doctl.ArgRegionSlug, \"\", \"\",\n\t\t\"The load balancer's region, e.g.: `nyc1`\", requiredOpt())\n\tAddStringFlag(cmdRecordCreate, doctl.ArgSizeSlug, \"\", \"\",\n\t\tfmt.Sprintf(\"The load balancer's size, e.g.: `lb-small`. Only one of %s and %s should be used\", doctl.ArgSizeSlug, doctl.ArgSizeUnit))\n\tAddIntFlag(cmdRecordCreate, doctl.ArgSizeUnit, \"\", 0,\n\t\tfmt.Sprintf(\"The load balancer's size, e.g.: 1. Only one of %s and %s should be used\", doctl.ArgSizeUnit, doctl.ArgSizeSlug))\n\tAddStringFlag(cmdRecordCreate, doctl.ArgVPCUUID, \"\", \"\", \"The UUID of the VPC to create the load balancer in\")\n\tAddStringFlag(cmdRecordCreate, doctl.ArgLoadBalancerAlgorithm, \"\",\n\t\t\"round_robin\", \"This field has been deprecated. You can no longer specify an algorithm for load balancers.\")\n\tAddBoolFlag(cmdRecordCreate, doctl.ArgRedirectHTTPToHTTPS, \"\", false,\n\t\t\"Redirects HTTP requests to the load balancer on port 80 to HTTPS on port 443\")\n\tAddBoolFlag(cmdRecordCreate, doctl.ArgEnableProxyProtocol, \"\", false,\n\t\t\"enable proxy protocol\")\n\tAddBoolFlag(cmdRecordCreate, doctl.ArgEnableBackendKeepalive, \"\", false,\n\t\t\"enable keepalive connections to backend target droplets\")\n\tAddBoolFlag(cmdRecordCreate, doctl.ArgDisableLetsEncryptDNSRecords, \"\", false,\n\t\t\"disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer\")\n\tAddStringFlag(cmdRecordCreate, doctl.ArgTagName, \"\", \"\", \"droplet tag name\")\n\tAddStringSliceFlag(cmdRecordCreate, doctl.ArgDropletIDs, \"\", []string{},\n\t\t\"A comma-separated list of Droplet IDs to add to the load balancer, e.g.: `12,33`\")\n\tAddStringFlag(cmdRecordCreate, doctl.ArgStickySessions, \"\", \"\",\n\t\t\"A comma-separated list of key-value pairs representing a list of active sessions, e.g.: `type:cookies, cookie_name:DO-LB, cookie_ttl_seconds:5`\")\n\tAddStringFlag(cmdRecordCreate, doctl.ArgHealthCheck, \"\", \"\",\n\t\t\"A comma-separated list of key-value pairs representing recent health check results, e.g.: `protocol:http,port:80,path:/index.html,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:5,unhealthy_threshold:3`\")\n\tAddStringFlag(cmdRecordCreate, doctl.ArgForwardingRules, \"\", \"\",\n\t\tforwardingRulesTxt)\n\tAddBoolFlag(cmdRecordCreate, doctl.ArgCommandWait, \"\", false, \"Boolean that specifies whether to wait for a load balancer to complete before returning control to the terminal\")\n\tAddStringFlag(cmdRecordCreate, doctl.ArgProjectID, \"\", \"\", \"Indicates which project to associate the Load Balancer with. If not specified, the Load Balancer will be placed in your default project.\")\n\tAddIntFlag(cmdRecordCreate, doctl.ArgHTTPIdleTimeoutSeconds, \"\", 0, \"HTTP idle timeout that configures the idle timeout for http connections on the load balancer\")\n\tAddStringSliceFlag(cmdRecordCreate, doctl.ArgAllowList, \"\", []string{},\n\t\t\"A comma-separated list of ALLOW rules for the load balancer, e.g.: `ip:1.2.3.4,cidr:1.2.0.0/16`\")\n\tAddStringSliceFlag(cmdRecordCreate, doctl.ArgDenyList, \"\", []string{},\n\t\t\"A comma-separated list of DENY rules for the load balancer, e.g.: `ip:1.2.3.4,cidr:1.2.0.0/16`\")\n\n\tcmdRecordUpdate := CmdBuilder(cmd, RunLoadBalancerUpdate, \"update <id>\",\n\t\t\"Update a load balancer's configuration\", `Use this command to update the configuration of a specified load balancer.`, Writer, aliasOpt(\"u\"))\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgLoadBalancerName, \"\", \"\",\n\t\t\"The load balancer's name\")\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgRegionSlug, \"\", \"\",\n\t\t\"The load balancer's region, e.g.: `nyc1`\")\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgSizeSlug, \"\", \"\",\n\t\tfmt.Sprintf(\"The load balancer's size, e.g.: `lb-small`. Only one of %s and %s should be used\", doctl.ArgSizeSlug, doctl.ArgSizeUnit))\n\tAddIntFlag(cmdRecordUpdate, doctl.ArgSizeUnit, \"\", 0,\n\t\tfmt.Sprintf(\"The load balancer's size, e.g.: 1. Only one of %s and %s should be used\", doctl.ArgSizeUnit, doctl.ArgSizeSlug))\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgVPCUUID, \"\", \"\", \"The UUID of the VPC to create the load balancer in\")\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgLoadBalancerAlgorithm, \"\",\n\t\t\"round_robin\", \"This field has been deprecated. You can no longer specify an algorithm for load balancers.\")\n\tAddBoolFlag(cmdRecordUpdate, doctl.ArgRedirectHTTPToHTTPS, \"\", false,\n\t\t\"Flag to redirect HTTP requests to the load balancer on port 80 to HTTPS on port 443\")\n\tAddBoolFlag(cmdRecordUpdate, doctl.ArgEnableProxyProtocol, \"\", false,\n\t\t\"enable proxy protocol\")\n\tAddBoolFlag(cmdRecordUpdate, doctl.ArgEnableBackendKeepalive, \"\", false,\n\t\t\"enable keepalive connections to backend target droplets\")\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgTagName, \"\", \"\", \"Assigns Droplets with the specified tag to the load balancer\")\n\tAddStringSliceFlag(cmdRecordUpdate, doctl.ArgDropletIDs, \"\", []string{},\n\t\t\"A comma-separated list of Droplet IDs, e.g.: `215,378`\")\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgStickySessions, \"\", \"\",\n\t\t\"A comma-separated list of key-value pairs representing a list of active sessions, e.g.: `type:cookies, cookie_name:DO-LB, cookie_ttl_seconds:5`\")\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgHealthCheck, \"\", \"\",\n\t\t\"A comma-separated list of key-value pairs representing recent health check results, e.g.: `protocol:http, port:80, path:/index.html, check_interval_seconds:10, response_timeout_seconds:5, healthy_threshold:5, unhealthy_threshold:3`\")\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgForwardingRules, \"\", \"\", forwardingRulesTxt)\n\tAddBoolFlag(cmdRecordUpdate, doctl.ArgDisableLetsEncryptDNSRecords, \"\", false,\n\t\t\"disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer\")\n\tAddStringFlag(cmdRecordUpdate, doctl.ArgProjectID, \"\", \"\",\n\t\t\"Indicates which project to associate the Load Balancer with. If not specified, the Load Balancer will be placed in your default project.\")\n\tAddStringSliceFlag(cmdRecordUpdate, doctl.ArgAllowList, \"\", []string{},\n\t\t\"A comma-separated list of ALLOW rules for the load balancer, e.g.: `ip:1.2.3.4,cidr:1.2.0.0/16`\")\n\tAddStringSliceFlag(cmdRecordUpdate, doctl.ArgDenyList, \"\", []string{},\n\t\t\"A comma-separated list of DENY rules for the load balancer, e.g.: `ip:1.2.3.4,cidr:1.2.0.0/16`\")\n\n\tCmdBuilder(cmd, RunLoadBalancerList, \"list\", \"List load balancers\", \"Use this command to get a list of the load balancers on your account, including the following information for each:\\n\\n\"+lbDetail, Writer,\n\t\taliasOpt(\"ls\"), displayerType(&displayers.LoadBalancer{}))\n\n\tcmdRunRecordDelete := CmdBuilder(cmd, RunLoadBalancerDelete, \"delete <id>\",\n\t\t\"Permanently delete a load balancer\", `Use this command to permanently delete the specified load balancer. This is irreversible.`, Writer, aliasOpt(\"d\", \"rm\"))\n\tAddBoolFlag(cmdRunRecordDelete, doctl.ArgForce, doctl.ArgShortForce, false,\n\t\t\"Delete the load balancer without a confirmation prompt\")\n\n\tcmdAddDroplets := CmdBuilder(cmd, RunLoadBalancerAddDroplets, \"add-droplets <id>\",\n\t\t\"Add Droplets to a load balancer\", `Use this command to add Droplets to a load balancer.`, Writer)\n\tAddStringSliceFlag(cmdAddDroplets, doctl.ArgDropletIDs, \"\", []string{},\n\t\t\"A comma-separated list of IDs of Droplet to add to the load balancer, example value: `12,33`\")\n\n\tcmdRemoveDroplets := CmdBuilder(cmd, RunLoadBalancerRemoveDroplets,\n\t\t\"remove-droplets <id>\", \"Remove Droplets from a load balancer\", `Use this command to remove Droplets from a load balancer. This command does not destroy any Droplets.`, Writer)\n\tAddStringSliceFlag(cmdRemoveDroplets, doctl.ArgDropletIDs, \"\", []string{},\n\t\t\"A comma-separated list of IDs of Droplets to remove from the load balancer, example value: `12,33`\")\n\n\tcmdAddForwardingRules := CmdBuilder(cmd, RunLoadBalancerAddForwardingRules,\n\t\t\"add-forwarding-rules <id>\", \"Add forwarding rules to a load balancer\", \"Use this command to add forwarding rules to a load balancer, specified with the `--forwarding-rules` flag. Valid rules include:\\n\"+forwardingDetail, Writer)\n\tAddStringFlag(cmdAddForwardingRules, doctl.ArgForwardingRules, \"\", \"\", forwardingRulesTxt)\n\n\tcmdRemoveForwardingRules := CmdBuilder(cmd, RunLoadBalancerRemoveForwardingRules,\n\t\t\"remove-forwarding-rules <id>\", \"Remove forwarding rules from a load balancer\", \"Use this command to remove forwarding rules from a load balancer, specified with the `--forwarding-rules` flag. Valid rules include:\\n\"+forwardingDetail, Writer)\n\tAddStringFlag(cmdRemoveForwardingRules, doctl.ArgForwardingRules, \"\", \"\", forwardingRulesTxt)\n\n\treturn cmd\n}", "title": "" }, { "docid": "94b80febc92a04b3559ddc4fe2067170", "score": "0.4787852", "text": "func NewLoadBalancerRR() *LoadBalancerRR {\n\treturn &LoadBalancerRR{\n\t\tservices: map[proxy.ServicePortName]*balancerState{},\n\t}\n}", "title": "" }, { "docid": "6df1da5a20deb2a1a7f56818de822d30", "score": "0.47799802", "text": "func (xdsB *EDSBalancer) HandleEDSResponse(edsResp *xdspb.ClusterLoadAssignment) {\n\t// Create balancer group if it's never created (this is the first EDS\n\t// response).\n\tif xdsB.bg == nil {\n\t\txdsB.bg = newBalancerGroup(xdsB)\n\t}\n\n\t// TODO: Unhandled fields from EDS response:\n\t// - edsResp.GetPolicy().GetOverprovisioningFactor()\n\t// - locality.GetPriority()\n\t// - lbEndpoint.GetMetadata(): contains BNS name, send to sub-balancers\n\t// - as service config or as resolved address\n\t// - if socketAddress is not ip:port\n\t// - socketAddress.GetNamedPort(), socketAddress.GetResolverName()\n\t// - resolve endpoint's name with another resolver\n\n\txdsB.updateDrops(edsResp.GetPolicy().GetDropOverloads())\n\n\t// newLocalitiesSet contains all names of localitis in the new EDS response.\n\t// It's used to delete localities that are removed in the new EDS response.\n\tnewLocalitiesSet := make(map[string]struct{})\n\tfor _, locality := range edsResp.Endpoints {\n\t\t// One balancer for each locality.\n\n\t\tl := locality.GetLocality()\n\t\tif l == nil {\n\t\t\tgrpclog.Warningf(\"xds: received LocalityLbEndpoints with <nil> Locality\")\n\t\t\tcontinue\n\t\t}\n\t\tlid := fmt.Sprintf(\"%s-%s-%s\", l.Region, l.Zone, l.SubZone)\n\t\tnewLocalitiesSet[lid] = struct{}{}\n\n\t\tnewWeight := locality.GetLoadBalancingWeight().GetValue()\n\t\tif newWeight == 0 {\n\t\t\t// Weight can never be 0.\n\t\t\tnewWeight = 1\n\t\t}\n\n\t\tvar newAddrs []resolver.Address\n\t\tfor _, lbEndpoint := range locality.GetLbEndpoints() {\n\t\t\tsocketAddress := lbEndpoint.GetEndpoint().GetAddress().GetSocketAddress()\n\t\t\tnewAddrs = append(newAddrs, resolver.Address{\n\t\t\t\tAddr: net.JoinHostPort(socketAddress.GetAddress(), strconv.Itoa(int(socketAddress.GetPortValue()))),\n\t\t\t})\n\t\t}\n\t\tvar weightChanged, addrsChanged bool\n\t\tconfig, ok := xdsB.lidToConfig[lid]\n\t\tif !ok {\n\t\t\t// A new balancer, add it to balancer group and balancer map.\n\t\t\txdsB.bg.add(lid, newWeight, xdsB.subBalancerBuilder)\n\t\t\tconfig = &localityConfig{\n\t\t\t\tweight: newWeight,\n\t\t\t}\n\t\t\txdsB.lidToConfig[lid] = config\n\n\t\t\t// weightChanged is false for new locality, because there's no need to\n\t\t\t// update weight in bg.\n\t\t\taddrsChanged = true\n\t\t} else {\n\t\t\t// Compare weight and addrs.\n\t\t\tif config.weight != newWeight {\n\t\t\t\tweightChanged = true\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(config.addrs, newAddrs) {\n\t\t\t\taddrsChanged = true\n\t\t\t}\n\t\t}\n\n\t\tif weightChanged {\n\t\t\tconfig.weight = newWeight\n\t\t\txdsB.bg.changeWeight(lid, newWeight)\n\t\t}\n\n\t\tif addrsChanged {\n\t\t\tconfig.addrs = newAddrs\n\t\t\txdsB.bg.handleResolvedAddrs(lid, newAddrs)\n\t\t}\n\t}\n\n\t// Delete localities that are removed in the latest response.\n\tfor lid := range xdsB.lidToConfig {\n\t\tif _, ok := newLocalitiesSet[lid]; !ok {\n\t\t\txdsB.bg.remove(lid)\n\t\t\tdelete(xdsB.lidToConfig, lid)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e903fe694797b48bd2921ecff904713", "score": "0.477927", "text": "func (vs *VSphere) LoadBalancer() (cloudprovider.LoadBalancer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1b3743adf37f85a46dad31638d247e18", "score": "0.47718683", "text": "func (client *LoadTestsClient) listByResourceGroupHandleResponse(resp *http.Response) (LoadTestsClientListByResourceGroupResponse, error) {\n\tresult := LoadTestsClientListByResourceGroupResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.LoadTestResourcePageList); err != nil {\n\t\treturn LoadTestsClientListByResourceGroupResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e6b65c583defaa2630773fd23ba7bfef", "score": "0.47612846", "text": "func (p *LoadBalancerBackendAddressPoolsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "title": "" }, { "docid": "14531b6242ab48002a46448ed3435e25", "score": "0.47598988", "text": "func (s *ciliumBGPLoadBalancerIPPoolLister) List(selector labels.Selector) (ret []*v2alpha1.CiliumBGPLoadBalancerIPPool, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v2alpha1.CiliumBGPLoadBalancerIPPool))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "c2fcbab168a8b32a2ab5ebcf19886863", "score": "0.47534558", "text": "func (*ListNetworkLoadBalancerOperationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_loadbalancer_v1_network_load_balancer_service_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "76d683409a0e1ac33656397101ba48e2", "score": "0.4745146", "text": "func (l *loadBalancers) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error) {\n\tpatcher := newServicePatcher(l.resources.kclient, service)\n\tdefer func() { err = patcher.Patch(ctx, err) }()\n\n\tvar lb *godo.LoadBalancer\n\tlb, err = l.retrieveAndAnnotateLoadBalancer(ctx, service)\n\tif err != nil {\n\t\tif err == errLBNotFound {\n\t\t\treturn nil, false, nil\n\t\t}\n\t\treturn nil, false, err\n\t}\n\n\treturn &v1.LoadBalancerStatus{\n\t\tIngress: []v1.LoadBalancerIngress{\n\t\t\t{\n\t\t\t\tIP: lb.IP,\n\t\t\t},\n\t\t},\n\t}, true, nil\n}", "title": "" }, { "docid": "3da9f1abd8f022aabefa0d99a0530a53", "score": "0.47364452", "text": "func (nc *client) ListLoadBalancerVirtualServers() (*models.LbVirtualServerListResult, error) {\n\tparams := svc.NewListLoadBalancerVirtualServersParams()\n\tres, err := nc.client.Services.ListLoadBalancerVirtualServers(params, nc.auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.Payload, nil\n}", "title": "" }, { "docid": "28f5d75ea0811e016d15445ae0d11cd4", "score": "0.4730165", "text": "func (r *DescribeLoadBalancersResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "2733f938e19d346820ef9f6af428d7c6", "score": "0.4726194", "text": "func GetPools(client *gophercloud.ServiceClient, lbID string) ([]pools.Pool, error) {\n\tvar lbPools []pools.Pool\n\n\topts := pools.ListOpts{\n\t\tLoadbalancerID: lbID,\n\t}\n\tallPages, err := pools.List(client, opts).AllPages()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlbPools, err = pools.ExtractPools(allPages)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn lbPools, nil\n}", "title": "" }, { "docid": "6b8ec01095696b2f77ad50a44056af6a", "score": "0.47249565", "text": "func (az *Cloud) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error) {\n\t// Since public IP is not a part of the load balancer on Azure,\n\t// there is a chance that we could orphan public IP resources while we delete the load blanacer (kubernetes/kubernetes#80571).\n\t// We need to make sure the existence of the load balancer depends on the load balancer resource and public IP resource on Azure.\n\texistsPip := func() bool {\n\t\tpipName, _, err := az.determinePublicIPName(clusterName, service)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tpipResourceGroup := az.getPublicIPAddressResourceGroup(service)\n\t\t_, existsPip, err := az.getPublicIPAddress(pipResourceGroup, pipName)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn existsPip\n\t}()\n\n\t_, status, existsLb, err := az.getServiceLoadBalancer(service, clusterName, nil, false)\n\tif err != nil {\n\t\treturn nil, existsPip, err\n\t}\n\n\t// Return exists = false only if the load balancer and the public IP are not found on Azure\n\tif !existsLb && !existsPip {\n\t\tserviceName := getServiceName(service)\n\t\tklog.V(5).Infof(\"getloadbalancer (cluster:%s) (service:%s) - doesn't exist\", clusterName, serviceName)\n\t\treturn nil, false, nil\n\t}\n\n\t// Return exists = true if either the load balancer or the public IP (or both) exists\n\treturn status, true, nil\n}", "title": "" }, { "docid": "acdba07e9e9246fd2a06f688419b5fcb", "score": "0.4721246", "text": "func (p *Provider) L4LoadBalancerSrcRanges() []string {\n\treturn gcecloud.L4LoadBalancerSrcRanges()\n}", "title": "" }, { "docid": "892ffe99fca01a1d21e30e90af51aed3", "score": "0.47163817", "text": "func (client *VirtualNetworksClient) listHandleResponse(resp *http.Response) (VirtualNetworksClientListResponse, error) {\n\tresult := VirtualNetworksClientListResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkList); err != nil {\n\t\treturn VirtualNetworksClientListResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" } ]
aabfadbe242a1c45d663bf9319b34203
ProtoToClusterWorkloadIdentityConfig converts a ClusterWorkloadIdentityConfig resource from its proto representation.
[ { "docid": "106ff7f7baadcd22523ee7c1eca9cea6", "score": "0.6681672", "text": "func ProtoToContainerBetaClusterWorkloadIdentityConfig(p *betapb.ContainerBetaClusterWorkloadIdentityConfig) *beta.ClusterWorkloadIdentityConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &beta.ClusterWorkloadIdentityConfig{\n\t\tWorkloadPool: dcl.StringOrNil(p.WorkloadPool),\n\t\tIdentityNamespace: dcl.StringOrNil(p.IdentityNamespace),\n\t\tIdentityProvider: dcl.StringOrNil(p.IdentityProvider),\n\t}\n\treturn obj\n}", "title": "" } ]
[ { "docid": "cf46f55d0c52eac8b18c8081154f245d", "score": "0.77932954", "text": "func ProtoToContainerClusterWorkloadIdentityConfig(p *containerpb.ContainerClusterWorkloadIdentityConfig) *container.ClusterWorkloadIdentityConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterWorkloadIdentityConfig{\n\t\tWorkloadPool: dcl.StringOrNil(p.WorkloadPool),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "2edb10b8092b3d938264b520b4f66c24", "score": "0.76926476", "text": "func ProtoToGkemulticloudAzureClusterWorkloadIdentityConfig(p *gkemulticloudpb.GkemulticloudAzureClusterWorkloadIdentityConfig) *gkemulticloud.AzureClusterWorkloadIdentityConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &gkemulticloud.AzureClusterWorkloadIdentityConfig{\n\t\tIssuerUri: dcl.StringOrNil(p.IssuerUri),\n\t\tWorkloadPool: dcl.StringOrNil(p.WorkloadPool),\n\t\tIdentityProvider: dcl.StringOrNil(p.IdentityProvider),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "8d4e50d5bae689a27a7260c177e80b31", "score": "0.73655385", "text": "func GkemulticloudAzureClusterWorkloadIdentityConfigToProto(o *gkemulticloud.AzureClusterWorkloadIdentityConfig) *gkemulticloudpb.GkemulticloudAzureClusterWorkloadIdentityConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &gkemulticloudpb.GkemulticloudAzureClusterWorkloadIdentityConfig{\n\t\tIssuerUri: dcl.ValueOrEmptyString(o.IssuerUri),\n\t\tWorkloadPool: dcl.ValueOrEmptyString(o.WorkloadPool),\n\t\tIdentityProvider: dcl.ValueOrEmptyString(o.IdentityProvider),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "5f1c85edd466af23fa9970319674577c", "score": "0.71191275", "text": "func (in *ClusterWorkloadIdentityConfig) DeepCopy() *ClusterWorkloadIdentityConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClusterWorkloadIdentityConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fdef606d11aa8aed5f5296d683eecc0f", "score": "0.7075523", "text": "func ContainerClusterWorkloadIdentityConfigToProto(o *container.ClusterWorkloadIdentityConfig) *containerpb.ContainerClusterWorkloadIdentityConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterWorkloadIdentityConfig{\n\t\tWorkloadPool: dcl.ValueOrEmptyString(o.WorkloadPool),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "1ac9d7bf9e55816b0d4a1a8e77d4752f", "score": "0.627291", "text": "func ContainerBetaClusterWorkloadIdentityConfigToProto(o *beta.ClusterWorkloadIdentityConfig) *betapb.ContainerBetaClusterWorkloadIdentityConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &betapb.ContainerBetaClusterWorkloadIdentityConfig{\n\t\tWorkloadPool: dcl.ValueOrEmptyString(o.WorkloadPool),\n\t\tIdentityNamespace: dcl.ValueOrEmptyString(o.IdentityNamespace),\n\t\tIdentityProvider: dcl.ValueOrEmptyString(o.IdentityProvider),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "681ba828e18f8f00258dfd4bfb711ff4", "score": "0.6099814", "text": "func ProtoToContainerClusterNodeConfigWorkloadMetadataConfig(p *containerpb.ContainerClusterNodeConfigWorkloadMetadataConfig) *container.ClusterNodeConfigWorkloadMetadataConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodeConfigWorkloadMetadataConfig{\n\t\tMode: ProtoToContainerClusterNodeConfigWorkloadMetadataConfigModeEnum(p.GetMode()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "42d3bf631938a670765a1c1253b797d0", "score": "0.6004041", "text": "func (in *ClusterWorkloadConfig) DeepCopy() *ClusterWorkloadConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClusterWorkloadConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c07524e2555752a2f2e55cefdd4edfcb", "score": "0.5946392", "text": "func ProtoToContainerClusterNodePoolsConfigWorkloadMetadataConfig(p *containerpb.ContainerClusterNodePoolsConfigWorkloadMetadataConfig) *container.ClusterNodePoolsConfigWorkloadMetadataConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodePoolsConfigWorkloadMetadataConfig{\n\t\tMode: ProtoToContainerClusterNodePoolsConfigWorkloadMetadataConfigModeEnum(p.GetMode()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "fae6d1eadbe1e8180e3fab1dd6eb4cae", "score": "0.57197124", "text": "func (in *ClusterWorkloadMetadataConfig) DeepCopy() *ClusterWorkloadMetadataConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClusterWorkloadMetadataConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "122cb59ef2521f6eb9458c80052cd91e", "score": "0.57098424", "text": "func ProtoToDataprocClusterConfigSecurityConfigIdentityConfig(p *dataprocpb.DataprocClusterConfigSecurityConfigIdentityConfig) *dataproc.ClusterConfigSecurityConfigIdentityConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigSecurityConfigIdentityConfig{}\n\treturn obj\n}", "title": "" }, { "docid": "c4d115856ea58e5e65b21263ded83568", "score": "0.5669325", "text": "func DataprocClusterConfigSecurityConfigIdentityConfigToProto(o *dataproc.ClusterConfigSecurityConfigIdentityConfig) *dataprocpb.DataprocClusterConfigSecurityConfigIdentityConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigSecurityConfigIdentityConfig{}\n\tmUserServiceAccountMapping := make(map[string]string, len(o.UserServiceAccountMapping))\n\tfor k, r := range o.UserServiceAccountMapping {\n\t\tmUserServiceAccountMapping[k] = r\n\t}\n\tp.SetUserServiceAccountMapping(mUserServiceAccountMapping)\n\treturn p\n}", "title": "" }, { "docid": "b7c027c58724b922f3f4e8b445ac0d39", "score": "0.5628306", "text": "func ContainerClusterNodeConfigWorkloadMetadataConfigToProto(o *container.ClusterNodeConfigWorkloadMetadataConfig) *containerpb.ContainerClusterNodeConfigWorkloadMetadataConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodeConfigWorkloadMetadataConfig{\n\t\tMode: ContainerClusterNodeConfigWorkloadMetadataConfigModeEnumToProto(o.Mode),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "6ad21a069b2435d3c33c8592869cc2dc", "score": "0.55128145", "text": "func ContainerClusterNodePoolsConfigWorkloadMetadataConfigToProto(o *container.ClusterNodePoolsConfigWorkloadMetadataConfig) *containerpb.ContainerClusterNodePoolsConfigWorkloadMetadataConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodePoolsConfigWorkloadMetadataConfig{\n\t\tMode: ContainerClusterNodePoolsConfigWorkloadMetadataConfigModeEnumToProto(o.Mode),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "20a658e2aeda9e93e89ab3944ddfc27c", "score": "0.5316151", "text": "func ProtoToContainerBetaClusterNodeConfigWorkloadMetadataConfig(p *betapb.ContainerBetaClusterNodeConfigWorkloadMetadataConfig) *beta.ClusterNodeConfigWorkloadMetadataConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &beta.ClusterNodeConfigWorkloadMetadataConfig{\n\t\tMode: ProtoToContainerBetaClusterNodeConfigWorkloadMetadataConfigModeEnum(p.GetMode()),\n\t\tNodeMetadata: ProtoToContainerBetaClusterNodeConfigWorkloadMetadataConfigNodeMetadataEnum(p.GetNodeMetadata()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "8b79e5edbef48c9a502be037e770f635", "score": "0.51628375", "text": "func ProtoToContainerBetaClusterNodePoolsConfigWorkloadMetadataConfig(p *betapb.ContainerBetaClusterNodePoolsConfigWorkloadMetadataConfig) *beta.ClusterNodePoolsConfigWorkloadMetadataConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &beta.ClusterNodePoolsConfigWorkloadMetadataConfig{\n\t\tMode: ProtoToContainerBetaClusterNodePoolsConfigWorkloadMetadataConfigModeEnum(p.GetMode()),\n\t\tNodeMetadata: ProtoToContainerBetaClusterNodePoolsConfigWorkloadMetadataConfigNodeMetadataEnum(p.GetNodeMetadata()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "56323fdc1f33e35e567de2d7dbcd7f26", "score": "0.50847226", "text": "func ProtoToContainerClusterAddonsConfigCloudRunConfig(p *containerpb.ContainerClusterAddonsConfigCloudRunConfig) *container.ClusterAddonsConfigCloudRunConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterAddonsConfigCloudRunConfig{\n\t\tDisabled: dcl.Bool(p.Disabled),\n\t\tLoadBalancerType: ProtoToContainerClusterAddonsConfigCloudRunConfigLoadBalancerTypeEnum(p.GetLoadBalancerType()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "522ce8592805d6a33cb5a50d28dadf55", "score": "0.49642316", "text": "func ContainerBetaClusterNodeConfigWorkloadMetadataConfigToProto(o *beta.ClusterNodeConfigWorkloadMetadataConfig) *betapb.ContainerBetaClusterNodeConfigWorkloadMetadataConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &betapb.ContainerBetaClusterNodeConfigWorkloadMetadataConfig{\n\t\tMode: ContainerBetaClusterNodeConfigWorkloadMetadataConfigModeEnumToProto(o.Mode),\n\t\tNodeMetadata: ContainerBetaClusterNodeConfigWorkloadMetadataConfigNodeMetadataEnumToProto(o.NodeMetadata),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "1d82ff2dae2f94ebe4ef9b03a99841c9", "score": "0.49631914", "text": "func ProtoToContainerClusterNodePoolsConfigReservationAffinity(p *containerpb.ContainerClusterNodePoolsConfigReservationAffinity) *container.ClusterNodePoolsConfigReservationAffinity {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodePoolsConfigReservationAffinity{\n\t\tConsumeReservationType: ProtoToContainerClusterNodePoolsConfigReservationAffinityConsumeReservationTypeEnum(p.GetConsumeReservationType()),\n\t\tKey: dcl.StringOrNil(p.Key),\n\t}\n\tfor _, r := range p.GetValues() {\n\t\tobj.Values = append(obj.Values, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "915fcab237b57fa9f4eda52739044b9b", "score": "0.49569035", "text": "func ProtoToDataprocClusterConfigWorkerConfig(p *dataprocpb.DataprocClusterConfigWorkerConfig) *dataproc.ClusterConfigWorkerConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigWorkerConfig{\n\t\tNumInstances: dcl.Int64OrNil(p.GetNumInstances()),\n\t\tImage: dcl.StringOrNil(p.GetImage()),\n\t\tMachineType: dcl.StringOrNil(p.GetMachineType()),\n\t\tDiskConfig: ProtoToDataprocClusterConfigWorkerConfigDiskConfig(p.GetDiskConfig()),\n\t\tIsPreemptible: dcl.Bool(p.GetIsPreemptible()),\n\t\tPreemptibility: ProtoToDataprocClusterConfigWorkerConfigPreemptibilityEnum(p.GetPreemptibility()),\n\t\tManagedGroupConfig: ProtoToDataprocClusterConfigWorkerConfigManagedGroupConfig(p.GetManagedGroupConfig()),\n\t\tMinCpuPlatform: dcl.StringOrNil(p.GetMinCpuPlatform()),\n\t}\n\tfor _, r := range p.GetInstanceNames() {\n\t\tobj.InstanceNames = append(obj.InstanceNames, r)\n\t}\n\tfor _, r := range p.GetAccelerators() {\n\t\tobj.Accelerators = append(obj.Accelerators, *ProtoToDataprocClusterConfigWorkerConfigAccelerators(r))\n\t}\n\tfor _, r := range p.GetInstanceReferences() {\n\t\tobj.InstanceReferences = append(obj.InstanceReferences, *ProtoToDataprocClusterConfigWorkerConfigInstanceReferences(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "a09bc786e09e12437de5ca395a07af48", "score": "0.49399126", "text": "func ProtoToContainerClusterNotificationConfig(p *containerpb.ContainerClusterNotificationConfig) *container.ClusterNotificationConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNotificationConfig{\n\t\tPubsub: ProtoToContainerClusterNotificationConfigPubsub(p.GetPubsub()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "7106c2faddd066db30f1ff0833600f2e", "score": "0.49397206", "text": "func ContainerClusterAddonsConfigCloudRunConfigToProto(o *container.ClusterAddonsConfigCloudRunConfig) *containerpb.ContainerClusterAddonsConfigCloudRunConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterAddonsConfigCloudRunConfig{\n\t\tDisabled: dcl.ValueOrEmptyBool(o.Disabled),\n\t\tLoadBalancerType: ContainerClusterAddonsConfigCloudRunConfigLoadBalancerTypeEnumToProto(o.LoadBalancerType),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "26fbcb394b2baa0a2298586b669e9fdc", "score": "0.48543668", "text": "func ProtoToContainerClusterAddonsConfigHorizontalPodAutoscaling(p *containerpb.ContainerClusterAddonsConfigHorizontalPodAutoscaling) *container.ClusterAddonsConfigHorizontalPodAutoscaling {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterAddonsConfigHorizontalPodAutoscaling{\n\t\tDisabled: dcl.Bool(p.Disabled),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "0fb1ea5734906d390d725396de161e67", "score": "0.48472965", "text": "func DataprocClusterConfigToProto(o *dataproc.ClusterConfig) *dataprocpb.DataprocClusterConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfig{}\n\tp.SetStagingBucket(dcl.ValueOrEmptyString(o.StagingBucket))\n\tp.SetTempBucket(dcl.ValueOrEmptyString(o.TempBucket))\n\tp.SetGceClusterConfig(DataprocClusterConfigGceClusterConfigToProto(o.GceClusterConfig))\n\tp.SetMasterConfig(DataprocClusterConfigMasterConfigToProto(o.MasterConfig))\n\tp.SetWorkerConfig(DataprocClusterConfigWorkerConfigToProto(o.WorkerConfig))\n\tp.SetSecondaryWorkerConfig(DataprocClusterConfigSecondaryWorkerConfigToProto(o.SecondaryWorkerConfig))\n\tp.SetSoftwareConfig(DataprocClusterConfigSoftwareConfigToProto(o.SoftwareConfig))\n\tp.SetEncryptionConfig(DataprocClusterConfigEncryptionConfigToProto(o.EncryptionConfig))\n\tp.SetAutoscalingConfig(DataprocClusterConfigAutoscalingConfigToProto(o.AutoscalingConfig))\n\tp.SetSecurityConfig(DataprocClusterConfigSecurityConfigToProto(o.SecurityConfig))\n\tp.SetLifecycleConfig(DataprocClusterConfigLifecycleConfigToProto(o.LifecycleConfig))\n\tp.SetEndpointConfig(DataprocClusterConfigEndpointConfigToProto(o.EndpointConfig))\n\tp.SetMetastoreConfig(DataprocClusterConfigMetastoreConfigToProto(o.MetastoreConfig))\n\tp.SetDataprocMetricConfig(DataprocClusterConfigDataprocMetricConfigToProto(o.DataprocMetricConfig))\n\tsInitializationActions := make([]*dataprocpb.DataprocClusterConfigInitializationActions, len(o.InitializationActions))\n\tfor i, r := range o.InitializationActions {\n\t\tsInitializationActions[i] = DataprocClusterConfigInitializationActionsToProto(&r)\n\t}\n\tp.SetInitializationActions(sInitializationActions)\n\treturn p\n}", "title": "" }, { "docid": "2c9ff415d169e3dc6ca6e59206538a86", "score": "0.4831321", "text": "func ProtoToDataprocClusterConfigAutoscalingConfig(p *dataprocpb.DataprocClusterConfigAutoscalingConfig) *dataproc.ClusterConfigAutoscalingConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigAutoscalingConfig{\n\t\tPolicy: dcl.StringOrNil(p.GetPolicy()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "da5835a29be0a70e06a427dd6f6e8a47", "score": "0.4823575", "text": "func ProtoToContainerClusterAutoscalingAutoprovisioningNodePoolDefaultsShieldedInstanceConfig(p *containerpb.ContainerClusterAutoscalingAutoprovisioningNodePoolDefaultsShieldedInstanceConfig) *container.ClusterAutoscalingAutoprovisioningNodePoolDefaultsShieldedInstanceConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterAutoscalingAutoprovisioningNodePoolDefaultsShieldedInstanceConfig{\n\t\tEnableSecureBoot: dcl.Bool(p.EnableSecureBoot),\n\t\tEnableIntegrityMonitoring: dcl.Bool(p.EnableIntegrityMonitoring),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "fa7c8e41da72bc88f917a6c776360463", "score": "0.48209944", "text": "func ContainerBetaClusterNodePoolsConfigWorkloadMetadataConfigToProto(o *beta.ClusterNodePoolsConfigWorkloadMetadataConfig) *betapb.ContainerBetaClusterNodePoolsConfigWorkloadMetadataConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &betapb.ContainerBetaClusterNodePoolsConfigWorkloadMetadataConfig{\n\t\tMode: ContainerBetaClusterNodePoolsConfigWorkloadMetadataConfigModeEnumToProto(o.Mode),\n\t\tNodeMetadata: ContainerBetaClusterNodePoolsConfigWorkloadMetadataConfigNodeMetadataEnumToProto(o.NodeMetadata),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "9bb03cb3421ea186417702ed1b6693e6", "score": "0.48203245", "text": "func ProtoToDataprocClusterConfigEncryptionConfig(p *dataprocpb.DataprocClusterConfigEncryptionConfig) *dataproc.ClusterConfigEncryptionConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigEncryptionConfig{\n\t\tGcePdKmsKeyName: dcl.StringOrNil(p.GetGcePdKmsKeyName()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "17ba0ef61d5e882e7006aa85ef8ef2dc", "score": "0.48165235", "text": "func ProtoToContainerClusterNodeConfigReservationAffinity(p *containerpb.ContainerClusterNodeConfigReservationAffinity) *container.ClusterNodeConfigReservationAffinity {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodeConfigReservationAffinity{\n\t\tConsumeReservationType: ProtoToContainerClusterNodeConfigReservationAffinityConsumeReservationTypeEnum(p.GetConsumeReservationType()),\n\t\tKey: dcl.StringOrNil(p.Key),\n\t}\n\tfor _, r := range p.GetValues() {\n\t\tobj.Values = append(obj.Values, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "5b96587d4c7f2642949bae1b3dcc20e0", "score": "0.48048645", "text": "func ProtoToContainerClusterAddonsConfig(p *containerpb.ContainerClusterAddonsConfig) *container.ClusterAddonsConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterAddonsConfig{\n\t\tHttpLoadBalancing: ProtoToContainerClusterAddonsConfigHttpLoadBalancing(p.GetHttpLoadBalancing()),\n\t\tHorizontalPodAutoscaling: ProtoToContainerClusterAddonsConfigHorizontalPodAutoscaling(p.GetHorizontalPodAutoscaling()),\n\t\tKubernetesDashboard: ProtoToContainerClusterAddonsConfigKubernetesDashboard(p.GetKubernetesDashboard()),\n\t\tNetworkPolicyConfig: ProtoToContainerClusterAddonsConfigNetworkPolicyConfig(p.GetNetworkPolicyConfig()),\n\t\tCloudRunConfig: ProtoToContainerClusterAddonsConfigCloudRunConfig(p.GetCloudRunConfig()),\n\t\tDnsCacheConfig: ProtoToContainerClusterAddonsConfigDnsCacheConfig(p.GetDnsCacheConfig()),\n\t\tConfigConnectorConfig: ProtoToContainerClusterAddonsConfigConfigConnectorConfig(p.GetConfigConnectorConfig()),\n\t\tGcePersistentDiskCsiDriverConfig: ProtoToContainerClusterAddonsConfigGcePersistentDiskCsiDriverConfig(p.GetGcePersistentDiskCsiDriverConfig()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "01f40c56e6782ba828bdc0d2016ac351", "score": "0.4801137", "text": "func ProtoToContainerClusterNodePoolsConfigTaints(p *containerpb.ContainerClusterNodePoolsConfigTaints) *container.ClusterNodePoolsConfigTaints {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodePoolsConfigTaints{\n\t\tKey: dcl.StringOrNil(p.Key),\n\t\tValue: dcl.StringOrNil(p.Value),\n\t\tEffect: ProtoToContainerClusterNodePoolsConfigTaintsEffectEnum(p.GetEffect()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "1fac9c942e745141155accdee0375f5e", "score": "0.47937086", "text": "func DataprocClusterConfigDataprocMetricConfigToProto(o *dataproc.ClusterConfigDataprocMetricConfig) *dataprocpb.DataprocClusterConfigDataprocMetricConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigDataprocMetricConfig{}\n\tsMetrics := make([]*dataprocpb.DataprocClusterConfigDataprocMetricConfigMetrics, len(o.Metrics))\n\tfor i, r := range o.Metrics {\n\t\tsMetrics[i] = DataprocClusterConfigDataprocMetricConfigMetricsToProto(&r)\n\t}\n\tp.SetMetrics(sMetrics)\n\treturn p\n}", "title": "" }, { "docid": "3145e125ca754f397b686a9794471b4b", "score": "0.47884354", "text": "func DataprocClusterConfigAutoscalingConfigToProto(o *dataproc.ClusterConfigAutoscalingConfig) *dataprocpb.DataprocClusterConfigAutoscalingConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigAutoscalingConfig{}\n\tp.SetPolicy(dcl.ValueOrEmptyString(o.Policy))\n\treturn p\n}", "title": "" }, { "docid": "87b0efd167be9c917b4401aa469435dc", "score": "0.47850397", "text": "func ProtoToContainerClusterAddonsConfigHttpLoadBalancing(p *containerpb.ContainerClusterAddonsConfigHttpLoadBalancing) *container.ClusterAddonsConfigHttpLoadBalancing {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterAddonsConfigHttpLoadBalancing{\n\t\tDisabled: dcl.Bool(p.Disabled),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "6fd0931eb37daa1ed1961a164cd0395c", "score": "0.47474086", "text": "func ProtoToContainerClusterNodeConfigKubeletConfig(p *containerpb.ContainerClusterNodeConfigKubeletConfig) *container.ClusterNodeConfigKubeletConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodeConfigKubeletConfig{\n\t\tCpuManagerPolicy: dcl.StringOrNil(p.CpuManagerPolicy),\n\t\tCpuCfsQuota: dcl.Bool(p.CpuCfsQuota),\n\t\tCpuCfsQuotaPeriod: dcl.StringOrNil(p.CpuCfsQuotaPeriod),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "6215a451aaea47558f5327622f53025f", "score": "0.47439316", "text": "func ProtoToContainerClusterNodeConfigTaints(p *containerpb.ContainerClusterNodeConfigTaints) *container.ClusterNodeConfigTaints {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodeConfigTaints{\n\t\tKey: dcl.StringOrNil(p.Key),\n\t\tValue: dcl.StringOrNil(p.Value),\n\t\tEffect: ProtoToContainerClusterNodeConfigTaintsEffectEnum(p.GetEffect()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "f99d6a58b2bf2af33d9a57373ad3f53d", "score": "0.47436115", "text": "func ContainerClusterNotificationConfigToProto(o *container.ClusterNotificationConfig) *containerpb.ContainerClusterNotificationConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNotificationConfig{\n\t\tPubsub: ContainerClusterNotificationConfigPubsubToProto(o.Pubsub),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "1be6eb590d9cc735765c21096b12a026", "score": "0.47419104", "text": "func (in *ClusterIdentityConfig) DeepCopy() *ClusterIdentityConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClusterIdentityConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d4550c1b1d2e365c28cbcd77ceec4a25", "score": "0.47386134", "text": "func ContainerClusterNodeConfigTaintsToProto(o *container.ClusterNodeConfigTaints) *containerpb.ContainerClusterNodeConfigTaints {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodeConfigTaints{\n\t\tKey: dcl.ValueOrEmptyString(o.Key),\n\t\tValue: dcl.ValueOrEmptyString(o.Value),\n\t\tEffect: ContainerClusterNodeConfigTaintsEffectEnumToProto(o.Effect),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "fafc027636fae9e00396c8aa99de2298", "score": "0.4734227", "text": "func ContainerClusterAddonsConfigHorizontalPodAutoscalingToProto(o *container.ClusterAddonsConfigHorizontalPodAutoscaling) *containerpb.ContainerClusterAddonsConfigHorizontalPodAutoscaling {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterAddonsConfigHorizontalPodAutoscaling{\n\t\tDisabled: dcl.ValueOrEmptyBool(o.Disabled),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "3cd32e877671046994d4d3cb0eeaace6", "score": "0.4724738", "text": "func ProtoToContainerClusterNodeConfigShieldedInstanceConfig(p *containerpb.ContainerClusterNodeConfigShieldedInstanceConfig) *container.ClusterNodeConfigShieldedInstanceConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodeConfigShieldedInstanceConfig{\n\t\tEnableSecureBoot: dcl.Bool(p.EnableSecureBoot),\n\t\tEnableIntegrityMonitoring: dcl.Bool(p.EnableIntegrityMonitoring),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "8ed23f581683c247b61fb6a1596b1a6c", "score": "0.47229365", "text": "func ProtoToContainerClusterNodePoolsConfigShieldedInstanceConfig(p *containerpb.ContainerClusterNodePoolsConfigShieldedInstanceConfig) *container.ClusterNodePoolsConfigShieldedInstanceConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodePoolsConfigShieldedInstanceConfig{\n\t\tEnableSecureBoot: dcl.Bool(p.EnableSecureBoot),\n\t\tEnableIntegrityMonitoring: dcl.Bool(p.EnableIntegrityMonitoring),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "4dedf9634619e6d13600273834f30f17", "score": "0.47187337", "text": "func DataprocClusterConfigWorkerConfigToProto(o *dataproc.ClusterConfigWorkerConfig) *dataprocpb.DataprocClusterConfigWorkerConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigWorkerConfig{}\n\tp.SetNumInstances(dcl.ValueOrEmptyInt64(o.NumInstances))\n\tp.SetImage(dcl.ValueOrEmptyString(o.Image))\n\tp.SetMachineType(dcl.ValueOrEmptyString(o.MachineType))\n\tp.SetDiskConfig(DataprocClusterConfigWorkerConfigDiskConfigToProto(o.DiskConfig))\n\tp.SetIsPreemptible(dcl.ValueOrEmptyBool(o.IsPreemptible))\n\tp.SetPreemptibility(DataprocClusterConfigWorkerConfigPreemptibilityEnumToProto(o.Preemptibility))\n\tp.SetManagedGroupConfig(DataprocClusterConfigWorkerConfigManagedGroupConfigToProto(o.ManagedGroupConfig))\n\tp.SetMinCpuPlatform(dcl.ValueOrEmptyString(o.MinCpuPlatform))\n\tsInstanceNames := make([]string, len(o.InstanceNames))\n\tfor i, r := range o.InstanceNames {\n\t\tsInstanceNames[i] = r\n\t}\n\tp.SetInstanceNames(sInstanceNames)\n\tsAccelerators := make([]*dataprocpb.DataprocClusterConfigWorkerConfigAccelerators, len(o.Accelerators))\n\tfor i, r := range o.Accelerators {\n\t\tsAccelerators[i] = DataprocClusterConfigWorkerConfigAcceleratorsToProto(&r)\n\t}\n\tp.SetAccelerators(sAccelerators)\n\tsInstanceReferences := make([]*dataprocpb.DataprocClusterConfigWorkerConfigInstanceReferences, len(o.InstanceReferences))\n\tfor i, r := range o.InstanceReferences {\n\t\tsInstanceReferences[i] = DataprocClusterConfigWorkerConfigInstanceReferencesToProto(&r)\n\t}\n\tp.SetInstanceReferences(sInstanceReferences)\n\treturn p\n}", "title": "" }, { "docid": "4194dee02e9e213b4cc5cdf67b2dad76", "score": "0.4699463", "text": "func ProtoToContainerClusterNodePoolsConfigKubeletConfig(p *containerpb.ContainerClusterNodePoolsConfigKubeletConfig) *container.ClusterNodePoolsConfigKubeletConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodePoolsConfigKubeletConfig{\n\t\tCpuManagerPolicy: dcl.StringOrNil(p.CpuManagerPolicy),\n\t\tCpuCfsQuota: dcl.Bool(p.CpuCfsQuota),\n\t\tCpuCfsQuotaPeriod: dcl.StringOrNil(p.CpuCfsQuotaPeriod),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "fbe165d476a42c00424150c5ebc355f9", "score": "0.46973076", "text": "func ProtoToContainerClusterAutoscalingResourceLimits(p *containerpb.ContainerClusterAutoscalingResourceLimits) *container.ClusterAutoscalingResourceLimits {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterAutoscalingResourceLimits{\n\t\tResourceType: dcl.StringOrNil(p.ResourceType),\n\t\tMinimum: dcl.Int64OrNil(p.Minimum),\n\t\tMaximum: dcl.Int64OrNil(p.Maximum),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "c69cc5f99e4dc696ae83a8d8e043f47e", "score": "0.4689956", "text": "func ContainerClusterNodePoolsConfigTaintsToProto(o *container.ClusterNodePoolsConfigTaints) *containerpb.ContainerClusterNodePoolsConfigTaints {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodePoolsConfigTaints{\n\t\tKey: dcl.ValueOrEmptyString(o.Key),\n\t\tValue: dcl.ValueOrEmptyString(o.Value),\n\t\tEffect: ContainerClusterNodePoolsConfigTaintsEffectEnumToProto(o.Effect),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "f49d4e5fabc0c5b35138befe6618a100", "score": "0.4680574", "text": "func ProtoToDataprocClusterConfig(p *dataprocpb.DataprocClusterConfig) *dataproc.ClusterConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfig{\n\t\tStagingBucket: dcl.StringOrNil(p.GetStagingBucket()),\n\t\tTempBucket: dcl.StringOrNil(p.GetTempBucket()),\n\t\tGceClusterConfig: ProtoToDataprocClusterConfigGceClusterConfig(p.GetGceClusterConfig()),\n\t\tMasterConfig: ProtoToDataprocClusterConfigMasterConfig(p.GetMasterConfig()),\n\t\tWorkerConfig: ProtoToDataprocClusterConfigWorkerConfig(p.GetWorkerConfig()),\n\t\tSecondaryWorkerConfig: ProtoToDataprocClusterConfigSecondaryWorkerConfig(p.GetSecondaryWorkerConfig()),\n\t\tSoftwareConfig: ProtoToDataprocClusterConfigSoftwareConfig(p.GetSoftwareConfig()),\n\t\tEncryptionConfig: ProtoToDataprocClusterConfigEncryptionConfig(p.GetEncryptionConfig()),\n\t\tAutoscalingConfig: ProtoToDataprocClusterConfigAutoscalingConfig(p.GetAutoscalingConfig()),\n\t\tSecurityConfig: ProtoToDataprocClusterConfigSecurityConfig(p.GetSecurityConfig()),\n\t\tLifecycleConfig: ProtoToDataprocClusterConfigLifecycleConfig(p.GetLifecycleConfig()),\n\t\tEndpointConfig: ProtoToDataprocClusterConfigEndpointConfig(p.GetEndpointConfig()),\n\t\tMetastoreConfig: ProtoToDataprocClusterConfigMetastoreConfig(p.GetMetastoreConfig()),\n\t\tDataprocMetricConfig: ProtoToDataprocClusterConfigDataprocMetricConfig(p.GetDataprocMetricConfig()),\n\t}\n\tfor _, r := range p.GetInitializationActions() {\n\t\tobj.InitializationActions = append(obj.InitializationActions, *ProtoToDataprocClusterConfigInitializationActions(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "10fd27fa6dcaf26fbf6a7a333f2569dc", "score": "0.4665295", "text": "func DataprocClusterVirtualClusterConfigKubernetesClusterConfigToProto(o *dataproc.ClusterVirtualClusterConfigKubernetesClusterConfig) *dataprocpb.DataprocClusterVirtualClusterConfigKubernetesClusterConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterVirtualClusterConfigKubernetesClusterConfig{}\n\tp.SetKubernetesNamespace(dcl.ValueOrEmptyString(o.KubernetesNamespace))\n\tp.SetGkeClusterConfig(DataprocClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfigToProto(o.GkeClusterConfig))\n\tp.SetKubernetesSoftwareConfig(DataprocClusterVirtualClusterConfigKubernetesClusterConfigKubernetesSoftwareConfigToProto(o.KubernetesSoftwareConfig))\n\treturn p\n}", "title": "" }, { "docid": "3e08c4af30b7782a6afbe5bdfeee1509", "score": "0.46584255", "text": "func ProtoToContainerClusterNodeConfigSandboxConfig(p *containerpb.ContainerClusterNodeConfigSandboxConfig) *container.ClusterNodeConfigSandboxConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodeConfigSandboxConfig{\n\t\tType: ProtoToContainerClusterNodeConfigSandboxConfigTypeEnum(p.GetType()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d4fb0c9f7489c59a23b8ad0811cac9aa", "score": "0.46576786", "text": "func DataprocClusterConfigEncryptionConfigToProto(o *dataproc.ClusterConfigEncryptionConfig) *dataprocpb.DataprocClusterConfigEncryptionConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigEncryptionConfig{}\n\tp.SetGcePdKmsKeyName(dcl.ValueOrEmptyString(o.GcePdKmsKeyName))\n\treturn p\n}", "title": "" }, { "docid": "86764bd73e1935d3b68fdb1df2e07478", "score": "0.46540588", "text": "func ProtoToContainerClusterAddonsConfigConfigConnectorConfig(p *containerpb.ContainerClusterAddonsConfigConfigConnectorConfig) *container.ClusterAddonsConfigConfigConnectorConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterAddonsConfigConfigConnectorConfig{\n\t\tEnabled: dcl.Bool(p.Enabled),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "463c754c02a1c4d7036f0cf578def812", "score": "0.4650764", "text": "func ContainerClusterNodeConfigKubeletConfigToProto(o *container.ClusterNodeConfigKubeletConfig) *containerpb.ContainerClusterNodeConfigKubeletConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodeConfigKubeletConfig{\n\t\tCpuManagerPolicy: dcl.ValueOrEmptyString(o.CpuManagerPolicy),\n\t\tCpuCfsQuota: dcl.ValueOrEmptyBool(o.CpuCfsQuota),\n\t\tCpuCfsQuotaPeriod: dcl.ValueOrEmptyString(o.CpuCfsQuotaPeriod),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "357d53a0033fdf3c33964d10ca0c9e0a", "score": "0.46464214", "text": "func ProtoToContainerClusterAddonsConfigNetworkPolicyConfig(p *containerpb.ContainerClusterAddonsConfigNetworkPolicyConfig) *container.ClusterAddonsConfigNetworkPolicyConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterAddonsConfigNetworkPolicyConfig{\n\t\tDisabled: dcl.Bool(p.Disabled),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "bae61e8ea59c28cfafd46a2b0bcc4037", "score": "0.4620635", "text": "func ContainerClusterAutoscalingResourceLimitsToProto(o *container.ClusterAutoscalingResourceLimits) *containerpb.ContainerClusterAutoscalingResourceLimits {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterAutoscalingResourceLimits{\n\t\tResourceType: dcl.ValueOrEmptyString(o.ResourceType),\n\t\tMinimum: dcl.ValueOrEmptyInt64(o.Minimum),\n\t\tMaximum: dcl.ValueOrEmptyInt64(o.Maximum),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "600254f72206e961a5da3a6ac3e93705", "score": "0.46159744", "text": "func ProtoToContainerClusterIPAllocationPolicy(p *containerpb.ContainerClusterIPAllocationPolicy) *container.ClusterIPAllocationPolicy {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterIPAllocationPolicy{\n\t\tUseIPAliases: dcl.Bool(p.UseIpAliases),\n\t\tCreateSubnetwork: dcl.Bool(p.CreateSubnetwork),\n\t\tSubnetworkName: dcl.StringOrNil(p.SubnetworkName),\n\t\tClusterSecondaryRangeName: dcl.StringOrNil(p.ClusterSecondaryRangeName),\n\t\tServicesSecondaryRangeName: dcl.StringOrNil(p.ServicesSecondaryRangeName),\n\t\tClusterIPv4CidrBlock: dcl.StringOrNil(p.ClusterIpv4CidrBlock),\n\t\tNodeIPv4CidrBlock: dcl.StringOrNil(p.NodeIpv4CidrBlock),\n\t\tServicesIPv4CidrBlock: dcl.StringOrNil(p.ServicesIpv4CidrBlock),\n\t\tTPUIPv4CidrBlock: dcl.StringOrNil(p.TpuIpv4CidrBlock),\n\t\tClusterIPv4Cidr: dcl.StringOrNil(p.ClusterIpv4Cidr),\n\t\tNodeIPv4Cidr: dcl.StringOrNil(p.NodeIpv4Cidr),\n\t\tServicesIPv4Cidr: dcl.StringOrNil(p.ServicesIpv4Cidr),\n\t\tUseRoutes: dcl.Bool(p.UseRoutes),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "785ef4adc2b0696c88f63e40fcbd75d8", "score": "0.45887816", "text": "func ProtoToContainerClusterNetworkConfig(p *containerpb.ContainerClusterNetworkConfig) *container.ClusterNetworkConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNetworkConfig{\n\t\tNetwork: dcl.StringOrNil(p.Network),\n\t\tSubnetwork: dcl.StringOrNil(p.Subnetwork),\n\t\tEnableIntraNodeVisibility: dcl.Bool(p.EnableIntraNodeVisibility),\n\t\tDefaultSnatStatus: ProtoToContainerClusterNetworkConfigDefaultSnatStatus(p.GetDefaultSnatStatus()),\n\t\tPrivateIPv6GoogleAccess: ProtoToContainerClusterNetworkConfigPrivateIPv6GoogleAccessEnum(p.GetPrivateIpv6GoogleAccess()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "729aeb636edcda41da7a8745785aaaad", "score": "0.45808798", "text": "func ProtoToDataprocClusterConfigWorkerConfigDiskConfig(p *dataprocpb.DataprocClusterConfigWorkerConfigDiskConfig) *dataproc.ClusterConfigWorkerConfigDiskConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigWorkerConfigDiskConfig{\n\t\tBootDiskType: dcl.StringOrNil(p.GetBootDiskType()),\n\t\tBootDiskSizeGb: dcl.Int64OrNil(p.GetBootDiskSizeGb()),\n\t\tNumLocalSsds: dcl.Int64OrNil(p.GetNumLocalSsds()),\n\t\tLocalSsdInterface: dcl.StringOrNil(p.GetLocalSsdInterface()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "9bb5f60a2ccaa65bad7fbc8f29fcf37f", "score": "0.4570342", "text": "func ContainerClusterMasterAuthClientCertificateConfigToProto(o *container.ClusterMasterAuthClientCertificateConfig) *containerpb.ContainerClusterMasterAuthClientCertificateConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterMasterAuthClientCertificateConfig{\n\t\tIssueClientCertificate: dcl.ValueOrEmptyBool(o.IssueClientCertificate),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "dd9ef4a865c9196babd2373d0670e086", "score": "0.45498753", "text": "func ContainerClusterNodePoolsConfigShieldedInstanceConfigToProto(o *container.ClusterNodePoolsConfigShieldedInstanceConfig) *containerpb.ContainerClusterNodePoolsConfigShieldedInstanceConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodePoolsConfigShieldedInstanceConfig{\n\t\tEnableSecureBoot: dcl.ValueOrEmptyBool(o.EnableSecureBoot),\n\t\tEnableIntegrityMonitoring: dcl.ValueOrEmptyBool(o.EnableIntegrityMonitoring),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "39894fbb4f5315b2353bfb17b1356358", "score": "0.45473728", "text": "func ProtoToContainerClusterNodeConfig(p *containerpb.ContainerClusterNodeConfig) *container.ClusterNodeConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodeConfig{\n\t\tMachineType: dcl.StringOrNil(p.MachineType),\n\t\tDiskSizeGb: dcl.Int64OrNil(p.DiskSizeGb),\n\t\tServiceAccount: dcl.StringOrNil(p.ServiceAccount),\n\t\tImageType: dcl.StringOrNil(p.ImageType),\n\t\tLocalSsdCount: dcl.Int64OrNil(p.LocalSsdCount),\n\t\tPreemptible: dcl.Bool(p.Preemptible),\n\t\tDiskType: dcl.StringOrNil(p.DiskType),\n\t\tMinCpuPlatform: dcl.StringOrNil(p.MinCpuPlatform),\n\t\tWorkloadMetadataConfig: ProtoToContainerClusterNodeConfigWorkloadMetadataConfig(p.GetWorkloadMetadataConfig()),\n\t\tSandboxConfig: ProtoToContainerClusterNodeConfigSandboxConfig(p.GetSandboxConfig()),\n\t\tNodeGroup: dcl.StringOrNil(p.NodeGroup),\n\t\tReservationAffinity: ProtoToContainerClusterNodeConfigReservationAffinity(p.GetReservationAffinity()),\n\t\tShieldedInstanceConfig: ProtoToContainerClusterNodeConfigShieldedInstanceConfig(p.GetShieldedInstanceConfig()),\n\t\tLinuxNodeConfig: ProtoToContainerClusterNodeConfigLinuxNodeConfig(p.GetLinuxNodeConfig()),\n\t\tKubeletConfig: ProtoToContainerClusterNodeConfigKubeletConfig(p.GetKubeletConfig()),\n\t\tBootDiskKmsKey: dcl.StringOrNil(p.BootDiskKmsKey),\n\t}\n\tfor _, r := range p.GetOauthScopes() {\n\t\tobj.OAuthScopes = append(obj.OAuthScopes, r)\n\t}\n\tfor _, r := range p.GetTags() {\n\t\tobj.Tags = append(obj.Tags, r)\n\t}\n\tfor _, r := range p.GetAccelerators() {\n\t\tobj.Accelerators = append(obj.Accelerators, *ProtoToContainerClusterNodeConfigAccelerators(r))\n\t}\n\tfor _, r := range p.GetTaints() {\n\t\tobj.Taints = append(obj.Taints, *ProtoToContainerClusterNodeConfigTaints(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "6be3460e86ca4593185fc13711675339", "score": "0.45459858", "text": "func flattenClusterClusterConfigAutoscalingConfig(c *Client, i interface{}) *ClusterClusterConfigAutoscalingConfig {\n\tm, ok := i.(map[string]interface{})\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tr := &ClusterClusterConfigAutoscalingConfig{}\n\tr.Policy = dcl.FlattenString(m[\"policyUri\"])\n\n\treturn r\n}", "title": "" }, { "docid": "4ebdc066f5a4e16b90c75ea6565953a6", "score": "0.45404518", "text": "func ContainerClusterAddonsConfigNetworkPolicyConfigToProto(o *container.ClusterAddonsConfigNetworkPolicyConfig) *containerpb.ContainerClusterAddonsConfigNetworkPolicyConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterAddonsConfigNetworkPolicyConfig{\n\t\tDisabled: dcl.ValueOrEmptyBool(o.Disabled),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "a449360e8a358257104be6c25c2dbf82", "score": "0.45345134", "text": "func ContainerClusterNodePoolsConfigReservationAffinityToProto(o *container.ClusterNodePoolsConfigReservationAffinity) *containerpb.ContainerClusterNodePoolsConfigReservationAffinity {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodePoolsConfigReservationAffinity{\n\t\tConsumeReservationType: ContainerClusterNodePoolsConfigReservationAffinityConsumeReservationTypeEnumToProto(o.ConsumeReservationType),\n\t\tKey: dcl.ValueOrEmptyString(o.Key),\n\t}\n\tfor _, r := range o.Values {\n\t\tp.Values = append(p.Values, r)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "1337e13f3e16daa9966c572a90fb7c0a", "score": "0.45330074", "text": "func ProtoToDataprocClusterConfigGceClusterConfigNodeGroupAffinity(p *dataprocpb.DataprocClusterConfigGceClusterConfigNodeGroupAffinity) *dataproc.ClusterConfigGceClusterConfigNodeGroupAffinity {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigGceClusterConfigNodeGroupAffinity{\n\t\tNodeGroup: dcl.StringOrNil(p.GetNodeGroup()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "f02429e124859fe7a9c56c7692a77a72", "score": "0.45313057", "text": "func ContainerClusterNodeConfigShieldedInstanceConfigToProto(o *container.ClusterNodeConfigShieldedInstanceConfig) *containerpb.ContainerClusterNodeConfigShieldedInstanceConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodeConfigShieldedInstanceConfig{\n\t\tEnableSecureBoot: dcl.ValueOrEmptyBool(o.EnableSecureBoot),\n\t\tEnableIntegrityMonitoring: dcl.ValueOrEmptyBool(o.EnableIntegrityMonitoring),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "ac53b1e0582ac83040411788eddd12a1", "score": "0.4516519", "text": "func ContainerClusterAddonsConfigToProto(o *container.ClusterAddonsConfig) *containerpb.ContainerClusterAddonsConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterAddonsConfig{\n\t\tHttpLoadBalancing: ContainerClusterAddonsConfigHttpLoadBalancingToProto(o.HttpLoadBalancing),\n\t\tHorizontalPodAutoscaling: ContainerClusterAddonsConfigHorizontalPodAutoscalingToProto(o.HorizontalPodAutoscaling),\n\t\tKubernetesDashboard: ContainerClusterAddonsConfigKubernetesDashboardToProto(o.KubernetesDashboard),\n\t\tNetworkPolicyConfig: ContainerClusterAddonsConfigNetworkPolicyConfigToProto(o.NetworkPolicyConfig),\n\t\tCloudRunConfig: ContainerClusterAddonsConfigCloudRunConfigToProto(o.CloudRunConfig),\n\t\tDnsCacheConfig: ContainerClusterAddonsConfigDnsCacheConfigToProto(o.DnsCacheConfig),\n\t\tConfigConnectorConfig: ContainerClusterAddonsConfigConfigConnectorConfigToProto(o.ConfigConnectorConfig),\n\t\tGcePersistentDiskCsiDriverConfig: ContainerClusterAddonsConfigGcePersistentDiskCsiDriverConfigToProto(o.GcePersistentDiskCsiDriverConfig),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "7b2713daf4699207951a07ef06a21ab9", "score": "0.45085165", "text": "func ProtoToContainerClusterNodePoolsConfigSandboxConfig(p *containerpb.ContainerClusterNodePoolsConfigSandboxConfig) *container.ClusterNodePoolsConfigSandboxConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodePoolsConfigSandboxConfig{\n\t\tType: ProtoToContainerClusterNodePoolsConfigSandboxConfigTypeEnum(p.GetType()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "463025c4d3d263284a6386a97b3c02db", "score": "0.45036334", "text": "func ContainerBetaClusterAddonsConfigIstioConfigToProto(o *beta.ClusterAddonsConfigIstioConfig) *betapb.ContainerBetaClusterAddonsConfigIstioConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &betapb.ContainerBetaClusterAddonsConfigIstioConfig{\n\t\tDisabled: dcl.ValueOrEmptyBool(o.Disabled),\n\t\tAuth: ContainerBetaClusterAddonsConfigIstioConfigAuthEnumToProto(o.Auth),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "6c0f0bbbe2cca3d6bca48871f66680c0", "score": "0.44993472", "text": "func ContainerClusterAutoscalingAutoprovisioningNodePoolDefaultsShieldedInstanceConfigToProto(o *container.ClusterAutoscalingAutoprovisioningNodePoolDefaultsShieldedInstanceConfig) *containerpb.ContainerClusterAutoscalingAutoprovisioningNodePoolDefaultsShieldedInstanceConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterAutoscalingAutoprovisioningNodePoolDefaultsShieldedInstanceConfig{\n\t\tEnableSecureBoot: dcl.ValueOrEmptyBool(o.EnableSecureBoot),\n\t\tEnableIntegrityMonitoring: dcl.ValueOrEmptyBool(o.EnableIntegrityMonitoring),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "55e501ecc7824a8306f6dc538dcb9476", "score": "0.44942367", "text": "func ProtoToDataprocClusterConfigGceClusterConfigReservationAffinity(p *dataprocpb.DataprocClusterConfigGceClusterConfigReservationAffinity) *dataproc.ClusterConfigGceClusterConfigReservationAffinity {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigGceClusterConfigReservationAffinity{\n\t\tConsumeReservationType: ProtoToDataprocClusterConfigGceClusterConfigReservationAffinityConsumeReservationTypeEnum(p.GetConsumeReservationType()),\n\t\tKey: dcl.StringOrNil(p.GetKey()),\n\t}\n\tfor _, r := range p.GetValues() {\n\t\tobj.Values = append(obj.Values, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d91bfed178eb77cd83c268f213012317", "score": "0.44921225", "text": "func ProtoToContainerClusterNodePoolsConfig(p *containerpb.ContainerClusterNodePoolsConfig) *container.ClusterNodePoolsConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNodePoolsConfig{\n\t\tMachineType: dcl.StringOrNil(p.MachineType),\n\t\tDiskSizeGb: dcl.Int64OrNil(p.DiskSizeGb),\n\t\tServiceAccount: dcl.StringOrNil(p.ServiceAccount),\n\t\tImageType: dcl.StringOrNil(p.ImageType),\n\t\tLocalSsdCount: dcl.Int64OrNil(p.LocalSsdCount),\n\t\tPreemptible: dcl.Bool(p.Preemptible),\n\t\tDiskType: dcl.StringOrNil(p.DiskType),\n\t\tMinCpuPlatform: dcl.StringOrNil(p.MinCpuPlatform),\n\t\tWorkloadMetadataConfig: ProtoToContainerClusterNodePoolsConfigWorkloadMetadataConfig(p.GetWorkloadMetadataConfig()),\n\t\tSandboxConfig: ProtoToContainerClusterNodePoolsConfigSandboxConfig(p.GetSandboxConfig()),\n\t\tNodeGroup: dcl.StringOrNil(p.NodeGroup),\n\t\tReservationAffinity: ProtoToContainerClusterNodePoolsConfigReservationAffinity(p.GetReservationAffinity()),\n\t\tShieldedInstanceConfig: ProtoToContainerClusterNodePoolsConfigShieldedInstanceConfig(p.GetShieldedInstanceConfig()),\n\t\tLinuxNodeConfig: ProtoToContainerClusterNodePoolsConfigLinuxNodeConfig(p.GetLinuxNodeConfig()),\n\t\tKubeletConfig: ProtoToContainerClusterNodePoolsConfigKubeletConfig(p.GetKubeletConfig()),\n\t\tBootDiskKmsKey: dcl.StringOrNil(p.BootDiskKmsKey),\n\t}\n\tfor _, r := range p.GetOauthScopes() {\n\t\tobj.OAuthScopes = append(obj.OAuthScopes, r)\n\t}\n\tfor _, r := range p.GetTags() {\n\t\tobj.Tags = append(obj.Tags, r)\n\t}\n\tfor _, r := range p.GetAccelerators() {\n\t\tobj.Accelerators = append(obj.Accelerators, *ProtoToContainerClusterNodePoolsConfigAccelerators(r))\n\t}\n\tfor _, r := range p.GetTaints() {\n\t\tobj.Taints = append(obj.Taints, *ProtoToContainerClusterNodePoolsConfigTaints(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "017c6be0a629c154c9cd62d0301b0989", "score": "0.44799295", "text": "func ProtoToDataprocClusterConfigSecurityConfig(p *dataprocpb.DataprocClusterConfigSecurityConfig) *dataproc.ClusterConfigSecurityConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigSecurityConfig{\n\t\tKerberosConfig: ProtoToDataprocClusterConfigSecurityConfigKerberosConfig(p.GetKerberosConfig()),\n\t\tIdentityConfig: ProtoToDataprocClusterConfigSecurityConfigIdentityConfig(p.GetIdentityConfig()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "4d4e0d560c4a85818bcfa015011c8801", "score": "0.44778505", "text": "func DataprocClusterConfigGceClusterConfigNodeGroupAffinityToProto(o *dataproc.ClusterConfigGceClusterConfigNodeGroupAffinity) *dataprocpb.DataprocClusterConfigGceClusterConfigNodeGroupAffinity {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigGceClusterConfigNodeGroupAffinity{}\n\tp.SetNodeGroup(dcl.ValueOrEmptyString(o.NodeGroup))\n\treturn p\n}", "title": "" }, { "docid": "d40a8038e548f3eadff909a940ed161b", "score": "0.446453", "text": "func DataprocClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfigToProto(o *dataproc.ClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfig) *dataprocpb.DataprocClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfig{}\n\tp.SetGkeClusterTarget(dcl.ValueOrEmptyString(o.GkeClusterTarget))\n\tsNodePoolTarget := make([]*dataprocpb.DataprocClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfigNodePoolTarget, len(o.NodePoolTarget))\n\tfor i, r := range o.NodePoolTarget {\n\t\tsNodePoolTarget[i] = DataprocClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfigNodePoolTargetToProto(&r)\n\t}\n\tp.SetNodePoolTarget(sNodePoolTarget)\n\treturn p\n}", "title": "" }, { "docid": "debe90a875e7b9c86d9d7e84e8c76816", "score": "0.44628108", "text": "func ContainerClusterAddonsConfigConfigConnectorConfigToProto(o *container.ClusterAddonsConfigConfigConnectorConfig) *containerpb.ContainerClusterAddonsConfigConfigConnectorConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterAddonsConfigConfigConnectorConfig{\n\t\tEnabled: dcl.ValueOrEmptyBool(o.Enabled),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "4c8cbf4acc67dd925f4bff6fd572c15a", "score": "0.4461195", "text": "func ProtoToDataprocClusterConfigWorkerConfigInstanceReferences(p *dataprocpb.DataprocClusterConfigWorkerConfigInstanceReferences) *dataproc.ClusterConfigWorkerConfigInstanceReferences {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigWorkerConfigInstanceReferences{\n\t\tInstanceName: dcl.StringOrNil(p.GetInstanceName()),\n\t\tInstanceId: dcl.StringOrNil(p.GetInstanceId()),\n\t\tPublicKey: dcl.StringOrNil(p.GetPublicKey()),\n\t\tPublicEciesKey: dcl.StringOrNil(p.GetPublicEciesKey()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "6b62127b410deba2287e7d8701d4b33f", "score": "0.4460566", "text": "func ContainerClusterNetworkConfigToProto(o *container.ClusterNetworkConfig) *containerpb.ContainerClusterNetworkConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNetworkConfig{\n\t\tNetwork: dcl.ValueOrEmptyString(o.Network),\n\t\tSubnetwork: dcl.ValueOrEmptyString(o.Subnetwork),\n\t\tEnableIntraNodeVisibility: dcl.ValueOrEmptyBool(o.EnableIntraNodeVisibility),\n\t\tDefaultSnatStatus: ContainerClusterNetworkConfigDefaultSnatStatusToProto(o.DefaultSnatStatus),\n\t\tPrivateIpv6GoogleAccess: ContainerClusterNetworkConfigPrivateIPv6GoogleAccessEnumToProto(o.PrivateIPv6GoogleAccess),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "63315abb3db2d9ef87a0034ad2016120", "score": "0.44452006", "text": "func ContainerBetaClusterAddonsConfigHorizontalPodAutoscalingToProto(o *beta.ClusterAddonsConfigHorizontalPodAutoscaling) *betapb.ContainerBetaClusterAddonsConfigHorizontalPodAutoscaling {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &betapb.ContainerBetaClusterAddonsConfigHorizontalPodAutoscaling{\n\t\tDisabled: dcl.ValueOrEmptyBool(o.Disabled),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "ae0737b0f4a52a22e69bd05921b97485", "score": "0.44423974", "text": "func ProtoToContainerClusterAuthenticatorGroupsConfig(p *containerpb.ContainerClusterAuthenticatorGroupsConfig) *container.ClusterAuthenticatorGroupsConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterAuthenticatorGroupsConfig{\n\t\tEnabled: dcl.Bool(p.Enabled),\n\t\tSecurityGroup: dcl.StringOrNil(p.SecurityGroup),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "9984eed53a499349fdbce1ab9759d2de", "score": "0.44418305", "text": "func DataprocClusterConfigDataprocMetricConfigMetricsToProto(o *dataproc.ClusterConfigDataprocMetricConfigMetrics) *dataprocpb.DataprocClusterConfigDataprocMetricConfigMetrics {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigDataprocMetricConfigMetrics{}\n\tp.SetMetricSource(DataprocClusterConfigDataprocMetricConfigMetricsMetricSourceEnumToProto(o.MetricSource))\n\tsMetricOverrides := make([]string, len(o.MetricOverrides))\n\tfor i, r := range o.MetricOverrides {\n\t\tsMetricOverrides[i] = r\n\t}\n\tp.SetMetricOverrides(sMetricOverrides)\n\treturn p\n}", "title": "" }, { "docid": "fa52083b2f68824a5a439b4d81e0d7a1", "score": "0.44374982", "text": "func ContainerClusterIPAllocationPolicyToProto(o *container.ClusterIPAllocationPolicy) *containerpb.ContainerClusterIPAllocationPolicy {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterIPAllocationPolicy{\n\t\tUseIpAliases: dcl.ValueOrEmptyBool(o.UseIPAliases),\n\t\tCreateSubnetwork: dcl.ValueOrEmptyBool(o.CreateSubnetwork),\n\t\tSubnetworkName: dcl.ValueOrEmptyString(o.SubnetworkName),\n\t\tClusterSecondaryRangeName: dcl.ValueOrEmptyString(o.ClusterSecondaryRangeName),\n\t\tServicesSecondaryRangeName: dcl.ValueOrEmptyString(o.ServicesSecondaryRangeName),\n\t\tClusterIpv4CidrBlock: dcl.ValueOrEmptyString(o.ClusterIPv4CidrBlock),\n\t\tNodeIpv4CidrBlock: dcl.ValueOrEmptyString(o.NodeIPv4CidrBlock),\n\t\tServicesIpv4CidrBlock: dcl.ValueOrEmptyString(o.ServicesIPv4CidrBlock),\n\t\tTpuIpv4CidrBlock: dcl.ValueOrEmptyString(o.TPUIPv4CidrBlock),\n\t\tClusterIpv4Cidr: dcl.ValueOrEmptyString(o.ClusterIPv4Cidr),\n\t\tNodeIpv4Cidr: dcl.ValueOrEmptyString(o.NodeIPv4Cidr),\n\t\tServicesIpv4Cidr: dcl.ValueOrEmptyString(o.ServicesIPv4Cidr),\n\t\tUseRoutes: dcl.ValueOrEmptyBool(o.UseRoutes),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "c9252a1b68e414667c3f61c5c6517496", "score": "0.443417", "text": "func ProtoToDataprocClusterConfigDataprocMetricConfig(p *dataprocpb.DataprocClusterConfigDataprocMetricConfig) *dataproc.ClusterConfigDataprocMetricConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigDataprocMetricConfig{}\n\tfor _, r := range p.GetMetrics() {\n\t\tobj.Metrics = append(obj.Metrics, *ProtoToDataprocClusterConfigDataprocMetricConfigMetrics(r))\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "44890b9b48c9a7f103cc7e5a9fbde129", "score": "0.44318667", "text": "func ProtoToContainerBetaClusterAddonsConfigHorizontalPodAutoscaling(p *betapb.ContainerBetaClusterAddonsConfigHorizontalPodAutoscaling) *beta.ClusterAddonsConfigHorizontalPodAutoscaling {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &beta.ClusterAddonsConfigHorizontalPodAutoscaling{\n\t\tDisabled: dcl.Bool(p.Disabled),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "18a8a043f31dd61856eb5a6c4d1a69e7", "score": "0.4431157", "text": "func ProtoToDataprocClusterConfigGceClusterConfigConfidentialInstanceConfig(p *dataprocpb.DataprocClusterConfigGceClusterConfigConfidentialInstanceConfig) *dataproc.ClusterConfigGceClusterConfigConfidentialInstanceConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigGceClusterConfigConfidentialInstanceConfig{\n\t\tEnableConfidentialCompute: dcl.Bool(p.GetEnableConfidentialCompute()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "432909f37f4fb354780782b6ac02c9ff", "score": "0.4426724", "text": "func DataprocClusterVirtualClusterConfigToProto(o *dataproc.ClusterVirtualClusterConfig) *dataprocpb.DataprocClusterVirtualClusterConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterVirtualClusterConfig{}\n\tp.SetStagingBucket(dcl.ValueOrEmptyString(o.StagingBucket))\n\tp.SetKubernetesClusterConfig(DataprocClusterVirtualClusterConfigKubernetesClusterConfigToProto(o.KubernetesClusterConfig))\n\tp.SetAuxiliaryServicesConfig(DataprocClusterVirtualClusterConfigAuxiliaryServicesConfigToProto(o.AuxiliaryServicesConfig))\n\treturn p\n}", "title": "" }, { "docid": "3810fc95642f3c1cac363bde07d4808e", "score": "0.44253337", "text": "func ProtoToContainerBetaClusterAddonsConfigIstioConfig(p *betapb.ContainerBetaClusterAddonsConfigIstioConfig) *beta.ClusterAddonsConfigIstioConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &beta.ClusterAddonsConfigIstioConfig{\n\t\tDisabled: dcl.Bool(p.Disabled),\n\t\tAuth: ProtoToContainerBetaClusterAddonsConfigIstioConfigAuthEnum(p.GetAuth()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "c5e7288e3eaabce09cf59776ca82542d", "score": "0.4410799", "text": "func ContainerClusterNodeConfigToProto(o *container.ClusterNodeConfig) *containerpb.ContainerClusterNodeConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodeConfig{\n\t\tMachineType: dcl.ValueOrEmptyString(o.MachineType),\n\t\tDiskSizeGb: dcl.ValueOrEmptyInt64(o.DiskSizeGb),\n\t\tServiceAccount: dcl.ValueOrEmptyString(o.ServiceAccount),\n\t\tImageType: dcl.ValueOrEmptyString(o.ImageType),\n\t\tLocalSsdCount: dcl.ValueOrEmptyInt64(o.LocalSsdCount),\n\t\tPreemptible: dcl.ValueOrEmptyBool(o.Preemptible),\n\t\tDiskType: dcl.ValueOrEmptyString(o.DiskType),\n\t\tMinCpuPlatform: dcl.ValueOrEmptyString(o.MinCpuPlatform),\n\t\tWorkloadMetadataConfig: ContainerClusterNodeConfigWorkloadMetadataConfigToProto(o.WorkloadMetadataConfig),\n\t\tSandboxConfig: ContainerClusterNodeConfigSandboxConfigToProto(o.SandboxConfig),\n\t\tNodeGroup: dcl.ValueOrEmptyString(o.NodeGroup),\n\t\tReservationAffinity: ContainerClusterNodeConfigReservationAffinityToProto(o.ReservationAffinity),\n\t\tShieldedInstanceConfig: ContainerClusterNodeConfigShieldedInstanceConfigToProto(o.ShieldedInstanceConfig),\n\t\tLinuxNodeConfig: ContainerClusterNodeConfigLinuxNodeConfigToProto(o.LinuxNodeConfig),\n\t\tKubeletConfig: ContainerClusterNodeConfigKubeletConfigToProto(o.KubeletConfig),\n\t\tBootDiskKmsKey: dcl.ValueOrEmptyString(o.BootDiskKmsKey),\n\t}\n\tfor _, r := range o.OAuthScopes {\n\t\tp.OauthScopes = append(p.OauthScopes, r)\n\t}\n\tp.Metadata = make(map[string]string)\n\tfor k, r := range o.Metadata {\n\t\tp.Metadata[k] = r\n\t}\n\tp.Labels = make(map[string]string)\n\tfor k, r := range o.Labels {\n\t\tp.Labels[k] = r\n\t}\n\tfor _, r := range o.Tags {\n\t\tp.Tags = append(p.Tags, r)\n\t}\n\tfor _, r := range o.Accelerators {\n\t\tp.Accelerators = append(p.Accelerators, ContainerClusterNodeConfigAcceleratorsToProto(&r))\n\t}\n\tfor _, r := range o.Taints {\n\t\tp.Taints = append(p.Taints, ContainerClusterNodeConfigTaintsToProto(&r))\n\t}\n\treturn p\n}", "title": "" }, { "docid": "c21bea7cf94a544ce7b41af75f8a9d5b", "score": "0.4401539", "text": "func ContainerClusterNodeConfigReservationAffinityToProto(o *container.ClusterNodeConfigReservationAffinity) *containerpb.ContainerClusterNodeConfigReservationAffinity {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodeConfigReservationAffinity{\n\t\tConsumeReservationType: ContainerClusterNodeConfigReservationAffinityConsumeReservationTypeEnumToProto(o.ConsumeReservationType),\n\t\tKey: dcl.ValueOrEmptyString(o.Key),\n\t}\n\tfor _, r := range o.Values {\n\t\tp.Values = append(p.Values, r)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "ba7f7ee6c3e7473af1485e2a04699b41", "score": "0.43928605", "text": "func ProtoToContainerClusterNotificationConfigPubsub(p *containerpb.ContainerClusterNotificationConfigPubsub) *container.ClusterNotificationConfigPubsub {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &container.ClusterNotificationConfigPubsub{\n\t\tEnabled: dcl.Bool(p.Enabled),\n\t\tTopic: dcl.StringOrNil(p.Topic),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "774f0d9a4cbac3c6e323571f1956d5a9", "score": "0.43841958", "text": "func ProtoToDataprocClusterConfigWorkerConfigAccelerators(p *dataprocpb.DataprocClusterConfigWorkerConfigAccelerators) *dataproc.ClusterConfigWorkerConfigAccelerators {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterConfigWorkerConfigAccelerators{\n\t\tAcceleratorType: dcl.StringOrNil(p.GetAcceleratorType()),\n\t\tAcceleratorCount: dcl.Int64OrNil(p.GetAcceleratorCount()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "d0fe4ee7b7c4403cc04d26d80390f0a1", "score": "0.43837342", "text": "func DataprocClusterConfigGceClusterConfigReservationAffinityToProto(o *dataproc.ClusterConfigGceClusterConfigReservationAffinity) *dataprocpb.DataprocClusterConfigGceClusterConfigReservationAffinity {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigGceClusterConfigReservationAffinity{}\n\tp.SetConsumeReservationType(DataprocClusterConfigGceClusterConfigReservationAffinityConsumeReservationTypeEnumToProto(o.ConsumeReservationType))\n\tp.SetKey(dcl.ValueOrEmptyString(o.Key))\n\tsValues := make([]string, len(o.Values))\n\tfor i, r := range o.Values {\n\t\tsValues[i] = r\n\t}\n\tp.SetValues(sValues)\n\treturn p\n}", "title": "" }, { "docid": "90eb1a846eea88681608cfe7aaa0a0da", "score": "0.4383674", "text": "func ContainerClusterNodePoolsConfigKubeletConfigToProto(o *container.ClusterNodePoolsConfigKubeletConfig) *containerpb.ContainerClusterNodePoolsConfigKubeletConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNodePoolsConfigKubeletConfig{\n\t\tCpuManagerPolicy: dcl.ValueOrEmptyString(o.CpuManagerPolicy),\n\t\tCpuCfsQuota: dcl.ValueOrEmptyBool(o.CpuCfsQuota),\n\t\tCpuCfsQuotaPeriod: dcl.ValueOrEmptyString(o.CpuCfsQuotaPeriod),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "2e329c3728e37b5812c19fe4c027ea24", "score": "0.4382788", "text": "func ConvertWorkloadEntry(cfg config.Config) *networking.WorkloadEntry {\n\twle := cfg.Spec.(*networking.WorkloadEntry)\n\tif wle == nil {\n\t\treturn nil\n\t}\n\n\tlabels := make(map[string]string, len(wle.Labels)+len(cfg.Labels))\n\tfor k, v := range wle.Labels {\n\t\tlabels[k] = v\n\t}\n\t// we will merge labels from metadata with spec, with precedence to the metadata\n\tfor k, v := range cfg.Labels {\n\t\tlabels[k] = v\n\t}\n\t// shallow copy\n\tcopied := &networking.WorkloadEntry{}\n\tprotomarshal.ShallowCopy(copied, wle)\n\tcopied.Labels = labels\n\treturn copied\n}", "title": "" }, { "docid": "252c82e6f54f26ac75d9c6acd8d36f1c", "score": "0.43813977", "text": "func DataprocClusterConfigGceClusterConfigConfidentialInstanceConfigToProto(o *dataproc.ClusterConfigGceClusterConfigConfidentialInstanceConfig) *dataprocpb.DataprocClusterConfigGceClusterConfigConfidentialInstanceConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigGceClusterConfigConfidentialInstanceConfig{}\n\tp.SetEnableConfidentialCompute(dcl.ValueOrEmptyBool(o.EnableConfidentialCompute))\n\treturn p\n}", "title": "" }, { "docid": "421f947e58196371652408b27c195a63", "score": "0.438095", "text": "func ContainerClusterNetworkPolicyToProto(o *container.ClusterNetworkPolicy) *containerpb.ContainerClusterNetworkPolicy {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterNetworkPolicy{\n\t\tProvider: ContainerClusterNetworkPolicyProviderEnumToProto(o.Provider),\n\t\tEnabled: dcl.ValueOrEmptyBool(o.Enabled),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "aa851c82283d90cb4a91deb724d8457e", "score": "0.43675163", "text": "func ContainerBetaClusterAddonsConfigCloudRunConfigToProto(o *beta.ClusterAddonsConfigCloudRunConfig) *betapb.ContainerBetaClusterAddonsConfigCloudRunConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &betapb.ContainerBetaClusterAddonsConfigCloudRunConfig{\n\t\tDisabled: dcl.ValueOrEmptyBool(o.Disabled),\n\t\tLoadBalancerType: ContainerBetaClusterAddonsConfigCloudRunConfigLoadBalancerTypeEnumToProto(o.LoadBalancerType),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "a97984f5c38f773c819709053212d962", "score": "0.43541414", "text": "func ContainerClusterAddonsConfigHttpLoadBalancingToProto(o *container.ClusterAddonsConfigHttpLoadBalancing) *containerpb.ContainerClusterAddonsConfigHttpLoadBalancing {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &containerpb.ContainerClusterAddonsConfigHttpLoadBalancing{\n\t\tDisabled: dcl.ValueOrEmptyBool(o.Disabled),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "45aaed518fa1786b9d2d5eac90df6682", "score": "0.43450975", "text": "func DataprocClusterConfigWorkerConfigDiskConfigToProto(o *dataproc.ClusterConfigWorkerConfigDiskConfig) *dataprocpb.DataprocClusterConfigWorkerConfigDiskConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigWorkerConfigDiskConfig{}\n\tp.SetBootDiskType(dcl.ValueOrEmptyString(o.BootDiskType))\n\tp.SetBootDiskSizeGb(dcl.ValueOrEmptyInt64(o.BootDiskSizeGb))\n\tp.SetNumLocalSsds(dcl.ValueOrEmptyInt64(o.NumLocalSsds))\n\tp.SetLocalSsdInterface(dcl.ValueOrEmptyString(o.LocalSsdInterface))\n\treturn p\n}", "title": "" }, { "docid": "42913bcae2643743f5d5fb89ea69e7ff", "score": "0.4336051", "text": "func ProtoToDataprocClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfigNodePoolTargetNodePoolConfigAutoscaling(p *dataprocpb.DataprocClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfigNodePoolTargetNodePoolConfigAutoscaling) *dataproc.ClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfigNodePoolTargetNodePoolConfigAutoscaling {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dataproc.ClusterVirtualClusterConfigKubernetesClusterConfigGkeClusterConfigNodePoolTargetNodePoolConfigAutoscaling{\n\t\tMinNodeCount: dcl.Int64OrNil(p.GetMinNodeCount()),\n\t\tMaxNodeCount: dcl.Int64OrNil(p.GetMaxNodeCount()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "f0680823dc1f98305d461294fe661cb8", "score": "0.43332222", "text": "func DataprocClusterConfigSecurityConfigToProto(o *dataproc.ClusterConfigSecurityConfig) *dataprocpb.DataprocClusterConfigSecurityConfig {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dataprocpb.DataprocClusterConfigSecurityConfig{}\n\tp.SetKerberosConfig(DataprocClusterConfigSecurityConfigKerberosConfigToProto(o.KerberosConfig))\n\tp.SetIdentityConfig(DataprocClusterConfigSecurityConfigIdentityConfigToProto(o.IdentityConfig))\n\treturn p\n}", "title": "" } ]
893937435af36a2748bd8bf78338350b
Healthz handle URL healthcheck
[ { "docid": "5b2b52ef54cb429067b826c5baa18d95", "score": "0.6219939", "text": "func Healthz(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"ok\"))\n}", "title": "" } ]
[ { "docid": "bca8e025823d4474ee5d72b14e27df31", "score": "0.7330406", "text": "func HealthCheck(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.URL.Path == statusEndpoint {\n\t\t\tstatusHandler(w, r)\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "b6a6fde11e3e64a958cc72a266d44669", "score": "0.7288172", "text": "func (c clientREST) HealthCheck(url *url.URL) error {\n\tres, err := c.client.Get(url.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res.StatusCode != http.StatusOK {\n\t\treturn ErrServiceNotAvailable\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bc14de0db70eee0b4fd527bab06446f8", "score": "0.71034944", "text": "func checkHealth(wg *sync.WaitGroup, url string) {\n\tr, err := http.Get(url)\n\tif err != nil {\n\t\treturn\n\t}\n\tif r.StatusCode == http.StatusOK {\n\t\tSuccessCounter.Lock()\n\t\tSuccessCounter.x++\n\t\tSuccessCounter.Unlock()\n\t}\n\twg.Done()\n}", "title": "" }, { "docid": "c662040d37c7826621d8e3221c1b0a2e", "score": "0.7024857", "text": "func runHealthcheck(url string, timeout time.Duration) int {\n\tclient := &http.Client{\n\t\tTimeout: timeout,\n\t}\n\tr, err := http.NewRequest(\"HEAD\", url, nil)\n\tif err != nil {\n\t\tseelog.Errorf(\"error creating healthcheck request: %v\", err)\n\t\treturn exitcodes.ExitError\n\t}\n\tresp, err := client.Do(r)\n\tif err != nil {\n\t\tseelog.Errorf(\"health check [HEAD %s] failed with error: %v\", url, err)\n\t\treturn exitcodes.ExitError\n\t}\n\tresp.Body.Close()\n\treturn exitcodes.ExitSuccess\n}", "title": "" }, { "docid": "3ce1ddfcb42f6e1d7ee81d98de924e4e", "score": "0.6994871", "text": "func ServeHealth(w http.ResponseWriter, r *http.Request) {\n\tlogrus.WithField(\"uri\", r.RequestURI).Debug(\"healthy\")\n\tfmt.Fprint(w, \"OK\")\n}", "title": "" }, { "docid": "6915ea7c80462f3c8f444460140fa179", "score": "0.68687946", "text": "func (h *Handlers) healthcheck(w http.ResponseWriter, r *http.Request) {\n\th.logger.Println(\"healthcheck request processed\")\n\n\ths := &healthState{}\n\n\t// urlshortener\n\tresWeb, err := http.Get(fmt.Sprintf(\"http://localhost:%s%s/ok\", h.serverAddress, h.apiprefix))\n\tif err != nil {\n\t\th.logger.Printf(\"Check failed: %v\", err)\n\t} else {\n\t\tdefer resWeb.Body.Close()\n\t\t// if err != nil || resWeb.StatusCode != 200 {\n\t\tif resWeb.StatusCode != 200 {\n\t\t\th.logger.Printf(\"Status code error: %d, Status error: %s\", resWeb.StatusCode, resWeb.Status)\n\t\t\ths.UrlErrorMessages = append(hs.UrlErrorMessages, fmt.Sprintf(\"HealthError: %s\", resWeb.Status))\n\t\t}\n\t\tif len(hs.UrlErrorMessages) > 0 {\n\t\t\ths.State = \"NOK\"\n\t\t} else {\n\t\t\ths.State = \"OK\"\n\t\t}\n\t}\n\n\t// redis\n\tresRedis, err := http.Get(fmt.Sprintf(\"http://localhost:%s\", h.storeAddress))\n\tif err != nil {\n\t\th.logger.Printf(\"Check failed: %v\", err)\n\t\ths.Redis = \"NOK\"\n\t\ths.RedisErrorMessages = append(hs.RedisErrorMessages, fmt.Sprintf(\"HealthError: %v\", err))\n\t} else {\n\t\tdefer resRedis.Body.Close()\n\t\tif resRedis.StatusCode != 200 {\n\t\t\th.logger.Printf(\"Status code error: %d, Status error: %s\", resRedis.StatusCode, resRedis.Status)\n\t\t\ths.RedisErrorMessages = append(hs.RedisErrorMessages, fmt.Sprintf(\"HealthError: %s\", resRedis.Status))\n\t\t}\n\t\tif len(hs.RedisErrorMessages) > 0 {\n\t\t\ths.Redis = \"NOK\"\n\t\t} else {\n\t\t\ths.Redis = \"OK\"\n\t\t}\n\t}\n\t// both\n\tb, err := json.Marshal(hs)\n\tif err != nil {\n\t\th.logger.Printf(\"Marshaling failed: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write([]byte(b))\n}", "title": "" }, { "docid": "1ed698f4f7498d26e6f14b2b285d8435", "score": "0.686316", "text": "func healthcheck(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "8c8f1e018e2c00f473b223ffaa9ac933", "score": "0.68448687", "text": "func healthCheck(status chan string) {\n\tdefer func() { status <- \"stop\" }()\n\trouter := mux.NewRouter()\n\trouter.HandleFunc(\"/\", health)\n\trouter.HandleFunc(\"/health\", health)\n\trouter.HandleFunc(\"/metrics\", metrics)\n\tlog.Fatal(http.ListenAndServe(\":8080\", router))\n}", "title": "" }, { "docid": "c3fdbf35720f8de8414c0f85addd0bf1", "score": "0.68310165", "text": "func Healthchecker(url string) bool {\n\tclient := http.Client{\n\t\tTimeout: 800 * time.Millisecond,\n\t}\n\n\treq, err := http.NewRequest(\"HEAD\", url, nil)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn false\n\t}\n\tresp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "7a722462be8eb5b407719d90e62ebede", "score": "0.68176955", "text": "func healthCheck(client *http.Client, url string) bool {\n\treq, err := http.NewRequest(\"HEAD\", url, nil)\n\tif err != nil {\n\t\treturn false\n\t}\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", framework.TestContext.BearerToken))\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tklog.Warningf(\"Health check on %q failed, error=%v\", url, err)\n\t} else if resp.StatusCode != http.StatusOK {\n\t\tklog.Warningf(\"Health check on %q failed, status=%d\", url, resp.StatusCode)\n\t}\n\treturn err == nil && resp.StatusCode == http.StatusOK\n}", "title": "" }, { "docid": "7a5aa9e0d02ed147231d2d706bfb5cf1", "score": "0.67873335", "text": "func (h *Handlers) healthz(w http.ResponseWriter, r *http.Request) {\n\th.logger.Println(\"healthz request processed\")\n\tresWeb, err := http.Get(fmt.Sprintf(\"http://localhost:%s%s/ok\", h.serverAddress, h.apiprefix))\n\tif err != nil {\n\t\th.logger.Printf(\"Check failed: %v\", err)\n\t} else {\n\t\tdefer resWeb.Body.Close()\n\t\t// if err != nil || resWeb.StatusCode != 200 {\n\t\tif resWeb.StatusCode != 200 {\n\t\t\th.logger.Printf(\"Status code error: %d, Status error: %s\", resWeb.StatusCode, resWeb.Status)\n\t\t\tw.Write([]byte(\"NOK\"))\n\t\t} else {\n\t\t\tw.Write([]byte(\"OK\"))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c83da862d9ef89bef45b045e6a3a1d0b", "score": "0.67718875", "text": "func Healthcheck(ctx context.Context, c *gnomock.Container) error {\n\tif err := health.HTTPGet(ctx, c.Address(\"web80\")); err != nil {\n\t\treturn err\n\t}\n\n\treturn health.HTTPGet(ctx, c.Address(\"web8080\"))\n}", "title": "" }, { "docid": "4f06b3fdfbc87d3dc6d20e962cff0f5d", "score": "0.67410934", "text": "func health(writer http.ResponseWriter, request *http.Request) {\n\tglog.V(2).Infof(\"got %q\", html.EscapeString(request.URL.Path))\n\tif _, err := fmt.Fprintf(writer, \"Ok, %q\", html.EscapeString(request.URL.Path)); err != nil {\n\t\tglog.Error(err)\n\t}\n}", "title": "" }, { "docid": "f7eb0f5a6283b7bd519910f619535d2e", "score": "0.6731145", "text": "func HealthHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, \"Hello, you've hit %s\\n\", r.URL.Path)\n}", "title": "" }, { "docid": "f7eb0f5a6283b7bd519910f619535d2e", "score": "0.6731145", "text": "func HealthHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, \"Hello, you've hit %s\\n\", r.URL.Path)\n}", "title": "" }, { "docid": "3bbe2b1b19f3d72494aed2915b99e1a0", "score": "0.6684612", "text": "func healthCheckHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "9664cd6d5321158dcc641e1cf2f05a1c", "score": "0.66607934", "text": "func Health(w http.ResponseWriter, r *http.Request) {\n\tlog.Debug(\"/health endpoint called\")\n\tw.Write([]byte(\"OK\"))\n}", "title": "" }, { "docid": "db1954934c8e0467c1308319bb835add", "score": "0.66546357", "text": "func (h *handler) health(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprint(w, \"OK\")\n}", "title": "" }, { "docid": "404d84a6d0f88bbe3eae1fb551df8081", "score": "0.6641727", "text": "func HealthCheck(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, http.StatusText(http.StatusOK), http.StatusOK)\n}", "title": "" }, { "docid": "ac020b325e3f9b3c75b42a988a4e0381", "score": "0.6621593", "text": "func healthz(w http.ResponseWriter, _ *http.Request) {\n w.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "c0f4b5528ac430a183b375dfde8b3847", "score": "0.661181", "text": "func APIHealthCheck(uri *types.URI, delay time.Duration) (ok bool, err error) {\n\tlog.Printf(\"checking for rest service health\\n\")\n\tfor i := 0; i <= 5; i++ {\n\t\tlog.Infof(\"health check %s \", uri.String())\n\t\tresponse, errResp := http.Get(uri.String())\n\t\tif errResp != nil {\n\t\t\tlog.Warnf(\"try %d, return health check of the rest service for error %v\", i, errResp)\n\t\t\ttime.Sleep(delay)\n\t\t\terr = errResp\n\t\t\tcontinue\n\t\t}\n\t\tif response != nil && response.StatusCode == http.StatusOK {\n\t\t\tresponse.Body.Close()\n\t\t\tlog.Info(\"rest service returned healthy status\")\n\t\t\ttime.Sleep(delay)\n\t\t\terr = nil\n\t\t\tok = true\n\t\t\treturn\n\t\t}\n\t\tresponse.Body.Close()\n\t}\n\tif err != nil {\n\t\terr = fmt.Errorf(\"error connecting to rest api %s\", err.Error())\n\t}\n\treturn\n}", "title": "" }, { "docid": "24d5fcf7f4875b8dae3eaebe469c53df", "score": "0.6593726", "text": "func healthHandler(w http.ResponseWriter, _ *http.Request) {\n\tfmt.Fprint(w, \"OK\")\n}", "title": "" }, { "docid": "3df9798af3fc401c5b7c3f1c5cda1caf", "score": "0.6582272", "text": "func (a *App) healthcheck(w http.ResponseWriter, r *http.Request) {\n respondWithJSON(w, http.StatusOK, \"\")\n}", "title": "" }, { "docid": "7887f6ae320c831e5521f66a37d9d85f", "score": "0.6581208", "text": "func (s *Services) healthcheck(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "5f2bf348583af0bb7aacb5df8b28d862", "score": "0.656219", "text": "func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Service is healthy :)\")\n}", "title": "" }, { "docid": "d9b72d3d77443cafd3e2528f8ca79aee", "score": "0.6550812", "text": "func (*Server) health(w http.ResponseWriter, req *http.Request) {\n\tif req.Method != \"GET\" {\n\t\tw.Header().Set(\"Allow\", \"GET\")\n\t\thttp.Error(w, http.StatusText(405), 405)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\tio.WriteString(w, \"OK\")\n}", "title": "" }, { "docid": "407d00c62422905757d2e6f9a54d397b", "score": "0.65481687", "text": "func handleHealth(w http.ResponseWriter, req *http.Request) {\n\tw.Write([]byte(\"ok\\n\"))\n}", "title": "" }, { "docid": "9c27018fcd14591ee36f75d96480ffce", "score": "0.6542613", "text": "func ServeHealthCheck(mux *http.ServeMux, f func(r *http.Request) error) {\n\tmux.HandleFunc(\"/healthz\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif err := f(r); err != nil {\n\t\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\t\tlog.Errorln(w, err)\n\t\t} else {\n\t\t\tfmt.Fprintln(w, \"ok\")\n\t\t}\n\t})\n}", "title": "" }, { "docid": "3721612892e6b3064039195915948e39", "score": "0.6525133", "text": "func checkHealth(rw http.ResponseWriter, req *http.Request) {\n\tfmt.Fprint(rw, \"ok\")\n}", "title": "" }, { "docid": "3926f5bb15803a9350f40433b30cb163", "score": "0.65148854", "text": "func health(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"ok\"))\n}", "title": "" }, { "docid": "03a4cbc2ee7c79a14713c901a3ddb505", "score": "0.6494702", "text": "func routeHealthCheck(resp http.ResponseWriter, req *http.Request) {\n\tif healthy {\n\t\tresp.WriteHeader(http.StatusNoContent)\n\t\treturn\n\t}\n\tresp.WriteHeader(http.StatusServiceUnavailable)\n}", "title": "" }, { "docid": "d373db86607b57e824912c5b3d519296", "score": "0.64944756", "text": "func healthCheck(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"HealthCheck invoked\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"All is well :)\"))\n\treturn\n}", "title": "" }, { "docid": "473ea2528feeedf2109dae760d3def96", "score": "0.64928585", "text": "func HealthCheck(endpoint string) int {\n\n\turl := fmt.Sprintf(\"%s/healthcheck\", endpoint)\n\t//fmt.Printf( \"%s\\n\", url )\n\n\tresp, _, errs := gorequest.New().\n\t\tSetDebug(debugHTTP).\n\t\tGet(url).\n\t\tTimeout(time.Duration(serviceTimeout) * time.Second).\n\t\tEnd()\n\n\tif errs != nil {\n\t\treturn http.StatusInternalServerError\n\t}\n\n\tdefer io.Copy(ioutil.Discard, resp.Body)\n\tdefer resp.Body.Close()\n\n\treturn resp.StatusCode\n}", "title": "" }, { "docid": "dc3132c05701fdc63766cc844f7ff5b8", "score": "0.6492689", "text": "func HealthCheck(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "1f38f79f5816619e6508c203a6692cf8", "score": "0.64895606", "text": "func healthzHandler(rw http.ResponseWriter, req *http.Request) {\n\tfmt.Fprintf(rw, \"ok\")\n}", "title": "" }, { "docid": "14fb25122c2ff7ea9686ced8136fc484", "score": "0.6464977", "text": "func Health(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"Ok\")\n}", "title": "" }, { "docid": "a1149119b6e2775d2d2fc01477216880", "score": "0.6464842", "text": "func (p *proxyrunner) healthHandler(w http.ResponseWriter, r *http.Request) {\n\tif p.healthByExternalWD(w, r) {\n\t\treturn\n\t}\n\n\tvar (\n\t\tsmap = p.owner.smap.get()\n\t\tprimary = smap != nil && smap.version() > 0 && smap.isPrimary(p.si)\n\t\tquery = r.URL.Query()\n\t\tgetCii = cmn.IsParseBool(query.Get(cmn.URLParamClusterInfo))\n\t)\n\t// NOTE: internal use\n\tif getCii {\n\t\tcii := &clusterInfo{}\n\t\tcii.fill(&p.httprunner)\n\t\t_ = p.writeJSON(w, r, cii, \"cluster-info\")\n\t\treturn\n\t}\n\t// non-primary will keep returning 503 until cluster starts up\n\tif !primary && !p.ClusterStarted() {\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "ba8ed578b5b137794c113a5373fc1dc8", "score": "0.6460275", "text": "func Healthcheck(endpoint, msg string) func(http.Handler) http.Handler {\n\tf := func(next http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t\tctx, span := trace.StartSpan(r.Context(), \"middleware.Healthcheck\")\n\t\t\tdefer span.End()\n\t\t\tif strings.EqualFold(r.URL.Path, endpoint) {\n\t\t\t\tif r.Method != http.MethodGet && r.Method != http.MethodHead {\n\t\t\t\t\thttp.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\t\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t\tif r.Method == http.MethodGet {\n\t\t\t\t\tw.Write([]byte(msg))\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t}\n\t\treturn http.HandlerFunc(fn)\n\t}\n\treturn f\n}", "title": "" }, { "docid": "fe1c3c2d9159316582d9f4279de2cfad", "score": "0.64569014", "text": "func health(cfg *config.Config, l log.Logger) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\ttargetHost, err := url.Parse(cfg.Ldap.URI)\n\t\tif err != nil {\n\t\t\tl.Fatal().Err(err).Str(\"uri\", cfg.Ldap.URI).Msg(\"invalid LDAP URI\")\n\t\t}\n\t\terr = shared.RunChecklist(shared.TCPConnect(targetHost.Host))\n\t\tretVal := http.StatusOK\n\t\tif err != nil {\n\t\t\tl.Error().Err(err).Msg(\"Healtcheck failed\")\n\t\t\tretVal = http.StatusInternalServerError\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\t\tw.WriteHeader(retVal)\n\n\t\t_, err = io.WriteString(w, http.StatusText(retVal))\n\t\tif err != nil {\n\t\t\tl.Fatal().Err(err).Msg(\"Could not write health check body\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "93424aad70ae156a45e6cfbf3977c0d7", "score": "0.6441175", "text": "func (a *API) health() http.HandlerFunc {\n\tconst expBase = \"health\"\n\treturn httputil.MakeHealthHandler(expBase, nil)\n}", "title": "" }, { "docid": "8c562b1895d9d715f06a2a90e2dec22d", "score": "0.6432764", "text": "func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {\n\t// A very simple health check.\n\tw.WriteHeader(http.StatusOK)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t// In the future we could report back on the status of our DB, or our cache and include them in the response.\n\tresponse := `{alive: true}`\n\tdata, _ := json.Marshal(response)\n\tw.Write(data)\n}", "title": "" }, { "docid": "96b744252a45a3abc0720469c54f9489", "score": "0.64144015", "text": "func (a *HTTPHealthCheckHandler) HealthCheck(w http.ResponseWriter, r *http.Request) {\n\tvar t config.Config\n\th, _ := a.HUsecase.Check()\n\th.Status = \"up\"\n\tt.ResponseWithJSON(w, http.StatusOK, h)\n}", "title": "" }, { "docid": "198fbfe469b315ec2215ce4f1da6ca91", "score": "0.6414344", "text": "func Health(w http.ResponseWriter, r *http.Request) {\n\tname, err := os.Hostname()\n\tif err != nil {\n\t\tshared.FError(w, http.StatusBadRequest, \"Healthcheck failed\")\n\t}\n\tshared.FResponse(w, http.StatusOK, map[string]string{\"server\": name, \"result\": \"success\"})\n}", "title": "" }, { "docid": "374a9efb8704b9b8964d41979e1b07b8", "score": "0.6412859", "text": "func Check(urlAddr, port string, errChan chan error) {\n\tfor {\n\t\tif isHealth {\n\t\t\ttime.Sleep(time.Second * 2)\n\t\t\t// Create a Health Check Request\n\t\t\treq, err := http.NewRequest(http.MethodGet, urlAddr, nil)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"error while creating health check request :\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// ResponseRecorder (which satisfies http.ResponseWriter) to record the response.\n\t\t\trr := httptest.NewRecorder()\n\t\t\thandler := http.HandlerFunc(healthCheckHandler)\n\t\t\thandler.ServeHTTP(rr, req)\n\t\t\tif rr.Code == http.StatusOK {\n\t\t\t\tlog.Printf(\"Health Check : HTTP Server is up and running on port %s\", port)\n\t\t\t} else {\n\t\t\t\tisHealth = false\n\t\t\t\tlog.Println(\"Health Check : HTTP server is NOT SERVING\")\n\t\t\t\terrChan <- errors.New(\"Health Check Faild\")\n\t\t\t}\n\t\t\ttime.Sleep(time.Second * 58)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a8d3f9656b918cf3ef2f514e3f174b0d", "score": "0.6400602", "text": "func (vp *VaultPool) HealthCheck() {\n\tfor _, vaults := range vp.VaultBackends {\n\t\tstatus := \"up\"\n\t\talive := isBackendAlive(vaults.HealthURL)\n\t\tvaults.SetAlive(alive)\n\t\tif !alive {\n\t\t\tstatus = \"down\"\n\t\t}\n\t\tlog.Infof(\"Status of the URL %s : %s\", vaults.IP, status)\n\t}\n}", "title": "" }, { "docid": "d978ad495d440426d0cecdfed6116df0", "score": "0.63965625", "text": "func health(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, \"healthy\")\n}", "title": "" }, { "docid": "9a73232a88a374d649af2e9c81ecf65d", "score": "0.6389252", "text": "func HealthzHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tw.WriteHeader(health.HealthzStatus())\n}", "title": "" }, { "docid": "f3e964e11b6a46599a4af6eac4ee2392", "score": "0.6338973", "text": "func (s *PrimeServer) HealthCheckHandler(w http.ResponseWriter, r *http.Request) {\n\t//@todo check server session validity for routes/HealthCheckHandler\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(`{\"status\":\"ok\"}`))\n}", "title": "" }, { "docid": "8fdc1ae199218a4c045e3d7263ce34af", "score": "0.63374937", "text": "func main() {\n\turls := []string{\n\t\t\"http://google.com\",\n\t\t\"http://golang.org\",\n\t\t\"http://github.com/rochacon\",\n\t}\n\twg := &sync.WaitGroup{}\n\twg.Add(len(urls))\n\tfor _, url := range urls {\n\t\tgo checkHealth(wg, url)\n\t}\n\twg.Wait()\n\tfmt.Println(SuccessCounter.x, \"Successfully hitted URLs\")\n\tfmt.Println(len(urls)-SuccessCounter.x, \"Failed hits\")\n}", "title": "" }, { "docid": "a0b926cbf1f8d8bc48cf671a82e92414", "score": "0.63266605", "text": "func (s *Server) HealthCheckHandler(c *gin.Context) {\n\tif s.IsHealthy() {\n\t\tc.String(http.StatusOK, \"OK\")\n\t\treturn\n\t}\n\tc.AbortWithStatus(http.StatusServiceUnavailable)\n}", "title": "" }, { "docid": "90bb9a3d227eee07178c167c35a959bf", "score": "0.63136756", "text": "func defaultHealthcheck(w http.ResponseWriter, _ *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\t_, _ = io.WriteString(w, \"OK\")\n}", "title": "" }, { "docid": "52a6e5e56bc145e26ea5561a9b6de078", "score": "0.6289092", "text": "func checkUrl(url string) {\n\t_, err := http.Get(url)\n\tif err != nil {\n\t\tfmt.Println(url, \" is down.\")\n\t\treturn\n\t}\n\tfmt.Println(url, \" is up and running.\")\n}", "title": "" }, { "docid": "ff1de71270948d6bd84a4071b7e3ced4", "score": "0.62884736", "text": "func serveHealth() http.HandlerFunc {\n\tchecker := health.NewChecker(\n\t\t// just simple up/down status is enough\n\t\thealth.WithDisabledDetails(),\n\t\t// no caching required\n\t\thealth.WithDisabledCache(),\n\t)\n\treturn health.NewHandler(checker)\n}", "title": "" }, { "docid": "20f7f66b1eec8ae69ecb03882b7d302d", "score": "0.62853754", "text": "func healthFunc(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Service status: OK\\n\")\n}", "title": "" }, { "docid": "0c7d3421fe6f302ed3e4dff55fe33130", "score": "0.62753755", "text": "func HealthcheckHandler(w http.ResponseWriter, req *http.Request, ctx AppContext) {\n\tcheck := Healthcheck{\n\t\tAppName: \"go-rest-api-template\",\n\t\tVersion: ctx.Version,\n\t}\n\tctx.Render.JSON(w, http.StatusOK, check)\n}", "title": "" }, { "docid": "d219fdf7dedab90f51c1c70bb9738566", "score": "0.6271645", "text": "func (c *controller) healthCheck(r *web.Request) (*web.Response, error) {\n\tctx := r.Context()\n\tlogger := log.C(ctx)\n\tlogger.Debugf(\"Performing health check...\")\n\thealthState, _, _ := c.health.State()\n\thealthResult := c.aggregate(ctx, healthState)\n\tvar status int\n\tif healthResult.Status == health.StatusUp {\n\t\tstatus = http.StatusOK\n\t} else {\n\t\tstatus = http.StatusServiceUnavailable\n\t}\n\treturn util.NewJSONResponse(status, healthResult)\n}", "title": "" }, { "docid": "19f4ced1a003212df0e32247686cec1c", "score": "0.62693655", "text": "func HealthHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(`HEALTHY ` + version))\n}", "title": "" }, { "docid": "714259d3aeceba6130f10fe26daea261", "score": "0.62520427", "text": "func (h *Handler) Health(w http.ResponseWriter, r *http.Request) {\n\tresp := util.NewUtil().BuildResponse(http.StatusOK, nil, \"Alive\")\n\tjson.NewEncoder(w).Encode(resp)\n\treturn\n}", "title": "" }, { "docid": "d306e9702783c49862165ce4c96a249f", "score": "0.6245403", "text": "func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write([]byte(`{\"alive\": true}`))\n}", "title": "" }, { "docid": "c45332e86dc580be239dc2f625d07300", "score": "0.6237528", "text": "func HealthHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\treturn\n}", "title": "" }, { "docid": "18c51dc72813fd6054208949cec72592", "score": "0.62331206", "text": "func healthz(w http.ResponseWriter, _ *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "18c51dc72813fd6054208949cec72592", "score": "0.62331206", "text": "func healthz(w http.ResponseWriter, _ *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "b689361e71603cea39a127fd18cdd894", "score": "0.62322974", "text": "func HealthcheckHandler(rw http.ResponseWriter, r *http.Request) {\n\n\th, err := getHealth()\n\tif err != nil {\n\t\tlog.Printf(`event=\"Error attempting to fetch health\" error=\"%v\"`, err)\n\t\tapi.WriteProblemResponse(api.Problem{\n\t\t\tTitle: \"Problem when attempting to construct health\",\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t}, rw)\n\t\treturn\n\t}\n\n\trw.Header().Set(\"Content-Type\", \"application/json\")\n\trw.WriteHeader(http.StatusOK)\n\trw.Write(h)\n\treturn\n}", "title": "" }, { "docid": "cba96c11763a526501137fbe0028795a", "score": "0.623171", "text": "func routeImplHealth(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tfmt.Fprint(w, \"OK\")\n}", "title": "" }, { "docid": "e045bd403fd215cb32eb5fe8b95d0138", "score": "0.62314266", "text": "func HealthCheckHandler(appName string, version string) fasthttp.RequestHandler {\n\treturn func(ctx *fasthttp.RequestCtx) {\n\t\tmessage := map[string]interface{}{\n\t\t\t\"name\": appName,\n\t\t\t\"version\": version,\n\t\t\t\"healthy\": true,\n\t\t}\n\n\t\tbody, _ := json.Marshal(message)\n\t\tctx.Success(\"application/json\", body)\n\t}\n}", "title": "" }, { "docid": "85198840253428e2e6e1392d3b686cec", "score": "0.6223915", "text": "func Check(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/\" {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"TEST Health\"))\n}", "title": "" }, { "docid": "bcbba544d7ecdc73bff006857fcdc6fb", "score": "0.62226075", "text": "func (o *HookOptions) health(w http.ResponseWriter, r *http.Request) {\n\tutil.TraceLogger(r.Context()).Info(\"Health check\")\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "ab8d36473ad9cfff92d8a64b0a42be92", "score": "0.6220592", "text": "func getHealth(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"OK\")\n}", "title": "" }, { "docid": "e82ff5d32fb5fa36ec6385c54641ea7c", "score": "0.6218378", "text": "func (m *Monitor) healthCheck(mirror Mirror) error {\n\tformat := \"%-\" + fmt.Sprintf(\"%d.%ds\", m.formatLongestID+4, m.formatLongestID+4)\n\n\tfile, size, err := m.getRandomFile(mirror.ID)\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn mirrorNotScanned\n\t\t} else {\n\t\t\tlog.Warning(format+\"Error: Cannot obtain a random file: %s\", mirror.ID, err)\n\t\t}\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"HEAD\", strings.TrimRight(mirror.HttpURL, \"/\")+file, nil)\n\treq.Header.Set(\"User-Agent\", userAgent)\n\treq.Close = true\n\n\tstart := time.Now()\n\tresp, err := m.httpClient.Do(req)\n\telapsed := time.Since(start)\n\n\tif err != nil {\n\t\tif opErr, ok := err.(*net.OpError); ok {\n\t\t\tlog.Debug(\"Op: %s | Net: %s | Addr: %s | Err: %s | Temporary: %t\", opErr.Op, opErr.Net, opErr.Addr, opErr.Error(), opErr.Temporary())\n\t\t}\n\t\tmarkMirrorDown(m.redis, mirror.ID, \"Unreachable\")\n\t\tlog.Error(format+\"Error: %s (%dms)\", mirror.ID, err.Error(), elapsed/time.Millisecond)\n\t\treturn err\n\t}\n\tresp.Body.Close()\n\n\tcontentLength := resp.Header.Get(\"Content-Length\")\n\n\tif resp.StatusCode == 404 {\n\t\tmarkMirrorDown(m.redis, mirror.ID, fmt.Sprintf(\"File not found %s (error 404)\", file))\n\t\tif GetConfig().DisableOnMissingFile {\n\t\t\tdisableMirror(m.redis, mirror.ID)\n\t\t}\n\t\tlog.Error(format+\"Error: File %s not found (error 404)\", mirror.ID, file)\n\t} else if resp.StatusCode != 200 {\n\t\tmarkMirrorDown(m.redis, mirror.ID, fmt.Sprintf(\"Got status code %d\", resp.StatusCode))\n\t\tlog.Warning(format+\"Down! Status: %d\", mirror.ID, resp.StatusCode)\n\t} else {\n\t\tmarkMirrorUp(m.redis, mirror.ID)\n\t\trsize, err := strconv.ParseInt(contentLength, 10, 64)\n\t\tif err == nil && rsize != size {\n\t\t\tlog.Warning(format+\"File size mismatch! [%s] (%dms)\", mirror.ID, file, elapsed/time.Millisecond)\n\t\t} else {\n\t\t\tlog.Notice(format+\"Up! (%dms)\", mirror.ID, elapsed/time.Millisecond)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a07bb7d48a0c4b69cea13918e387c7e9", "score": "0.62153745", "text": "func (s *healthServer) HealthCheck(w http.ResponseWriter, r *http.Request) {\n\ts.Response(w, s.API.HealthCheck())\n}", "title": "" }, { "docid": "5aba3fb335287dcab719463a5c27e95c", "score": "0.62145096", "text": "func HealthCheck(c *gin.Context) {\n\tc.String(http.StatusOK, \"OK\")\n}", "title": "" }, { "docid": "39c33b8e190299dfa3b932c91ba4acc4", "score": "0.6213966", "text": "func Healthcheck(r *http.Request) (int, interface{}) {\n\tresponse := healthCheckResponse{\"Ok\", \"I'm OK\", http.StatusOK}\n\treturn http.StatusOK, response\n}", "title": "" }, { "docid": "9008d4385e79ae0926a425df74f8f4b4", "score": "0.6208988", "text": "func checkURLStatus(url string, c chan string) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tc <- url + \" [down]\"\n\t\treturn\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\tc <- url + \" [\" + strconv.Itoa(resp.StatusCode) + \"]\"\n\t\treturn\n\t}\n\n\tc <- url + \" [up]\"\n}", "title": "" }, { "docid": "e8b6d949fb54be39702a058433171272", "score": "0.62084156", "text": "func health(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tw.Write([]byte(\"Hello World!\"))\n}", "title": "" }, { "docid": "f99a7747b380c524c3d6e7eca7ff577c", "score": "0.6201719", "text": "func HealthHandlerFunc(w http.ResponseWriter, req *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "4eb691dae5e00d7e420c95ab5c8d9cdc", "score": "0.6179049", "text": "func healthHandler(wr http.ResponseWriter, req *http.Request) {\n\twr.WriteHeader(http.StatusOK)\n\twr.Write([]byte(`{\"Status\": OK}`))\n}", "title": "" }, { "docid": "e381161177593430b96739837b0674bb", "score": "0.6177038", "text": "func (app *App) healthCheck(e echo.Context) error {\n\treturn e.JSON(http.StatusOK, \"OK\")\n}", "title": "" }, { "docid": "4da42d2cc044fe9eba1d532e7ad335c2", "score": "0.61764395", "text": "func (vs *VulcanService) HealthCheckHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\n\tio.WriteString(w, `{\"alive\": true}`)\n}", "title": "" }, { "docid": "f30dd26e5ffe9d73feb933e987fb41e1", "score": "0.616533", "text": "func (sh *SysHandler) Health(rw http.ResponseWriter, req *http.Request) {\n\thealthChecks := map[string]string{\n\t\t\"http\": \"ok\",\n\t}\n\tencoder := json.NewEncoder(rw)\n\tif err := encoder.Encode(healthChecks); err != nil {\n\t\thttp.Error(rw, \"failed to encode response: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "5c6923f0083cb399d7be60da837bfa6b", "score": "0.61540854", "text": "func (c *healthcheckClient) Healthcheck() (string, error) {\n\tresp, err := c.client.Get(context.Background(), c.url)\n\tif err != nil {\n\t\treturn c.service, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn c.service, &errorResponse{c.service, http.StatusOK, resp.StatusCode, c.url}\n\t}\n\n\treturn c.service, nil\n}", "title": "" }, { "docid": "8556c44488b7d0303ac21d8937da99f5", "score": "0.6151185", "text": "func HealthCheckHandler() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tHealthCheckRequest.Inc()\n\t\tdefer HealthCheckRequest.Dec()\n\t\t// Make sure we can only be called with an HTTP POST request.\n\t\tif r.Method != \"HEAD\" {\n\t\t\tw.Header().Set(\"Allow\", \"HEAD\")\n\t\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\t\treturn\n\t\t}\n\n\t\t// A very simple health check.\n\t\tw.WriteHeader(http.StatusNoContent)\n\n\t}\n}", "title": "" }, { "docid": "445a71ebc5691e3a7474562d120723aa", "score": "0.6149473", "text": "func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(`{\"healthy\": true}`))\n}", "title": "" }, { "docid": "15eea6efb088315df0a851f60fbfef24", "score": "0.61470664", "text": "func Health(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprint(w, \"Health Works\")\n}", "title": "" }, { "docid": "604431965cba8d2510013d77135f1eba", "score": "0.61370254", "text": "func (api *API) HealthzHandler(c *echo.Context) error {\n\tapp := c.Get(\"app\").(*App)\n\n\t// if you need to fake connection latency\n\t// <-time.After(time.Millisecond * 500)\n\n\tc.JSON(200, app.Conf.Root)\n\treturn nil\n}", "title": "" }, { "docid": "0dea9257e9079acbdc4e3af9f79f4124", "score": "0.6128835", "text": "func Health(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, http.StatusText(http.StatusOK))\n}", "title": "" }, { "docid": "433d50fe2e154152eb1b3bf7f5123c3f", "score": "0.61270577", "text": "func HealthCheck(c *gin.Context) {\n\tmessage := \"OK\"\n\tc.String(http.StatusOK, \"\\n\"+message)\n}", "title": "" }, { "docid": "19fdb56bd6f6fe5a76e5df54f55f7b10", "score": "0.61196166", "text": "func HealthHandeler(w http.ResponseWriter, r *http.Request) {\n\trespond.OK(w, serviceInfo)\n}", "title": "" }, { "docid": "9068daa9f6137e62c3724b9181ec16a7", "score": "0.6119392", "text": "func healthcheck(c *cli.Context) error {\n\tconfig := gossh.ClientConfig{\n\t\tUser: \"healthcheck\",\n\t\tHostKeyCallback: func(hostname string, remote net.Addr, key gossh.PublicKey) error { return nil },\n\t\tAuth: []gossh.AuthMethod{gossh.Password(\"healthcheck\")},\n\t}\n\n\tif c.Bool(\"wait\") {\n\t\tfor {\n\t\t\tif err := healthcheckOnce(c.String(\"addr\"), config, c.Bool(\"quiet\")); err != nil {\n\t\t\t\tif !c.Bool(\"quiet\") {\n\t\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t\t}\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tif err := healthcheckOnce(c.String(\"addr\"), config, c.Bool(\"quiet\")); err != nil {\n\t\tif c.Bool(\"quiet\") {\n\t\t\treturn cli.NewExitError(\"\", 1)\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d20dc1ef0680932b2c07b13ec0085777", "score": "0.611173", "text": "func healthCheckHandler(ctx *gin.Context) {\n log.Info(\"received health check request\")\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"message\": \"Service running\"})\n}", "title": "" }, { "docid": "0b648f7002cf4c51db07fdc309af1183", "score": "0.6109707", "text": "func (h handlers) healthcheck(startedAt time.Time) func(c *gin.Context) {\n\treturn func(c *gin.Context) {\n\t\tnow := time.Now().UTC()\n\n\t\tuptime := now.Sub(startedAt)\n\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"started_at\": startedAt.String(),\n\t\t\t\"uptime\": uptime.String(),\n\t\t\t\"status\": \"Ok\",\n\t\t\t\"version\": constants.Version,\n\t\t\t\"revision\": constants.Revision,\n\t\t\t\"build_time\": constants.BuildTime,\n\t\t\t\"compiler\": constants.Compiler,\n\t\t\t\"latest_commit_message\": constants.LatestCommitMessage,\n\t\t\t\"ip_address\": c.ClientIP(),\n\t\t})\n\t}\n}", "title": "" }, { "docid": "769c259a41f2136922a59a39bde25328", "score": "0.6109448", "text": "func CheckHTTPHealth() error {\n\tif !cnf.Conf.Exploit.IsFetchViaHTTP() {\n\t\treturn nil\n\t}\n\n\turl := fmt.Sprintf(\"%s/health\", cnf.Conf.Exploit.URL)\n\tvar errs []error\n\tvar resp *http.Response\n\tresp, _, errs = gorequest.New().Get(url).End()\n\t// resp, _, errs = gorequest.New().SetDebug(config.Conf.Debug).Get(url).End()\n\t// resp, _, errs = gorequest.New().Proxy(api.httpProxy).Get(url).End()\n\tif 0 < len(errs) || resp == nil || resp.StatusCode != 200 {\n\t\treturn xerrors.Errorf(\"Failed to connect to exploit server. url: %s, errs: %w\", url, errs)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3cd40d9baea6012557e4bb9d8c6436bc", "score": "0.6105232", "text": "func (this *HttpAPI) Health(params martini.Params, r render.Render, req *http.Request) {\n\thealth, err := process.HealthTest()\n\tif err != nil {\n\t\tRespond(r, &APIResponse{Code: ERROR, Message: fmt.Sprintf(\"Application node is unhealthy %+v\", err), Details: health})\n\t\treturn\n\t}\n\n\tRespond(r, &APIResponse{Code: OK, Message: \"Application node is healthy\", Details: health})\n\n}", "title": "" }, { "docid": "f1b19af52cff07f43b7759ea86db7634", "score": "0.6103639", "text": "func (p *consumer) handleHealthcheck(w http.ResponseWriter, r *http.Request) {\n\tswitch p.healthy {\n\tcase true:\n\t\tfmt.Fprintf(w, \"The server is healthy\")\n\tcase false:\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"The server is unhealthy: the last attempt to publish a message failed\")\n\t}\n}", "title": "" }, { "docid": "1d66179b863c4d0d2b820ad2a2a10460", "score": "0.6103512", "text": "func HealthHandler(w http.ResponseWriter, r *http.Request) {\n\tif err := json.NewEncoder(w).Encode(map[string]bool{\"ok\": true}); err != nil {\n\t\tapp.Error.Println(err)\n\t}\n}", "title": "" }, { "docid": "4b05ca5a79bfbf8f16c941b12cdaf352", "score": "0.6102333", "text": "func Health(w http.ResponseWriter, r *http.Request) {\n\ttime.Sleep(time.Duration(timeout) * time.Second)\n\tw.Write([]byte(\"200 OK\"))\n}", "title": "" }, { "docid": "0435c5ecbe425b7231d5ef6d848b9d40", "score": "0.6098835", "text": "func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tio.WriteString(w, `{\"alive\": true}`)\n}", "title": "" }, { "docid": "14a3650bbc690a25905a262e2642a8d3", "score": "0.6094959", "text": "func checkHeartbeat(url string) (int, error) {\n\tresp, err := http.Get(url)\n\tfmt.Printf(\"Checking %s: \", url)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tfmt.Printf(\"%s has code %s\\n\", url, resp.Status)\n\treturn resp.StatusCode, nil\n\n}", "title": "" }, { "docid": "5194a40fc7a66889af37710a2635824e", "score": "0.6076755", "text": "func health(c echo.Context) error {\n\treturn c.String(http.StatusOK, \"ok\\n\")\n}", "title": "" }, { "docid": "55fc071748f873c1da0c087cddc1a260", "score": "0.6062378", "text": "func ready() {\n\thttp.HandleFunc(\"/healthz\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"OK\")\n\t})\n\n\tgo func() {\n\t\thttp.ListenAndServe(\":80\", nil)\n\t}()\n}", "title": "" }, { "docid": "2355ac5fc4019a8818e669d1bf3f70ef", "score": "0.6061157", "text": "func registerHandlers(s *staticPageHandler) {\n\thttp.HandleFunc(\"/healthz\", func(w http.ResponseWriter, r *http.Request) {\n\t\t// Delegate a check to the haproxy stats service.\n\t\tresponse, err := http.Get(fmt.Sprintf(\"http://localhost:%v\", *statsPort))\n\t\tif err != nil {\n\t\t\tglog.Infof(\"Error %v\", err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t} else {\n\t\t\tdefer response.Body.Close()\n\t\t\tif response.StatusCode != http.StatusOK {\n\t\t\t\tcontents, err := ioutil.ReadAll(response.Body)\n\t\t\t\tif err != nil {\n\t\t\t\t\tglog.Infof(\"Error reading resonse on receiving status %v: %v\",\n\t\t\t\t\t\tresponse.StatusCode, err)\n\t\t\t\t}\n\t\t\t\tglog.Infof(\"%v\\n\", string(contents))\n\t\t\t\tw.WriteHeader(response.StatusCode)\n\t\t\t} else {\n\t\t\t\tw.WriteHeader(200)\n\t\t\t\tw.Write([]byte(\"ok\"))\n\t\t\t}\n\t\t}\n\t})\n\n\t// handler for not matched traffic\n\thttp.HandleFunc(\"/\", s.Getfunc)\n\n\tglog.Fatal(http.ListenAndServe(fmt.Sprintf(\":%v\", *healthCheckPort), nil))\n}", "title": "" } ]
81f0d16290dceb6e983b92f4fadca3d0
ForContext is method to get mongodb client from context
[ { "docid": "77832494e86a42f05a1269b5930e4722", "score": "0.8484074", "text": "func ForContext(ctx context.Context) *mongo.Client {\n\tclient, ok := ctx.Value(mongoClient).(*mongo.Client)\n\tif !ok {\n\t\tpanic(\"ctx passing is not contain mongodb client\")\n\t}\n\treturn client\n}", "title": "" } ]
[ { "docid": "6c64214eb2b3d99fba44f1df0d53bb5a", "score": "0.6748329", "text": "func getCurrentMongoClient() (MongoClient, error) {\n\treturn currentMongoClient, nil\n}", "title": "" }, { "docid": "8f0a72a1fc3843977092b364baeaf1c6", "score": "0.6668118", "text": "func GetClient() *(mongo.Client) {\n\n\tif monoMongoClient == nil {\n\t\tmongoURI := fmt.Sprintf(\"%v://mongodb:%v/%v\", env.MongoKeys.Host, env.MongoKeys.Port, env.MongoKeys.Database)\n\t\toptionsObject := options.Client().ApplyURI(mongoURI)\n\t\tmongoClient, err := mongo.NewClient(optionsObject)\n\t\t// Just as an option here\n\t\t// optionsObject.SetMaxPoolSize(10)\n\t\tif err != nil {\n\t\t\tlogs.StatusFileMessageLogging(\"FAILURE\", filename, \"GetClient\", \"Failed to create a new MongoClient\")\n\t\t}\n\n\t\terr = mongoClient.Connect(context.TODO())\n\t\tif err != nil {\n\t\t\tlogs.StatusFileMessageLogging(\"FAILURE\", filename, \"GetClient\", \"Failed to connect to the new MongoClient\")\n\t\t}\n\n\t\tmonoMongoClient = mongoClient\n\n\t\treturn mongoClient\n\t}\n\n\treturn monoMongoClient\n\n}", "title": "" }, { "docid": "ed5f0ea88ee1dd00f02f3c911ccaaa65", "score": "0.64785266", "text": "func getMongoClient() (*mongo.Client, error) {\n\tmongoOnce.Do(func() {\n\t\tclientOptions := options.Client().ApplyURI(DB_URL)\n\n\t\tclient, err := mongo.Connect(context.TODO(), clientOptions)\n\t\tif err != nil {\n\t\t\tclientInstanceError = err\n\t\t\tfmt.Println(\"Connected to MongoDB succesfully!\")\n\t\t}\n\n\t\terr = client.Ping(context.TODO(), nil)\n\t\tif err != nil {\n\t\t\tclientInstanceError = err\n\t\t}\n\t\tclientInstance = client\n\n\t})\n\n\treturn clientInstance, clientInstanceError\n}", "title": "" }, { "docid": "152f42a18b0f9dbb034cbf32ee821723", "score": "0.64784974", "text": "func getConnection() (*mongo.Client, context.Context, context.CancelFunc) {\n\tusername := os.Getenv(\"MONGO_USERNAME\")\n\tpassword := os.Getenv(\"MONGO_PASSWORD\")\n\tclusterEndPoint := os.Getenv(\"MONGO_ENDPOINT\")\n\n\t// Generamos una URI para conectarnos al cliente de Mongo\n\tconnectionURI := fmt.Sprintf(connStringTemplate, username, password, clusterEndPoint)\n\n\t// Obtenemos un elemento del tipo context para poder realizar consultas\n\tctx, cancel := context.WithTimeout(context.Background(), connTimeout*time.Second)\n\n\t// Conectamos al cliente de Mongo con la URI generada\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(connectionURI))\n\tif err != nil {\n\t\tlog.Panicf(\"Fallo al conectar al cluster %v\\n\", err)\n\t}\n\n\t/*err = client.Ping(ctx, nil)\n\tif err != nil {\n\t\tlog.Panicf(\"Fallo ping al cluster %v\\n\", err)\n\t}*/\n\n\tlog.Printf(\"Conectado a MongoDB\\n\")\n\n\t// Retornamos un puntero al cliente, el contexto, y una funcion para cancelar la conexion\n\treturn client, ctx, cancel\n}", "title": "" }, { "docid": "943d3f6a32cacc16a5bbe499ab9d9d0f", "score": "0.64641553", "text": "func GetClient() *mongo.Client {\n\treturn client\n}", "title": "" }, { "docid": "96fed539bd9cdbf5b16fdc0f569e5578", "score": "0.6399699", "text": "func getDBConnection() (*mongo.Client, context.Context, context.CancelFunc) {\n\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(config.Config.MongoDBURL))\n\tif err != nil {\n\t\tlog.Printf(\"Failed to create client: %v\", err)\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), connectTimeout*time.Second)\n\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to connect to cluster: %v\", err)\n\t}\n\n\treturn client, ctx, cancel\n}", "title": "" }, { "docid": "0a24fd41881e889b01b09bb1fd69d39b", "score": "0.6377136", "text": "func GetClient() *mongo.Client {\n\tconnect := os.Getenv(\"DB_CONN\")\n\tclientOptions := options.Client().ApplyURI(connect)\n\tclient, err := mongo.NewClient(clientOptions)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\terr = client.Connect(context.Background())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn client\n}", "title": "" }, { "docid": "ba9ddff099ce35a2668998f6110070ce", "score": "0.63136744", "text": "func (dbs *Driver) Client() interface{} {\n\tif dbs.server == nil {\n\t\tdbs.start()\n\t}\n\n\tif dbs.client == nil {\n\t\tvar err error\n\n\t\tclientOptions := options.Client().ApplyURI(\"mongodb://\" + dbs.host + \"/test\")\n\t\tclientOptions.SetConnectTimeout(dbs.config.Timeout)\n\n\t\tdbs.ctx = context.Background()\n\t\tdbs.client, err = mongo.Connect(dbs.ctx, clientOptions)\n\t\tif err != nil || dbs.client == nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"failed to connect to mongodb: %v\\n\", err)\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\treturn dbs.client\n}", "title": "" }, { "docid": "634c76ff3b595d34b8650b1ce1823858", "score": "0.6259783", "text": "func Client() *mongo.Client {\n\treturn client\n}", "title": "" }, { "docid": "74eb0f5ce9d6297b5cbff632c0aa757f", "score": "0.62349796", "text": "func GetClient(ctx context.Context) (*Client, error) {\n\tmc, err := mongo.Connect(ctx, options.Client().ApplyURI(CONFIG.GetApplyURI()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &Client{mc: mc}\n\treturn client, nil\n}", "title": "" }, { "docid": "8f15d10c40e24857fd30f2f310ffbf63", "score": "0.62218475", "text": "func GetClient(uri string) *mongo.Client {\n\tclientOptions := options.Client().ApplyURI(uri)\n\tclient, err := mongo.NewClient(clientOptions)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\terr = client.Connect(context.Background())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn client\n}", "title": "" }, { "docid": "9039204bd9fc0f4791a9d8d634ea4b7f", "score": "0.6216313", "text": "func GetMongoClient() *mongo.Client {\n\treturn mongoClient\n}", "title": "" }, { "docid": "45cc8b149ba0ec8d550608b60d371772", "score": "0.61913455", "text": "func (g *Gomongo) GetClient() *mongo.Client {\n\treturn g.mongo.Client\n}", "title": "" }, { "docid": "1b76fb5229b3b45b1dad160dd301d55d", "score": "0.6162275", "text": "func IntiateMongoConn() *mongo.Client {\n\t// Set the client options, specified database location by using ApplyURI\n\tclientOptions := options.Client().ApplyURI(connectionString)\n\n\t//Connect to mongoDB\n\tclient, err := mongo.Connect(context.TODO(), clientOptions)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t//Check the connection\n\terr = client.Ping(context.TODO(), nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"Connected to MongoDB\")\n\treturn client\n}", "title": "" }, { "docid": "6880cbb34298729c2f100f8ed01d9f81", "score": "0.6111961", "text": "func Mongo() (*mongo.Client) {\n\t\n\tclientOptions := options.Client().ApplyURI(\"mongodb+srv://admin:admin@cluster0.rgwkm.mongodb.net/Appointy?retryWrites=true&w=majority\")\n\t//fmt.Println(\"Client optom type: \", reflect.TypeOf(clientOptions))\n\tclient,err := mongo.Connect(context.TODO(),clientOptions)\n\n\tif err!=nil {\n\t\tfmt.Println(\"ERROR\", err)\n\t\t//os.Exit(1)\n\t}\n\n\t//fmt.Println(reflect.TypeOf(client))\n\treturn client\n}", "title": "" }, { "docid": "a69a4c463995733e1e03df66f1a76662", "score": "0.60865515", "text": "func Client(ctx context.Context) *datadog.APIClient {\n\tc, ok := ClientFromContext(ctx)\n\tif !ok {\n\t\tlog.Fatal(\"client is not configured\")\n\t}\n\treturn c\n}", "title": "" }, { "docid": "4bb271456eb6ef5d2aeacc7919587e19", "score": "0.6083971", "text": "func configForContext(context string) (clientcmd.ClientConfig, *rest.Config, error) {\n clientConfig := kube.GetConfig(context, \"\")\n config, err := clientConfig.ClientConfig()\n if err != nil {\n return nil, nil, fmt.Errorf(\"could not get Kubernetes config for context %q: %s\", context, err)\n }\n return clientConfig, config, nil\n}", "title": "" }, { "docid": "422fff1e08cde732417ebfe3dc5c409e", "score": "0.60614914", "text": "func clientForRequestContext(ctx context.Context) (dynamic.Interface, error) {\n\t// TODO: replace incluster config with the user config using token from request meta.\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get client config: %w\", err)\n\t}\n\n\tclient, err := dynamic.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create dynamic client: %w\", err)\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "945456b9748c4aa111761e8ac8394910", "score": "0.6039352", "text": "func (c *Mongo) Client(host string, port int) int {\n return int(C.mongo_client(c.conn, C.CString(host), C.int(port)))\n}", "title": "" }, { "docid": "c95054bb19c6f76f9689a5d1faa90cc8", "score": "0.6014673", "text": "func newClient(ctx context.Context, config MongoStoreConfig) (*mongo.Client, error) {\n\n\tclientOptions := mopts.Client()\n\tif config.MongoURL == nil {\n\t\treturn nil, errors.New(\"mongo: missing URL\")\n\t}\n\tclientOptions.ApplyURI(config.MongoURL.String())\n\n\tif config.Username != \"\" {\n\t\tcredentials := mopts.Credential{\n\t\t\tUsername: config.Username,\n\t\t}\n\t\tif config.Password != \"\" {\n\t\t\tcredentials.Password = config.Password\n\t\t\tcredentials.PasswordSet = true\n\t\t}\n\t\tclientOptions.SetAuth(credentials)\n\t}\n\n\tif config.TLSConfig != nil {\n\t\tclientOptions.SetTLSConfig(config.TLSConfig)\n\t}\n\n\tclient, err := mongo.Connect(ctx, clientOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"mongo: failed to connect with server\")\n\t}\n\n\t// Validate connection\n\tif err = client.Ping(ctx, nil); err != nil {\n\t\treturn nil, errors.Wrap(err, \"mongo: error reaching mongo server\")\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "7b464a1364f2ee10e1425efa18aebb91", "score": "0.5941866", "text": "func (d *MongoDatabase) Client() IClient {\n\treturn d.client\n}", "title": "" }, { "docid": "33ab68c331a33a824a5eba709809f32a", "score": "0.5845715", "text": "func (connManager *Manager) GetMongoClient() *mongo.Client {\n\tclientOptions := options.Client().ApplyURI(connManager.Env[\"MONGO_URL\"])\n\tclient, err := mongo.Connect(context.TODO(), clientOptions)\n\tfailOnError(err, \"Error to connect to Mongo\")\n\treturn client\n}", "title": "" }, { "docid": "c44e96146fceca5c5bda5e1a94a2b225", "score": "0.58371425", "text": "func InitDbConnection(mongodbUri string) (context.Context, *mongo.Client) {\n\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(mongodbUri))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// context with 1000 seconds timeout\n\tctx, _ := context.WithTimeout(context.Background(), 1000*time.Second)\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn ctx, client\n}", "title": "" }, { "docid": "ad19a01b0bd2ba486f7277c5a6af5591", "score": "0.58271056", "text": "func Get() Mongo {\n\tif _mongo.client == nil {\n\t\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\t\t_mongo.client, _mongo.Err = mongo.Connect(ctx, options.Client().ApplyURI(connectionURL))\n\t\tif _mongo.Err == nil {\n\t\t\t_mongo.Database = _mongo.client.Database(dbName)\n\t\t\tfmt.Print(\"Database Created Successfully\\n\")\n\t\t} else {\n\t\t\tpanic(_mongo.Err)\n\t\t}\n\t}\n\treturn _mongo\n}", "title": "" }, { "docid": "52a8c8fde8b7760150595d2dd6cf0e86", "score": "0.57694316", "text": "func (m *Connection) WithContext(ctx context.Context) context.Context {\n\tif m != nil {\n\t\t// save it in the mux context\n\t\treturn context.WithValue(ctx, mongoClient, m.client)\n\t} else {\n\t\t// TODO: Warn\n\t}\n\treturn ctx\n}", "title": "" }, { "docid": "e4eacdc3ec17a9a4b163b37454e04ad7", "score": "0.5740354", "text": "func getKubeClient(context string) (kubernetes.Interface, *rest.Config, error) {\n _, config, err := configForContext(context)\n if err != nil {\n return nil, nil, err\n }\n client, err := kubernetes.NewForConfig(config)\n if err != nil {\n return nil, nil, fmt.Errorf(\"could not get Kubernetes client: %s\", err)\n }\n return client, config, nil\n}", "title": "" }, { "docid": "502f6044d02ef08b115feea359d3c2bd", "score": "0.57357633", "text": "func (msc *MongoStoreClient) WithContext(ctx context.Context) Storage {\n\tif ctx == nil {\n\t\tpanic(\"nil context\")\n\t}\n\tmsc2 := new(MongoStoreClient)\n\t*msc2 = *msc\n\tmsc2.context = ctx\n\treturn msc2\n}", "title": "" }, { "docid": "3c8df4eec0a1fe9df8c5d6ba5d1e6f49", "score": "0.5718164", "text": "func connectToMongo(connectionString string, databaseName string, collectionName string) (*mongo.Collection, context.Context) {\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(connectionString))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tctx := context.Background()\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tcollection := client.Database(databaseName).Collection(collectionName)\n\n\treturn collection, ctx\n}", "title": "" }, { "docid": "8a8b0bf1710af8d5fb9c4568bab88df9", "score": "0.57035035", "text": "func GetMongoSession() (interfaces.MongoDB, error) {\n\tvar err error\n\n\tonce.Do(func() {\n\t\tconfig := viper.GetViper()\n\n\t\turl := config.Get(\"mongo.host\")\n\t\tconfig.Set(\"mongo.url\", url)\n\n\t\tclient, err = mongo.NewClient(\"mongo\", config)\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.MongoDB, nil\n}", "title": "" }, { "docid": "867cab2005d74929e0b252cf90150e6d", "score": "0.5694243", "text": "func ClientFromContext(ctx context.Context) (*datadog.APIClient, bool) {\n\tif ctx == nil {\n\t\treturn nil, false\n\t}\n\tv := ctx.Value(clientKey)\n\tif c, ok := v.(*datadog.APIClient); ok {\n\t\treturn c, true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "0563d847a63808ca0b17a11fe366e74b", "score": "0.5685943", "text": "func initMongo() *mongo.Database {\n\tmongoHost := os.Getenv(\"MONGO_HOST\")\n\tmongoPort := os.Getenv(\"MONGO_PORT\")\n\n\tif mongoHost == \"\" || mongoPort == \"\" {\n\t\tlog.Fatal(\"error MONGO_HOST or MONGO_PORT does not exist.\")\n\t}\n\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(fmt.Sprintf(\"mongodb://%s:%s\", mongoHost, mongoPort)))\n\tif err != nil {\n\t\tlog.Fatal(\"error creating a mongo client: \", err)\n\t}\n\n\terr = client.Connect(context.Background())\n\tif err != nil {\n\t\tlog.Fatal(\"error connecting to mongodb: \", err)\n\t}\n\n\terr = client.Ping(context.Background(), nil)\n\tif err != nil {\n\t\tlog.Fatal(\"error pinging the mongo server: \", err)\n\t}\n\n\treturn client.Database(\"backend-homework\")\n}", "title": "" }, { "docid": "be21562f5a3dff5d3b06ac1a3ee00941", "score": "0.5679401", "text": "func GetClient() (MongoDBClient, error) {\n\t//Perform connection creation operation only once.\n\tmongoOnce.Do(func() {\n\t\tmongoDbInstance = utils.MustGet(\"MONGO_DB_INSTANCE\")\n\t\tdbInstance = utils.MustGet(\"DB_INSTANCE\")\n\t\t// Set client options\n\t\tclientOptions := options.Client().ApplyURI(mongoDbInstance)\n\t\t// Connect to MongoDB\n\t\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\t\tdefer cancel()\n\t\tclient, err := mongo.Connect(ctx, clientOptions)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\tclientInstanceError = err\n\t\t}\n\t\t// Check the connection\n\t\terr = client.Ping(context.TODO(), nil)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\tclientInstanceError = err\n\t\t}\n\t\tclientInstance = client\n\t})\n\treturn MongoDBClient{\n\t\tClient: clientInstance,\n\t\tDBName: dbInstance,\n\t}, clientInstanceError\n}", "title": "" }, { "docid": "92cb750a674e411449bc0d802577f0b1", "score": "0.5656814", "text": "func GetClient(projectName string) (*db.Client, context.Context, error) {\n\tapp, ctx, err := getApp(projectName)\n\tif err != nil {\n\t\tlog.Fatalln(\"Error initializing database app instance:\", err)\n\t\treturn nil, nil, err\n\t}\n\n\tclient, err := app.Database(ctx)\n\tif err != nil {\n\t\tlog.Fatalln(\"Error initializing database client:\", err)\n\t\treturn nil, nil, err\n\t}\n\n\treturn client, ctx, nil\n}", "title": "" }, { "docid": "17b0e0ef3672c16a552abd8e81f8b256", "score": "0.5651321", "text": "func GetMongoClientFromPool(uri string) (*mongo.Client, error) {\n\tvar err error\n\tvar connstr connstring.ConnString\n\tcmutex.Lock()\n\tdefer cmutex.Unlock()\n\tif pool == nil {\n\t\tpool = &mongoClientsMap{}\n\t}\n\tif (*pool)[uri] == nil {\n\t\tif connstr, err = mdb.ParseURI(uri); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif (*pool)[uri], err = mdb.NewMongoClient(connstr.String()); err != nil {\n\t\t\t(*pool)[uri] = nil\n\t\t\treturn (*pool)[uri], err\n\t\t}\n\t} else {\n\t\tif err = (*pool)[uri].Ping(context.Background(), nil); err != nil {\n\t\t\t(*pool)[uri] = nil\n\t\t\treturn (*pool)[uri], err\n\t\t}\n\t}\n\treturn (*pool)[uri], nil\n}", "title": "" }, { "docid": "027f9ff9ff90625cce0c27e4a2a82eb8", "score": "0.56403095", "text": "func I(user string, password string, host string) *mongo.Client {\n\tkey := host\n\n\tif val, ok := clients[key]; ok {\n\t\treturn val\n\t}\n\n\tmutex.Lock()\n\n\tif val, ok := clients[key]; ok {\n\t\treturn val\n\t}\n\n\tport := \"27017\"\n\tif strings.Contains(host, \":\") {\n\t\tparts := strings.Split(host, \":\")\n\t\thost = parts[0]\n\t\tport = parts[1]\n\t}\n\n\turi := \"mongodb://\"\n\tif user != \"\" && password != \"\" {\n\t\turi = fmt.Sprintf(\"%s%s:%s@\", uri, user, password)\n\t}\n\turi = fmt.Sprintf(\"%s%s:%s\", uri, host, port)\n\n\tctx, _ := context.WithTimeout(context.Background(), 5*time.Second)\n\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Ping(ctx, readpref.Primary()); err != nil {\n\t\tpanic(err)\n\t}\n\n\tclients[key] = client\n\n\tmutex.Unlock()\n\n\treturn client\n}", "title": "" }, { "docid": "286ebb460ecc8f5ef4554cabd67ea68d", "score": "0.5628172", "text": "func DefaultClient() *mongo.Client {\n\tconfig := config.GetConfiguration()\n\tmongo, _ := CreateClient(config.Mongo)\n\treturn mongo\n}", "title": "" }, { "docid": "2a3cfa03532b096ae954bb8a3305a325", "score": "0.56175613", "text": "func connect() (*mongo.Database, error) {\n\tclientOptions := options.Client()\n\tclientOptions.ApplyURI(\"mongodb://localhost:27017\")\n\n\t// try to establish the client\n\tclient, err := mongo.NewClient(clientOptions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// try to connect the client to the context\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client.Database(\"sekolah\"), nil\n}", "title": "" }, { "docid": "be02693164243b2276f535036ea11dbf", "score": "0.56120574", "text": "func getClient() *mgo.Database {\n\tif client != nil {\n\t\treturn client\n\t}\n\n\tconfig := getConnectionConfig()\n\tsession, err := mgo.Dial(config.host)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tclient = session.DB(config.dbName)\n\treturn client\n}", "title": "" }, { "docid": "0b2ac6907883c8b869c84f561c9879fc", "score": "0.5583088", "text": "func GetConnect() *mongo.Client {\n\tclient, err := mongo.Connect(context.TODO(), clientOptions)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t\treturn client\n\t}\n\terr = client.Ping(context.TODO(), nil)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t\treturn client\n\t}\n\tlog.Println(\"Conexion Exitosa con la BD\")\n\treturn client\n}", "title": "" }, { "docid": "7e127e51ac68590ccf728af2a60ddd12", "score": "0.5580639", "text": "func connect(uri string) (*mongo.Client, context.Context,\n\tcontext.CancelFunc, error) {\n\n\t// ctx will be used to set deadline for process, here\n\t// deadline will of 30 seconds.\n\tctx, cancel := context.WithTimeout(context.Background(),\n\t\t30*time.Second)\n\n\t// mongo.Connect return mongo.Client method\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))\n\treturn client, ctx, cancel, err\n}", "title": "" }, { "docid": "908a40c313be23a5f72ce5da3e15efed", "score": "0.5570836", "text": "func (s *MongoSession) Client() IClient {\n\treturn s.client\n}", "title": "" }, { "docid": "a75f08fbc0cc44b0c0af7b428b0eb5f0", "score": "0.5550809", "text": "func getPostsCollectionFromContext(c context.Context) *mongo.Collection {\n\tdb, ok := c.Value(\"db\").(*mongo.Client)\n\tif !ok {\n\t\tlog.Panic(\"No database context found\")\n\t}\n\n\t// Get the handle on the posts collection based on information from the configuration\n\tSermireDB := db.Database(POSTS_DB_NAME)\n\tPostsCol := SermireDB.Collection(POSTS_COL_NAME)\n\n\treturn PostsCol\n}", "title": "" }, { "docid": "6356b58687f699c47cbc455cc7b25957", "score": "0.55368054", "text": "func GetMongoConnection() (*mongo.Client, error) {\n\tonce.Do(func() {\n\t\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\t\tdefer cancel()\n\n\t\t//init client options with uri\n\t\tclientOptions := options.Client().ApplyURI(confighelper.GetConfig(\"MongoDSN\"))\n\n\t\t//set maximum number of idle connections to handle\n\t\tclientOptions.SetMaxConnIdleTime(100)\n\n\t\t//set maximum number of open connections to handle\n\t\tclientOptions.SetMaxPoolSize(1000)\n\n\t\t/* clientOptions.SetRetryReads(true)\n\t\tclientOptions.SetRetryWrites(true) */\n\n\t\t//max connection idle time\n\t\tclientOptions.SetMaxConnIdleTime(4 * time.Hour)\n\n\t\t//Initiate connection\n\t\tclient, err := mongo.Connect(ctx, clientOptions)\n\t\tif err != nil {\n\t\t\tsessionError = err\n\t\t\treturn\n\t\t}\n\n\t\t//Ping to check connection status\n\t\terr = client.Ping(ctx, nil)\n\t\tif err != nil {\n\t\t\tsessionError = err\n\t\t\treturn\n\t\t}\n\t\tinstance = client\n\t})\n\treturn instance, sessionError\n}", "title": "" }, { "docid": "c7ec157efa8c5c620e2e7472ad555a80", "score": "0.5536185", "text": "func GetDB() (*mongo.Collection, context.Context) {\n\treturn collection, ctx\n}", "title": "" }, { "docid": "64062aa871765c3271792ac786e8e12f", "score": "0.5531403", "text": "func (ctx *Contextual) GetClient() *github.Client {\n\treturn ctx.client\n}", "title": "" }, { "docid": "c17a6a20bf0164cb5419625b0ad5a5fd", "score": "0.55130255", "text": "func InitMongoClient(dbConf *conf.MongoConfig) (*mongo.Client, error) {\n\n\tdbName := dbConf.Dbname\n\tdbUser := dbConf.Username\n\tdbPass := dbConf.Password\n\tdbHost := dbConf.Host\n\tdbPort := dbConf.Port\n\tcxnString := fmt.Sprintf(\"mongodb://%s:%s@%s:%d/%s\", dbUser, dbPass, dbHost, dbPort, dbName)\n\n\treturn mongo.NewClient(cxnString)\n}", "title": "" }, { "docid": "bacba41a249e38a6126fa1fb5762d8f0", "score": "0.5510781", "text": "func GetClient() (mongoclient *mongodata, err error) {\n\tmu.RLock()\n\tfor i:=1; i<cp.size; i++ {\n\t\tif cp.clientList[i].flag == AVAILABLE{\n\t\t\treturn &cp.clientList[i], nil\n\t\t}\n\t}\n\tmu.RUnlock()\n\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tif cp.size < MAX_CONNECTION{\n\t\terr = cp.allocateCToPool(cp.size)\n\t\tif err != nil {\n\t\t\tutils.Logger.SetPrefix(\"WARNING \")\n\t\t\tutils.Logger.Println(\"GetClient - DB pooling allocate failed\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpos := cp.size\n\t\tcp.size++\n\t\treturn &cp.clientList[pos], nil\n\t} else {\n\t\tutils.Logger.SetPrefix(\"WARNING \")\n\t\tutils.Logger.Println(\"GetClient - DB pooling is fulled\")\n\t\treturn nil, errors.New(\"DB pooling is fulled\")\n\t}\n\n}", "title": "" }, { "docid": "d5e840657386aa08b8e26218b7bf9282", "score": "0.55086213", "text": "func (ctx *Context) Client() lib.Client {\n\tif client, ok := ctx.App().Metadata[\"client\"].(lib.Client); ok {\n\t\treturn client\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b74120dc8f91c5482b33e0c4cb48f34", "score": "0.54900956", "text": "func (m *mongoDB) SetClient() {\n\tconfig := m.Config\n\n\tconnectionString := fmt.Sprintf(\"mongodb://%s:%v\", config.Host, config.Port)\n\n\tif config.Username != \"\" {\n\t\tconnectionString = fmt.Sprintf(\"mongodb://%s:%s@%s:%v\", config.Username, config.Password, config.Host, config.Port)\n\t\tif config.AuthMechanism != \"\" {\n\t\t\tconnectionString = fmt.Sprintf(\"mongodb+srv://%s:%s@%s/%s?authMechanism=%s\", config.Username, config.Password, config.Host, config.Database, config.AuthMechanism)\n\t\t}\n\t}\n\n\tclientOptions := options.Client().ApplyURI(connectionString)\n\n\tif config.MaxPool > 0 {\n\t\tclientOptions.SetMaxPoolSize(uint64(config.MaxPool))\n\t}\n\n\tif config.RegistryBuilder {\n\t\t// register custom codec registry to handle empty interfaces\n\t\trb := bson.NewRegistryBuilder()\n\t\trb.RegisterTypeMapEntry(bsontype.EmbeddedDocument, reflect.TypeOf(bson.M{}))\n\n\t\tclientOptions.SetRegistry(rb.Build())\n\t}\n\n\tclient, err := mongo.NewClient(clientOptions)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = client.Connect(context.Background())\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tm.ConnectionString = connectionString\n\n\tm.Client = client\n}", "title": "" }, { "docid": "15d42d68d361597ff57f7fcc97498c54", "score": "0.54810995", "text": "func init() {\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(config.Config.ConnectionString))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\terr = client.Connect(context.Background())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// Collection types can be used to access the models\n\tdb = client.Database(config.Config.DatabaseName)\n}", "title": "" }, { "docid": "3b77e6781242bb4a8168422293aff55a", "score": "0.54741985", "text": "func NewClient(config Configuration) (MongoClient, error) {\n\tm := MongoClient{}\n\n\t// Create the dial info for the Mongo session\n\tconnectionString := config.Host + \":\" + strconv.Itoa(config.Port)\n\tmongoDBDialInfo := &mgo.DialInfo{\n\t\tAddrs: []string{connectionString},\n\t\tTimeout: time.Duration(config.Timeout) * time.Millisecond,\n\t\tDatabase: config.Database,\n\t\tUsername: config.Username,\n\t\tPassword: config.Password,\n\t}\n\tsession, err := mgo.DialWithInfo(mongoDBDialInfo)\n\tif err != nil {\n\t\treturn m, err\n\t}\n\n\tm.session = session\n\tm.database = session.DB(config.Database)\n\n\tcurrentMongoClient = m // Set the singleton\n\treturn m, nil\n}", "title": "" }, { "docid": "1dea99c1464101fc5f1f28ea465e47ac", "score": "0.5447766", "text": "func WithContext(ctx context.Context) DialOption {\n\treturn func(cfg *mongoConfig) {\n\t\tcfg.ctx = ctx\n\t}\n}", "title": "" }, { "docid": "4d3946dc490564f38bec890c0db71df6", "score": "0.54425025", "text": "func Setup(ctx context.Context, address string) (*mongo.Client, error) {\n\tctx, cancel := context.WithTimeout(ctx, 1*time.Second)\n\tdefer cancel()\n\n\tfmt.Println(address)\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(address))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := client.Connect(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "d68303c3f499a29bc1374c14b74f6d04", "score": "0.5437011", "text": "func GetClientFor(c kubernetes.Interface, group string, version string) (*rest.RESTClient, error) {\n\tinConfig, err := config.GetConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconf := rest.CopyConfig(inConfig)\n\tconf.GroupVersion = &schema.GroupVersion{\n\t\tGroup: group,\n\t\tVersion: version,\n\t}\n\tconf.APIPath = \"/apis\"\n\tconf.AcceptContentTypes = \"application/json\"\n\tconf.ContentType = \"application/json\"\n\n\t// this gets used for discovery and error handling types\n\tconf.NegotiatedSerializer = basicNegotiatedSerializer{}\n\tif conf.UserAgent == \"\" {\n\t\tconf.UserAgent = rest.DefaultKubernetesUserAgent()\n\t}\n\n\treturn rest.RESTClientFor(conf)\n}", "title": "" }, { "docid": "165ccb147dd4fce5889867b5524ed78e", "score": "0.54309154", "text": "func InitMongoDB() *mongo.Client {\n\tfmt.Println(\"into InitMongoDB\")\n\t//Build connection\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(\n\t\t\"mongodb+srv://root:root@cluster0.qfx1p.mongodb.net/short-url?retryWrites=true&w=majority\",\n\t))\n\tif err != nil {\n\t\tfmt.Println(\"connect error!\")\n\t\tlog.Fatal(err)\n\t}\n\t//check connection timeout\n\t// if err = client.Ping(ctx, readpref.Primary()); err != nil {\n\t// \tpanic(err)\n\t// }\n\treturn client\n}", "title": "" }, { "docid": "15c3f6522b14f71503128725bf3c9480", "score": "0.5430632", "text": "func NewMongoClient(ctx context.Context, opts ...*options.ClientOptions) (*mongo.Client, error) {\n\tclient, err := mongo.NewClient(opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// ping\n\tctxTimeout, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tdefer cancel()\n\n\terr = client.Ping(ctxTimeout, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "9dfa8d68207c40ea3f0dbb000ce8740c", "score": "0.5421142", "text": "func (g *OCIGetter) Context() context.Context {\n\tif g == nil || g.client == nil {\n\t\treturn context.Background()\n\t}\n\treturn g.client.Ctx\n}", "title": "" }, { "docid": "44309f7bbde6ff2b5db8f709f369a7d4", "score": "0.5399372", "text": "func Connect(ctx context.Context, opts ...*options.ClientOptions) (IClient, error) {\n\tclient, err := mongo.Connect(ctx, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &MongoClient{Client: client}, nil\n}", "title": "" }, { "docid": "0c4243777b3bc0c560caab97ad71a89a", "score": "0.53970176", "text": "func (ctx *Contextual) ClientFromContext(c *context.Context) (*github.Client, error) {\n\tclient, ok := (*c).Value(clientContext{}).(*github.Client)\n\tif !ok {\n\t\treturn nil, errors.New(\"client not available in this context\")\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "72e3fc042a3ec0a13730e1a31e4d1f21", "score": "0.5383258", "text": "func (ts *mysqlDBSwitch) ClientFor(ctx context.Context, tenant string) (_ *ent.Client, err error) {\n\tif err := ts.sem.Acquire(ctx, 1); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tts.sem.Release(1)\n\t\t\tpanic(r)\n\t\t}\n\t\tif err != nil {\n\t\t\tts.sem.Release(1)\n\t\t}\n\t}()\n\tquery := fmt.Sprintf(\"USE `%s`\", viewer.DBName(tenant))\n\tif _, err := ts.db.ExecContext(ctx, query); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot switch tenancy: %w\", err)\n\t}\n\treturn ts.client, nil\n}", "title": "" }, { "docid": "f7c63d503a0a6c4f6e0d525db6eda226", "score": "0.53700626", "text": "func connect(uri string) (*mongo.Client, context.Context, context.CancelFunc, error) {\n\tvar cred options.Credential\n\tcred.Username = \"admin\"\n\tcred.Password = \"fridgemanager\"\n\tctx, cancel := context.WithTimeout(context.Background(), 2500 * time.Second)\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(uri).SetAuth(cred))\n\treturn client, ctx, cancel, err\n}", "title": "" }, { "docid": "e79532f7a687f15bda1ccb09d1b69acf", "score": "0.53519607", "text": "func ConnectToMongoDB(ctx context.Context) *mongo.Client {\n\n\t// pwd := os.Getenv(\"MONGOPASS\")\n\n\tclientOptions := options.Client().ApplyURI(\"mongodb://127.0.0.1:27017\") // .SetAuth(options.Credential{\n\t// AuthSource: \"admin\", Username: \"toodle\", Password: pwd,\n\t// })\n\n\tclient, err := mongo.Connect(ctx, clientOptions)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = client.Ping(context.TODO(), nil)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(\"Connected to MongoDB\")\n\treturn client\n}", "title": "" }, { "docid": "571de76e8f182cfd68bd039390f113c3", "score": "0.5323334", "text": "func configForContext(context string) (*rest.Config, error) {\n\tconfig, err := getConfig(context).ClientConfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get Kubernetes config for context %q: %s\", context, err)\n\t}\n\treturn config, nil\n}", "title": "" }, { "docid": "6812ccceb92988ed2b3c2ea4f3f7444d", "score": "0.53159535", "text": "func GetFromContext(c *gin.Context) (*gorm.DB, error) {\n\tdbi, _ := c.Get(\"DB\")\n\tdb, ok := dbi.(*gorm.DB)\n\tif !ok {\n\t\treturn nil, errors.New(\"No db in context\")\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "eb33830a1f4559d4cabfcded19f6f483", "score": "0.52804434", "text": "func FromContext(ctx context.Context) *Client {\r\n\tc, _ := ctx.Value(clientCtxKey{}).(*Client)\r\n\treturn c\r\n}", "title": "" }, { "docid": "f51ccb29005172f2168935319513b4ec", "score": "0.52729696", "text": "func (p *wrappedPool) GetContext(ctx context.Context) (conn redis.Conn, err error) {\n\tif conn, err = p.Pool.GetContext(ctx); err != nil {\n\t\treturn\n\t}\n\n\tif txn := newrelic.FromContext(ctx); txn != nil {\n\t\tconn = wrapConn(conn, txn, p.cfg)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f8016c2965e2d3b46036221cc8759507", "score": "0.52620524", "text": "func NewMongoClientByURI(ctx context.Context, uri string) (*mongo.Client, error) {\n\topt := options.Client().ApplyURI(uri)\n\treturn NewMongoClient(ctx, opt)\n}", "title": "" }, { "docid": "22ee62d92874b0230297eae21568c279", "score": "0.52586746", "text": "func GetMongoConnectionTest(mongoDSN string) (*mongo.Client, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)\n\tdefer cancel()\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(mongoDSN))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = client.Ping(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "65a384e2436ac700ebda05ea754c4813", "score": "0.5254293", "text": "func ConnectDB() *mongo.Client {\n\n\terr := godotenv.Load()\n\tif err != nil {\n\t\tlog.Fatal(\"Error Cargando Variable de entorno\")\n\n\t}\n\n\tmongoURL := os.Getenv(\"MONGODB\")\n\n\tclientOption := options.Client().ApplyURI(mongoURL)\n\t// clientOption := options.Client().ApplyURI(os.Getenv(\"MONGODB\"))\n\n\tclient, err := mongo.Connect(context.TODO(), clientOption)\n\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t\treturn client\n\t}\n\n\terr = client.Ping(context.TODO(), nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn client\n\t}\n\n\tlog.Println(\"Conexion exitosa\")\n\n\treturn client\n\n}", "title": "" }, { "docid": "85d384b98c20bae37990ad83748626e9", "score": "0.52498823", "text": "func FromContext(ctx context.Context) *Client {\n\tc, _ := ctx.Value(contextKey{}).(*Client)\n\treturn c\n}", "title": "" }, { "docid": "cbbb42da367f889eb99d7e30487c9774", "score": "0.524877", "text": "func getDatabaseFromGinContext(c *gin.Context) *gorm.DB {\n db, ok := c.MustGet(\"database\").(*gorm.DB)\n if !ok {\n panic(\"failed to get database\")\n }\n return db\n}", "title": "" }, { "docid": "4d851dd9b5a4cef3483faa22e50df7ed", "score": "0.5247502", "text": "func (g *getter) Context() context.Context {\n\tif g == nil || g.client == nil {\n\t\treturn context.Background()\n\t}\n\treturn g.client.Ctx\n}", "title": "" }, { "docid": "9eeef9608ae2bd012edf509040a5b11f", "score": "0.52359796", "text": "func Database() (*mongo.Database, error) {\n\tconnectionString := os.Getenv(\"MONGODB_CONNECTION_STRING\")\n\tdatabase := os.Getenv(\"MONGODB_DATABASE\")\n\tif connectionString == \"\" {\n\t\tc := config{}\n\t\terr := envconfig.Process(envconfigPrefix, &c)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(\n\t\t\t\terr,\n\t\t\t\t\"error getting mongo configuration from environment\",\n\t\t\t)\n\t\t}\n\t\tconnectionString = fmt.Sprintf(\n\t\t\t\"mongodb://%s:%s@%s:%d/%s?replicaSet=%s\",\n\t\t\tc.Username,\n\t\t\tc.Password,\n\t\t\tc.Host,\n\t\t\tc.Port,\n\t\t\tc.Database,\n\t\t\tc.ReplicaSet,\n\t\t)\n\t\tdatabase = c.Database\n\t}\n\n\tconnectCtx, connectCancel :=\n\t\tcontext.WithTimeout(context.Background(), 10*time.Second)\n\tdefer connectCancel()\n\t// This client's settings favor consistency over speed\n\tclient, err := mongo.Connect(\n\t\tconnectCtx,\n\t\toptions.Client().ApplyURI(connectionString).SetWriteConcern(\n\t\t\twriteconcern.New(writeconcern.WMajority()),\n\t\t).SetReadConcern(readconcern.Linearizable()),\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error connecting to mongo\")\n\t}\n\treturn client.Database(database), nil\n}", "title": "" }, { "docid": "b633751937c57d60079449a08dfafe2c", "score": "0.5228557", "text": "func configureClient(opts options.ToolOptions) (*mongo.Client, error) {\n\tif opts.URI == nil || opts.URI.ConnectionString == \"\" {\n\t\t// XXX Normal operations shouldn't ever reach here because a URI should\n\t\t// be created in options parsing, but tests still manually construct\n\t\t// options and generally don't construct a URI, so we invoke the URI\n\t\t// normalization routine here to correct for that.\n\t\topts.NormalizeOptionsAndURI()\n\t}\n\n\tclientopt := mopt.Client()\n\tcs := opts.URI.ParsedConnString()\n\n\tclientopt.Hosts = cs.Hosts\n\n\tif opts.RetryWrites != nil {\n\t\tclientopt.SetRetryWrites(*opts.RetryWrites)\n\t}\n\n\tclientopt.SetConnectTimeout(time.Duration(opts.Timeout) * time.Second)\n\tclientopt.SetSocketTimeout(time.Duration(opts.SocketTimeout) * time.Second)\n\tif opts.Connection.ServerSelectionTimeout > 0 {\n\t\tclientopt.SetServerSelectionTimeout(time.Duration(opts.Connection.ServerSelectionTimeout) * time.Second)\n\t}\n\tif opts.ReplicaSetName != \"\" {\n\t\tclientopt.SetReplicaSet(opts.ReplicaSetName)\n\t}\n\n\tclientopt.SetAppName(opts.AppName)\n\tif opts.Direct && len(clientopt.Hosts) == 1 {\n\t\tclientopt.SetDirect(true)\n\t\tt := true\n\t\tclientopt.AuthenticateToAnything = &t\n\t}\n\n\tif opts.ReadPreference != nil {\n\t\tclientopt.SetReadPreference(opts.ReadPreference)\n\t}\n\tif opts.WriteConcern != nil {\n\t\tclientopt.SetWriteConcern(opts.WriteConcern)\n\t} else {\n\t\t// If no write concern was specified, default to majority\n\t\tclientopt.SetWriteConcern(writeconcern.New(writeconcern.WMajority()))\n\t}\n\n\tif opts.Compressors != \"\" && opts.Compressors != \"none\" {\n\t\tclientopt.SetCompressors(strings.Split(opts.Compressors, \",\"))\n\t}\n\n\tif cs.ZlibLevelSet {\n\t\tclientopt.SetZlibLevel(cs.ZlibLevel)\n\t}\n\tif cs.ZstdLevelSet {\n\t\tclientopt.SetZstdLevel(cs.ZstdLevel)\n\t}\n\n\tif cs.HeartbeatIntervalSet {\n\t\tclientopt.SetHeartbeatInterval(cs.HeartbeatInterval)\n\t}\n\n\tif cs.LocalThresholdSet {\n\t\tclientopt.SetLocalThreshold(cs.LocalThreshold)\n\t}\n\n\tif cs.MaxConnIdleTimeSet {\n\t\tclientopt.SetMaxConnIdleTime(cs.MaxConnIdleTime)\n\t}\n\n\tif cs.MaxPoolSizeSet {\n\t\tclientopt.SetMaxPoolSize(cs.MaxPoolSize)\n\t}\n\n\tif cs.MinPoolSizeSet {\n\t\tclientopt.SetMinPoolSize(cs.MinPoolSize)\n\t}\n\n\tif cs.LoadBalancedSet {\n\t\tclientopt.SetLoadBalanced(cs.LoadBalanced)\n\t}\n\n\tif cs.ReadConcernLevel != \"\" {\n\t\trc := readconcern.New(readconcern.Level(cs.ReadConcernLevel))\n\t\tclientopt.SetReadConcern(rc)\n\t}\n\n\tif cs.ReadPreference != \"\" || len(cs.ReadPreferenceTagSets) > 0 || cs.MaxStalenessSet {\n\t\treadPrefOpts := make([]readpref.Option, 0, 1)\n\n\t\ttagSets := tag.NewTagSetsFromMaps(cs.ReadPreferenceTagSets)\n\t\tif len(tagSets) > 0 {\n\t\t\treadPrefOpts = append(readPrefOpts, readpref.WithTagSets(tagSets...))\n\t\t}\n\n\t\tif cs.MaxStaleness != 0 {\n\t\t\treadPrefOpts = append(readPrefOpts, readpref.WithMaxStaleness(cs.MaxStaleness))\n\t\t}\n\n\t\tmode, err := readpref.ModeFromString(cs.ReadPreference)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treadPref, err := readpref.New(mode, readPrefOpts...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tclientopt.SetReadPreference(readPref)\n\t}\n\n\tif cs.RetryReadsSet {\n\t\tclientopt.SetRetryReads(cs.RetryReads)\n\t}\n\n\tif cs.JSet || cs.WString != \"\" || cs.WNumberSet || cs.WTimeoutSet {\n\t\topts := make([]writeconcern.Option, 0, 1)\n\n\t\tif len(cs.WString) > 0 {\n\t\t\topts = append(opts, writeconcern.WTagSet(cs.WString))\n\t\t} else if cs.WNumberSet {\n\t\t\topts = append(opts, writeconcern.W(cs.WNumber))\n\t\t}\n\n\t\tif cs.JSet {\n\t\t\topts = append(opts, writeconcern.J(cs.J))\n\t\t}\n\n\t\tif cs.WTimeoutSet {\n\t\t\topts = append(opts, writeconcern.WTimeout(cs.WTimeout))\n\t\t}\n\n\t\tclientopt.SetWriteConcern(writeconcern.New(opts...))\n\t}\n\n\tif opts.Auth != nil && opts.Auth.IsSet() {\n\t\tcred := mopt.Credential{\n\t\t\tUsername: opts.Auth.Username,\n\t\t\tPassword: opts.Auth.Password,\n\t\t\tAuthSource: opts.GetAuthenticationDatabase(),\n\t\t\tAuthMechanism: opts.Auth.Mechanism,\n\t\t}\n\t\tif cs.AuthMechanism == \"MONGODB-AWS\" {\n\t\t\tcred.Username = cs.Username\n\t\t\tcred.Password = cs.Password\n\t\t\tcred.AuthSource = cs.AuthSource\n\t\t\tcred.AuthMechanism = cs.AuthMechanism\n\t\t\tcred.AuthMechanismProperties = cs.AuthMechanismProperties\n\t\t}\n\t\t// Technically, an empty password is possible, but the tools don't have the\n\t\t// means to easily distinguish and so require a non-empty password.\n\t\tif cred.Password != \"\" {\n\t\t\tcred.PasswordSet = true\n\t\t}\n\t\tif opts.Kerberos != nil && cred.AuthMechanism == \"GSSAPI\" {\n\t\t\tprops := make(map[string]string)\n\t\t\tif opts.Kerberos.Service != \"\" {\n\t\t\t\tprops[\"SERVICE_NAME\"] = opts.Kerberos.Service\n\t\t\t}\n\t\t\t// XXX How do we use opts.Kerberos.ServiceHost if at all?\n\t\t\tcred.AuthMechanismProperties = props\n\t\t}\n\t\tclientopt.SetAuth(cred)\n\t}\n\n\tif opts.SSL != nil && opts.UseSSL {\n\t\t// Error on unsupported features\n\t\tif opts.SSLFipsMode {\n\t\t\treturn nil, fmt.Errorf(\"FIPS mode not supported\")\n\t\t}\n\t\tif opts.SSLCRLFile != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"CRL files are not supported on this platform\")\n\t\t}\n\n\t\ttlsConfig := &tls.Config{}\n\t\tif opts.SSLAllowInvalidCert || opts.SSLAllowInvalidHost || opts.TLSInsecure {\n\t\t\ttlsConfig.InsecureSkipVerify = true\n\t\t}\n\n\t\tvar x509Subject string\n\t\tkeyPasswd := opts.SSL.SSLPEMKeyPassword\n\t\tvar err error\n\t\tif cs.SSLClientCertificateKeyPasswordSet && cs.SSLClientCertificateKeyPassword != nil {\n\t\t\tkeyPasswd = cs.SSLClientCertificateKeyPassword()\n\t\t}\n\t\tif cs.SSLClientCertificateKeyFileSet {\n\t\t\tx509Subject, err = addClientCertFromFile(tlsConfig, cs.SSLClientCertificateKeyFile, keyPasswd)\n\t\t} else if cs.SSLCertificateFileSet || cs.SSLPrivateKeyFileSet {\n\t\t\tx509Subject, err = addClientCertFromSeparateFiles(tlsConfig, cs.SSLCertificateFile, cs.SSLPrivateKeyFile, keyPasswd)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error configuring client, can't load client certificate: %v\", err)\n\t\t}\n\t\tif opts.SSLCAFile != \"\" {\n\t\t\tif err := addCACertsFromFile(tlsConfig, opts.SSLCAFile); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error configuring client, can't load CA file: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\t// If a username wasn't specified for x509, add one from the certificate.\n\t\tif clientopt.Auth != nil && strings.ToLower(clientopt.Auth.AuthMechanism) == \"mongodb-x509\" && clientopt.Auth.Username == \"\" {\n\t\t\t// The Go x509 package gives the subject with the pairs in reverse order that we want.\n\t\t\tclientopt.Auth.Username = extractX509UsernameFromSubject(x509Subject)\n\t\t}\n\n\t\tclientopt.SetTLSConfig(tlsConfig)\n\t}\n\n\tif cs.SSLDisableOCSPEndpointCheckSet {\n\t\tclientopt.SetDisableOCSPEndpointCheck(cs.SSLDisableOCSPEndpointCheck)\n\t}\n\n\treturn mongo.NewClient(clientopt)\n}", "title": "" }, { "docid": "cb39b8e5cdb39d4d0d658110a0b8dc6d", "score": "0.5218094", "text": "func NewClient(coptions ...ClientOption) (*Client, error) {\n\topts := cltOptions{}\n\tfor _, option := range coptions {\n\t\toption.f(&opts)\n\t}\n\n\t// using SCRAM auth\n\tloginCreds := opts.dbUser + \":\" + opts.dbPasswd + \"@\"\n\turl := \"mongodb://\" + loginCreds + opts.hostPorts // works on mac without the auth db suffix\n\n\tif len(opts.dbAuthDB) > 0 {\n\t\t// use the database auth name when on ubuntu-18.04\n\t\t// ex: mongodb://foo:bar@localhost:27017/mydb\n\t\turl = url + \"/\" + opts.dbAuthDB\n\t}\n\tcltOpts := options.Client()\n\tcltOpts = cltOpts.ApplyURI(url)\n\tcltOpts = cltOpts.SetSocketTimeout(opts.commTimeoutMS)\n\tconnTimeOutMS := opts.commTimeoutMS * 2\n\tcltOpts = cltOpts.SetConnectTimeout(connTimeOutMS)\n\n\tclt, err := mongo.NewClient(cltOpts)\n\tif err != nil {\n\t\treturn nil, normalizeError(err)\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), (connTimeOutMS/1000)*time.Second)\n\tdefer cancel()\n\terr = clt.Connect(ctx)\n\tif err != nil {\n\t\treturn nil, normalizeError(err)\n\t}\n\n\tclient := Client{\n\t\tclt,\n\t\t&opts,\n\t}\n\treturn &client, nil\n}", "title": "" }, { "docid": "990fb1fd8ed1eb263b52a7103ac52808", "score": "0.52128863", "text": "func NewClientFromContext(c *cli.Context) (*redis.Client, error) {\n\tredisEndpoint := c.String(redisEndpointFlag)\n\tredisPassword := c.String(redisPasswordFlag)\n\n\tif err := validation.Validate(redisEndpoint, validation.Required, is.URL); err != nil {\n\t\treturn nil, err\n\t}\n\tredisClient := redis.NewClient(&redis.Options{\n\t\tAddr: redisEndpoint,\n\t\tPassword: redisPassword,\n\t\tDB: c.Int(redisDBFlag),\n\t})\n\t_, err := redisClient.Ping().Result()\n\treturn redisClient, err\n}", "title": "" }, { "docid": "dadcdb5de9e7cf3142b7b9b06f2348c8", "score": "0.51995283", "text": "func (s ServiceInit) newDBClient(dbType string) (interfaces.DBClient, error) {\n\tswitch dbType {\n\tcase db.MongoDB:\n\t\tdbConfig := db.Configuration{\n\t\t\tHost: Configuration.Databases[\"Primary\"].Host,\n\t\t\tPort: Configuration.Databases[\"Primary\"].Port,\n\t\t\tTimeout: Configuration.Databases[\"Primary\"].Timeout,\n\t\t\tDatabaseName: Configuration.Databases[\"Primary\"].Name,\n\t\t\tUsername: Configuration.Databases[\"Primary\"].Username,\n\t\t\tPassword: Configuration.Databases[\"Primary\"].Password,\n\t\t}\n\t\treturn mongo.NewClient(dbConfig)\n\tcase db.RedisDB:\n\t\tdbConfig := db.Configuration{\n\t\t\tHost: Configuration.Databases[\"Primary\"].Host,\n\t\t\tPort: Configuration.Databases[\"Primary\"].Port,\n\t\t}\n\t\tredisClient, err := redis.NewCoreDataClient(dbConfig, LoggingClient) // TODO: Verify this also connects to Redis\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn redisClient, nil\n\tdefault:\n\t\treturn nil, db.ErrUnsupportedDatabase\n\t}\n}", "title": "" }, { "docid": "bfc3203d24ded606968c53a256f050bf", "score": "0.51992637", "text": "func (r *Repository) client() Client {\n\tif r.Client == nil {\n\t\treturn auth.DefaultClient\n\t}\n\treturn r.Client\n}", "title": "" }, { "docid": "c154b87ba23b24335244446c87f87bef", "score": "0.51964617", "text": "func getApiClient(c *cli.Context) *giniapi.APIClient {\n\tcredentials := getClientCredentials(c)\n\tapiEndpoint := c.GlobalString(\"api\")\n\tuserEndpoint := c.GlobalString(\"usercenter\")\n\n\tapiConfig := giniapi.Config{\n\t\tClientID: credentials[0],\n\t\tClientSecret: credentials[1],\n\t\tAuthentication: giniapi.UseBasicAuth,\n\t\tEndpoints: giniapi.Endpoints{\n\t\t\tAPI: apiEndpoint,\n\t\t\tUserCenter: userEndpoint,\n\t\t},\n\t}\n\n\tif c.GlobalBool(\"debug\") {\n\t\tapiConfig.HTTPDebug = true\n\t\tapiConfig.RequestDebug = request\n\t\tapiConfig.ResponseDebug = response\n\t}\n\n\tapi, err := giniapi.NewClient(&apiConfig)\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %s\\n\", err)\n\t\tcli.ShowCommandHelp(c, c.Command.FullName())\n\t\tos.Exit(1)\n\t}\n\n\treturn api\n}", "title": "" }, { "docid": "d96ce591c724ea3960dcf637c17c745e", "score": "0.51946324", "text": "func ExampleMongoDBResourcesClient_GetMongoDBDatabase() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armcosmos.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewMongoDBResourcesClient().GetMongoDBDatabase(ctx, \"rg1\", \"ddb1\", \"databaseName\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.MongoDBDatabaseGetResults = armcosmos.MongoDBDatabaseGetResults{\n\t// \tName: to.Ptr(\"databaseName\"),\n\t// \tType: to.Ptr(\"Microsoft.DocumentDB/databaseAccounts/mongodbDatabases\"),\n\t// \tID: to.Ptr(\"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName\"),\n\t// \tLocation: to.Ptr(\"West US\"),\n\t// \tTags: map[string]*string{\n\t// \t},\n\t// \tProperties: &armcosmos.MongoDBDatabaseGetProperties{\n\t// \t\tResource: &armcosmos.MongoDBDatabaseGetPropertiesResource{\n\t// \t\t\tEtag: to.Ptr(\"\\\"00005900-0000-0000-0000-56f9a2630000\\\"\"),\n\t// \t\t\tRid: to.Ptr(\"PD5DALigDgw=\"),\n\t// \t\t\tTs: to.Ptr[float32](1459200611),\n\t// \t\t\tID: to.Ptr(\"databaseName\"),\n\t// \t\t},\n\t// \t},\n\t// }\n}", "title": "" }, { "docid": "28ff787c389186b62a588a87b3a31ffd", "score": "0.51933163", "text": "func (its *OrdaService) ProcessClient(\n\tgoCtx gocontext.Context,\n\treq *model.ClientMessage,\n) (*model.ClientMessage, error) {\n\tctx := svrcontext.NewServerContext(goCtx, constants.TagClient).\n\t\tUpdateCollection(req.Collection).\n\t\tUpdateClient(req.GetClientSummary())\n\tcollectionDoc, rpcErr := its.getCollectionDocWithRPCError(ctx, req.Collection)\n\tif rpcErr != nil {\n\t\treturn nil, rpcErr\n\t}\n\tctx.UpdateCollection(collectionDoc.GetSummary())\n\tclientDocFromReq := schema.ClientModelToBson(req.GetClient(), collectionDoc.Num)\n\n\tctx.L().Infof(\"REQ[CLIE] %s %v %v\", req.ToString(), len(req.Cuid), req.Cuid)\n\n\tclientDocFromDB, err := its.mongo.GetClient(ctx, clientDocFromReq.CUID)\n\tif err != nil {\n\t\treturn nil, errors.NewRPCError(err)\n\t}\n\tif clientDocFromDB == nil {\n\t\tclientDocFromReq.CreatedAt = time.Now()\n\t\tctx.L().Infof(\"create a new client:%+v\", clientDocFromReq)\n\t\tif err := its.mongo.GetOrCreateRealCollection(ctx, req.Collection); err != nil {\n\t\t\treturn nil, errors.NewRPCError(err)\n\t\t}\n\t} else {\n\n\t\tif clientDocFromDB.CollectionNum != clientDocFromReq.CollectionNum {\n\t\t\tmsg := fmt.Sprintf(\"client '%s' accesses collection(%d)\",\n\t\t\t\tclientDocFromDB.ToString(), clientDocFromReq.CollectionNum)\n\t\t\treturn nil, errors.NewRPCError(errors.ServerNoPermission.New(ctx.L(), msg))\n\t\t}\n\t\tctx.L().Infof(\"Client will be updated:%+v\", clientDocFromReq)\n\t}\n\tclientDocFromReq.CreatedAt = time.Now()\n\tif err = its.mongo.UpdateClient(ctx, clientDocFromReq); err != nil {\n\t\treturn nil, errors.NewRPCError(err)\n\t}\n\tctx.L().Infof(\"RES[CLIE] %s\", req.ToString())\n\treturn req, nil\n}", "title": "" }, { "docid": "34b25a327a6aa58a18216d1dd45d740d", "score": "0.5190697", "text": "func (api *API) Mongo() *mgo.Mongo {\n\treturn mgo.Init(api.config)\n}", "title": "" }, { "docid": "2506175a142a935244759a04880d4e75", "score": "0.51840687", "text": "func ClientContext(ctx context.Context) context.Context {\n\tif clientCtx, ok := ctx.Value(&clientContextKey).(context.Context); ok {\n\t\treturn clientCtx\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d6ab4bf60d2a6690b76a80ee4f0f84f", "score": "0.51573664", "text": "func Init() (*mongo.Database, error) {\n\tval, exist := os.LookupEnv(\"DATABASE_URL\")\n\tif !exist {\n\t\treturn nil, errors.New(\"DATABASE_URL value not set\")\n\t}\n\n\tdb, exist := os.LookupEnv(\"DATABASE_NAME\")\n\tif !exist {\n\t\treturn nil, errors.New(\"DATABASE_NAME value not set\")\n\t}\n\n\tclient, err := mongo.Connect(context.Background(), options.Client().ApplyURI(val))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client.Database(db), nil\n}", "title": "" }, { "docid": "5d03c94ba8b08dcfe99568432d7f24c3", "score": "0.51511985", "text": "func getClient(c context.Context) crimson.CrimsonClient {\n\treturn c.Value(&clientKey).(crimson.CrimsonClient)\n}", "title": "" }, { "docid": "1985df6ea5917c9aeb950dfd2d53e1ab", "score": "0.5149138", "text": "func Createdb() (*mongo.Collection, *mongo.Collection, *mongo.Collection, *mongo.Client) {\n\n\tclientOptions := options.Client().ApplyURI(DbURL)\n\n\t// Connect to MongoDB\n\tclient, err := mongo.Connect(context.TODO(), clientOptions)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Check the connection\n\terr = client.Ping(context.TODO(), nil)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(\"Connected to MongoDB!\")\n\tusercollection := client.Database(\"Dev\").Collection(\"User\")\n\tprofilecollection := client.Database(\"Dev\").Collection(\"Profile\")\n\tPost := client.Database(\"Dev\").Collection(\"Post\")\n\treturn usercollection, profilecollection, Post, client\n}", "title": "" }, { "docid": "2a6561eb295c8f58bcaa88feb73caaa7", "score": "0.5119633", "text": "func init() {\n\tvar err error\n\tclient, err = mongo.NewClient(options.Client().ApplyURI(\"mongodb://mongod:\"+MONGO+\"@127.0.0.1/admin\"))\n\tif err != nil {\n\t\tfmt.Println(\"Error creating mongo client: \", err)\n\t}\n\t\n\tctx = context.Background()\n\ttox = 2 * time.Second\n\t\n\tctx_, cancel := context.WithTimeout(ctx, 5 * time.Second)\n\tdefer cancel()\n\t\n\terr = client.Connect(ctx_)\n\tif err != nil {\n\t\tfmt.Println(\"Error initializing mongo client: \", err)\n\t}\n}", "title": "" }, { "docid": "ed3ccfe896fb3edaffe15326e0b0cc63", "score": "0.51192266", "text": "func getSession() *mgo.Session {\n\t// Connect to our local mongo\n\ts, err := mgo.Dial(\"mongodb://localhost\")\n\n\t// Check if connection error, is mongo running?\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Deliver session\n\treturn s\n}", "title": "" }, { "docid": "730183b9402054ce9f0d53e776ac8433", "score": "0.5118718", "text": "func GetFromCtx(ctx context.Context) (*raven.Client, error) {\n\tsentry, ok := ctx.Value(ctxKey{}).(*raven.Client)\n\tif !ok {\n\t\treturn nil, errNotInCtx\n\t}\n\treturn sentry, nil\n}", "title": "" }, { "docid": "4114189cbb091773aa0873073aab9876", "score": "0.5116164", "text": "func (client DatabaseAccountsClient) GetMongoDBDatabaseSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "6db1e9f09e09a712c74a936512dfb539", "score": "0.51101464", "text": "func getSession() *mgo.Session {\n\t// Connect to our local mongo\n\ts, err := mgo.Dial(\"mongodb://localhost/go_rest_tutorial\")\n\n\t// Check if connection error, is mongo running?\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Deliver session\n\treturn s\n}", "title": "" }, { "docid": "29f8cbea19a167d6f6c38bff6e530803", "score": "0.51089936", "text": "func CreateClient(connectionString string) (*mongo.Client, error) {\n\t// Set client options\n\tclientOptions := options.Client().ApplyURI(connectionString)\n\tcontx := context.TODO()\n\n\t// Connect to MongoDB\n\tclient, err := mongo.Connect(contx, clientOptions)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "191acf7cd77809cb8a875bb70b79d290", "score": "0.5103131", "text": "func mongoConnection(dbName string) (*db.DB, error) {\n\n\t// Define the mongo config.\n\tvar mgoDB *db.DB\n\tconfig := mongo.Config{\n\t\tHost: mongoHost,\n\t\tDB: dbName,\n\t}\n\n\t// Register the Mongo master session.\n\terr := db.RegMasterSession(\"Mongo\", \"test\", config)\n\tif err != nil {\n\t\treturn mgoDB, errors.Wrap(err, \"Could not register Master Session\")\n\t}\n\n\t// Create a session copy.\n\tmgoDB, err = db.NewMGO(\"Mongo\", \"test\")\n\tif err != nil {\n\t\treturn mgoDB, errors.Wrap(err, \"Could not connect to MongoDB\")\n\t}\n\n\treturn mgoDB, err\n}", "title": "" }, { "docid": "7443e01e8feafd756fadf31b4a5fc2c2", "score": "0.51004475", "text": "func GetMongoSession(conf Configuration) *mgo.Session {\n\n\tmongoDBDialInfo := &mgo.DialInfo{\n\t\tAddrs: []string{conf.MongoDBHost},\n\t\tTimeout: 60 * time.Second,\n\t\tDatabase: conf.Database,\n\t\tUsername: conf.AuthUserName,\n\t\tPassword: conf.AuthPassword,\n\t}\n\n\t// Create a session which maintains a pool of socket connections\n\t// to our MongoDB.\n\tmongoSession, err := mgo.DialWithInfo(mongoDBDialInfo)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tmongoSession.SetMode(mgo.Monotonic, true)\n\n\treturn mongoSession.Copy()\n\n}", "title": "" }, { "docid": "d7d9999bcdf6fa915231464600838cf1", "score": "0.5090385", "text": "func NewMongoClient(cfg *MongoConfig) *mongo.Client {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\toption := options.Client().SetAuth(options.Credential{Username: cfg.Username, Password: cfg.Password, AuthSource: cfg.Database})\n\toption.SetConnectTimeout(time.Second * 5)\n\toption.SetMaxPoolSize(cfg.PoolLimit)\n\toption.SetHosts(cfg.Hosts)\n\n\tclient, err := mongo.Connect(ctx, option)\n\tdefer cancel()\n\n\tif err != nil {\n\t\tglog.Infof(\"connect mongodb error: %v\", err.Error())\n\t\tpanic(err)\n\t}\n\terr = client.Ping(context.TODO(), nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t//err = client.Ping(ctx, readpref.Primary())\n\tglog.Infof(\"mongodb connected\")\n\treturn client\n}", "title": "" }, { "docid": "724cf0cc59707eaec3d9e1f8f25ab149", "score": "0.5070074", "text": "func getDatabase() *mgo.Database {\n\t// Connect to our local mongo\n\tfmt.Println(\"mongodb://\"+config.Address+\":\"+config.Port)\n\ts, err := mgo.Dial(\"mongodb://\"+config.Address+\":\"+config.Port)\n\n\t// Check if connection error, is mongo running?\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tpanic(err)\n\t}\n\n\t// Deliver session\n\treturn s.DB(config.Dbname)\n}", "title": "" }, { "docid": "194ba9a8496f2d7b29fd50644c85e49e", "score": "0.50594527", "text": "func (c *Context) GetClient() kv.Client {\n\tif c.Store == nil {\n\t\treturn nil\n\t}\n\treturn c.Store.GetClient()\n}", "title": "" }, { "docid": "ed3d64c9439cce6ccf90c329a01520eb", "score": "0.5052878", "text": "func GetMongoSession() *mgo.Session {\n\tif mgoSession == nil {\n\t\tvar err error\n\t\tmgoSession, err = mgo.DialWithInfo(&mgo.DialInfo{\n\t\t\tAddrs: Host,\n\t\t\t Username: os.Getenv(\"MONGODB_USER\"),\n\t\t\t Password: os.Getenv(\"MONGODB_PASS\"),\n\t\t\t //Database: os.Getenv(\"MONGO_INITDB_DATABASE\"),\n\t\t\t// DialServer: func(addr *mgo.ServerAddr) (net.Conn, error) {\n\t\t\t// \treturn tls.Dial(\"tcp\", addr.String(), &tls.Config{})\n\t\t\t// },\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Error: \", err)\n\t\t\tlog.Fatal(\"Error: Failed to start the Mongo session\")\n\t\t}\n\t}\n\treturn mgoSession.Clone()\n}", "title": "" }, { "docid": "51a49145cccbb904e947a761877fe210", "score": "0.5052274", "text": "func Get(ctx context.Context) versioned.Interface {\n\tuntyped := ctx.Value(Key{})\n\tif untyped == nil {\n\t\tif injection.GetConfig(ctx) == nil {\n\t\t\tlogging.FromContext(ctx).Panic(\n\t\t\t\t\"Unable to fetch knative.dev/networking/pkg/client/clientset/versioned.Interface from context. This context is not the application context (which is typically given to constructors via sharedmain).\")\n\t\t} else {\n\t\t\tlogging.FromContext(ctx).Panic(\n\t\t\t\t\"Unable to fetch knative.dev/networking/pkg/client/clientset/versioned.Interface from context.\")\n\t\t}\n\t}\n\treturn untyped.(versioned.Interface)\n}", "title": "" }, { "docid": "e01f1995073e98006366f5354126d471", "score": "0.5041517", "text": "func ExtractApiClient(c *gin.Context) remote.Client {\n\tif v, ok := c.Get(\"api_client\"); ok {\n\t\treturn v.(remote.Client)\n\t}\n\tpanic(\"middleware/middlware: cannot extract api clinet: not present in context\")\n}", "title": "" } ]
3e1bd027f139e2963e5630e0972edf74
WithContext adds the context to the post v1 task lists params
[ { "docid": "ce8ae129d29bd843881dbb205f245adf", "score": "0.6496928", "text": "func (o *PostV1TaskListsParams) WithContext(ctx context.Context) *PostV1TaskListsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" } ]
[ { "docid": "088152cd2cfa9f9967797b6c391a66c3", "score": "0.5680656", "text": "func (o *PostV1TaskListsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "8fb58d5597718d4cb5eb6297ca8e804c", "score": "0.51939017", "text": "func (o *PostScheduledTasksParams) WithContext(ctx context.Context) *PostScheduledTasksParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "a17fbdfc2fb16ba64682ba07130153fa", "score": "0.5136454", "text": "func (o *CreateListBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "7c45476c62830bbf86b620ddffb800f4", "score": "0.51034564", "text": "func (o *PostV1TaskListsParams) WithHTTPClient(client *http.Client) *PostV1TaskListsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "b42923cb69d66c5553a2f3bce480e509", "score": "0.50963545", "text": "func (o *CreateListOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0b0fd08a492bb2a338233ccefa875585", "score": "0.5092009", "text": "func (_obj *Apistickers) AddServantWithContext(imp _impApistickersWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "title": "" }, { "docid": "baabef03c36cd9d9de684dd5c5ac20a7", "score": "0.5071265", "text": "func (c *PlaylistsInsertCall) Context(ctx context.Context) *PlaylistsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "e4d730fbba4f65be05aa3a6d9ef7f436", "score": "0.4981432", "text": "func (page *BuildTaskListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/BuildTaskListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.btlr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.btlr = next\n\treturn nil\n}", "title": "" }, { "docid": "c6d9907c84426eba21538f57debade66", "score": "0.49372765", "text": "func (o *GetComponentByIDListUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "36aa59c101a0c455c6764c97c31fdd37", "score": "0.49255446", "text": "func (o *PostScheduledTasksParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ee6da0000ebb1e3cba2bdd848dbd485c", "score": "0.49027032", "text": "func (c *PlaylistItemsInsertCall) Context(ctx context.Context) *PlaylistItemsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "58874753612bc57c4e2eff8a68a07419", "score": "0.48708442", "text": "func (_obj *DataService) AddServantWithContext(imp _impDataServiceWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "title": "" }, { "docid": "c3db6333008fb677f6c11e637a93cc5f", "score": "0.48474565", "text": "func (m *MockEKSAPI) ListNodegroupsWithContext(arg0 context.Context, arg1 *eks.ListNodegroupsInput, arg2 ...request.Option) (*eks.ListNodegroupsOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListNodegroupsWithContext\", varargs...)\n\tret0, _ := ret[0].(*eks.ListNodegroupsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1e3b1411cfe56bd7aa06cdfc82a6520f", "score": "0.4834078", "text": "func (o *ActivityListPostListParams) WithContext(ctx context.Context) *ActivityListPostListParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "5c5b25c4c911c0994069660356aa9240", "score": "0.48224944", "text": "func NewPostV1TaskListsParamsWithHTTPClient(client *http.Client) *PostV1TaskListsParams {\n\treturn &PostV1TaskListsParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "7d7656f146ad635d65a5a5bae98f57a1", "score": "0.4822432", "text": "func (_obj *Apistickers) Stickers_addStickerToSetWithContext(tarsCtx context.Context, params *TLstickers_addStickerToSet, _opt ...map[string]string) (ret Messages_StickerSet, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 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\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"stickers_addStickerToSet\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "title": "" }, { "docid": "d18dcebfddbaf9f6251471f2111b5181", "score": "0.481232", "text": "func (c *LiveChatModeratorsInsertCall) Context(ctx context.Context) *LiveChatModeratorsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "cd7c4ef2ba04df867d50cfa5a26922e1", "score": "0.47896343", "text": "func (_obj *Fetcher) AddServantWithContext(imp _impFetcherWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "title": "" }, { "docid": "c42590bed41ae13ac1bec9b2b5d16fac", "score": "0.4769515", "text": "func (iter *BuildTaskListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/BuildTaskListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "title": "" }, { "docid": "8e9436916a099c6ba97e99fda392531d", "score": "0.47653377", "text": "func (o *PostV1TaskListsParams) WithTimeout(timeout time.Duration) *PostV1TaskListsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "bfab22473316966972fcd733d9715d08", "score": "0.47510442", "text": "func (o *CreateVersionByIDUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "df7c7dbdacfe3e14c61fe6c00ce91057", "score": "0.4745791", "text": "func (m *ListPaymentsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0f0c28e860b9c92891320565e52fbcaf", "score": "0.4745203", "text": "func (o *PostV1TaskListsParams) 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.PostV1TaskLists != nil {\n\t\tif err := r.SetBodyParam(o.PostV1TaskLists); 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": "3ddb8ea942337321017ecd2044ab9730", "score": "0.4740835", "text": "func (o *LedgerPaymentTypeOutListPutListParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "9f70ac98e0357be662228fa09cd0796b", "score": "0.4722352", "text": "func (df *DataFlow) WithContext(c context.Context) *DataFlow {\n\tdf.Req.Index++\n\tdf.Req.ctxIndex = df.Req.Index\n\tdf.Req.c = c\n\treturn df\n}", "title": "" }, { "docid": "f7669d2d1e868638048b1d0cfb0b71a4", "score": "0.472134", "text": "func (mr *MockEKSAPIMockRecorder) ListNodegroupsWithContext(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, \"ListNodegroupsWithContext\", reflect.TypeOf((*MockEKSAPI)(nil).ListNodegroupsWithContext), varargs...)\n}", "title": "" }, { "docid": "48726fd4faff240191ba1d66363bee59", "score": "0.47105193", "text": "func (o *ListMandatesRequest) WithContext(ctx context.Context) *ListMandatesRequest {\n\to.Context = ctx\n\treturn o\n}", "title": "" }, { "docid": "2a11ae5d7534554b5465b33cdb95a9d9", "score": "0.47053996", "text": "func (c *CommentThreadsInsertCall) Context(ctx context.Context) *CommentThreadsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "197d274593188ad8f19291643dfcc334", "score": "0.4702525", "text": "func (o *GetComponentByIDListUsingPOSTParams) WithContext(ctx context.Context) *GetComponentByIDListUsingPOSTParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "dd0d0cf511c22647bfa7f2f8b0d7add1", "score": "0.46942255", "text": "func (o *LedgerVoucherListPutListParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "541aa702e35990a705594b29b3cc2c89", "score": "0.4693088", "text": "func (mock *ec2ClientMock) CreateInstanceExportTaskWithContextCalls() []struct {\n\tContextMoqParam context.Context\n\tCreateInstanceExportTaskInput *ec2.CreateInstanceExportTaskInput\n\tOptions []request.Option\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tCreateInstanceExportTaskInput *ec2.CreateInstanceExportTaskInput\n\t\tOptions []request.Option\n\t}\n\tmock.lockCreateInstanceExportTaskWithContext.RLock()\n\tcalls = mock.calls.CreateInstanceExportTaskWithContext\n\tmock.lockCreateInstanceExportTaskWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "fced5827147f5e38dd726d4e6d48836f", "score": "0.46930838", "text": "func (o *PostIDStatusParamsBodyObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "e9b44d98711ba138998d40fa43add466", "score": "0.46875644", "text": "func (c *SurveysInsertCall) Context(ctx context.Context) *SurveysInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "e3c1f293bc433515009be292bc50b805", "score": "0.4686448", "text": "func (o *CreateUsingPOST3Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "a78287f2397591c7174c1ab08dca2ee2", "score": "0.4683686", "text": "func (o *FetchDirGroupsFromDNsUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "bcc8c93ba291f33d1aa01b4857552042", "score": "0.4666627", "text": "func (o *PostKeysParams) WithContext(ctx context.Context) *PostKeysParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "fdc565a926ae29b51488a0182f140a94", "score": "0.46646085", "text": "func (o *PutItemBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "dae75b42e17d3b65f7b1091fa90cd8e9", "score": "0.4656161", "text": "func (c *HotlistsCreateEntriesCall) Context(ctx context.Context) *HotlistsCreateEntriesCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "b138c1eaa9c64c3252f90614b7b48a27", "score": "0.4654457", "text": "func (o *ActivityListPostListParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "4abdfd4c05bba83eafc8c0386ccf3e55", "score": "0.46427265", "text": "func (o *PostIDStatusCreatedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "cf1aa791674adce8ae4652389247ccbb", "score": "0.46388066", "text": "func (o *MultipleParams) WithContext(ctx context.Context) *MultipleParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "1db7422fb400084b763c6354582d2dbb", "score": "0.46365172", "text": "func (o *UrlshortenerURLListParams) WithContext(ctx context.Context) *UrlshortenerURLListParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "32d54ec1e783d0bd5a8bb620922d2e09", "score": "0.46262497", "text": "func postCtx(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the value of the id found in the url parameter\n\t\tctx := context.WithValue(r.Context(), \"id\", chi.URLParam(r, \"id\"))\n\t\t// Add the context to the given handler\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" }, { "docid": "9751f843bfe79a4c14d51df4f0f6f9ca", "score": "0.46203104", "text": "func (o *PostStakingDelegatorsDelegatorAddrUnbondingDelegationsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "e14fdb47764e4938c7c00c82c9295393", "score": "0.46171287", "text": "func (o *PostLTENetworkIDSubscribersV2Params) WithContext(ctx context.Context) *PostLTENetworkIDSubscribersV2Params {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "f6eebf0d8855a5f4c85a2c13a03a072c", "score": "0.46122697", "text": "func (c *ChannelSectionsInsertCall) Context(ctx context.Context) *ChannelSectionsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "d6e57782380abbe98ad39733c7bca3b6", "score": "0.46027428", "text": "func (o *PostTxsParams) WithContext(ctx context.Context) *PostTxsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "49e3610e388715fb7a2b58c2aaa82d3c", "score": "0.46022826", "text": "func (o *PostIPAMTapPortsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "9f35d1ead3ce7d74aea20c381c507750", "score": "0.45881435", "text": "func (o *PostDeviceURLParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "44c739d62adbcc860dd1a2747c86d6d4", "score": "0.4581344", "text": "func NewGetComponentByIDListUsingPOSTParamsWithContext(ctx context.Context) *GetComponentByIDListUsingPOSTParams {\n\tvar (\n\t\tcurrentPageDefault = int32(0)\n\t\tfieldsDefault = string(\"DEFAULT\")\n\t\tpageSizeDefault = int32(10)\n\t)\n\treturn &GetComponentByIDListUsingPOSTParams{\n\t\tCurrentPage: &currentPageDefault,\n\t\tFields: &fieldsDefault,\n\t\tPageSize: &pageSizeDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "f3814d02e0cdccd8118ad8169f117537", "score": "0.45770586", "text": "func (mock *rdsClientMock) StartExportTaskWithContextCalls() []struct {\n\tContextMoqParam context.Context\n\tStartExportTaskInput *rds.StartExportTaskInput\n\tOptions []request.Option\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tStartExportTaskInput *rds.StartExportTaskInput\n\t\tOptions []request.Option\n\t}\n\tmock.lockStartExportTaskWithContext.RLock()\n\tcalls = mock.calls.StartExportTaskWithContext\n\tmock.lockStartExportTaskWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "fb8171ebf9a67c540b91e19f5b7680c9", "score": "0.45720568", "text": "func (c *TestsInsertCall) Context(ctx context.Context) *TestsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "421768b06d0e9b76e7ee9b7185a23dfe", "score": "0.45590332", "text": "func WithContext(ctx context.Context) Option {\n\treturn func(l *lister) error {\n\t\tl.ctx = ctx\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "2565ce247baac6bcd5e0b822941ac54e", "score": "0.45574197", "text": "func (c Client) AddWordWithContext(word, translation string, context string) ([]error, Word) {\n\treq := AddWordWithContextRequest{\n\t\tWord: word,\n\t\tTranslation: translation,\n\t\tContext: context,\n\t}\n\n\tvar result Word\n\terrs := c.get(addWordURL, req, &result)\n\tif strings.TrimSpace(result.ErrorMsg) != \"\" {\n\t\terrs = append(errs, errors.New(\"Something went wrong: \"+result.ErrorMsg))\n\t}\n\n\treturn errs, result\n}", "title": "" }, { "docid": "0373ed3dd8121f9a530623168b0d50c8", "score": "0.4556637", "text": "func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "2a549761eca9a26436c6d5a4e2b8b674", "score": "0.45535904", "text": "func (o *UrlshortenerURLListParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "cc962e0551e5811c77fdc3efd9672e57", "score": "0.45505548", "text": "func tasksPost(c *gin.Context) {\n\ttask := models.Task{}\n\tif err := c.ShouldBindJSON(&task); err != nil {\n\t\tabortWithError(c, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\ttask, err := models.TasksDB.Create(currentUserID(c), task)\n\tif err != nil {\n\t\tabortWithError(c, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, task)\n}", "title": "" }, { "docid": "183b6d52efe14f95ef009b45221c753a", "score": "0.45491314", "text": "func (c *CreativesInsertCall) Context(ctx context.Context) *CreativesInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "50666a59e5183a35bdc457e176abea67", "score": "0.4533046", "text": "func (o *PostIPAMTapPortsParams) WithContext(ctx context.Context) *PostIPAMTapPortsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "2fa1a82059cd27be12ab6fa82103c3c2", "score": "0.45320058", "text": "func (o *UploadContentUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "55f934ae8d0a84f0b3bd572c67a81cb1", "score": "0.4520395", "text": "func (o *GetDirectorySyncExecutionAlertsUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "9858aba39a832e469cb9c9453aeafcdd", "score": "0.4515679", "text": "func (o *PostDeviceURLParams) WithContext(ctx context.Context) *PostDeviceURLParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "8ca30a4171595b1cdea3d5d384b29c26", "score": "0.45094317", "text": "func (o *PostSimulationDevicesParams) WithContext(ctx context.Context) *PostSimulationDevicesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "d398179ee029c527fbd8e85ebcfe3a03", "score": "0.4509151", "text": "func (c *ThirdPartyLinksInsertCall) Context(ctx context.Context) *ThirdPartyLinksInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "1b00df3caafe45e0d556c7acd5821d97", "score": "0.45085412", "text": "func (o *PostAppsAppIDOperationsParams) WithContext(ctx context.Context) *PostAppsAppIDOperationsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "38ec933b234d95aff167eb6401bc3332", "score": "0.4506185", "text": "func NewPostV1TaskListsParams() *PostV1TaskListsParams {\n\treturn &PostV1TaskListsParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "38ecc5aaa7f02d23e15073fd6ca3d8fd", "score": "0.4503976", "text": "func (o *PostLogParams) WithContext(ctx context.Context) *PostLogParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "930c9723650e71208e84c3b9bea30048", "score": "0.45010102", "text": "func (o *PostV1TaskListsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "6378575f5d7a6cb4fab1fe7d0ab9eb83", "score": "0.4495683", "text": "func (c *AsyncCollector) RunWithContext(ctx context.Context, f TaskFunc, args ...interface{}) {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\ttask := newTask(ctx, c.cfg, f, args...)\n\n\tcolTask := newCollectorTask(task, c.resChan)\n\tc.tasks = append(c.tasks, colTask)\n\tc.results = append(c.results, nil)\n\tc.waitCount++\n\tcolTask.Start(len(c.results) - 1)\n}", "title": "" }, { "docid": "bfcb876c1b6b0523349788c9dce72f3b", "score": "0.44950432", "text": "func (c *Client) NewListTasksRequest(ctx context.Context, path string, userID *string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\tvalues := u.Query()\n\tif userID != nil {\n\t\tvalues.Set(\"userId\", *userID)\n\t}\n\tu.RawQuery = values.Encode()\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif c.JWTAuthSigner != nil {\n\t\tif err := c.JWTAuthSigner.Sign(req); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "4b3be426e081180120c99865e0f52f14", "score": "0.44911686", "text": "func WithTaskContext(ctx context.Context, params TaskCtxParams) context.Context {\n\treturn context.WithValue(ctx, taskCtxKey{}, &params)\n}", "title": "" }, { "docid": "f63c347da6dc0d1224795cc08a6191e3", "score": "0.44881958", "text": "func TagBulkApplyCtx(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctxMap := r.Context().Value(ContextMapKey).(map[string]string)\n\n\t\tbb, err := ioutil.ReadAll(r.Body)\n\t\tif err == nil {\n\t\t\tvar body tenable.TagBulkJob\n\t\t\terr = json.Unmarshal(bb, &body)\n\t\t\tif err == nil {\n\t\t\t\tctxMap[\"Assets\"] = strings.Join(body.AssetUUID, \",\")\n\t\t\t\tctxMap[\"Tags\"] = strings.Join(body.TagUUID, \",\")\n\t\t\t}\n\t\t}\n\n\t\tctx := context.WithValue(r.Context(), ContextMapKey, ctxMap)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" }, { "docid": "764946d53cea38ed2b045ff47339157b", "score": "0.44881514", "text": "func (page * TilesetListResponsePage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/TilesetListResponsePage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n for {\n next, err := page.fn(ctx, page.tlr)\n if err != nil {\n return err\n }\n page.tlr = next\n if !next.hasNextLink() || !next.IsEmpty() {\n break\n }\n }\n return nil\n }", "title": "" }, { "docid": "32eec8b6a221cde89d75e8f30daa8281", "score": "0.44876757", "text": "func (o *PostSlashingValidatorsValidatorAddrUnjailParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "f56548dd7f854d72ef4b601fdc543769", "score": "0.44849172", "text": "func (c *PretargetingConfigInsertCall) Context(ctx context.Context) *PretargetingConfigInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "3c862f07a29a7cab9dcc27478da58b1e", "score": "0.44783455", "text": "func (o *PostLTENetworkIDSubscribersV2Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "d74202e334bcaa9c333ccfc15e6cf5ce", "score": "0.4477901", "text": "func (o *PostChatroomsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "d9a1e50b702355ee7e89489d6216c7fc", "score": "0.44758165", "text": "func (c *LiveBroadcastsInsertCall) Context(ctx context.Context) *LiveBroadcastsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "d0839521fc11817bb60efd36d04f960a", "score": "0.4472823", "text": "func (mr *MockTaskServerIfaceMockRecorder) SendTaskWithContext(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SendTaskWithContext\", reflect.TypeOf((*MockTaskServerIface)(nil).SendTaskWithContext), arg0, arg1)\n}", "title": "" }, { "docid": "22eeb261003c207a9f4d76adb1ec536b", "score": "0.44719422", "text": "func (o *PrototypeCloudAddPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "924c65d315a98ec8c93a2cb2c764c70e", "score": "0.44701672", "text": "func (o *AddSDTParams) WithContext(ctx context.Context) *AddSDTParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "ba8a83ee697a574676e85acb041d7cc2", "score": "0.4465111", "text": "func (c *VideosInsertCall) Context(ctx context.Context) *VideosInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "e92b54eca4e15c78dbb87dccda901fed", "score": "0.44650775", "text": "func (wc *WebController) POST(ctx *Context) {}", "title": "" }, { "docid": "f8ba89a4f8afb21596ea1918b49f8bae", "score": "0.446068", "text": "func (mock *rdsClientMock) AddTagsToResourceWithContextCalls() []struct {\n\tContextMoqParam context.Context\n\tAddTagsToResourceInput *rds.AddTagsToResourceInput\n\tOptions []request.Option\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tAddTagsToResourceInput *rds.AddTagsToResourceInput\n\t\tOptions []request.Option\n\t}\n\tmock.lockAddTagsToResourceWithContext.RLock()\n\tcalls = mock.calls.AddTagsToResourceWithContext\n\tmock.lockAddTagsToResourceWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "d50f8c2ddf0cbe30ec14c5b80fa65202", "score": "0.44598272", "text": "func (o *PostChatroomsParams) WithContext(ctx context.Context) *PostChatroomsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "046534650226e596fcdf1406d96b4453", "score": "0.4459683", "text": "func (_obj *HttpRoute) AddServantWithContext(imp _impHttpRouteWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "title": "" }, { "docid": "44a741c32e6359443272e4079ceaad49", "score": "0.44551674", "text": "func (c *ProjectsLocationsAgentsEnvironmentsDeploymentsListCall) Context(ctx context.Context) *ProjectsLocationsAgentsEnvironmentsDeploymentsListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "bb7b3af9644c7d45772c2ad8826f12f2", "score": "0.4452716", "text": "func createTask(w io.Writer, r *http.Request) error {\n\tc := appengine.NewContext(r)\n\n\t// Decode the list id in the URL and check the current user is the creator.\n\tlistKey, creator, err := decode(mux.Vars(r)[\"list\"])\n\tif err != nil {\n\t\treturn err\n\t}\n\tif creator != user.Current(c).Email {\n\t\treturn AppErrorf(http.StatusForbidden, \"only %v can do this\", creator)\n\t}\n\n\t// Decode the task from the request body.\n\ttask := Task{}\n\terr = json.NewDecoder(r.Body).Decode(&task)\n\tif err != nil {\n\t\treturn AppErrorf(http.StatusBadRequest, \"decode task: %v\", err)\n\t}\n\n\t// Set the creation time in the task and put it in the datastore.\n\ttask.Time = time.Now().Unix()\n\tkey := datastore.NewIncompleteKey(c, taskKind, listKey)\n\tkey, err = datastore.Put(c, key, &task)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"add task: %v\", err)\n\t}\n\n\t// Add the encoded key before encoding the task to JSON.\n\ttask.ID = key.IntID()\n\treturn json.NewEncoder(w).Encode(task)\n}", "title": "" }, { "docid": "1445c1f3e29064fcac27fbf1ea6b986f", "score": "0.44457328", "text": "func (o *GetCommandsForEnvironmentUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "5083eb1762cfdabc2e018ef9043e2297", "score": "0.44445926", "text": "func (m *MockTaskServerIface) SendTaskWithContext(arg0 context.Context, arg1 *tasks.Signature) (*result.AsyncResult, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SendTaskWithContext\", arg0, arg1)\n\tret0, _ := ret[0].(*result.AsyncResult)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c008bce38b04c56493cf9bb0fae86cf2", "score": "0.4439939", "text": "func (o *PostEquipmentPsusMoidParams) WithContext(ctx context.Context) *PostEquipmentPsusMoidParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "82aabce195fed0522081f18f22754e7d", "score": "0.44298488", "text": "func (c *ProjectsLocationsJobsTaskGroupsTasksListCall) Context(ctx context.Context) *ProjectsLocationsJobsTaskGroupsTasksListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "cecf8e42c1b16867efea6428ce8e1f8e", "score": "0.4428519", "text": "func (o *ListMTOPaymentRequestsParams) WithContext(ctx context.Context) *ListMTOPaymentRequestsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "4326198b09f479dbc4830c359d40cee0", "score": "0.44284585", "text": "func (o *GetAllCompletedEnvironmentsForGivenProdNVersionUsingGETParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "d0a753703f2f833a3e56d56b28906a53", "score": "0.44266373", "text": "func (h *HDFS) WriteWithContext(ctx context.Context, msg *message.Batch) error {\n\treturn h.Write(msg)\n}", "title": "" }, { "docid": "9bdab951986e2256e6a6f27571e726af", "score": "0.44213215", "text": "func (o *PostV2DocumentsDocumentIDEmbeddedInvitesFieldInviteUniqueIDLinkParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b000366a89c0cddb9229fb93a7724e7c", "score": "0.44212145", "text": "func (c *LiveStreamsInsertCall) Context(ctx context.Context) *LiveStreamsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "bf66e9cb9fd0ceecd53ea395ac8e56a4", "score": "0.44204408", "text": "func (o *GetPrivateGetNewAnnouncementsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "63554b8c9dcc5f92932607fdec2b92c7", "score": "0.4408186", "text": "func (o *TriggerDryrunUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "5459d05779a31f292451c6357f9bfee3", "score": "0.44080418", "text": "func (this *RangerAppWriterContext) Set_todoList( value []*RangerAppTodo) {\n this.todoList = value \n}", "title": "" } ]
3a4c148da878eba7de13da60482db9db
WaitForTangleProcessorStartup waits until all background workers of the tangle processor are started.
[ { "docid": "b0b99c2aaf11e92f5c7b8b1338c8ab74", "score": "0.7892727", "text": "func WaitForTangleProcessorStartup() {\n\tstartWaitGroup.Wait()\n}", "title": "" } ]
[ { "docid": "343c1e5a790a039b4c1887fc668f1ec5", "score": "0.5545338", "text": "func LaunchProcessor(complete chan struct{}) {\n\tdefer func() {\n\t\tclose(complete)\n\t}()\n\n\tfmt.Printf(\"Start Work\\n\")\n\n\tfor count := 0; count < 5; count++ {\n\t\tfmt.Printf(\"Doing Work\\n\")\n\t\ttime.Sleep(1 * time.Second)\n\n\t\tif atomic.LoadInt32(&Shutdown) == 1 {\n\t\t\tfmt.Printf(\"Kill Early\\n\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tfmt.Printf(\"End Work\\n\")\n}", "title": "" }, { "docid": "45cf76e0b148154319afa67a0f2c14fb", "score": "0.5259052", "text": "func (g *Processor) waitForStartupTables(ctx context.Context) error {\n\terrg, startupCtx := multierr.NewErrGroup(ctx)\n\n\tvar (\n\t\twaitMap = make(map[string]struct{})\n\t\tmWaitMap sync.Mutex\n\t)\n\n\t// we'll wait for all lookup tables to have recovered.\n\t// For this we're looping through all tables and start\n\t// a new goroutine that terminates when the table is done (or ctx is closed).\n\t// The extra code adds and removes the table to a map used for logging\n\t// the items that the processor is still waiting to recover before ready to go.\n\tg.mTables.RLock()\n\tfor _, view := range g.lookupTables {\n\t\tview := view\n\n\t\terrg.Go(func() error {\n\t\t\tname := fmt.Sprintf(\"lookup-table-%s\", view.topic)\n\t\t\tmWaitMap.Lock()\n\t\t\twaitMap[name] = struct{}{}\n\t\t\tmWaitMap.Unlock()\n\n\t\t\tdefer func() {\n\t\t\t\tmWaitMap.Lock()\n\t\t\t\tdefer mWaitMap.Unlock()\n\t\t\t\tdelete(waitMap, name)\n\t\t\t}()\n\n\t\t\tselect {\n\t\t\tcase <-startupCtx.Done():\n\t\t\tcase <-view.WaitRunning():\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}\n\tg.mTables.RUnlock()\n\n\t// If we recover ahead, we'll also start all partition processors once in recover-only-mode\n\t// and do the same boilerplate to keep the waitmap up to date.\n\tif g.opts.recoverAhead {\n\t\tpartitions, err := g.findStatefulPartitions()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error finding dependent partitions: %w\", err)\n\t\t}\n\t\tfor _, part := range partitions {\n\t\t\tpart := part\n\t\t\tpproc, err := g.createPartitionProcessor(ctx, part, runModeRecoverOnly, func(msg *message, meta string) {\n\t\t\t\tpanic(\"a partition processor in recover-only-mode never commits a message\")\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error creating partition processor for recover-ahead %s/%d: %v\", g.Graph().Group(), part, err)\n\t\t\t}\n\t\t\terrg.Go(func() error {\n\t\t\t\tname := fmt.Sprintf(\"partition-processor-%d\", part)\n\t\t\t\tmWaitMap.Lock()\n\t\t\t\twaitMap[name] = struct{}{}\n\t\t\t\tmWaitMap.Unlock()\n\n\t\t\t\tdefer func() {\n\t\t\t\t\tmWaitMap.Lock()\n\t\t\t\t\tdefer mWaitMap.Unlock()\n\t\t\t\t\tdelete(waitMap, name)\n\t\t\t\t}()\n\n\t\t\t\tg.setPartProc(part, pproc)\n\t\t\t\tdefer g.setPartProc(part, nil)\n\n\t\t\t\terr := pproc.Start(ctx, ctx)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn pproc.Stop()\n\t\t\t})\n\t\t}\n\t}\n\n\tvar (\n\t\tstart = time.Now()\n\t\tlogTicker = time.NewTicker(1 * time.Minute)\n\t)\n\n\t// Now run through\n\tdefer logTicker.Stop()\n\terrgWaiter := errg.WaitChan()\n\tfor {\n\t\tselect {\n\t\t// the context has closed, no point in waiting\n\t\tcase <-ctx.Done():\n\t\t\tg.log.Debugf(\"Stopping to wait for views to get up, context closed\")\n\t\t\treturn fmt.Errorf(\"context closed while waiting for startup tables to become ready\")\n\n\t\t\t// the error group is done, which means\n\t\t\t// * err==nil --> it's done\n\t\t\t// * err!=nil --> it failed, let's return the error\n\t\tcase errs := <-errgWaiter:\n\t\t\terr := errs.ErrorOrNil()\n\t\t\tif err == nil {\n\t\t\t\tg.log.Debugf(\"View catchup finished\")\n\t\t\t}\n\t\t\treturn err\n\n\t\t// log the things we're still waiting for\n\t\tcase <-logTicker.C:\n\t\t\tvar tablesWaiting []string\n\t\t\tmWaitMap.Lock()\n\t\t\tfor table := range waitMap {\n\t\t\t\ttablesWaiting = append(tablesWaiting, table)\n\t\t\t}\n\t\t\tmWaitMap.Unlock()\n\n\t\t\tg.log.Printf(\"Waiting for [%s] to start up since %.2f minutes\",\n\t\t\t\tstrings.Join(tablesWaiting, \", \"),\n\t\t\t\ttime.Since(start).Minutes())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "747fa94107ebc651944036a301e1b182", "score": "0.5110121", "text": "func (e *AlluxioEngine) SetupWorkers() (err error) {\n\truntime, err := e.getRuntime()\n\tif err != nil {\n\t\te.Log.Error(err, \"setupWorker\")\n\t\treturn err\n\t}\n\n\treplicas := runtime.Replicas()\n\n\tcurrentReplicas, err := e.AssignNodesToCache(replicas)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.Log.Info(\"check the desired and current replicas\",\n\t\t\"desriedReplicas\", replicas,\n\t\t\"currentReplicas\", currentReplicas)\n\n\tif currentReplicas == 0 {\n\t\treturn fmt.Errorf(\"The number of the current workers which can be scheduled is 0\")\n\t}\n\n\t// 2. Update the status\n\terr = retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\truntime, err := e.getRuntime()\n\t\tif err != nil {\n\t\t\te.Log.Error(err, \"setupWorker\")\n\t\t\treturn err\n\t\t}\n\n\t\truntimeToUpdate := runtime.DeepCopy()\n\n\t\truntimeToUpdate.Status.WorkerPhase = datav1alpha1.RuntimePhaseNotReady\n\t\truntimeToUpdate.Status.DesiredWorkerNumberScheduled = replicas\n\t\truntimeToUpdate.Status.CurrentWorkerNumberScheduled = currentReplicas\n\t\truntimeToUpdate.Status.FusePhase = datav1alpha1.RuntimePhaseNotReady\n\t\truntimeToUpdate.Status.DesiredFuseNumberScheduled = replicas\n\t\truntimeToUpdate.Status.CurrentFuseNumberScheduled = currentReplicas\n\t\tif len(runtimeToUpdate.Status.Conditions) == 0 {\n\t\t\truntimeToUpdate.Status.Conditions = []datav1alpha1.RuntimeCondition{}\n\t\t}\n\t\tcond := utils.NewRuntimeCondition(datav1alpha1.RuntimeWorkersInitialized, datav1alpha1.RuntimeWorkersInitializedReason,\n\t\t\t\"The workers are initialized.\", corev1.ConditionTrue)\n\t\truntimeToUpdate.Status.Conditions =\n\t\t\tutils.UpdateRuntimeCondition(runtimeToUpdate.Status.Conditions,\n\t\t\t\tcond)\n\t\tfuseCond := utils.NewRuntimeCondition(datav1alpha1.RuntimeFusesInitialized, datav1alpha1.RuntimeFusesInitializedReason,\n\t\t\t\"The fuses are initialized.\", corev1.ConditionTrue)\n\t\truntimeToUpdate.Status.Conditions =\n\t\t\tutils.UpdateRuntimeCondition(runtimeToUpdate.Status.Conditions,\n\t\t\t\tfuseCond)\n\n\t\tif !reflect.DeepEqual(runtime.Status, runtimeToUpdate.Status) {\n\t\t\treturn e.Client.Status().Update(context.TODO(), runtimeToUpdate)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "d1e550cb4b494c9ba03cc1786e7757b3", "score": "0.49694327", "text": "func (e *EFCEngine) SetupWorkers() (err error) {\n\terr = retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\tworkers, err := ctrl.GetWorkersAsStatefulset(e.Client,\n\t\t\ttypes.NamespacedName{Namespace: e.namespace, Name: e.getWorkerName()})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\truntime, err := e.getRuntime()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\truntimeToUpdate := runtime.DeepCopy()\n\t\treturn e.Helper.SetupWorkers(runtimeToUpdate, runtimeToUpdate.Status, workers)\n\t})\n\tif err != nil {\n\t\t_ = utils.LoggingErrorExceptConflict(e.Log, err, \"Failed to setup workers\", types.NamespacedName{Namespace: e.namespace, Name: e.name})\n\t\treturn err\n\t}\n\treturn\n}", "title": "" }, { "docid": "d6054d92e73579c1ed6be96c8bca6764", "score": "0.48780677", "text": "func main() {\n\tsigChan := make(chan os.Signal, 1)\n\tsignal.Notify(sigChan, os.Interrupt)\n\n\tcomplete := make(chan struct{})\n\tgo LaunchProcessor(complete)\n\n\tfor {\n\t\tselect {\n\t\tcase <-sigChan:\n\t\t\tatomic.StoreInt32(&Shutdown, 1)\n\t\t\tcontinue\n\n\t\tcase <-time.After(time.Duration(TimeoutSeconds) * time.Second):\n\t\t\tfmt.Printf(\"******> TIMEOUT\\n\")\n\t\t\tos.Exit(1)\n\n\t\tcase <-complete:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "98e2d3b95aef42919b059cddcff28de0", "score": "0.48737693", "text": "func (g *Processor) Setup(session sarama.ConsumerGroupSession) error {\n\tg.state.SetState(ProcStateSetup)\n\tdefer g.state.SetState(ProcStateRunning)\n\tg.log.Printf(\"setup generation %d, claims=%#v\", session.GenerationID(), session.Claims())\n\tdefer g.log.Debugf(\"setup generation %d ... done\", session.GenerationID())\n\n\tif err := g.createAssignedPartitions(session); err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.createHotStandbyPartitions(session); err != nil {\n\t\treturn err\n\t}\n\n\t// setup all processors\n\tsetupErrg, setupCtx := multierr.NewErrGroup(session.Context())\n\tg.mTables.RLock()\n\tfor partID, partition := range g.partitions {\n\t\tpproc := partition\n\t\tsetupErrg.Go(func() error {\n\t\t\t// the partition processors need two contexts:\n\t\t\t// setupCtx --> for this setup, which we'll wait for\n\t\t\t// the runner ctx, which is active during a session\n\t\t\terr := pproc.Start(setupCtx, session.Context())\n\t\t\tif err != nil {\n\t\t\t\treturn newErrSetup(partID, err)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}\n\tg.mTables.RUnlock()\n\n\treturn setupErrg.Wait().ErrorOrNil()\n}", "title": "" }, { "docid": "5194a72cff46b140409deb261e6e0dbc", "score": "0.48383188", "text": "func (c *SimpleConsumer) Startup(ctx context.Context) {\n\tif c.MaxProcessors == 0 {\n\t\tLog.L.Infof(\"%s was started with no processors. Assuming 1.\", c)\n\t\tc.MaxProcessors = 1\n\t}\n\n\tLog.L.Infof(\"Starting %d %s processor(s)\", c.MaxProcessors, c)\n\tc.wg.Add(c.MaxProcessors)\n\tfor i := 0; i < c.MaxProcessors; i++ {\n\t\tgo c.processor(ctx)\n\t}\n}", "title": "" }, { "docid": "7ace158725b6821a104c8e798b740648", "score": "0.48330092", "text": "func (g *Processor) WaitForReady() error {\n\treturn g.waitForReady(context.Background())\n}", "title": "" }, { "docid": "e34b371729e906896f234e9a52d2ec9a", "score": "0.48281646", "text": "func (tsa *threadedAbci) PreStart() {\n\taddress := tsa.worker.getAddress()\n\tconnection.GlobalConnServer.BroadcastMessage(&wire.MsgFetchInit{ShardIndex: tsa.shardIndex, Address: address}, &connection.BroadcastParams{\n\t\tToNode: connection.ToStorageNode,\n\t\tToShard: tsa.shardIndex,\n\t})\n}", "title": "" }, { "docid": "e2ba10f079e306de7920be090bb34a97", "score": "0.48250508", "text": "func StartTestManager() (chan struct{}, *sync.WaitGroup) {\n\tstop := make(chan struct{})\n\twg := &sync.WaitGroup{}\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tExpect(k8sManager.Start(stop)).NotTo(HaveOccurred())\n\t}()\n\treturn stop, wg\n}", "title": "" }, { "docid": "f32fdd561c22a1ace379ca421481e655", "score": "0.47982937", "text": "func init() {\n\n\t// Lanch N goroutines based on number of cores.\n\tfor i := 0; i < runtime.NumCPU(); i++ {\n\n\t\tlog.Printf(\"OOF - launching sub-worker %v\", i+1)\n\t\tgo asyncProcessor(workQueue)\n\n\t}\n}", "title": "" }, { "docid": "43e5dff86a0a31ed3be1626c14822a2a", "score": "0.4797604", "text": "func (r *SleepInfoReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\tif r.Clock == nil {\n\t\tr.Clock = realClock{}\n\t}\n\n\tpred := predicate.GenerationChangedPredicate{}\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(&kubegreenv1alpha1.SleepInfo{}).\n\t\tWithOptions(controller.Options{\n\t\t\tMaxConcurrentReconciles: 10,\n\t\t}).\n\t\tWithEventFilter(pred).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "45be90c2850c71b1f4faf12246a93702", "score": "0.47951666", "text": "func Setup() (err error) {\n\tif _, err = runCompose(\"up\", \"-d\"); err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tTeardown()\n\t\t}\n\t}()\n\tif _, err = getServices(); err != nil {\n\t\treturn\n\t}\n\t_, err = checkServices()\n\treturn\n}", "title": "" }, { "docid": "3ab879b723d0d353c59460e48f053b01", "score": "0.476115", "text": "func warmupScheduler(targetThreadCount int) {\n\tvar wg sync.WaitGroup\n\tvar count int32\n\tfor i := 0; i < targetThreadCount; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tatomic.AddInt32(&count, 1)\n\t\t\tfor atomic.LoadInt32(&count) < int32(targetThreadCount) {\n\t\t\t\t// spin until all threads started\n\t\t\t}\n\n\t\t\t// spin a bit more to ensure they are all running on separate CPUs.\n\t\t\tdoWork(Millisecond)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "f1721f172a1ec5fdde05d6dbd227e5f6", "score": "0.4750045", "text": "func (e *AlluxioEngine) CheckWorkersReady() (ready bool, err error) {\n\tvar (\n\t\tworkerReady, fuseReady, workerPartialReady, fusePartialReady bool\n\t\tworkerName string = e.getWorkerDaemonsetName()\n\t\tfuseName string = e.getFuseDaemonsetName()\n\t\tnamespace string = e.namespace\n\t)\n\n\truntime, err := e.getRuntime()\n\tif err != nil {\n\t\treturn ready, err\n\t}\n\n\t// runtime, err := e.getRuntime()\n\t// if err != nil {\n\t// \treturn\n\t// }\n\n\tworkers, err := e.getDaemonset(workerName, namespace)\n\tif err != nil {\n\t\treturn ready, err\n\t}\n\n\t// replicas := runtime.Replicas()\n\n\tif workers.Status.NumberReady > 0 {\n\t\tif runtime.Replicas() == workers.Status.NumberReady {\n\t\t\tworkerReady = true\n\t\t} else if workers.Status.NumberReady >= 1 {\n\t\t\tworkerPartialReady = true\n\t\t}\n\t}\n\n\tfuses, err := e.getDaemonset(fuseName, namespace)\n\tif fuses.Status.NumberAvailable > 0 {\n\t\tif runtime.Spec.Replicas == fuses.Status.NumberReady {\n\t\t\tfuseReady = true\n\t\t} else if fuses.Status.NumberReady >= 1 {\n\t\t\tfusePartialReady = true\n\t\t}\n\t}\n\n\tif (workerReady || workerPartialReady) && (fuseReady || fusePartialReady) {\n\t\tready = true\n\t} else {\n\t\te.Log.Info(\"workers are not ready\", \"workerReady\", workerReady,\n\t\t\t\"workerPartialReady\", workerPartialReady,\n\t\t\t\"fuseReady\", fuseReady,\n\t\t\t\"fusePartialReady\", fusePartialReady)\n\t\treturn\n\t}\n\n\t// update the status as the workers are ready\n\terr = retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\truntime, err := e.getRuntime()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\truntimeToUpdate := runtime.DeepCopy()\n\t\tif len(runtimeToUpdate.Status.Conditions) == 0 {\n\t\t\truntimeToUpdate.Status.Conditions = []datav1alpha1.RuntimeCondition{}\n\t\t}\n\t\tcond := utils.NewRuntimeCondition(datav1alpha1.RuntimeWorkersReady, datav1alpha1.RuntimeWorkersReadyReason,\n\t\t\t\"The workers are ready.\", corev1.ConditionTrue)\n\t\tif workerPartialReady {\n\t\t\tcond = utils.NewRuntimeCondition(datav1alpha1.RuntimeWorkersReady, datav1alpha1.RuntimeWorkersReadyReason,\n\t\t\t\t\"The workers are partially ready.\", corev1.ConditionTrue)\n\n\t\t\truntimeToUpdate.Status.WorkerPhase = datav1alpha1.RuntimePhasePartialReady\n\t\t}\n\t\truntimeToUpdate.Status.Conditions =\n\t\t\tutils.UpdateRuntimeCondition(runtimeToUpdate.Status.Conditions,\n\t\t\t\tcond)\n\t\tfuseCond := utils.NewRuntimeCondition(datav1alpha1.RuntimeFusesReady, datav1alpha1.RuntimeFusesReadyReason,\n\t\t\t\"The fuses are ready.\", corev1.ConditionTrue)\n\n\t\tif fusePartialReady {\n\t\t\tfuseCond = utils.NewRuntimeCondition(datav1alpha1.RuntimeFusesReady, datav1alpha1.RuntimeFusesReadyReason,\n\t\t\t\t\"The fuses are partially ready.\", corev1.ConditionTrue)\n\n\t\t\truntimeToUpdate.Status.FusePhase = datav1alpha1.RuntimePhasePartialReady\n\t\t}\n\t\truntimeToUpdate.Status.Conditions =\n\t\t\tutils.UpdateRuntimeCondition(runtimeToUpdate.Status.Conditions,\n\t\t\t\tfuseCond)\n\n\t\tif !reflect.DeepEqual(runtime.Status, runtimeToUpdate.Status) {\n\t\t\treturn e.Client.Status().Update(context.TODO(), runtimeToUpdate)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "e2420e19a3d3df7eef1e31beaf8439e4", "score": "0.47385624", "text": "func (chief *Chief) Start(parentCtx context.Context) {\n\tif !chief.active {\n\t\tlog.Default.Error(\"Workers is not initialized! Unable to start.\")\n\t\treturn\n\t}\n\n\tchief.wg = sync.WaitGroup{}\n\tfor name, worker := range chief.wPool.workers {\n\t\tif !chief.wPool.IsEnabled(name) {\n\t\t\tchief.logger.WithField(\"worker\", name).\n\t\t\t\tDebug(\"Worker disabled\")\n\t\t\tcontinue\n\t\t}\n\n\t\tchief.wg.Add(1)\n\t\tgo chief.runWorker(name, worker)\n\t}\n\n\t<-parentCtx.Done()\n\tchief.logger.Info(\"Begin graceful shutdown of workers\")\n\tchief.active = false\n\tchief.cancel()\n\n\tchief.wg.Wait()\n\tchief.logger.Info(\"Workers stopped\")\n}", "title": "" }, { "docid": "8e028846dd10f41fa70496feb8e1e535", "score": "0.47291574", "text": "func (p *ReplicationTaskProcessorImpl) Start() {\n\tif !atomic.CompareAndSwapInt32(&p.status, common.DaemonStatusInitialized, common.DaemonStatusStarted) {\n\t\treturn\n\t}\n\n\tgo p.processorLoop()\n\tgo p.syncShardStatusLoop()\n\tgo p.cleanupReplicationTaskLoop()\n\tp.logger.Info(\"ReplicationTaskProcessor started.\")\n}", "title": "" }, { "docid": "9ce68982518c7549b474d1b553affa6f", "score": "0.47218558", "text": "func StartWorkers(numberOfWorkerToStart int, endPoint string, user string, password string, inputs <-chan *TicketFetcherJob) {\n\t// This starts up CYCLOP_NUMBER_OF_WORKERS workers, we do it now to\n\t// take advantage of the time needed by the issue search to init our workers\n\tfor w := 1; w <= numberOfWorkerToStart; w++ {\n\t\tgo TicketFetcherWorker(w, endPoint, user, password, inputs)\n\t}\n}", "title": "" }, { "docid": "5cf4ba8b30b1a0f5d00bfb39334a36a1", "score": "0.47211564", "text": "func (o LoadTestCluster) Setup() {\n\n\tif !o.kh.IsRookInstalled(o.namespace) {\n\t\tisRookInstalled, err := o.installer.InstallRookOnK8sWithHostPathAndDevices(o.namespace, \"bluestore\",\n\t\t\tfalse, true, cephv1.MonSpec{Count: 3, AllowMultiplePerNode: true},\n\t\t\ttrue, /* startWithAllNodes */\n\t\t\t1 /*rbd mirror workers*/)\n\t\trequire.NoError(o.T(), err)\n\t\trequire.True(o.T(), isRookInstalled)\n\t}\n\n\t// Enable chaos monkey if enable_chaos flag is present\n\tif installer.Env.EnableChaos {\n\t\tc := NewChaosHelper(o.namespace, o.kh)\n\t\tgo c.Monkey()\n\t}\n}", "title": "" }, { "docid": "eb88f913efd99399188fc143123a2afb", "score": "0.46947634", "text": "func (e *JindoFSxEngine) SetupWorkers() (err error) {\n\n\tif e.runtime.Spec.Worker.Disabled {\n\t\terr = nil\n\t\treturn\n\t}\n\n\terr = retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\tworkers, err := ctrl.GetWorkersAsStatefulset(e.Client,\n\t\t\ttypes.NamespacedName{Namespace: e.namespace, Name: e.getWorkerName()})\n\t\tif err != nil {\n\t\t\tif fluiderrs.IsDeprecated(err) {\n\t\t\t\te.Log.Info(\"Warning: Deprecated mode is not support, so skip handling\", \"details\", err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\truntime, err := e.getRuntime()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\truntimeToUpdate := runtime.DeepCopy()\n\t\treturn e.Helper.SetupWorkers(runtimeToUpdate, runtimeToUpdate.Status, workers)\n\t})\n\n\tif err != nil {\n\t\t_ = utils.LoggingErrorExceptConflict(e.Log,\n\t\t\terr,\n\t\t\t\"Failed to setup worker\",\n\t\t\ttypes.NamespacedName{\n\t\t\t\tNamespace: e.namespace,\n\t\t\t\tName: e.name,\n\t\t\t})\n\t}\n\treturn\n}", "title": "" }, { "docid": "b57ecdd057ee632d202c4d1a125a00ce", "score": "0.46636206", "text": "func (chaincodeSupport *ChaincodeSupport) preLaunchSetup(l *ledger.Ledger, chaincode string) *chaincodeRTEnv {\n\t//register placeholder Handler.\n\tret := &chaincodeRTEnv{\n\t\tlaunchNotify: make(chan error, 1),\n\t}\n\n\tif _, ok := chaincodeSupport.runningChaincodes.chaincodeMap[chaincode]; !ok {\n\t\tchaincodeSupport.runningChaincodes.chaincodeMap[chaincode] = make(map[*ledger.Ledger]*chaincodeRTEnv)\n\t}\n\tchaincodeSupport.runningChaincodes.chaincodeMap[chaincode][l] = ret\n\treturn ret\n}", "title": "" }, { "docid": "e225bf88c432220f5f67fdf709452545", "score": "0.46634087", "text": "func (si *serviceIMPL) nodeStartup(ctx context.Context, gs gracefulStopper) error {\n\n\tif si.service.nodeIsInitialized {\n\t\treturn nil\n\t}\n\n\t// make sure we have a connection to PowerStore\n\tif si.service.adminClient == nil {\n\t\treturn fmt.Errorf(\"there is no PowerStore connection\")\n\t}\n\n\tvar err error\n\tvar initiators []string\n\tif si.service.opts.PreferredTransport != noneTransport {\n\t\tvar iscsiAvailable bool\n\t\tvar fcAvailable bool\n\n\t\tiscsiInitiators, err := si.service.iscsiConnector.GetInitiatorName(ctx)\n\t\tif err != nil {\n\t\t\tlog.Error(\"nodeStartup could not GetInitiatorIQNs\")\n\t\t} else if len(iscsiInitiators) == 0 {\n\t\t\tlog.Error(\"iscsi initiators not found on node\")\n\t\t} else {\n\t\t\tlog.Error(\"iscsi initiators found on node\")\n\t\t\tiscsiAvailable = true\n\t\t}\n\n\t\tfcInitiators, err := si.implProxy.getNodeFCPorts(ctx)\n\t\tif err != nil {\n\t\t\tlog.Error(\"nodeStartup could not FC initiators for node\")\n\t\t} else if len(fcInitiators) == 0 {\n\t\t\tlog.Error(\"FC was not found or filtered with FCPortsFilterFile\")\n\t\t} else {\n\t\t\tlog.Error(\"FC initiators found on node\")\n\t\t\tfcAvailable = true\n\t\t}\n\n\t\tif !iscsiAvailable && !fcAvailable {\n\t\t\treturn fmt.Errorf(\"FC and iSCSI initiators not found on node\")\n\t\t}\n\n\t\tswitch si.service.opts.PreferredTransport {\n\t\tcase iSCSITransport:\n\t\t\tif !iscsiAvailable {\n\t\t\t\treturn fmt.Errorf(\"iSCSI transport was requested but iSCSI initiator is not available\")\n\t\t\t}\n\t\t\tsi.service.useFC = false\n\t\tcase fcTransport:\n\t\t\tif !fcAvailable {\n\t\t\t\treturn fmt.Errorf(\"FC transport was requested but FC initiator is not available\")\n\t\t\t}\n\t\t\tsi.service.useFC = true\n\t\tdefault:\n\t\t\tsi.service.useFC = fcAvailable\n\t\t}\n\n\t\tif si.service.useFC {\n\t\t\tinitiators = fcInitiators\n\t\t} else {\n\t\t\tinitiators = iscsiInitiators\n\t\t}\n\t}\n\n\tgo func() {\n\t\terr := si.implProxy.nodeHostSetup(initiators, si.service.useFC, maximumStartupDelay)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"error during nodeHostSetup: %s\", err.Error())\n\t\t\tgs.GracefulStop(ctx)\n\t\t}\n\t}()\n\n\treturn err\n}", "title": "" }, { "docid": "964eb7ac1893aba4eb508f5c846e0507", "score": "0.4654075", "text": "func (r *WorkerReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(&infrastructurev1alpha1.Worker{}).\n\t\tOwns(&capiv1alpha3.Cluster{}).\n\t\tOwns(&kcpv1alpha3.KubeadmControlPlane{}).\n\t\tOwns(&capzv1alpha3.AzureCluster{}).\n\t\tOwns(&capbkv1alpha3.KubeadmConfigTemplate{}).\n\t\tOwns(&capiv1alpha3.MachineDeployment{}).\n\t\tOwns(&capzv1alpha3.AzureMachineTemplate{}).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "25c6132edacab5b4806f23dbe851f41a", "score": "0.46521842", "text": "func tobaccoHolder() {\n\tstartUp.Done() //Signal ready to start\n\tfor {\n\t\ttobbaccoWait.Wait()\n\t\ttobbaccoWait.Add(1)\n\t\tgo smoking()\n\t}\n}", "title": "" }, { "docid": "c232d4f101db0d64f9bc149ecff43362", "score": "0.46468785", "text": "func (si *serviceIMPL) nodeHostSetup(initiators []string, useFC bool, maximumStartupDelay int) error {\n\tsi.service.nodeRescanMutex.Lock()\n\tdefer si.service.nodeRescanMutex.Unlock()\n\tlog.Info(\"**************************\\nnodeHostSetup executing...\\n*******************************\")\n\tdefer log.Info(\"**************************\\nnodeHostSetup completed...\\n*******************************\")\n\n\t// we need to randomize a time before starting the interaction with PowerStore\n\t// in order to reduce the concurrent workload on the system\n\n\t// determine a random delay period (in\n\trand.Seed(time.Now().UTC().UnixNano())\n\tperiod := rand.Int() % maximumStartupDelay // #nosec G404\n\t// sleep ...\n\tlog.Printf(\"Waiting for %d seconds\", period)\n\ttime.Sleep(time.Duration(period) * time.Second)\n\n\tif si.service.nodeID == \"\" {\n\t\treturn fmt.Errorf(\"nodeID not set\")\n\t}\n\n\t// register node on PowerStore\n\tif len(initiators) > 0 {\n\t\terr := si.implProxy.createOrUpdateHost(context.Background(), useFC, initiators)\n\t\tif err != nil {\n\t\t\tlog.Error(err.Error())\n\t\t\treturn err\n\t\t}\n\t}\n\n\tsi.service.nodeIsInitialized = true\n\n\treturn nil\n}", "title": "" }, { "docid": "f440181af74567f77201eec044a31619", "score": "0.46413022", "text": "func init() {\n\ttact.Registry.Add(waitClass)\n}", "title": "" }, { "docid": "bf7b6b6a1f9be062609a82986c5cf7ce", "score": "0.4640883", "text": "func (r *Runner) waitForWorker() {\n\tfor r.Async.NRunning >= r.Async.MaxConcurrent {\n\n\t\t// hang out for second\n\t\tfmt.Println(\"hit maxConcurrrent; waiting for a test-in-progress to finish:\")\n\t\tPrintJSON(r.Async.InProgress)\n\n\t\ttime.Sleep(5 * time.Second)\n\t}\n}", "title": "" }, { "docid": "58f5ace4f8c3f4542543d1083423bdc7", "score": "0.46373346", "text": "func WaitUntilStarterReady(t *testing.T, what string, requiredGoodResults int, starters ...*SubProcess) bool {\n\tresults := make([]error, len(starters))\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(len(results))\n\n\tfor id, starter := range starters {\n\t\tgo func(i int, s *SubProcess) {\n\t\t\tdefer wg.Done()\n\t\t\tid := fmt.Sprintf(\"starter-%d\", i+1)\n\t\t\tresults[i] = s.ExpectTimeout(ctx, time.Minute*3, regexp.MustCompile(fmt.Sprintf(\"Your %s can now be accessed with a browser at\", what)), id)\n\t\t}(id, starter)\n\t}\n\n\twg.Wait()\n\n\tfailed := 0\n\tfor _, result := range results {\n\t\tif result != nil {\n\t\t\tfailed++\n\t\t}\n\t}\n\n\treadyStarters := len(starters) - failed\n\tif readyStarters >= requiredGoodResults || requiredGoodResults == 0 {\n\t\tGetLogger(t).Log(\"%d starters ready\", readyStarters)\n\t\treturn true\n\t}\n\n\tif os.Getenv(\"DEBUG_CLUSTER\") == \"interactive\" {\n\t\t// Halt forever\n\t\tfmt.Println(\"Cluster not ready in time, halting forever for debugging\")\n\t\tfor {\n\t\t\ttime.Sleep(time.Hour)\n\t\t}\n\t}\n\tfor _, msg := range results {\n\t\tif msg != nil {\n\t\t\tt.Error(msg)\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0c29f22ff50937e2eab98cdebe4a0738", "score": "0.46366614", "text": "func (w *Worker) Start() {\n\tfor {\n\t\tselect {\n\t\tcase <-AppConfig.NewTasks:\n\t\t\tif w.tasks.Len() > 0 {\n\t\t\t\ttask := w.tasks.Pop()\n\t\t\t\tif ok := AppConfig.CancelledTasks.Get(task.hash); ok {\n\t\t\t\t\tLogTaskDequeued(task)\n\t\t\t\t\tAppConfig.CancelledTasks.Remove(task.hash)\n\t\t\t\t} else if time.Since(task.nextRun) > 0 {\n\t\t\t\t\tw.Process(task)\n\t\t\t\t} else {\n\t\t\t\t\tw.tasks.Push(task)\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-time.After(100 * time.Millisecond):\n\t\t\tw.Sleep()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6add49961d581f74ec3c9ee35315231d", "score": "0.46262252", "text": "func startHeartbeat() {\n\tlog.Println(\"Heartbeat started\")\n\n\tticker := time.NewTicker(heartbeatDelay)\n\tgo func() {\n\t\tfor {\n\t\t\t// Wait for tick\n\t\t\t<-ticker.C\n\n\t\t\tlog.Println(\"Checking FogNode\")\n\t\t\terr := registerService()\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "0a43067c3fc3cf377d638e09bda8b187", "score": "0.46189174", "text": "func TestStartPrimaryAsync(t *testing.T) {\n\trunSteps(t, false, []step{\n\t\t{Cmd: \"addpeer node1\"},\n\t\t{Cmd: \"addpeer\"},\n\t\t{Cmd: \"addpeer\"},\n\t\t{Cmd: \"bootstrap node1 node2\"},\n\t\t{\n\t\t\tCmd: \"discoverd\",\n\t\t\tCheck: &simulator.DiscoverdInfo{\n\t\t\t\tState: &state.DiscoverdState{\n\t\t\t\t\tIndex: 1,\n\t\t\t\t\tState: &state.State{\n\t\t\t\t\t\tGeneration: 1,\n\t\t\t\t\t\tPrimary: node(1, 1),\n\t\t\t\t\t\tSync: node(2, 2),\n\t\t\t\t\t\tAsync: []*discoverd.Instance{node(3, 3)},\n\t\t\t\t\t\tInitWAL: xlog.Zero,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tPeers: []*discoverd.Instance{node(1, 1), node(2, 2), node(3, 3)},\n\t\t\t},\n\t\t},\n\t\t{Cmd: \"rmpeer node2\"},\n\t\t{Cmd: \"startPeer\"},\n\t\t{\n\t\t\tCmd: \"peer\",\n\t\t\tCheck: &simulator.PeerSimInfo{\n\t\t\t\tPeer: &state.PeerInfo{\n\t\t\t\t\tID: node1ID,\n\t\t\t\t\tRole: state.RolePrimary,\n\t\t\t\t\tState: &state.State{\n\t\t\t\t\t\tGeneration: 2,\n\t\t\t\t\t\tPrimary: node(1, 1),\n\t\t\t\t\t\tSync: node(3, 3),\n\t\t\t\t\t\tInitWAL: \"0/0000000A\",\n\t\t\t\t\t},\n\t\t\t\t\tPeers: []*discoverd.Instance{node(1, 1), node(3, 3)},\n\t\t\t\t},\n\t\t\t\tPostgres: &simulator.PostgresInfo{\n\t\t\t\t\tOnline: true,\n\t\t\t\t\tConfig: &state.PgConfig{\n\t\t\t\t\t\tRole: state.RolePrimary,\n\t\t\t\t\t\tDownstream: node(3, 3),\n\t\t\t\t\t},\n\t\t\t\t\tXLog: \"0/00000014\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n}", "title": "" }, { "docid": "49c4cbffb58537f97bcea618ce5f41a8", "score": "0.4605181", "text": "func (s *Container) WaitStartup(timeout time.Duration) error {\n\tnodes, err := s.NetworkNodes()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error getting network nodes: %v\", err)\n\t}\n\n\tif !s.HasExposedPorts() {\n\t\treturn fmt.Errorf(\"Current container has no exposed ports\")\n\t}\n\n\tok := raiqub.WaitPeerListening(\n\t\tnodes[0].Protocol, nodes[0].FormatDialAddress(), timeout)\n\tif !ok {\n\t\terr = fmt.Errorf(\"%s unreachable for %v\",\n\t\t\tnodes[0].FormatDialAddress(), timeout)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "12519eef439cccbb095c92b2d26a059d", "score": "0.46023738", "text": "func (s *supervisor) waitSettle(ctx context.Context) error {\n\twaiter := make(chan struct{})\n\ts.pReq <- &processorRequest{\n\t\twaitSettled: &processorRequestWaitSettled{\n\t\t\twaiter: waiter,\n\t\t},\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-waiter:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "a3e25822604280ec89f680bb4cc20ea1", "score": "0.45992762", "text": "func (self *ConsensusEngine) waitUntilActive(validator, shutdownRx messaging.Connection) (StartupState, error) {\n\tpoller := zmq.NewPoller()\n\tpoller.Add(validator.Socket(), zmq.POLLIN)\n\tpoller.Add(shutdownRx.Socket(), zmq.POLLIN)\n\n\tlogger.Debug(\"waitUntilActive: about to poll\")\n\tfor {\n\t\tpolled, err := poller.Poll(time.Millisecond * 100)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Polling failed: %v\", err)\n\t\t}\n\n\t\tfor _, ready := range polled {\n\t\t\tswitch socket := ready.Socket; socket {\n\t\t\tcase validator.Socket():\n\t\t\t\tvar msg *validator_pb2.Message\n\t\t\t\t_, msg, err := validator.RecvMsg()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tif msg.GetMessageType() != validator_pb2.Message_CONSENSUS_NOTIFY_ENGINE_ACTIVATED {\n\t\t\t\t\treturn nil, &ReceiveError{Msg: fmt.Sprintf(\"Received unexpected message type: %v\", msg.GetMessageType())}\n\t\t\t\t}\n\n\t\t\t\tactivationResponse := &consensus_pb2.ConsensusNotifyEngineActivated{}\n\t\t\t\terr = proto.Unmarshal(msg.GetContent(), activationResponse)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tregAck := &consensus_pb2.ConsensusNotifyAck{}\n\t\t\t\tregAckBytes, err := proto.Marshal(regAck)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\terr = validator.SendMsg(validator_pb2.Message_CONSENSUS_NOTIFY_ACK, regAckBytes, msg.GetCorrelationId())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tlogger.Infof(\n\t\t\t\t\t\"Successfully activated engine (%v, %v)\",\n\t\t\t\t\tself.impl.Name(),\n\t\t\t\t\tself.impl.Version(),\n\t\t\t\t)\n\n\t\t\t\tstartupState := newStartupStateFromProtos(activationResponse.GetChainHead(), activationResponse.GetPeers(), activationResponse.GetLocalPeerInfo())\n\n\t\t\t\treturn startupState, nil\n\n\t\t\tcase shutdownRx.Socket():\n\t\t\t\treturn nil, fmt.Errorf(\"Received shutdown while waiting for activation\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "56aea8d80c7094c0cef8f0a4251d9ee5", "score": "0.45837122", "text": "func (i *Test) waitForCore() {\n\tfor t := 30 * time.Second; t >= 0; t -= time.Second {\n\t\ti.t.Log(\"Waiting for core to be up...\")\n\t\tctx, cancel := context.WithTimeout(context.Background(), time.Second)\n\t\t_, err := i.cclient.Info(ctx)\n\t\tcancel()\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n\n\t// We need to wait for Core to be armed before closing the first ledger\n\t// Otherwise, for some reason, the protocol version of the ledger stays at 0\n\t// TODO: instead of sleeping we should ensure Core's status (in GET /info) is \"Armed\"\n\t// but, to do so, we should first expose it in Core's client.\n\ttime.Sleep(time.Second)\n\tif err := i.CloseCoreLedger(); err != nil {\n\t\ti.t.Fatalf(\"Failed to manually close the second ledger: %s\", err)\n\t}\n\n\t// Make sure that the Sleep above was successful\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second)\n\tinfo, err := i.cclient.Info(ctx)\n\tcancel()\n\tif err != nil || !info.IsSynced() {\n\t\tlog.Fatal(\"failed to wait for Core to be synced\")\n\t}\n}", "title": "" }, { "docid": "d6847e105fbaa8a0d90eb2dd8ecac691", "score": "0.4583569", "text": "func SetupNode(Log ILogger) {\n\n\tLog.Infof(\"setup node...\")\n\tfor {\n\t\tif GAdminAuth == nil || ZkPoDExchangeClient == nil {\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\t\tBobNodeStart = true\n\t\tfmt.Printf(\"\\n====================(●'◡'●)ノ♥====================\\n\")\n\t\tfmt.Printf(\"Bob node start....\\n\\n\")\n\t\tbreak\n\t}\n\tfor {\n\t\tif BConf.NetIP == \"\" || GAdminAuth == nil || ZkPoDExchangeClient == nil {\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Printf(\"\\n====================(づ。◕‿‿◕。)づ====================\\n\")\n\t\tfmt.Printf(\"Alice node start....\\n\\n\")\n\t\terr := AliceStartNode(BConf.NetIP, ETHKey, Log)\n\t\tif err != nil {\n\t\t\tLog.Errorf(\"failed to start node.\")\n\t\t\tAliceNodeStart = false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0bbaa224ff978f231f0ccbb655a2dcd6", "score": "0.45783567", "text": "func waitForChainStart(chainDetails ChainDetails) error {\n\t// exponential backoff on trying to ping the node, timeout after 30 seconds\n\tb := backoff.NewExponentialBackOff()\n\tb.MaxInterval = 5 * time.Second\n\tb.MaxElapsedTime = 30 * time.Second\n\tif err := backoff.Retry(func() error { return pingKava(chainDetails.RpcUrl) }, b); err != nil {\n\t\treturn fmt.Errorf(\"failed connect to chain: %s\", err)\n\t}\n\n\tb.Reset()\n\t// the evm takes a bit longer to start up. wait for it to start as well.\n\tif err := backoff.Retry(func() error { return pingEvm(chainDetails.EvmRpcUrl) }, b); err != nil {\n\t\treturn fmt.Errorf(\"failed connect to chain: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4b7bb25ed83b6c91ae15f593857092b3", "score": "0.45602548", "text": "func VerifyNodeCriticalComponentsBootstrapping(ctx context.Context, f *framework.ShootFramework) {\n\tshootClientSet, err := access.CreateShootClientFromAdminKubeconfig(ctx, f.GardenClient, f.Shoot)\n\tExpectWithOffset(1, err).To(Succeed())\n\n\tvar (\n\t\tseedClient = f.SeedClient.Client()\n\t\tshootClient = shootClientSet.Client()\n\t\ttechnicalID = f.Shoot.Status.TechnicalID\n\t)\n\n\tBy(\"Create ManagedResources for shoot with broken node-critical components\")\n\tcreateOrUpdateNodeCriticalManagedResource(ctx, seedClient, shootClient, technicalID, nodeCriticalDaemonSetName, \"non-existing\", false)\n\tcreateOrUpdateNodeCriticalManagedResource(ctx, seedClient, shootClient, technicalID, csiNodeDaemonSetName, \"non-existing\", true)\n\tDeferCleanup(func() {\n\t\tcleanupCtx, cancel := context.WithTimeout(context.Background(), time.Minute)\n\t\tdefer cancel()\n\n\t\tcleanupNodeCriticalManagedResource(cleanupCtx, seedClient, technicalID, nodeCriticalDaemonSetName)\n\t\tcleanupNodeCriticalManagedResource(cleanupCtx, seedClient, technicalID, csiNodeDaemonSetName)\n\t})\n\n\tBy(\"Delete Nodes and Machines to trigger new Node bootstrap\")\n\tEventuallyWithOffset(1, func(g Gomega) {\n\t\tg.Expect(seedClient.DeleteAllOf(ctx, &machinev1alpha1.Machine{}, client.InNamespace(technicalID))).To(Succeed())\n\t\tg.Expect(shootClient.DeleteAllOf(ctx, &corev1.Node{})).To(Succeed())\n\t}).Should(Succeed())\n\n\tBy(\"Wait for new Node to be created\")\n\tvar node *corev1.Node\n\tEventuallyWithOffset(1, func(g Gomega) {\n\t\tnodeList := &corev1.NodeList{}\n\t\tg.Expect(shootClient.List(ctx, nodeList)).To(Succeed())\n\t\tg.Expect(nodeList.Items).NotTo(BeEmpty(), \"new Node should be created\")\n\t\tnode = &nodeList.Items[0]\n\t}).WithContext(ctx).WithTimeout(10 * time.Minute).Should(Succeed())\n\n\tBy(\"Verify node-critical components not ready taint is present\")\n\tConsistentlyWithOffset(1, func(g Gomega) []corev1.Taint {\n\t\tg.Expect(shootClient.Get(ctx, client.ObjectKeyFromObject(node), node)).To(Succeed())\n\t\treturn node.Spec.Taints\n\t}).Should(ContainElement(corev1.Taint{\n\t\tKey: v1beta1constants.TaintNodeCriticalComponentsNotReady,\n\t\tEffect: corev1.TaintEffectNoSchedule,\n\t}))\n\n\tBy(\"Update ManagedResources for shoot with working node-critical component\")\n\tcreateOrUpdateNodeCriticalManagedResource(ctx, seedClient, shootClient, technicalID, nodeCriticalDaemonSetName, \"nginx\", false)\n\tcreateOrUpdateNodeCriticalManagedResource(ctx, seedClient, shootClient, technicalID, csiNodeDaemonSetName, \"nginx\", true)\n\n\tBy(\"Patch CSINode object to contain required driver\")\n\tpatchCSINodeObjectWithRequiredDriver(ctx, shootClient)\n\n\tBy(\"Verify node-critical components not ready taint is removed\")\n\tEventuallyWithOffset(1, func(g Gomega) []corev1.Taint {\n\t\tg.Expect(shootClient.Get(ctx, client.ObjectKeyFromObject(node), node)).To(Succeed())\n\t\treturn node.Spec.Taints\n\t}).WithContext(ctx).WithTimeout(10 * time.Minute).ShouldNot(ContainElement(corev1.Taint{\n\t\tKey: v1beta1constants.TaintNodeCriticalComponentsNotReady,\n\t\tEffect: corev1.TaintEffectNoSchedule,\n\t}))\n\n\tcleanupNodeCriticalManagedResource(ctx, seedClient, technicalID, nodeCriticalDaemonSetName)\n\tcleanupNodeCriticalManagedResource(ctx, seedClient, technicalID, csiNodeDaemonSetName)\n}", "title": "" }, { "docid": "8ac9673e854b85e8510b52ae600c88bb", "score": "0.4557088", "text": "func (r *GameReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\tctrl.NewControllerManagedBy(mgr).\n\t\tWithOptions(controller.Options{\n\t\t\tMaxConcurrentReconciles: 3,\n\t\t}).\n\t\tFor(&myappv1.Game{}).\n\t\tOwns(&appsv1.Deployment{}).\n\t\tComplete(r)\n\n\treturn nil\n}", "title": "" }, { "docid": "298364aa950558f3dcd6b10bdf0b97f9", "score": "0.45523766", "text": "func (p *ReplicationTaskProcessorImpl) Start() {\n\tif !atomic.CompareAndSwapInt32(\n\t\t&p.status,\n\t\tcommon.DaemonStatusInitialized,\n\t\tcommon.DaemonStatusStarted,\n\t) {\n\t\treturn\n\t}\n\n\tgo p.eventLoop()\n\n\tp.logger.Info(\"ReplicationTaskProcessor started.\")\n}", "title": "" }, { "docid": "876a4593f63ce3e2af804feaa0097ee8", "score": "0.45498943", "text": "func WaitLauncherReady(readinessFilePath string, checkTimes int) (bool, error) {\n\tcheckCount := 0\n\tticker := time.NewTicker(2 * time.Second)\n\tfor range ticker.C {\n\t\tisExist, err := fileExists(readinessFilePath)\n\t\tlog.Log.Infof(\"Try check virt-launcher ready count: %d\", checkCount)\n\t\tif err != nil || checkCount > checkTimes {\n\t\t\treturn false, errors.New(\"check error or timeout\")\n\t\t} else if isExist {\n\t\t\treturn true, nil\n\t\t} else {\n\t\t\tcheckCount++\n\t\t}\n\t}\n\treturn false, errors.New(\"unknown\")\n}", "title": "" }, { "docid": "472cd6d192e096f724225f04da0e540d", "score": "0.45498708", "text": "func EnsureInitialization(context context.T) {\n\t//todo: After we start using 1 task pool for entire agent (even for core modules), we can then move all initializations to init()\n\n\t//only components with access to context are expected to call this\n\n\t//this ensures that only one instance of lrpm exists\n\tonce.Do(func() {\n\t\tmanagerContext := context.With(\"[\" + Name + \"]\")\n\t\tlog := managerContext.Log()\n\t\t//initialize pluginsInfo (which will store all information about long running plugins)\n\t\tplugins := map[string]managerContracts.PluginInfo{}\n\t\t//load all registered plugins\n\t\tregPlugins := RegisteredPlugins(context)\n\t\tjsonB, _ := json.Marshal(&regPlugins)\n\t\tlog.Infof(\"registered plugins: %s\", string(jsonB))\n\n\t\t// startPlugin and stopPlugin will be processed by separate worker pools\n\t\t// so we can define the number of workers for each pool\n\t\tcancelWaitDuration := 10000 * time.Millisecond\n\t\tclock := times.DefaultClock\n\t\tstartPluginPool := task.NewPool(log, NumberOfLongRunningPluginWorkers, 0, cancelWaitDuration, clock)\n\t\tstopPluginPool := task.NewPool(log, NumberOfCancelWorkers, 0, cancelWaitDuration, clock)\n\n\t\tfileSysUtil := &longrunning.FileSysUtilImpl{}\n\n\t\tec2ConfigXmlParser := &cloudwatch.Ec2ConfigXmlParserImpl{\n\t\t\tFileSysUtil: fileSysUtil,\n\t\t}\n\n\t\tdataStore := ds{\n\t\t\tdsImpl: datastore.FsStore{},\n\t\t\tcontext: context,\n\t\t}\n\n\t\tsingletonInstance = &Manager{\n\t\t\tcontext: managerContext,\n\t\t\tdataStore: dataStore,\n\t\t\tstartPlugin: startPluginPool,\n\t\t\tstopPlugin: stopPluginPool,\n\t\t\trunningPlugins: plugins,\n\t\t\tregisteredPlugins: regPlugins,\n\t\t\tfileSysUtil: fileSysUtil,\n\t\t\tec2ConfigXmlParser: ec2ConfigXmlParser,\n\t\t}\n\t})\n\n}", "title": "" }, { "docid": "f144ad3aa3e077987f5c612361dd089a", "score": "0.4547743", "text": "func (chaincodeSupport *ChaincodeSupport) launchAndWaitForRegister(ctxt context.Context, netTag string, cds *pb.ChaincodeDeploymentSpec, cLang pb.ChaincodeSpec_Type, targz io.Reader) error {\n\n\tif chaincodeSupport.userRunsCC && cds.GetExecEnv() != pb.ChaincodeDeploymentSpec_SYSTEM {\n\t\treturn fmt.Errorf(\"chaincode is user-running and no need to launch\")\n\t}\n\n\tchaincode := cds.GetChaincodeSpec().GetChaincodeID().GetName()\n\tif chaincode == \"\" {\n\t\treturn fmt.Errorf(\"chaincode name not set\")\n\t}\n\n\tvar args, env []string\n\tvar err error\n\t//launch the chaincode\n\tif cds.GetExecEnv() != pb.ChaincodeDeploymentSpec_SYSTEM {\n\t\targs, env, err = platforms.GetArgsAndEnv(cds.ChaincodeSpec, netTag, chaincodeSupport.clientGuide)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\targs = platforms.GetSystemEnvArgsAndEnv(cds.ChaincodeSpec)\n\t}\n\n\tchaincodeLogger.Debugf(\"start container: %s(chain:%s,nodeid:%s)\", chaincode, chaincodeSupport.name, chaincodeSupport.nodeID)\n\tchaincodeLogger.Debugf(\"envs are %v, %v\", args, env)\n\n\tvmtype, _ := chaincodeSupport.getVMType(cds)\n\n\tsir := container.StartImageReq{CCID: ccintf.CCID{ChaincodeSpec: cds.ChaincodeSpec, NetworkID: netTag, PeerID: chaincodeSupport.nodeID}, Reader: targz, Args: args, Env: env}\n\n\tipcCtxt := context.WithValue(ctxt, ccintf.GetCCHandlerKey(), chaincodeSupport)\n\n\tresp, err := container.VMCProcess(ipcCtxt, vmtype, sir)\n\tif err != nil || (resp != nil && resp.(container.VMCResp).Err != nil) {\n\t\tif err == nil {\n\t\t\terr = resp.(container.VMCResp).Err\n\t\t}\n\t\terr = fmt.Errorf(\"Error starting container: %s\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b75a5ffd2846accda83481e6964d3191", "score": "0.45279577", "text": "func TestConsensusProcess_Start(t *testing.T) {\n\tsim := service.NewSimulator()\n\tn1 := sim.NewNode()\n\tbroker := buildBroker(t, n1, t.Name())\n\tbroker.Start(context.TODO())\n\tproc := generateConsensusProcess(t)\n\tinbox, _ := broker.Register(context.TODO(), proc.ID())\n\tproc.SetInbox(inbox)\n\tproc.s = NewSetFromValues(value1)\n\terr := proc.Start(context.TODO())\n\tassert.Equal(t, nil, err)\n\terr = proc.Start(context.TODO())\n\tassert.Equal(t, \"instance already started\", err.Error())\n}", "title": "" }, { "docid": "e6a03b732d5aa0eda3d4eae0a3ee8f4f", "score": "0.45253575", "text": "func init() {\n\truntime.GOMAXPROCS(runtime.NumCPU())\n}", "title": "" }, { "docid": "05a299230036db93561db2b1c26695b4", "score": "0.45176053", "text": "func (e *EFCEngine) ShouldSetupWorkers() (should bool, err error) {\n\truntime, err := e.getRuntime()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tswitch runtime.Status.WorkerPhase {\n\tcase datav1alpha1.RuntimePhaseNone:\n\t\tshould = true\n\tdefault:\n\t\tshould = false\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "93458d84182c828b2230fba0ed5d3456", "score": "0.4507786", "text": "func (p *Processor) Start() error {\n\n\t// create a goroutine that restarts a trigger if needed\n\tgo p.listenOnRestartTriggerChannel()\n\n\t// handles system signals (for now only SIGTERM)\n\tgo p.handleSignals()\n\n\tp.logger.DebugWith(\"Starting triggers\", \"triggers\", p.triggers)\n\n\t// iterate over all triggers and start them\n\tfor _, triggerInstance := range p.triggers {\n\t\tif err := triggerInstance.Start(nil); err != nil {\n\t\t\tp.logger.ErrorWith(\"Failed to start trigger\",\n\t\t\t\t\"kind\", triggerInstance.GetKind(),\n\t\t\t\t\"err\", err.Error())\n\t\t\treturn errors.Wrap(err, \"Failed to start trigger\")\n\t\t}\n\t}\n\n\t// start the web interface\n\tif err := p.webAdminServer.Start(); err != nil {\n\t\treturn errors.Wrap(err, \"Failed to start web interface\")\n\t}\n\n\t// start pushing metrics\n\tfor _, metricPusher := range p.metricSinks {\n\t\tif err := metricPusher.Start(); err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to start metric pushing\")\n\t\t}\n\t}\n\n\t// indicate that we're done starting\n\tp.startComplete = true\n\n\tp.logger.Debug(\"Processor started\")\n\n\t<-p.stop // Wait for stop\n\tp.logger.Info(\"Processor quitting\")\n\n\ttime.Sleep(5 * time.Second) // Give triggers etc time to finish\n\n\treturn nil\n}", "title": "" }, { "docid": "184fa3dc84954ba1d3adaad597dccdc0", "score": "0.45021233", "text": "func main() {\n\tvar err error\n\tvar tasks *demand.Tasks\n\n\tst := getSettings()\n\n\t// Sending an empty struct on this channel triggers the scheduler to make updates\n\tdemandUpdate := make(chan struct{}, 1)\n\n\ts, err := getScheduler(st, demandUpdate)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to get scheduler: %v\", err)\n\t\treturn\n\t}\n\n\ttasks, err = getTasks(st)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to get tasks: %v\", err)\n\t\treturn\n\t}\n\n\t// Let the scheduler know about the task types.\n\tfor _, task := range tasks.Tasks {\n\t\terr = s.InitScheduler(task)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to start task %s: %v\", task.Name, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Check if there are already any of these containers running\n\terr = s.CountAllTasks(tasks)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to count containers. %v\", err)\n\t}\n\n\t// Set the initial requested counts to match what's running\n\tfor name, task := range tasks.Tasks {\n\t\ttask.Requested = task.Running\n\t\ttasks.Tasks[name] = task\n\t}\n\n\t// Prepare for cleanup when we receive an interrupt\n\tclosedown := make(chan os.Signal, 1)\n\tsignal.Notify(closedown, os.Interrupt)\n\tsignal.Notify(closedown, syscall.SIGTERM)\n\n\tvar ws *websocket.Conn\n\n\t// Open a web socket to the server if needed.\n\tif st.demandEngine != \"LOCAL\" && st.monitorTypes != \"none\" {\n\t\tws, err = utils.InitWebSocket(st.microscalingAPI)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to open web socket: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tde, err := getDemandEngine(st, ws)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to get demand engine: %v\", err)\n\t\treturn\n\t}\n\n\tgo de.GetDemand(tasks, demandUpdate)\n\n\t// Handle demand updates\n\tgo func() {\n\t\tfor range demandUpdate {\n\t\t\terr = s.StopStartTasks(tasks)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed to stop / start tasks. %v\", err)\n\t\t\t}\n\t\t}\n\n\t\t// When the demandUpdate channel is closed, it's time to scale everything down to 0\n\t\tcleanup(s, tasks)\n\t}()\n\n\t// Periodically read the current state of tasks\n\tgetMetricsTimeout := time.NewTicker(constGetMetricsTimeout * time.Millisecond)\n\tgo func() {\n\t\tfor _ = range getMetricsTimeout.C {\n\t\t\t// Find out how many instances of each task are running\n\t\t\terr = s.CountAllTasks(tasks)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed to count containers. %v\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Periodically send metrics to any monitors\n\tmonitors := getMonitors(st, ws)\n\tif len(monitors) > 0 {\n\t\tsendMetricsTimeout := time.NewTicker(constSendMetricsTimeout * time.Millisecond)\n\t\tgo func() {\n\t\t\tfor _ = range sendMetricsTimeout.C {\n\t\t\t\tfor _, m := range monitors {\n\t\t\t\t\terr = m.SendMetrics(tasks)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"Failed to send metrics. %v\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\t// When we're asked to close down, we don't want to handle demand updates any more\n\t<-closedown\n\tlog.Info(\"Clean up when ready\")\n\t// Give the scheduler a chance to do any necessary cleanup\n\ts.Cleanup()\n\t// The demand engine is responsible for closing the demandUpdate channel so that we stop\n\t// doing scaling operations\n\tde.StopDemand(demandUpdate)\n\n\texitWaitTimeout := time.NewTicker(constGetMetricsTimeout * time.Millisecond)\n\tfor _ = range exitWaitTimeout.C {\n\t\tif tasks.Exited() {\n\t\t\tlog.Info(\"All finished\")\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c388da282febfeb93fe8aafcd524bb3b", "score": "0.4502037", "text": "func (c *Controller) Start() error {\n\t// Set up the stopping channel here in case the controller restarts.\n\tc.stopping = make(chan struct{})\n\n\tif err := c.Transactor.Start(); err != nil {\n\t\treturn errors.Wrap(err, \"starting transactor\")\n\t}\n\n\tc.backgroundGroup.Go(c.poller.Run) // TODO: this could just use c.stopping as well?\n\n\tc.backgroundGroup.Go(func() error {\n\t\treturn c.nodeRegistrationRoutine(c.nodeChan, c.registrationBatchTimeout)\n\n\t})\n\tc.backgroundGroup.Go(func() error {\n\t\treturn c.snappingTurtleRoutine(c.snappingTurtleTimeout, c.snapControl, c.logger.WithPrefix(\"Snapping Turtle: \"))\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "456838fe95d4a174307b0d5d27b1cdde", "score": "0.44982147", "text": "func SetupWithManager(mgr controllerruntime.Manager, config options.JobControllerConfiguration) error {\n\tfor workload, f := range SetupWithManagerMap {\n\t\tkind, enabled := workloadgate.IsWorkloadEnable(workload, mgr.GetScheme())\n\t\tif !enabled {\n\t\t\tklog.Warningf(\"skip workload %v because it is not enabled.\", kind)\n\t\t\tcontinue\n\t\t}\n\t\tif err := f(mgr, config); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tklog.Infof(\"workload %v controller has started.\", kind)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7dbc6be065362aef77f914cf9c6f7194", "score": "0.44943482", "text": "func InstancePreCheck(t *testing.T) {\n\n\t// Skip if testing is disabled\n\tif DisableTesting {\n\t\treturn\n\t}\n\n\tAccountPreCheck(t)\n\t// not checking for VTL currently\n\tifNil(t, InstanceName, \"InstanceName\", \"instance\")\n\tifNil(t, InstanceImageID, \"InstanceImageID\", \"instance\")\n\tifNil(t, InstanceMemory, \"InstanceMemory\", \"instance\")\n\tifNil(t, InstanceNetworkID, \"InstanceNetworkID\", \"instance\")\n\tifNil(t, InstanceProcessors, \"InstanceProcessors\", \"instance\")\n\tifNil(t, InstanceProcType, \"InstanceProcType\", \"instance\")\n\tifNil(t, InstanceSSHKey, \"InstanceSSHKey\", \"instance\")\n\tifNil(t, InstanceSysType, \"InstanceSysType\", \"instance\")\n\tifNil(t, InstanceVolumeID, \"InstanceVolumeID\", \"instance\")\n}", "title": "" }, { "docid": "cb7c57cc84eac5a1ab283dd05e51915a", "score": "0.4492527", "text": "func (r *RunReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(&databricksv1alpha1.Run{}).\n\t\tWithOptions(ctrl_controller.Options{\n\t\t\tMaxConcurrentReconciles: getMaxConcurrentReconciles(),\n\t\t}).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "dac22c2faed48d1744698550c72546c2", "score": "0.44916323", "text": "func startWorkers(h *common.SampleHelper) {\n\tworkflowClient, err := h.Builder.BuildCadenceClient()\n\tif err != nil {\n\t\th.Logger.Error(\"Failed to build cadence client.\", zap.Error(err))\n\t\tpanic(err)\n\t}\n\tctx := context.WithValue(context.Background(), CadenceClientKey, workflowClient)\n\n\t// Configure worker options.\n\tworkerOptions := worker.Options{\n\t\tMetricsScope: h.WorkerMetricScope,\n\t\tLogger: h.Logger,\n\t\tBackgroundActivityContext: ctx,\n\t}\n\n\th.StartWorkers(h.Config.DomainName, ApplicationName, workerOptions)\n}", "title": "" }, { "docid": "7d1cae72e96e75f8f6150b4a84813ad7", "score": "0.44856608", "text": "func (vtworker *VtworkerProcess) Setup(cell string) (err error) {\n\n\tvtworker.proc = exec.Command(\n\t\tvtworker.Binary,\n\t\t\"-log_dir\", vtworker.LogDir,\n\t\t\"-port\", fmt.Sprintf(\"%d\", vtworker.Port),\n\t\t\"-executefetch_retry_time\", vtworker.ExecuteRetryTime,\n\t\t\"-tablet_manager_protocol\", \"grpc\",\n\t\t\"-tablet_protocol\", \"grpc\",\n\t\t\"-topo_implementation\", vtworker.CommonArg.TopoImplementation,\n\t\t\"-topo_global_server_address\", vtworker.CommonArg.TopoGlobalAddress,\n\t\t\"-topo_global_root\", vtworker.CommonArg.TopoGlobalRoot,\n\t\t\"-service_map\", vtworker.ServiceMap,\n\t\t\"-grpc_port\", fmt.Sprintf(\"%d\", vtworker.GrpcPort),\n\t\t\"-cell\", cell,\n\t\t\"-command_display_interval\", \"10ms\",\n\t)\n\tif *isCoverage {\n\t\tvtworker.proc.Args = append(vtworker.proc.Args, \"-test.coverprofile=vtworker.out\", \"-test.v\")\n\t}\n\tvtworker.proc.Args = append(vtworker.proc.Args, vtworker.ExtraArgs...)\n\n\tvtworker.proc.Stderr = os.Stderr\n\tvtworker.proc.Stdout = os.Stdout\n\n\tvtworker.proc.Env = append(vtworker.proc.Env, os.Environ()...)\n\n\tlog.Infof(\"%v\", strings.Join(vtworker.proc.Args, \" \"))\n\n\terr = vtworker.proc.Start()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvtworker.exit = make(chan error)\n\tgo func() {\n\t\tvtworker.exit <- vtworker.proc.Wait()\n\t}()\n\n\ttimeout := time.Now().Add(60 * time.Second)\n\tfor time.Now().Before(timeout) {\n\t\tif vtworker.IsHealthy() {\n\t\t\treturn nil\n\t\t}\n\t\tselect {\n\t\tcase err := <-vtworker.exit:\n\t\t\treturn fmt.Errorf(\"process '%s' exited prematurely (err: %s)\", vtworker.Name, err)\n\t\tdefault:\n\t\t\ttime.Sleep(300 * time.Millisecond)\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"process '%s' timed out after 60s (err: %s)\", vtworker.Name, <-vtworker.exit)\n}", "title": "" }, { "docid": "ec42cd936863e729a3eef02162109902", "score": "0.44780862", "text": "func initializeProcessor() {\n\ttestSubscriber.GivenStopError = nil\n\ttestSubscriber.GivenErrError = nil\n\ttestSubscriber.FoundError = nil\n\ttestSubscriber.ProtoMessages = nil\n\ttestSubscriber.JSONMessages = nil\n}", "title": "" }, { "docid": "66a4c9c09f435d1435732faea3c5207b", "score": "0.44758198", "text": "func (e *AlluxioEngine) ShouldSetupWorkers() (should bool, err error) {\n\truntime, err := e.getRuntime()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tswitch runtime.Status.WorkerPhase {\n\tcase datav1alpha1.RuntimePhaseNone:\n\t\tshould = true\n\tdefault:\n\t\tshould = false\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "14e54b509f25e8b0571071057b836c78", "score": "0.44706556", "text": "func (s *ServiceManager) Setup() {\n\tlog.Println(\"[DEBUG] setting up a service manager\")\n\n\ts.commandCreatedChan = make(chan *exec.Cmd)\n\ts.commandCompleteChan = make(chan *exec.Cmd)\n\ts.processMap = processMap{processes: make(map[int]*exec.Cmd)}\n\n\t// Listen for service create/kill\n\tgo s.addServiceMonitor()\n\tgo s.removeServiceMonitor()\n}", "title": "" }, { "docid": "e9fa8459037db07b5dd87611be00a2c7", "score": "0.44697204", "text": "func WaitForRebalanceToStart(baseParams api.BaseParams, args api.XactReqArgs) error {\n\tdebug.Assert(args.Kind == \"\" || args.Kind == cmn.ActRebalance)\n\targs.Kind = cmn.ActRebalance\n\tctx := context.Background()\n\tif args.Timeout > 0 {\n\t\tvar cancel context.CancelFunc\n\t\tctx, cancel = context.WithTimeout(ctx, args.Timeout)\n\t\tdefer cancel()\n\t}\n\tfor {\n\t\txactStats, err := api.QueryXactionStats(baseParams, args)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif xactStats.Running() {\n\t\t\tbreak\n\t\t}\n\t\tif len(xactStats) > 0 && xactStats.Finished() {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(api.XactPollTime)\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9566e2bafebb0bd6ef2d238b9d67cbb3", "score": "0.4468475", "text": "func (e *JindoFSxEngine) CheckWorkersReady() (ready bool, err error) {\n\n\tif e.runtime.Spec.Worker.Disabled {\n\t\tready = true\n\t\terr = nil\n\t\treturn\n\t}\n\n\tworkers, err := ctrl.GetWorkersAsStatefulset(e.Client,\n\t\ttypes.NamespacedName{Namespace: e.namespace, Name: e.getWorkerName()})\n\tif err != nil {\n\t\tif fluiderrs.IsDeprecated(err) {\n\t\t\te.Log.Info(\"Warning: Deprecated mode is not support, so skip handling\", \"details\", err)\n\t\t\tready = true\n\t\t\treturn ready, nil\n\t\t}\n\t\treturn ready, err\n\t}\n\n\terr = retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\truntime, err := e.getRuntime()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\truntimeToUpdate := runtime.DeepCopy()\n\t\tready, err = e.Helper.CheckWorkersReady(runtimeToUpdate, runtimeToUpdate.Status, workers)\n\t\tif err != nil {\n\t\t\t_ = utils.LoggingErrorExceptConflict(e.Log,\n\t\t\t\terr,\n\t\t\t\t\"Failed to setup worker\",\n\t\t\t\ttypes.NamespacedName{\n\t\t\t\t\tNamespace: e.namespace,\n\t\t\t\t\tName: e.name,\n\t\t\t\t})\n\t\t}\n\t\treturn err\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "effd7c47642400cbc4fdecca03b7e1fe", "score": "0.44677085", "text": "func (tc *threadContext) Setup() {\n\n\t\t// Set up the context and cancel functions\n\t\ttc.Context, tc.Cancel = context.WithCancel(context.Background())\n\n\t\t// Spawn a background thread that will watch for Unix signals (sigint, sigterm)\n\t\tgo func() {\n\n\t\t\t// Make a channel to receive unix signals\n\t\t\tsignalChannel := make(chan os.Signal, 1)\n\n\t\t\t// Register for notifications of being asked to quit by unix\n\t\t\tsignal.Notify(signalChannel, syscall.SIGINT, syscall.SIGTERM)\n\n\t\t\t// Wait for a quit instruction from outside\n\t\t\t<- signalChannel\n\n\t\t\t// Call the cancel function for our thread context\n\t\t\ttc.Cancel()\n\t\t}()\n\n\t\t// Send back the thread which has now completed setup\n\t\treturn\n\t}", "title": "" }, { "docid": "0a0243e3d54f74b868590e2c96704ecc", "score": "0.44650537", "text": "func (c *Chain) Start() {\n\tc.logger.Infof(\"Starting Raft node\")\n\n\tif err := c.configureComm(); err != nil {\n\t\tc.logger.Errorf(\"Failed to start chain, aborting: +%v\", err)\n\t\tclose(c.doneC)\n\t\treturn\n\t}\n\n\tisJoin := c.support.Height() > 1\n\tif isJoin && c.opts.MigrationInit {\n\t\tisJoin = false\n\t\tc.logger.Infof(\"Consensus-type migration detected, starting new raft node on an existing channel; height=%d\", c.support.Height())\n\t}\n\tc.Node.start(c.fresh, isJoin)\n\n\tclose(c.startC)\n\tclose(c.errorC)\n\n\tgo c.gc()\n\tgo c.run()\n\n\tes := c.newEvictionSuspector()\n\n\tinterval := DefaultLeaderlessCheckInterval\n\tif c.opts.LeaderCheckInterval != 0 {\n\t\tinterval = c.opts.LeaderCheckInterval\n\t}\n\n\tc.periodicChecker = &PeriodicCheck{\n\t\tLogger: c.logger,\n\t\tReport: es.confirmSuspicion,\n\t\tReportCleared: es.clearSuspicion,\n\t\tCheckInterval: interval,\n\t\tCondition: c.suspectEviction,\n\t}\n\tc.periodicChecker.Run()\n}", "title": "" }, { "docid": "7de0cf24c1dcdc67cb50282b36452495", "score": "0.44646877", "text": "func (n *Peer) Setup() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase msg := <-n.send:\n\t\t\t\tn.producer.SendAsync(context.Background(), &pulsar.ProducerMessage{\n\t\t\t\t\tPayload: msg,\n\t\t\t\t}, func(id pulsar.MessageID, message *pulsar.ProducerMessage, err error) {\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Println(\"Failed to publish\", err)\n\t\t\t\t\t\tn.errors <- err\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\tcase <-n.done:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "f58a36fc30f05968285484f5300bf19e", "score": "0.4457478", "text": "func waitForInitialIngestCompletion() {\n\tfor {\n\t\tif initialIngestsComplete() {\n\t\t\tctx.Context.Logger.Infof(\"E2E: Initial ingests complete\")\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(10 * time.Second)\n\t}\n}", "title": "" }, { "docid": "441c88e94b57ef3075ace72580caefa7", "score": "0.4449368", "text": "func setupSuite() {\n\t// Run only on Ginkgo node 1\n\n\tc, err := framework.LoadClientset()\n\tif err != nil {\n\t\tklog.Fatal(\"Error loading client: \", err)\n\t}\n\n\t// Delete any namespaces except those created by the system. This ensures no\n\t// lingering resources are left over from a previous test run.\n\tif framework.TestContext.CleanStart {\n\t\tdeleted, err := framework.DeleteNamespaces(c, nil, /* deleteFilter */\n\t\t\t[]string{\n\t\t\t\tmetav1.NamespaceSystem,\n\t\t\t\tmetav1.NamespaceDefault,\n\t\t\t\tmetav1.NamespacePublic,\n\t\t\t\tv1.NamespaceNodeLease,\n\t\t\t\t// kind local path provisioner namespace since 0.7.0\n\t\t\t\t// https://github.com/kubernetes-sigs/kind/blob/v0.7.0/pkg/build/node/storage.go#L35\n\t\t\t\t\"local-path-storage\",\n\t\t\t})\n\t\tif err != nil {\n\t\t\tframework.Failf(\"Error deleting orphaned namespaces: %v\", err)\n\t\t}\n\t\tklog.Infof(\"Waiting for deletion of the following namespaces: %v\", deleted)\n\t\tif err := framework.WaitForNamespacesDeleted(c, deleted, namespaceCleanupTimeout); err != nil {\n\t\t\tframework.Failf(\"Failed to delete orphaned namespaces %v: %v\", deleted, err)\n\t\t}\n\t}\n\n\t// In large clusters we may get to this point but still have a bunch\n\t// of nodes without Routes created. Since this would make a node\n\t// unschedulable, we need to wait until all of them are schedulable.\n\tframework.ExpectNoError(e2enode.WaitForAllNodesSchedulable(c, framework.TestContext.NodeSchedulableTimeout))\n\n\t//// If NumNodes is not specified then auto-detect how many are scheduleable and not tainted\n\t//if framework.TestContext.CloudConfig.NumNodes == framework.DefaultNumNodes {\n\t//\tframework.TestContext.CloudConfig.NumNodes = len(framework.GetReadySchedulableNodesOrDie(c).Items)\n\t//}\n\n\t// Ensure all pods are running and ready before starting tests (otherwise,\n\t// cluster infrastructure pods that are being pulled or started can block\n\t// test pods from running, and tests that ensure all pods are running and\n\t// ready will fail).\n\tpodStartupTimeout := framework.TestContext.SystemPodsStartupTimeout\n\t// TODO: In large clusters, we often observe a non-starting pods due to\n\t// #41007. To avoid those pods preventing the whole test runs (and just\n\t// wasting the whole run), we allow for some not-ready pods (with the\n\t// number equal to the number of allowed not-ready nodes).\n\tif err := e2epod.WaitForPodsRunningReady(c, metav1.NamespaceSystem, int32(framework.TestContext.MinStartupPods), int32(framework.TestContext.AllowedNotReadyNodes), podStartupTimeout, map[string]string{}); err != nil {\n\t\te2edebug.DumpAllNamespaceInfo(c, metav1.NamespaceSystem)\n\t\te2ekubectl.LogFailedContainers(c, metav1.NamespaceSystem, framework.Logf)\n\t\tframework.Failf(\"Error waiting for all pods to be running and ready: %v\", err)\n\t}\n\n\t//if err := framework.WaitForDaemonSets(c, metav1.NamespaceSystem, int32(framework.TestContext.AllowedNotReadyNodes), framework.TestContext.SystemDaemonsetStartupTimeout); err != nil {\n\t//\tframework.Logf(\"WARNING: Waiting for all daemonsets to be ready failed: %v\", err)\n\t//}\n\n\tdc := c.DiscoveryClient\n\n\tserverVersion, serverErr := dc.ServerVersion()\n\tif serverErr != nil {\n\t\tframework.Logf(\"Unexpected server error retrieving version: %v\", serverErr)\n\t}\n\tif serverVersion != nil {\n\t\tframework.Logf(\"kube-apiserver version: %s\", serverVersion.GitVersion)\n\t}\n}", "title": "" }, { "docid": "9500d4a77c8cfa5838fe58f7a0763efa", "score": "0.44440946", "text": "func (c *Core) InitializeBackground() error {\n\t//poll torrents and files\n\tgo func() {\n\t\tfor {\n\t\t\tc.state.Lock()\n\t\t\tc.state.Torrents = c.engine.GetTorrents()\n\t\t\t//s.state.Downloads = s.listFiles()\n\t\t\tc.state.Unlock()\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\t}()\n\n\t// Middleware set custom echo context\n\tc.http.Use(func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(ctx echo.Context) error {\n\t\t\treturn next(&CustomContext{\n\t\t\t\tContext: ctx,\n\t\t\t\tCore: c,\n\t\t\t})\n\t\t}\n\t})\n\n\t//run http server\n\treturn c.http.Run(routes)\n}", "title": "" }, { "docid": "3d9c877aa8d2e14da14c8a238d18df19", "score": "0.44412255", "text": "func init() { //init is a special function that runs before the rest of the code\n runtime.GOMAXPROCS(runtime.NumCPU())\n}", "title": "" }, { "docid": "790cbd1635bc22ce2e4fb013618b7ff2", "score": "0.44404933", "text": "func startWorkers(h *common.SampleHelper) {\n\t// Configure worker options.\n\tworkerOptions := worker.Options{\n\t\tMetricsScope: h.Scope,\n\t\tLogger: h.Logger,\n\t\t// From yaml config\n\t\tMaxConcurrentActivityExecutionSize: h.Config.WorkerOptions.MaxConcurrentActivityExecutionSize,\n\t\tWorkerActivitiesPerSecond: h.Config.WorkerOptions.WorkerActivitiesPerSecond,\n\t\tMaxConcurrentLocalActivityExecutionSize: h.Config.WorkerOptions.MaxConcurrentLocalActivityExecutionSize,\n\t\tWorkerLocalActivitiesPerSecond: h.Config.WorkerOptions.WorkerLocalActivitiesPerSecond,\n\t\tTaskListActivitiesPerSecond: h.Config.WorkerOptions.TaskListActivitiesPerSecond,\n\t\tMaxConcurrentActivityTaskPollers: h.Config.WorkerOptions.MaxConcurrentActivityTaskPollers,\n\t\tMaxConcurrentDecisionTaskExecutionSize: h.Config.WorkerOptions.MaxConcurrentDecisionTaskExecutionSize,\n\t\tWorkerDecisionTasksPerSecond: h.Config.WorkerOptions.WorkerDecisionTasksPerSecond,\n\t\tMaxConcurrentDecisionTaskPollers: h.Config.WorkerOptions.MaxConcurrentDecisionTaskPollers,\n\t\tAutoHeartBeat: h.Config.WorkerOptions.AutoHeartBeat,\n\t\tIdentity: h.Config.WorkerOptions.Identity,\n\t\tEnableLoggingInReplay: h.Config.WorkerOptions.EnableLoggingInReplay,\n\t\tDisableWorkflowWorker: h.Config.WorkerOptions.DisableWorkflowWorker,\n\t\tDisableActivityWorker: h.Config.WorkerOptions.DisableActivityWorker,\n\t\tDisableStickyExecution: h.Config.WorkerOptions.DisableStickyExecution,\n\t\tStickyScheduleToStartTimeout: h.Config.WorkerOptions.StickyScheduleToStartTimeout,\n\t\tWorkerStopTimeout: h.Config.WorkerOptions.WorkerStopTimeout,\n\t\tEnableSessionWorker: h.Config.WorkerOptions.EnableSessionWorker,\n\t\tMaxConcurrentSessionExecutionSize: h.Config.WorkerOptions.MaxConcurrentSessionExecutionSize,\n\t}\n\th.Logger.Info(fmt.Sprintf(\"Worker options: %v\", h.Config.WorkerOptions))\n\th.Logger.Info(fmt.Sprintf(\"Worker options: %v\", workerOptions))\n\n\tfor i := 0; i < h.Config.TaskListCount; i++ {\n\t\th.StartWorkers(\n\t\t\th.Config.DomainName,\n\t\t\tgetTaskListName(i),\n\t\t\tworkerOptions)\n\t}\n}", "title": "" }, { "docid": "3b0cfa918fc2c792900f03eaedcc4a17", "score": "0.44401482", "text": "func (fRuntime *FlowRuntime) StartRuntime() error {\n\tworker := &Worker{\n\t\tID: getNewId(),\n\t\tFlows: make([]string, 0, len(fRuntime.Flows)),\n\t\tConcurrency: fRuntime.Concurrency,\n\t}\n\t// Get the flow details for each flow\n\tflowDetails := make(map[string]string)\n\tfor flowID, handler := range fRuntime.Flows {\n\t\tworker.Flows = append(worker.Flows, flowID)\n\t\tdag, err := getFlowDefinition(handler)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to strat runtime, dag export failed, error %v\", err)\n\t\t}\n\t\tflowDetails[flowID] = dag\n\t}\n\terr := fRuntime.saveWorkerDetails(worker)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to register worker details, %v\", err)\n\t}\n\terr = fRuntime.saveFlowDetails(flowDetails)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to register worker details, %v\", err)\n\t}\n\tgocron.Every(GoFlowRegisterInterval).Second().Do(func() {\n\t\tvar err error\n\t\terr = fRuntime.saveWorkerDetails(worker)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"failed to register worker details, %v\", err)\n\t\t}\n\t\terr = fRuntime.saveFlowDetails(flowDetails)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"failed to register worker details, %v\", err)\n\t\t}\n\t})\n\t<-gocron.Start()\n\n\treturn fmt.Errorf(\"runtime stopped\")\n}", "title": "" }, { "docid": "25acd92638199caeddba4a65fafb2749", "score": "0.44257534", "text": "func (e *EFCEngine) CheckWorkersReady() (ready bool, err error) {\n\tworkers, err := ctrl.GetWorkersAsStatefulset(e.Client,\n\t\ttypes.NamespacedName{Namespace: e.namespace, Name: e.getWorkerName()})\n\tif err != nil {\n\t\treturn ready, err\n\t}\n\n\terr = retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\truntime, err := e.getRuntime()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\truntimeToUpdate := runtime.DeepCopy()\n\t\tready, err = e.Helper.CheckWorkersReady(runtimeToUpdate, runtimeToUpdate.Status, workers)\n\t\tif err != nil {\n\t\t\t_ = utils.LoggingErrorExceptConflict(e.Log, err, \"Failed to check worker ready\", types.NamespacedName{Namespace: e.namespace, Name: e.name})\n\t\t}\n\t\treturn err\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "bf98a86b809a456161ed940a9ce01b3a", "score": "0.44099742", "text": "func (i *Installer) wait() error {\n\tif err := i.runStoppers(i.ctx, i.completers); err != nil {\n\t\ti.WithError(err).Warn(\"Stoppers failed to run.\")\n\t}\n\treturn trace.Wrap(i.config.Process.Wait())\n}", "title": "" }, { "docid": "04aa2295fe053cf75383a6e0d42f1472", "score": "0.44052958", "text": "func Start() {\n\tInitUsers()\n\n\ttime.Sleep(time.Second * 5)\n\n\tStartTestingWithoutVerify()\n}", "title": "" }, { "docid": "3a02c3858d2fc54a8f7d8d42f1f2ecd6", "score": "0.4403311", "text": "func startWorker(params *AppParams, startChan chan bool) {\n\t//start a job for each electorate\n\tfor i := 0; i < params.NumElectorates; i++ {\n\t\tstartChan <- true\n\t}\n}", "title": "" }, { "docid": "9059fac1689ed84322c3cffb492b91eb", "score": "0.44019923", "text": "func SystemStart() error {\n\tcommon.LogTitle(common.Initialization, \"------------***--------- Checking system ---------***------------\")\n\tif err := checkSystem(); err != nil {\n\t\treturn err\n\t}\n\tcommon.LogTitle(common.Initialization, \"------------***---------- Creating ports ---------***------------\")\n\tfor i := range createdPorts {\n\t\tif createdPorts[i].config != inactivePort {\n\t\t\tif err := low.CreatePort(createdPorts[i].port, uint16(createdPorts[i].rxQueuesNumber),\n\t\t\t\tuint16(createdPorts[i].txQueuesNumber), hwtxchecksum); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\t// Timeout is needed for ports to start up. This way is used in pktgen.\n\t// Pktgen also has checks for link status for all ports, but we compensate it\n\t// by additional time.\n\t// Timeout prevents loss of starting packets in generated flow.\n\ttime.Sleep(time.Second * 2)\n\n\tcommon.LogTitle(common.Initialization, \"------------***------ Starting FlowFunctions -----***------------\")\n\tif err := schedState.SystemStart(); err != nil {\n\t\treturn common.WrapWithNFError(err, \"scheduler start failed\", common.Fail)\n\t}\n\tcommon.LogTitle(common.Initialization, \"------------***--------- YANFF-GO Started --------***------------\")\n\tschedState.Schedule(schedTime)\n\treturn nil\n}", "title": "" }, { "docid": "1e55fb8959fd52d23834b5b8729ee6bc", "score": "0.4398812", "text": "func setupSuite() {\n\t// Run only on Ginkgo node 1\n\tc, err := framework.LoadClientset()\n\tif err != nil {\n\t\tklog.Fatal(\"Error loading client: \", err)\n\t}\n\n\t// Delete any namespaces except those created by the system. This ensures no\n\t// lingering resources are left over from a previous test run.\n\tif framework.TestContext.CleanStart {\n\t\tdeleted, err := framework.DeleteNamespaces(c, nil, /* deleteFilter */\n\t\t\t[]string{\n\t\t\t\tmetav1.NamespaceSystem,\n\t\t\t\tmetav1.NamespaceDefault,\n\t\t\t\tmetav1.NamespacePublic,\n\t\t\t\tv1.NamespaceNodeLease,\n\t\t\t})\n\t\tif err != nil {\n\t\t\tframework.Failf(\"Error deleting orphaned namespaces: %v\", err)\n\t\t}\n\t\tklog.Infof(\"Waiting for deletion of the following namespaces: %v\", deleted)\n\t\tif err := framework.WaitForNamespacesDeleted(c, deleted, framework.NamespaceCleanupTimeout); err != nil {\n\t\t\tframework.Failf(\"Failed to delete orphaned namespaces %v: %v\", deleted, err)\n\t\t}\n\t}\n\n\t// In large clusters we may get to this point but still have a bunch\n\t// of nodes without Routes created. Since this would make a node\n\t// unschedulable, we need to wait until all of them are schedulable.\n\tframework.ExpectNoError(framework.WaitForAllNodesSchedulable(c, framework.TestContext.NodeSchedulableTimeout))\n\n\t// Ensure all pods are running and ready before starting tests (otherwise,\n\t// cluster infrastructure pods that are being pulled or started can block\n\t// test pods from running, and tests that ensure all pods are running and\n\t// ready will fail).\n\tpodStartupTimeout := framework.TestContext.SystemPodsStartupTimeout\n\t// TODO: In large clusters, we often observe a non-starting pods due to\n\t// #41007. To avoid those pods preventing the whole test runs (and just\n\t// wasting the whole run), we allow for some not-ready pods (with the\n\t// number equal to the number of allowed not-ready nodes).\n\tif err := e2epod.WaitForPodsRunningReady(c, metav1.NamespaceSystem, int32(framework.TestContext.MinStartupPods), int32(framework.TestContext.AllowedNotReadyNodes), podStartupTimeout, map[string]string{}); err != nil {\n\t\tframework.DumpAllNamespaceInfo(c, metav1.NamespaceSystem)\n\t\t//e2ekubectl.LogFailedContainers(c, metav1.NamespaceSystem, framework.Logf)\n\t\tframework.Failf(\"Error waiting for all pods to be running and ready: %v\", err)\n\t}\n\n\tdc := c.DiscoveryClient\n\n\tserverVersion, serverErr := dc.ServerVersion()\n\tif serverErr != nil {\n\t\tframework.Logf(\"Unexpected server error retrieving version: %v\", serverErr)\n\t}\n\tif serverVersion != nil {\n\t\tframework.Logf(\"kube-apiserver version: %s\", serverVersion.GitVersion)\n\t}\n\n\tif framework.TestContext.NodeKiller.Enabled {\n\t\tnodeKiller := framework.NewNodeKiller(framework.TestContext.NodeKiller, c, framework.TestContext.Provider)\n\t\tgo nodeKiller.Run(framework.TestContext.NodeKiller.NodeKillerStopCh)\n\t}\n}", "title": "" }, { "docid": "743ea9bbd2ac3f45271eff313af06579", "score": "0.43978077", "text": "func (s *Server) Start() error {\n\tfirstTime := true\n\tcheckCh := time.NewTicker(1)\n\tfor {\n\t\tselect {\n\t\tcase <-checkCh.C:\n\t\t\tif firstTime {\n\t\t\t\tcheckCh.Stop()\n\t\t\t\tcheckCh = time.NewTicker(s.config.ReconcileInterval)\n\t\t\t}\n\t\t\ts.reconcileComputeNodes()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e9204b5c1776628d141dddb7a190965", "score": "0.43967947", "text": "func (mq *MessageQueue) Startup() {\n\tgo mq.runQueue()\n\tgo mq.sendMessages()\n}", "title": "" }, { "docid": "846ca48b6db14483b9f22ac054c8edc6", "score": "0.43914762", "text": "func (r *KongV1Beta1TCPIngressReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\tpreds := ctrlutils.GeneratePredicateFuncsForIngressClassFilter(r.IngressClassName, false, true)\n\treturn ctrl.NewControllerManagedBy(mgr).For(&kongv1beta1.TCPIngress{}, builder.WithPredicates(preds)).Complete(r)\n}", "title": "" }, { "docid": "e9bb225deb136b76eaeb1e03af1ee8f0", "score": "0.43837878", "text": "func (sm *SysModel) SetupWorkloads(scale bool) error {\n\n\thosts, err := sm.ListRealHosts()\n\tif err != nil {\n\t\tlog.Error(\"Error finding real hosts to run traffic tests\")\n\t\treturn err\n\t}\n\n\tfor _, h := range hosts {\n\t\t_, err := sm.SetupWorkloadsOnHost(h)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn sm.BringupWorkloads()\n}", "title": "" }, { "docid": "36c1d382103bbffaf9d75dc2118ab43a", "score": "0.43814078", "text": "func (r *ConcurrencyRunner) Before(workers tester.Workers, opts interface{}) error {\n\tif err := r.runner.Before(workers, opts); err != nil {\n\t\treturn err\n\t}\n\n\to, ok := opts.(*options.Options)\n\tif !ok {\n\t\treturn tester.ErrInvalidOptions\n\t}\n\n\tr.workerSem = bender.NewWorkerSemaphore()\n\n\tgo func() { r.workerSem.Signal(workers) }()\n\n\tr.requests = make(chan interface{})\n\n\tctx, cancel := context.WithCancel(context.Background())\n\n\tgo func() {\n\t\tfor i := 0; ; i++ {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tclose(r.requests)\n\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tr.requests <- r.Params.RequestGenerator(i)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// We want tne progressbar to measure the time passed.\n\tconst scale = 10\n\tcount := int(o.Duration/time.Second) * scale\n\n\tr.progress, r.bar = recorders.NewLoadTestProgress(count)\n\tr.progress.Start()\n\n\tgo func() {\n\t\tfor i := 0; i < count; i++ {\n\t\t\ttime.Sleep(time.Second / scale)\n\t\t\tr.bar.Incr()\n\t\t}\n\t\tcancel()\n\t\tr.progress.Stop()\n\t\tr.spinnerCancel = utils.NewBackgroundSpinner(\"Waiting for tests to finish\", 0)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "5718b4745bb0212d8fccd128d909d50b", "score": "0.43782347", "text": "func StartCheck(config types.Configuration, healthChannel chan<- types.StatsEvent) {\n\tintervalDuration := time.Second * time.Duration(config.PollIntervalSec)\n\tfor {\n\t\tev := getStatsEvent(config.TraefikHealthEndpoint)\n\t\thealthChannel <- ev\n\t\ttime.Sleep(intervalDuration)\n\t}\n}", "title": "" }, { "docid": "1bc658d2a31db316a279932c4a0512e2", "score": "0.43773976", "text": "func startNodesBlocking(t *testing.T, nodes ...BaseGossiper) {\n\twg := new(sync.WaitGroup)\n\twg.Add(len(nodes))\n\tfor idx := range nodes {\n\t\tgo func(i int) {\n\t\t\tdefer wg.Done()\n\t\t\tready := make(chan struct{})\n\t\t\tgo nodes[i].Run(ready)\n\t\t\t<-ready\n\t\t}(idx)\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "fac2bfaf9062d11ead6f3fc0ac30ffec", "score": "0.4373793", "text": "func (processorService *ProcessorService) OnStart() error {\n\tif err := processorService.BaseService.OnStart(); err != nil {\n\t\tprocessorService.Logger.Error(\"OnStart | OnStart\", \"Error\", err)\n\t} // Always call the overridden method.\n\n\t// start processors\n\tfor _, processor := range processorService.processors {\n\t\tprocessor.RegisterTasks()\n\t\tprocessor := processor\n\t\tgo func() {\n\t\t\tif err := processor.Start(); err != nil {\n\t\t\t\tprocessorService.Logger.Error(\"processor is failed\", \"Err\", err)\n\t\t\t}\n\t\t}()\n\t}\n\n\tprocessorService.Logger.Info(\"all processors Started\")\n\treturn nil\n}", "title": "" }, { "docid": "49cf90564f78a55e6e8dbd13b309a5c9", "score": "0.43720666", "text": "func (bw *baseWorker) Start() {\n\tif bw.isWorkerStarted {\n\t\treturn\n\t}\n\t// Add the total number of routines to the wait group\n\tbw.shutdownWG.Add(bw.options.routineCount)\n\n\t// Launch the routines to do work\n\tfor i := 0; i < bw.options.routineCount; i++ {\n\t\tgo bw.execute(i)\n\t}\n\n\tbw.isWorkerStarted = true\n\tbw.logger.Info(\"Started Worker\", zap.Int(\"RoutineCount\", bw.options.routineCount))\n}", "title": "" }, { "docid": "0b4e9d60ea57d7ced3f27343f0858c29", "score": "0.43706238", "text": "func (r *Runner) Start() error {\n\tr.log.Info(\"Runner starting\")\n\tr.done = make(chan struct{})\n\n\tr.publishChan, _ = r.checker.Start()\n\tfor _, publisher := range r.publishers {\n\t\tpublisher.Start()\n\t}\n\tgo r.process()\n\treturn nil\n}", "title": "" }, { "docid": "0883d1fc45b59e19ca30c9a9f253173b", "score": "0.4369547", "text": "func (l *Manager) Setup() {\n\tl.c = sync.NewCond(&sync.Mutex{})\n\tl.shutdown = make(chan struct{}, 1)\n}", "title": "" }, { "docid": "634ff5cb1bba7f25f4c56bb0d91f083d", "score": "0.4368951", "text": "func TestStartAction(t *testing.T) {\n\tbeehiveContext.InitContext([]string{common.MsgCtxTypeChannel})\n\n\treceiveChanActionPresent := GenerateReceiveChanAction(dtcommon.SendToCloud, Identity, Message, Msg)\n\treceiveChanActionNotPresent := GenerateReceiveChanAction(Action, Identity, Message, Msg)\n\n\ttests := []CaseWorkerStr{\n\t\tGenerateStartActionCase(ActionPresent, receiveChanActionPresent),\n\t\tGenerateStartActionCase(ActionNotPresent, receiveChanActionNotPresent),\n\t}\n\n\tfor _, test := range tests {\n\t\tretry := 0\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tcw := CommWorker{\n\t\t\t\tWorker: test.Worker,\n\t\t\t}\n\t\t\tgo cw.Start()\n\t\t\tif test.Worker.ReceiverChan == receiveChanActionPresent {\n\t\t\t\tfor retry < MaxRetries {\n\t\t\t\t\ttime.Sleep(Delay)\n\t\t\t\t\tretry++\n\t\t\t\t\t_, exist := test.Worker.DTContexts.ConfirmMap.Load(\"message\")\n\t\t\t\t\tif exist {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif retry >= MaxRetries {\n\t\t\t\t\tt.Errorf(\"Start Failed to store message in ConfirmMap\")\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6952dc77c30d3e00f156a0aaf9b3f594", "score": "0.43683702", "text": "func TestStartup(t *testing.T) {\n\ttempDirPath := os.TempDir()\n\n\ttestDir := filepath.Join(tempDirPath, \"temp_dir_for_testing_startupshutdown\")\n\tdefer func() {\n\t\t// clean up after non-blocking startup function quits\n\t\ttime.Sleep(500 * time.Millisecond)\n\t\tos.RemoveAll(testDir)\n\t}()\n\tosSenitiveTestDir := filepath.FromSlash(testDir)\n\tos.RemoveAll(osSenitiveTestDir) // start with a clean slate\n\n\tvar registeredFunction func() error\n\tfakeRegister := func(fn func() error) {\n\t\tregisteredFunction = fn\n\t}\n\n\ttests := []struct {\n\t\tinput string\n\t\tshouldExecutionErr bool\n\t\tshouldRemoveErr bool\n\t}{\n\t\t// test case #0 tests proper functionality blocking commands\n\t\t{\"startup mkdir \" + osSenitiveTestDir, false, false},\n\n\t\t// test case #1 tests proper functionality of non-blocking commands\n\t\t{\"startup mkdir \" + osSenitiveTestDir + \" &\", false, true},\n\n\t\t// test case #2 tests handling of non-existent commands\n\t\t{\"startup \" + strconv.Itoa(int(time.Now().UnixNano())), true, true},\n\t}\n\n\tfor i, test := range tests {\n\t\tc := caddy.NewTestController(\"\", test.input)\n\t\terr := registerCallback(c, fakeRegister)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Expected no errors, got: %v\", err)\n\t\t}\n\t\tif registeredFunction == nil {\n\t\t\tt.Fatalf(\"Expected function to be registered, but it wasn't\")\n\t\t}\n\t\terr = registeredFunction()\n\t\tif err != nil && !test.shouldExecutionErr {\n\t\t\tt.Errorf(\"Test %d received an error of:\\n%v\", i, err)\n\t\t}\n\t\terr = os.Remove(osSenitiveTestDir)\n\t\tif err != nil && !test.shouldRemoveErr {\n\t\t\tt.Errorf(\"Test %d received an error of:\\n%v\", i, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5062ece19b84db78db3a706ac237f613", "score": "0.4367928", "text": "func SetupClasses() {\n\tsetupOnce.Do(setupUAX14Classes)\n}", "title": "" }, { "docid": "c3f83321c9bb1acdc0bb9244e735bbe8", "score": "0.43662184", "text": "func (mq *MessageQueue) Startup() {\n\tgo mq.runQueue()\n}", "title": "" }, { "docid": "e64b76e7947f318b287f31696c0f0933", "score": "0.4361156", "text": "func (e *JindoFSxEngine) ShouldSetupWorkers() (should bool, err error) {\n\truntime, err := e.getRuntime()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tswitch runtime.Status.WorkerPhase {\n\tcase datav1alpha1.RuntimePhaseNone:\n\t\tshould = true\n\tdefault:\n\t\tshould = false\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b734acde2df6babaed3b07650199d8a5", "score": "0.43600726", "text": "func SpawnWorkers() {\n\tfor i := 0; i < AppConfig.NumWorkers; i++ {\n\t\tworker := &Worker{\n\t\t\tid: i,\n\t\t\thash: uuid.NewV4(),\n\t\t\ttasks: AppConfig.ScheduledTasks,\n\t\t\tworkers: AppConfig.WorkerPool,\n\t\t\tcomplete: AppConfig.FinishedTasks,\n\t\t}\n\n\t\tgo worker.Start()\n\t\tLogWorkerStarted(worker)\n\t}\n}", "title": "" }, { "docid": "e9004b9a88c8ef19108977fed12a7717", "score": "0.4358252", "text": "func (r *CortexCompactorReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(&cortexv1alpha1.Cortex{}).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "12b53c4729328cb74b2ab2c950221f3a", "score": "0.43547177", "text": "func (mgr *MigrateMgr) WaitEnable() {\n\tmgr.taskSwitch.WaitEnable()\n}", "title": "" }, { "docid": "67362fc88c333a704d1b5c9274c61e43", "score": "0.43525222", "text": "func (r *PhScheduleReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(&primehubv1alpha1.PhSchedule{}).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "349b3e451ed4483bcdd6a1b571fce0be", "score": "0.43517393", "text": "func (p *Pool) _initWorkers() {\n\tvar nActiveWorker int = int(float64(p._maxWorkerSize) / 2)\n\tp._increaseWorker(nActiveWorker)\n}", "title": "" }, { "docid": "0f87f38e4e2c998d046237392d70f5b3", "score": "0.43401924", "text": "func (aw *AspiraWorker) InitAndStart(joinClusterAddr, initialCluster string) error {\n\trestart, err := aw.store.PastLife()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif restart {\n\t\tsnap, err := aw.store.Snapshot()\n\t\tutils.Check(err)\n\t\txlog.Logger.Info(\"RESTART\")\n\n\t\tif !raft.IsEmptySnap(snap) {\n\t\t\taw.Node.SetConfState(&snap.Metadata.ConfState) //for future snapshot\n\n\t\t\tvar state aspirapb.MembershipState\n\t\t\tutils.Check(state.Unmarshal(snap.Data))\n\t\t\taw.Node.Lock()\n\t\t\taw.Node.State = &state\n\t\t\taw.Node.Unlock()\n\t\t\tfor _, id := range snap.Metadata.ConfState.Nodes {\n\t\t\t\taw.Node.Connect(id, state.Nodes[id])\n\t\t\t}\n\t\t}\n\t\taw.Node.SetRaft(raft.RestartNode(aw.Node.Cfg))\n\t} else if len(joinClusterAddr) == 0 && len(initialCluster) == 0 {\n\t\txlog.Logger.Info(\"START\")\n\t\trpeers := make([]raft.Peer, 1)\n\t\tdata, err := aw.Node.RaftContext.Marshal()\n\t\tutils.Check(err)\n\t\trpeers[0] = raft.Peer{ID: aw.Node.Id, Context: data}\n\t\taw.Node.SetRaft(raft.StartNode(aw.Node.Cfg, rpeers))\n\t} else if len(initialCluster) != 0 {\n\t\t//initial start\n\t\txlog.Logger.Info(\"Initial START\")\n\t\tparts := strings.Split(initialCluster, \",\")\n\t\trpeers := make([]raft.Peer, len(parts))\n\t\tvar valid bool\n\t\tfor i, part := range parts {\n\n\t\t\tsegs := splitAndTrim(part, \";\")\n\t\t\tif len(segs) != 2 {\n\t\t\t\treturn errors.Errorf(\"failed to parse initialcluster, segs len is not 2\")\n\t\t\t}\n\n\t\t\tid, err := strconv.ParseUint(segs[0], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Errorf(\"failed to parse initialcluster, seg[0] is %v, err is %v\", segs[0], err)\n\t\t\t}\n\t\t\txlog.Logger.Infof(\"worker:%d, segs: %v, [%d, %s]\", aw.Node.Id, segs, aw.Node.Id, aw.Node.MyAddr)\n\t\t\tif id == aw.Node.Id && segs[1] == aw.Node.MyAddr {\n\t\t\t\tvalid = true\n\t\t\t}\n\t\t\trc := aspirapb.RaftContext{\n\t\t\t\tId: id,\n\t\t\t\tGid: aw.Node.Gid,\n\t\t\t\tAddr: segs[1],\n\t\t\t}\n\t\t\tdata, err := rc.Marshal()\n\t\t\trpeers[i] = raft.Peer{ID: id, Context: data}\n\t\t}\n\n\t\tif !valid {\n\t\t\treturn errors.Errorf(\"initial start: initialCluster doesnot include myself\")\n\t\t}\n\t\taw.Node.SetRaft(raft.StartNode(aw.Node.Cfg, rpeers))\n\t} else if len(joinClusterAddr) != 0 {\n\t\t//join remote cluster\n\t\txlog.Logger.Info(\"Join remote cluster\")\n\t\tp := conn.GetPools().Connect(joinClusterAddr)\n\t\tif p == nil {\n\t\t\tpanic(fmt.Sprintf(\"Unhealthy connection to %v\", joinClusterAddr))\n\t\t}\n\n\t\t//download snapshot first\n\t\tretry := 1\n\t\tfor {\n\t\t\terr := aw.populateSnapshot(raftpb.Snapshot{}, p)\n\t\t\tif err != nil {\n\t\t\t\txlog.Logger.Error(err.Error())\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttime.Sleep(time.Duration(retry) * time.Second)\n\t\t\tretry++\n\t\t\tif retry > 10 {\n\t\t\t\treturn errors.Errorf(\"can not download remote snapshot from %s, quit\", joinClusterAddr)\n\t\t\t}\n\t\t}\n\n\t\trestart, err := aw.store.PastLife()\n\t\tif !restart || err != nil {\n\t\t\treturn errors.Errorf(\"can not initial and replay backup snapshot\")\n\t\t}\n\t\tc := aspirapb.NewRaftClient(p.Get())\n\t\tretry = 1\n\t\tfor {\n\t\t\ttimeout := 8 * time.Second\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\t\t\t// JoinCluster can block indefinitely, raft ignores conf change proposal\n\t\t\t// if it has pending configuration.\n\t\t\t_, err := c.JoinCluster(ctx, aw.Node.RaftContext)\n\t\t\tcancel()\n\t\t\tif err == nil {\n\t\t\t\txlog.Logger.Infof(\"Success to joining cluster: %v\\n\")\n\t\t\t\tcancel()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif utils.ShouldCrash(err) {\n\t\t\t\tcancel()\n\t\t\t\tlog.Fatalf(\"Error while joining cluster: %v\", err)\n\t\t\t}\n\t\t\txlog.Logger.Errorf(\"Error while joining cluster: %v\\n, try again\", err)\n\t\t\tretry++\n\t\t\tif retry > 10 {\n\t\t\t\treturn errors.Errorf(\"Error while join remote cluster %+v, quit...\", err)\n\t\t\t}\n\t\t\ttimeout *= 2\n\t\t\tif timeout > 32*time.Second {\n\t\t\t\ttimeout = 32 * time.Second\n\t\t\t}\n\t\t\ttime.Sleep(timeout) // This is useful because JoinCluster can exit immediately.\n\t\t\tcancel()\n\t\t}\n\t\taw.Node.SetRaft(raft.StartNode(aw.Node.Cfg, nil))\n\t} else { //if len(initialCluster) ! = 0 && len(joinAddress) != 0\n\t\txlog.Logger.Fatal(\"input parameter is %+v, and %+v\", joinClusterAddr, initialCluster)\n\t}\n\n\taw.stopper.RunWorker(func() {\n\t\taw.Node.BatchAndSendMessages(aw.stopper)\n\t})\n\t/*\n\t\tas.stopper.RunWorker(func() {\n\t\t\tas.node.ReportRaftComms(as.stopper)\n\t\t})\n\t*/\n\taw.stopper.RunWorker(aw.Run)\n\treturn nil\n}", "title": "" }, { "docid": "e02bbacd3b36835c97bef40dcd0363b0", "score": "0.4333619", "text": "func (tmr *TinkerbellMachineReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(&infrastructurev1alpha3.TinkerbellMachine{}).\n\t\tWatches(\n\t\t\t&source.Kind{Type: &clusterv1.Machine{}},\n\t\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\t\tToRequests: util.MachineToInfrastructureMapFunc(infrastructurev1alpha3.GroupVersion.WithKind(\"TinkerbellMachine\")),\n\t\t\t},\n\t\t).\n\t\tComplete(tmr)\n}", "title": "" }, { "docid": "2920b3f72f4e562c1ce4cf6ffbc0dd0c", "score": "0.43199494", "text": "func waitForReady() {\n\tmax := 20\n\tfor attempts := 1; attempts <= max; attempts++ {\n\t\tres, err := http.Get(\"http://localhost:3000/ready\")\n\t\tif err == nil && res.StatusCode == http.StatusOK {\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(time.Duration(attempts) * 100 * time.Millisecond)\n\t}\n\n\tlog.Fatal(\"application did not start in time\")\n}", "title": "" }, { "docid": "d04cfe56476419785ee3ec1d9347ef24", "score": "0.43193302", "text": "func (tb *TortoiseBeacon) Start(ctx context.Context) error {\n\ttb.Log.Info(\"Starting %v with the following config: %+v\", protoName, tb.config)\n\n\ttb.initGenesisBeacons()\n\n\ttb.layerTicker = tb.clock.Subscribe()\n\n\ttb.backgroundWG.Add(1)\n\n\tgo func() {\n\t\tdefer tb.backgroundWG.Done()\n\n\t\ttb.listenLayers(ctx)\n\t}()\n\n\ttb.backgroundWG.Add(1)\n\n\tgo func() {\n\t\tdefer tb.backgroundWG.Done()\n\n\t\ttb.cleanupLoop()\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "0efaef415aba8caaa93155abc0bc5a00", "score": "0.43148524", "text": "func setup() error {\n\t// Setup global conf\n\tconfig.Datadog.SetConfigType(\"yaml\")\n\terr := config.Datadog.ReadConfig(strings.NewReader(datadogCfgString))\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfig.SetFeaturesNoCleanup(config.Docker)\n\n\tstore := workloadmeta.CreateGlobalStore(workloadmeta.NodeAgentCatalog)\n\tstore.Start(context.Background())\n\n\t// Setup tagger\n\ttagger.SetDefaultTagger(local.NewTagger(store))\n\ttagger.Init(context.Background())\n\n\t// Start compose recipes\n\tfor projectName, file := range defaultCatalog.composeFilesByProjects {\n\t\tcompose := &utils.ComposeConf{\n\t\t\tProjectName: projectName,\n\t\t\tFilePath: file,\n\t\t}\n\t\toutput, err := compose.Start()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Compose didn't start properly: %s\", string(output))\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
dbad71174b8e0f639152bb7907782272
MarshalJSON supports json.Marshaler interface
[ { "docid": "b5b54d8e2372b024b980f95b0087e66f", "score": "0.0", "text": "func (v AccountFundsResponse) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonCaf77204EncodeGithubComTarbBfapi7(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" } ]
[ { "docid": "d3167bd9d861abfe6df332d74e8a343e", "score": "0.7639992", "text": "func Marshal(input interface{}) ([]byte, error) {\n\treturn json.Marshal(input)\n}", "title": "" }, { "docid": "df176b38ae22f6dd34e880ceebe4abe9", "score": "0.75044954", "text": "func Marshal(i interface{}) (json string, err error) {\n\tif i == nil {\n\t\treturn \"\", nil\n\t}\n\n\tm, ok := i.(interface{ MarshalBinary() ([]byte, error) })\n\tif !ok {\n\t\tmarshal, err := swag.WriteJSON(m)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\treturn string(marshal), nil\n\t}\n\tmarshal, err := m.MarshalBinary()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(marshal), nil\n}", "title": "" }, { "docid": "d686d5bb499c426a4aae7f238f26f511", "score": "0.74680936", "text": "func Marshal(in interface{}) (string, error) {\n\tarr, err := json.Marshal(in)\n\treturn string(arr), err\n}", "title": "" }, { "docid": "4ad9ce9d4d9fb647d572f222c5426b9c", "score": "0.74475795", "text": "func (j JSON) Marshal(v interface{}) (out []byte, err error) {\n\treturn v.([]byte), nil\n}", "title": "" }, { "docid": "008311ac96b961f86664443780aaff4a", "score": "0.73864186", "text": "func Marshal(input interface{}) ([]byte, error) {\n\treturn json.MarshalIndent(input, \"\", \" \")\n}", "title": "" }, { "docid": "24cf5c5f8f5f05fa368198b21602cc4b", "score": "0.7364249", "text": "func JSONMarshal(t interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false) // not escape <, >, &\n\terr := encoder.Encode(t)\n\treturn buffer.Bytes(), err\n}", "title": "" }, { "docid": "541f44f3cc552d913183f9c0cc3a91c7", "score": "0.7347672", "text": "func (j JSON) MarshalJSON() ([]byte, error) { return MarshalJSON(j) }", "title": "" }, { "docid": "4ab1832af06c1032f28969dcbfd1c560", "score": "0.73200333", "text": "func Marshal(v interface{}) ([]byte, error) {\n\n\tbuf := bytes.NewBuffer([]byte{})\n\te := json.NewEncoder(buf)\n\tif IndentOutput {\n\t\te.SetIndent(\"\", \" \")\n\t}\n\tif EscapeHTML {\n\t\te.SetEscapeHTML(false)\n\t}\n\n\terr := e.Encode(v)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "5a9265852fb4506057e21c807c0b0a57", "score": "0.7249465", "text": "func (j *JSONCodec) Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "b6ce8412a9dad404e8be4b99c8615c08", "score": "0.7246611", "text": "func (m JSONContentMarshaler) Marshal(i interface{}) ([]byte, error) {\n\treturn json.Marshal(i)\n}", "title": "" }, { "docid": "7f322c52fe9fa79d027aabf1c833cd49", "score": "0.7145709", "text": "func JsonEncode(v interface{}) ([]byte, error) {\n\tvar parser = jsoniter.ConfigCompatibleWithStandardLibrary\n\n\treturn parser.Marshal(v)\n}", "title": "" }, { "docid": "06fe0aa0c9176b7f62172e5f868ddf98", "score": "0.7109613", "text": "func Marshal(v interface{}, prefix string, indent string, escapeHTML bool) ([]byte, error) {\n\tbuf := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buf)\n\tencoder.SetIndent(prefix, indent)\n\tencoder.SetEscapeHTML(escapeHTML)\n\terr := encoder.Encode(v)\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "13101d8e71df685de58f333d8f9c8c04", "score": "0.7074388", "text": "func JSONMarshaler(o interface{}) *jsonMarshaler {\n\treturn &jsonMarshaler{o: o}\n}", "title": "" }, { "docid": "4bcf223207f7f57a2a5141229e51abab", "score": "0.70681477", "text": "func marshal(v interface{}) ([]byte, error) {\n\treturn json.MarshalIndent(v, \"\", \" \")\n}", "title": "" }, { "docid": "ef6144b0e99a2965229f23d723861b6f", "score": "0.70561755", "text": "func jsonMarshal(v interface{}, indent, unEscapeHTML bool) ([]byte, error) {\n\tvar bs []byte\n\tvar err error\n\tif indent {\n\t\tbs, err = MarshalIndent(v, \"\", \" \")\n\t} else {\n\t\tbs, err = Marshal(v)\n\t}\n\n\tif err != nil {\n\t\treturn bs, err\n\t}\n\n\tif unEscapeHTML {\n\t\tbs = bytes.Replace(bs, []byte(\"\\\\u003c\"), []byte(\"<\"), -1)\n\t\tbs = bytes.Replace(bs, []byte(\"\\\\u003e\"), []byte(\">\"), -1)\n\t\tbs = bytes.Replace(bs, []byte(\"\\\\u0026\"), []byte(\"&\"), -1)\n\t}\n\n\treturn bs, nil\n}", "title": "" }, { "docid": "d07b5e96e3d807d7204956583b49ce05", "score": "0.70376456", "text": "func (c *Client) Marshal(i interface{}) (json string, err error) {\n\treturn Marshal(i)\n}", "title": "" }, { "docid": "a4573467a8c16e1d55309bceb23c1546", "score": "0.70148337", "text": "func JSONMarshal(data interface{}, hasIndent bool) (content []byte, err error) {\n\t//var content []byte\n\n\t//use json lib github.com/json-iterator/go\n\tvar json = jsoniter.ConfigCompatibleWithStandardLibrary\n\n\tif hasIndent {\n\t\tcontent, err = json.MarshalIndent(data, \"\", \" \")\n\t} else {\n\t\tcontent, err = json.Marshal(data)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn content, nil\n}", "title": "" }, { "docid": "02fda98bff5d3865d76a50da7a47b788", "score": "0.7014022", "text": "func JsonMarshal(ctx *fasthttp.RequestCtx, v interface{}) *Error {\n\tctx.SetContentType(CONTENT_TYPE_JSON)\n\terr := json.NewEncoder(ctx).Encode(v)\n\tif err != nil {\n\t\treturn &Error{INTERNAL_SERVER_ERROR, nil, err}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2704fdd9507e05210e49693a27b08e69", "score": "0.6960561", "text": "func jsonMarshal(data interface{}) (string, error) {\n\tb, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}", "title": "" }, { "docid": "f66119d153c5510aa9a473d4b7afc9da", "score": "0.69216526", "text": "func Marshal(o interface{}) ([]byte, error) {\n\tb := &bytes.Buffer{}\n\tencoder := json.NewEncoder(b)\n\tencoder.SetEscapeHTML(false)\n\n\tif err := encoder.Encode(o); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn []byte(strings.TrimSuffix(b.String(), \"\\n\")), nil\n}", "title": "" }, { "docid": "baccbaa43cc41576b4ffcd28d2436f0f", "score": "0.692121", "text": "func jsonMarshal(v interface{}) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tenc := json.NewEncoder(&buf)\n\tenc.SetEscapeHTML(false) // turn off that annoying setting\n\terr := enc.Encode(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// unlike json.Marshal(), json.Encoder.Encode() terminates with a '\\n'\n\t// which we strip off in order to match json.Marshal.\n\tb := buf.Bytes()\n\tif len(b) > 0 && b[len(b)-1] == '\\n' {\n\t\tb = b[:len(b)-1]\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "d0ea526ae873e9cedc45978a615f30ea", "score": "0.6905969", "text": "func marshal(i interface{}) []byte {\n switch v := i.(type) {\n case []byte:\n return v\n case string:\n return []byte(v)\n }\n\n byts, err := json.Marshal(i)\n if err != nil {\n return nil\n }\n return byts\n}", "title": "" }, { "docid": "b27fabc7aef8f66228256860ff553f5e", "score": "0.68865114", "text": "func (j *JsonMarshaler) Marshal(v interface{}) ([]byte, error) {\n\tswitch v.(type) {\n\tcase *management.GetResponse:\n\t\tvalue, err := protobuf.MarshalAny(v.(*management.GetResponse).Value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn json.Marshal(\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"value\": value,\n\t\t\t},\n\t\t)\n\tdefault:\n\t\treturn json.Marshal(v)\n\t}\n}", "title": "" }, { "docid": "d416ec32c6a86d4ddca23d5cd33eafe1", "score": "0.6882493", "text": "func marshalJSON(i *big.Int) ([]byte, error) {\n\ttext, err := i.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(string(text))\n}", "title": "" }, { "docid": "165720de584664b43dc1108411fe0374", "score": "0.6860088", "text": "func marshalJSON(v interface{}) ([]byte, error) {\n\tbuf := bytes.Buffer{}\n\tenc := json.NewEncoder(&buf)\n\tenc.SetEscapeHTML(false)\n\tif err := enc.Encode(v); err != nil {\n\t\treturn nil, err\n\t}\n\tbb := buf.Bytes()\n\t// omit trailing newline added by json.Encoder\n\tif len(bb) > 0 && bb[len(bb)-1] == '\\n' {\n\t\treturn bb[:len(bb)-1], nil\n\t}\n\treturn bb, nil\n}", "title": "" }, { "docid": "165720de584664b43dc1108411fe0374", "score": "0.6860088", "text": "func marshalJSON(v interface{}) ([]byte, error) {\n\tbuf := bytes.Buffer{}\n\tenc := json.NewEncoder(&buf)\n\tenc.SetEscapeHTML(false)\n\tif err := enc.Encode(v); err != nil {\n\t\treturn nil, err\n\t}\n\tbb := buf.Bytes()\n\t// omit trailing newline added by json.Encoder\n\tif len(bb) > 0 && bb[len(bb)-1] == '\\n' {\n\t\treturn bb[:len(bb)-1], nil\n\t}\n\treturn bb, nil\n}", "title": "" }, { "docid": "ac74e90bb3c7b47f2f499c1e442bfbbb", "score": "0.6817772", "text": "func JSONMarshal(content interface{}, escape bool) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tenc := json.NewEncoder(&buf)\n\tenc.SetEscapeHTML(escape)\n\tif err := enc.Encode(content); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "ac74e90bb3c7b47f2f499c1e442bfbbb", "score": "0.6817772", "text": "func JSONMarshal(content interface{}, escape bool) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tenc := json.NewEncoder(&buf)\n\tenc.SetEscapeHTML(escape)\n\tif err := enc.Encode(content); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "acc03fe3e7ceb3907bf369707dd24878", "score": "0.6799841", "text": "func MarshalJSON(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "8901afd98bcfb9d48928d0b26ef9667e", "score": "0.6789991", "text": "func toJSON(a interface{}) ([]byte, error) {\n\tbs, err := json.Marshal(a)\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"The toJSON function failed to marshall: %v\", err)\n\t}\n\treturn bs, nil\n}", "title": "" }, { "docid": "ec611c504c20a3b4fcc42fb62e8399c3", "score": "0.67716897", "text": "func jsonify(v interface{}) string { return string(mustMarshalJSON(v)) }", "title": "" }, { "docid": "caf5e248e7bf4ba54ef49d842e24513a", "score": "0.6754993", "text": "func (m marshaler) MarshalJSON() ([]byte, error) {\n\tif m == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\n\tsb := strings.Builder{}\n\tsb.WriteRune('{')\n\tfor i, kv := range m {\n\t\tsb.WriteRune('\"')\n\t\tsb.WriteString(kv.Key)\n\t\tsb.WriteRune('\"')\n\t\tsb.WriteRune(':')\n\n\t\tvalue, err := json.Marshal(kv.Value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsb.Write(value)\n\t\tif i != len(m)-1 {\n\t\t\tsb.WriteRune(',')\n\t\t}\n\t}\n\tsb.WriteRune('}')\n\treturn []byte(sb.String()), nil\n}", "title": "" }, { "docid": "a9e03087861d9e0269bac638af4ba386", "score": "0.6716432", "text": "func Marshal(obj interface{}) string {\n\t//b, err := json.Marshal(obj)\n\tb, err := json.MarshalIndent(obj, \"\", \" \")\n\t// Marshal error\n\tif logger.CheckError(err) {\n\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "6ace2d487ce1e1e88d6566b93fe7d3ae", "score": "0.67107874", "text": "func toJSON(i interface{}) ([]byte, error) {\n\treturn json.MarshalIndent(i, \"\", \" \")\n}", "title": "" }, { "docid": "92926659e1c2d79b6a8f4ac73341e9e7", "score": "0.66955316", "text": "func JSONEncoderCreator() EncoderCreator { return zapcore.NewJSONEncoder }", "title": "" }, { "docid": "595f6534ba08f1d679520b0d6fba529f", "score": "0.6674003", "text": "func (pm *PoolMember) Marshal() ([]byte, error) {\n\tjpm, err := json.Marshal(&pm)\n\treturn jpm, err\n}", "title": "" }, { "docid": "30ca7d8309908b28cfadee334d75db34", "score": "0.66575956", "text": "func (j Job) Marshal() ([]byte, error) {\n\treturn json.Marshal(j)\n}", "title": "" }, { "docid": "c6aec88bb72fc3b36abc87d21f49c664", "score": "0.66532964", "text": "func TestMarshal(t *testing.T){\n\tjsArr := []jsonStruct{\n\t\t{name:\"clark\",Age:10,Id:1},\n\t\t{name:\"clark1\",Age:11,Id:2},\n\t}\n\tbuf , err :=json.Marshal(jsArr)\n\tif err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\tos.Stdout.Write(buf)\n}", "title": "" }, { "docid": "b63b1ff423816c4ebf2ca2607de7fee1", "score": "0.6651729", "text": "func (v News) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson785d9294EncodeJsonbench(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "86860b83b027cb848cab84ef4486bce9", "score": "0.6632667", "text": "func marshalJSON(v interface{}) (io.Reader, error) {\n\tb, err := json.MarshalIndent(v, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bytes.NewReader(b), nil\n}", "title": "" }, { "docid": "5cf94b9f4efccc5d74e34c9cc15635fa", "score": "0.6611972", "text": "func MarshalJSON(value interface{}) ([]byte, error) {\n\tvar buf bytes.Buffer\n\te := json.NewEncoder(&buf)\n\te.Extend(&jsonExt)\n\terr := e.Encode(value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "8cd882da06f8fa902d0ea560c5c11dbc", "score": "0.66068244", "text": "func (v Native) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonB27eec76EncodeGithubComAtomxCoreOpenrtb9(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "037fe20c8a3d548011672dc24930f74f", "score": "0.66036785", "text": "func (v AwaitPromiseReturns) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime36(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "b6ae96f61d1d08a216197e749c9afd11", "score": "0.65902877", "text": "func (t *TestCase) Marshal(i interface{}) []byte {\n\tbody, err := json.Marshal(i)\n\tif err != nil {\n\t\tt.T.Fatalf(\"Failed to marshal data: %s [%s]\", err, CallerInfo())\n\t}\n\treturn body\n}", "title": "" }, { "docid": "855b78fb17abb36f00739944fb9ff32e", "score": "0.6583966", "text": "func (i *Interop) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(i.value)\n}", "title": "" }, { "docid": "e9efb0d953959072bada583eaa951be7", "score": "0.6576505", "text": "func marshal(data interface{}, outputFormat format,\n\tindentJSON bool) (result []byte, err error) {\n\tswitch outputFormat {\n\tcase fTOML:\n\t\tbuf := new(bytes.Buffer)\n\t\terr = toml.NewEncoder(buf).Encode(data)\n\t\tresult = buf.Bytes()\n\tcase fYAML:\n\t\tresult, err = yaml.Marshal(&data)\n\tcase fJSON:\n\t\tresult, err = json.Marshal(&data)\n\t\tif err == nil && indentJSON {\n\t\t\tbuf := new(bytes.Buffer)\n\t\t\terr = json.Indent(buf, result, \"\", \" \")\n\t\t\tresult = buf.Bytes()\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn\n}", "title": "" }, { "docid": "ae397febeddb853285f62ee162362c8f", "score": "0.65656304", "text": "func Marshal(p *Parser, ts string, v interface{}) ([]byte, error) {\n\tt, err := p.Parse(ts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := bytes.Buffer{}\n\tw := json.NewWriter(&buf)\n\tif err = t.Marshal(w, v); err != nil {\n\t\treturn nil, err\n\t}\n\terr = w.Flush()\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "54bf8fe98918caa4e95f2a7ce3ee7e8d", "score": "0.65641487", "text": "func (b *FooJSONBuilder) Marshal(orig *Foo) ([]byte, error) {\n\tret, err := b.Convert(orig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(ret)\n}", "title": "" }, { "docid": "a861cb4d40ec87af1020583ae861fe54", "score": "0.6561254", "text": "func (v Publisher) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonB27eec76EncodeGithubComAtomxCoreOpenrtb6(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "a364a8982936e3b7977930ac79e49133", "score": "0.6560909", "text": "func (v Imp) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonB27eec76EncodeGithubComAtomxCoreOpenrtb10(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "22b7dc48e9d7416bae22ce6b94def5f6", "score": "0.6558628", "text": "func MarshalJSON(j map[string]interface{}) graphql.Marshaler {\n\treturn graphql.WriterFunc(func(w io.Writer) {\n\t\tbytes, err := json.Marshal(j)\n\t\tif err != nil {\n\t\t\tfmt.Print(errors.Wrapf(err, \"while marshalling %+v scalar object\", j))\n\t\t\treturn\n\t\t}\n\t\t_, err = w.Write(bytes)\n\t\tif err != nil {\n\t\t\tfmt.Print(errors.Wrapf(err, \"while writing marshalled %+v object\", j))\n\t\t\treturn\n\t\t}\n\t})\n}", "title": "" }, { "docid": "08ae8768ce6ab6a055d05fa0eb542ff0", "score": "0.6555899", "text": "func JSON(w io.Writer, b *bundlev1.Bundle) error {\n\t// Check parameters\n\tif types.IsNil(w) {\n\t\treturn fmt.Errorf(\"unable to process nil writer\")\n\t}\n\tif b == nil {\n\t\treturn fmt.Errorf(\"unable to process nil bundle\")\n\t}\n\n\t// Initialize marshaller\n\tm := &protojson.MarshalOptions{}\n\n\t// Marshal bundle\n\tout, err := m.Marshal(b)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to produce JSON from bundle object: %w\", err)\n\t}\n\n\t// Write to writer\n\tif _, err := fmt.Fprintf(w, \"%s\", string(out)); err != nil {\n\t\treturn fmt.Errorf(\"unable to write JSON bundle: %w\", err)\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "c731ef721f86b8cfd28efd6b7d39cd64", "score": "0.654981", "text": "func JsonSortedMarshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "146a671817467c13d688b74edc3af0ad", "score": "0.65455866", "text": "func (v OnePayload) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonCdfae1c8EncodeGithubComGofuryFastjsonapi4(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "a577eaa9016e01ec4d15d8b3d172dc3b", "score": "0.652716", "text": "func (b BackendPool) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", b.ID)\n\tpopulate(objectMap, \"name\", b.Name)\n\tpopulate(objectMap, \"properties\", b.Properties)\n\tpopulate(objectMap, \"type\", b.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "080f04e25dc2978fa4de9b7923b569b9", "score": "0.6525545", "text": "func (u JSONableSlice) MarshalJSON() ([]byte, error) {\n\tvar result string\n\tif u == nil {\n\t\tresult = \"null\"\n\t} else {\n\t\tresult = strings.Join(strings.Fields(fmt.Sprintf(\"%d\", u)), \",\")\n\t}\n\treturn []byte(result), nil\n}", "title": "" }, { "docid": "99448d4f915ac7540b830ab3a2bff669", "score": "0.65203273", "text": "func toJSON(a interface{}) ([]byte, error) {\n\tbs, err := json.Marshal(a)\n\tif err != nil {\n\t\tfmt.Errorf(\"Marshal caused an error: %v\", err)\n\t}\n\treturn bs, err\n}", "title": "" }, { "docid": "6757c3be20f21b1ffc9ee50875b289a8", "score": "0.65198827", "text": "func JSON(in any) string {\n\tbs, err := json.Marshal(in)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn BinaryString(bs)\n}", "title": "" }, { "docid": "7343695dc8be6190eb6b4224d95d01ae", "score": "0.6515409", "text": "func (v Producer) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonB27eec76EncodeGithubComAtomxCoreOpenrtb7(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "19cbb5e0e0ac00d901f29f7c64c7f299", "score": "0.651402", "text": "func (j JSON) MarshalJSON() ([]byte, error) {\n\treturn json.RawMessage(j).MarshalJSON()\n}", "title": "" }, { "docid": "e8d7bd3f5292c3b47b7e842cad63b6ce", "score": "0.65085506", "text": "func mustMarshalJSON(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(\"marshal: \" + err.Error())\n\t}\n\treturn b\n}", "title": "" }, { "docid": "a3ad34f816341147353a4a5d4ee1c8db", "score": "0.65052855", "text": "func mustMarshalJSON(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(\"marshal json: \" + err.Error())\n\t}\n\treturn b\n}", "title": "" }, { "docid": "97598f846b5392080fec99f02f3dc0fd", "score": "0.6503951", "text": "func TryMarshalJSON(v interface{}) []byte {\n\tvar bytes, _ = MarshalJSON(v)\n\treturn bytes\n}", "title": "" }, { "docid": "b94e7b4097ceae3098af46c2a5317b62", "score": "0.64992386", "text": "func (p *Provisioner) Marshal() ([]byte, error) {\n\n\tm := make(map[string]interface{})\n\tm[provisioners.MapKey] = ProvisionerType\n\tm[\"bucket\"] = p.cfg.Bucket\n\tm[\"key\"] = p.cfg.Key\n\n\tout, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "6201175335cc777f279dfcb5bc4827e8", "score": "0.6492869", "text": "func marshalJSON(item interface{}) (string, error) {\n\titemString, err := json.Marshal(item)\n\tif err != nil {\n\t\tfmt.Printf(\"Error marshalling to json: %s\\n\", err)\n\t\treturn \"\", err\n\t}\n\treturn string(itemString), nil\n}", "title": "" }, { "docid": "fce754ec5c88e4357ef7b18077a8935d", "score": "0.64855313", "text": "func Fi(obj interface{}) []byte {\n\tjsonResult, _ := json.Marshal(obj)\n\treturn jsonResult\n}", "title": "" }, { "docid": "fedfb7b7bca95fe6c820b4a697f365fa", "score": "0.64806503", "text": "func (v ManyPayload) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonCdfae1c8EncodeGithubComGofuryFastjsonapi3(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "a23b2274d43cd806d25284af2b864b63", "score": "0.6475322", "text": "func JSONEncode(_ context.Context, obj interface{}) ([]byte, error) {\n\treturn json.Marshal(obj)\n}", "title": "" }, { "docid": "868ce2432a17b3308bef55ee8157df81", "score": "0.64722216", "text": "func (t *Template) Marshal() ([]byte, error) {\n\treturn json.Marshal(t)\n}", "title": "" }, { "docid": "c5b9adf1780cdb137df111838751bbe7", "score": "0.64721185", "text": "func (o FastlyService) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.UnparsedObject != nil {\n\t\treturn json.Marshal(o.UnparsedObject)\n\t}\n\ttoSerialize[\"id\"] = o.Id\n\tif o.Tags != nil {\n\t\ttoSerialize[\"tags\"] = o.Tags\n\t}\n\n\tfor key, value := range o.AdditionalProperties {\n\t\ttoSerialize[key] = value\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "7b6e532a00088ef0bfb5d2951f344641", "score": "0.6467542", "text": "func (j JitRequestPatchable) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"tags\", j.Tags)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "83b38152b41bda488162e6885bc3b753", "score": "0.64635915", "text": "func Marshal(obj interface{}, fields ...string) ([]string, []interface{}, error) {\n\treturn Encoder{}.Encode(obj, fields...)\n}", "title": "" }, { "docid": "c7dc7089a18399ac352a7dedfacf3da4", "score": "0.6462856", "text": "func (a ApplicationPatchable) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"identity\", a.Identity)\n\tpopulate(objectMap, \"kind\", a.Kind)\n\tpopulate(objectMap, \"location\", a.Location)\n\tpopulate(objectMap, \"managedBy\", a.ManagedBy)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"plan\", a.Plan)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"sku\", a.SKU)\n\tpopulate(objectMap, \"systemData\", a.SystemData)\n\tpopulate(objectMap, \"tags\", a.Tags)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c9fac8f5212785a4df00eb2bee989808", "score": "0.646123", "text": "func (j JSON) MarshalJSON() ([]byte, error) {\n\tif j == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn j, nil\n}", "title": "" }, { "docid": "4e09ab65d15b1273851fa3729d92f074", "score": "0.6457924", "text": "func (w *jsonWrapper) Encode(m Marshallable) (string, error) {\n\tserialized := m.JsonSerialize()\n\tencoded, err := json.Marshal(serialized)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(encoded), nil\n}", "title": "" }, { "docid": "9b0280e9bfa5a7049735f3b304262c62", "score": "0.6456927", "text": "func testJSONMarshal(t *testing.T, v interface{}, want string) {\n\tj, err := json.Marshal(v)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %v\", v)\n\t}\n\n\tw := new(bytes.Buffer)\n\terr = json.Compact(w, []byte(want))\n\tif err != nil {\n\t\tt.Errorf(\"String is not valid json: %s\", want)\n\t}\n\n\tif w.String() != string(j) {\n\t\t// v2, j2 := new(bytes.Buffer), new(bytes.Buffer)\n\t\t// json.Indent(v2, v.([]byte), \"\", \" \")\n\t\t// json.Indent(j2, []byte(*w), \"\", \" \")\n\t\tt.Errorf(\"json.Marshal(%q) returned %s, want %s\", v, j, w)\n\t}\n\n\t// now go the other direction and make sure things unmarshal as expected\n\tu := reflect.ValueOf(v).Interface()\n\tif err := json.Unmarshal([]byte(want), u); err != nil {\n\t\tt.Errorf(\"Unable to unmarshal JSON for %v\", want)\n\t}\n\n\tif !reflect.DeepEqual(v, u) {\n\t\tt.Errorf(\"json.Unmarshal(%q) returned %s, want %s\", want, u, v)\n\t}\n}", "title": "" }, { "docid": "da815a57c7fa9eab2da70309ff9c3071", "score": "0.64545095", "text": "func (s *Service) toJSON(in interface{}) []byte {\r\n\tvar ret, _ = json.Marshal(in)\r\n\r\n\treturn ret\r\n}", "title": "" }, { "docid": "48b354ba730163a27a7ac64c5f952b68", "score": "0.645199", "text": "func (v Pmp) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonB27eec76EncodeGithubComAtomxCoreOpenrtb8(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "04cf4ff3403562d15d2ec44e97315d51", "score": "0.64493287", "text": "func testJSONMarshal(t *testing.T, v interface{}, want string) {\n\tj, err := json.Marshal(v)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %v\", v)\n\t}\n\n\tw := new(bytes.Buffer)\n\terr = json.Compact(w, []byte(want))\n\tif err != nil {\n\t\tt.Errorf(\"String is` not valid json: %s\", want)\n\t}\n\n\tif w.String() != string(j) {\n\t\tt.Errorf(\"json.Marshal(%q) returned %s, want %s\", v, j, w)\n\t}\n\n\t// now go the other direction and make sure things unmarshal as expected\n\tu := reflect.ValueOf(v).Interface()\n\tif err := json.Unmarshal([]byte(want), u); err != nil {\n\t\tt.Errorf(\"Unable to unmarshal JSON for %v\", want)\n\t}\n\n\tif !reflect.DeepEqual(v, u) {\n\t\tt.Errorf(\"json.Unmarshal(%q) returned %s, want %s\", want, u, v)\n\t}\n}", "title": "" }, { "docid": "939239458275b6cae091a5ad0ceb7cd6", "score": "0.6446525", "text": "func Marshal(i interface{}) ([]byte, error) {\n\tswitch t := i.(type) {\n\tcase *InterpretRequest:\n\t\treturn marshalInterpretRequest(t)\n\tcase *InterpretResponse:\n\t\treturn marshalInterpretResponse(t)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unable to marshall %v\", i)\n\t}\n}", "title": "" }, { "docid": "a2aa4df80f68f0219bc91c46ae7369ac", "score": "0.6439837", "text": "func (c *CustomJSON) MarshalJSON() ([]byte, error) {\n\tvar v *interface{}\n\tif c != nil {\n\t\tv = &c.Value\n\t}\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "7cf1cdd279cd6f1ae12a3c3aba8999c8", "score": "0.6439042", "text": "func (b *FugaJSONBuilder) Marshal(orig *Fuga) ([]byte, error) {\n\tret, err := b.Convert(orig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(ret)\n}", "title": "" }, { "docid": "18f5034879ac12542c529e1b410f5e2a", "score": "0.64383376", "text": "func (j *OpenAPI) MarshalJSON() ([]byte, error) {\n\tvar buf fflib.Buffer\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn buf.Bytes(), nil\n\t}\n\terr := j.MarshalJSONBuf(&buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "1872449ba144c7f786e17998951a6f61", "score": "0.64321274", "text": "func (j jsonString) MarshalJSON() ([]byte, error) {\n\treturn []byte(j), nil\n}", "title": "" }, { "docid": "36a360aa018efec6c97731302c251908", "score": "0.642796", "text": "func marshalJSONNode(_ marshalNode) marshalNode {\n\treturn func(i interface{}) ([]byte, error) {\n\t\treturn json.Marshal(i)\n\t}\n}", "title": "" }, { "docid": "ee112bc954348c8bca9e12ab0d80d587", "score": "0.642593", "text": "func (v CallFunctionOnReturns) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime32(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "71b7624d4d82a8409cf25be52d93f125", "score": "0.6423322", "text": "func (p PatchObject) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"tags\", p.Tags)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d74f7b1e7a6b5cb8bdb79805e8c8f969", "score": "0.64218134", "text": "func toJSON(a interface{}) ([]byte, error) {\n\tmarshal, err := json.Marshal(a)\n\n\tif err != nil {\n\t\terr = fmt.Errorf(\"custom error: %v\", err.Error())\n\t}\n\n\treturn marshal, err\n}", "title": "" }, { "docid": "aec2c286de63af1f706a5d14fa245782", "score": "0.6419188", "text": "func (v EventConsoleAPICalled) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime22(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "80d3d4dc5665af9905189e3cf84d3118", "score": "0.64174765", "text": "func (root *Root) Marshal() ([]byte, error) {\n\tb := new(bytes.Buffer)\n\tjh := new(codec.JsonHandle)\n\tjh.Canonical = true\n\tenc := codec.NewEncoder(b, jh)\n\n\tif err := enc.Encode(root); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn b.Bytes(), nil\n}", "title": "" }, { "docid": "28b442d37885ee9526ba2b262e1ff713", "score": "0.64092445", "text": "func (x Major) MarshalJSON() ([]byte, error) {\n\treturn jsonplugin.DefaultMarshalerConfig.Marshal(x)\n}", "title": "" }, { "docid": "f55c6b15a66a066ea46f6aa0358dd284", "score": "0.6407749", "text": "func Marshal(v interface{}) ([]byte, error) { /* … */ }", "title": "" }, { "docid": "66c74022c8de4e1f7d1ff94e5a562756", "score": "0.6405904", "text": "func (c MarshalerConfig) Marshal(m Marshaler) ([]byte, error) {\n\ts := NewMarshalState(c)\n\tm.MarshalProtoJSON(s)\n\treturn s.Bytes()\n}", "title": "" }, { "docid": "63ad669df2a495bb1fe550159f190499", "score": "0.64018893", "text": "func jsonify(jsonable interface{}) (string, error) {\n\tjs, err := json.MarshalIndent(jsonable, \"\", \" \")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(js), nil\n}", "title": "" }, { "docid": "f0447ee0d275c831bc8fd72f8fc226e5", "score": "0.6400196", "text": "func MarshalRegistry(registry *portainer.Registry) ([]byte, error) {\n\treturn json.Marshal(registry)\n}", "title": "" }, { "docid": "6a0966e88e60d7027bd49b9e2bfc43bb", "score": "0.63997525", "text": "func MarshalMessageSetJSON(interface{}) ([]byte, error) {\n\treturn nil, errors.New(\"proto: not implemented\")\n}", "title": "" }, { "docid": "813a860ae0e75a62147af04d1e78d77d", "score": "0.63964707", "text": "func JSONEncode(source interface{}, unescape bool) ([]byte, error) {\n\tbytesResult, err := json.Marshal(source)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\tif unescape {\n\t\tbytesResult = bytes.Replace(bytesResult, []byte(\"\\\\u003c\"), []byte(\"<\"), -1)\n\t\tbytesResult = bytes.Replace(bytesResult, []byte(\"\\\\u003e\"), []byte(\">\"), -1)\n\t\tbytesResult = bytes.Replace(bytesResult, []byte(\"\\\\u0026\"), []byte(\"&\"), -1)\n\t}\n\n\treturn bytesResult, nil\n}", "title": "" }, { "docid": "d9514a88d3a897360052204a9fc64864", "score": "0.6390712", "text": "func (m RuntimeAPI) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 1)\n\n\taO0, err := swag.WriteJSON(m.BindParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_parts = append(_parts, aO0)\n\n\t// now for regular properties\n\tvar propsRuntimeAPI struct {\n\t\tAddress *string `json:\"address\"`\n\t}\n\tpropsRuntimeAPI.Address = m.Address\n\n\tjsonDataPropsRuntimeAPI, errRuntimeAPI := swag.WriteJSON(propsRuntimeAPI)\n\tif errRuntimeAPI != nil {\n\t\treturn nil, errRuntimeAPI\n\t}\n\t_parts = append(_parts, jsonDataPropsRuntimeAPI)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "5e35925ae3c65230c3dece938070c4de", "score": "0.6387211", "text": "func (v Publisher) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonB27eec76EncodeGithubComAtomxCoreOpenrtb6(w, v)\n}", "title": "" }, { "docid": "574c554bb64d4257fe8379a9e69b3144", "score": "0.63855594", "text": "func (v Paging) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson3c4140EncodeGithubComIfreddyrondonCaptureAppListingPaging(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "0c32edb9cdbecf551a73ae8919bb23f8", "score": "0.6385485", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tvar b bytes.Buffer\n\terr := NewEncoder(&b).Encode(v)\n\treturn b.Bytes(), err\n}", "title": "" } ]
c30d3d0f870196981b0dd4587c678811
NewTransferApplianceClientWithConfigurationProvider Creates a new default TransferAppliance client with the given configuration provider. the configuration provider will be used for the default signer as well as reading the region
[ { "docid": "276a09074b282c52a486259be83d6d9b", "score": "0.8228614", "text": "func NewTransferApplianceClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client TransferApplianceClient, err error) {\n\tif enabled := common.CheckForEnabledServices(\"dts\"); !enabled {\n\t\treturn client, fmt.Errorf(\"the Alloy configuration disabled this service, this behavior is controlled by OciSdkEnabledServicesMap variables. Please check if your local alloy_config file configured the service you're targeting or contact the cloud provider on the availability of this service\")\n\t}\n\tprovider, err := auth.GetGenericConfigurationProvider(configProvider)\n\tif err != nil {\n\t\treturn client, err\n\t}\n\tbaseClient, e := common.NewClientWithConfig(provider)\n\tif e != nil {\n\t\treturn client, e\n\t}\n\treturn newTransferApplianceClientFromBaseClient(baseClient, provider)\n}", "title": "" } ]
[ { "docid": "498d2e9123ff87fdd1eef0e5bd376c20", "score": "0.6582696", "text": "func (client *TransferApplianceClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "title": "" }, { "docid": "9243c11099ef1b42cb2c80e184b5ded1", "score": "0.63474655", "text": "func (client *TransferApplianceClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error {\n\tif ok, err := common.IsConfigurationProviderValid(configProvider); !ok {\n\t\treturn err\n\t}\n\n\t// Error has been checked already\n\tregion, _ := configProvider.Region()\n\tclient.SetRegion(region)\n\tif client.Host == \"\" {\n\t\treturn fmt.Errorf(\"invalid region or Host. Endpoint cannot be constructed without endpointServiceName or serviceEndpointTemplate for a dotted region\")\n\t}\n\tclient.config = &configProvider\n\treturn nil\n}", "title": "" }, { "docid": "6573df9711d0ca75f9491e261b7fe5ac", "score": "0.5888725", "text": "func NewRecipientInvitationClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client RecipientInvitationClient, err error) {\n\tif enabled := common.CheckForEnabledServices(\"tenantmanagercontrolplane\"); !enabled {\n\t\treturn client, fmt.Errorf(\"the Alloy configuration disabled this service, this behavior is controlled by OciSdkEnabledServicesMap variables. Please check if your local alloy_config file configured the service you're targeting or contact the cloud provider on the availability of this service\")\n\t}\n\tprovider, err := auth.GetGenericConfigurationProvider(configProvider)\n\tif err != nil {\n\t\treturn client, err\n\t}\n\tbaseClient, e := common.NewClientWithConfig(provider)\n\tif e != nil {\n\t\treturn client, e\n\t}\n\treturn newRecipientInvitationClientFromBaseClient(baseClient, provider)\n}", "title": "" }, { "docid": "8605e4a4cfde1fe8e1d355a9e3b5b9a5", "score": "0.58639944", "text": "func NewClientWithConfig(configProvider ConfigurationProvider) (client BaseClient, err error) {\n\tvar ok bool\n\tif ok, err = IsConfigurationProviderValid(configProvider); !ok {\n\t\terr = fmt.Errorf(\"can not create client, bad configuration: %s\", err.Error())\n\t\treturn\n\t}\n\n\tclient = defaultBaseClient(configProvider)\n\treturn\n}", "title": "" }, { "docid": "33db6b5f712cd218ab01cc4ba33d2244", "score": "0.5824212", "text": "func NewAuthenticationClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client AuthenticationClient, err error) {\n\tbaseClient, err := common.NewClientWithConfig(configProvider)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tclient = AuthenticationClient{BaseClient: baseClient}\n\tclient.BasePath = \"\"\n\terr = client.setConfigurationProvider(configProvider)\n\treturn\n}", "title": "" }, { "docid": "ec4db2672c41b17e37aac25dec91083f", "score": "0.5683153", "text": "func (client *KmsVaultClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "title": "" }, { "docid": "3dbd7ec6452aa9fd10a960d893c64ada", "score": "0.56488776", "text": "func NewDashboardGroupClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client DashboardGroupClient, err error) {\n\tif enabled := common.CheckForEnabledServices(\"dashboardservice\"); !enabled {\n\t\treturn client, fmt.Errorf(\"the Alloy configuration disabled this service, this behavior is controlled by OciSdkEnabledServicesMap variables. Please check if your local alloy_config file configured the service you're targeting or contact the cloud provider on the availability of this service\")\n\t}\n\tprovider, err := auth.GetGenericConfigurationProvider(configProvider)\n\tif err != nil {\n\t\treturn client, err\n\t}\n\tbaseClient, e := common.NewClientWithConfig(provider)\n\tif e != nil {\n\t\treturn client, e\n\t}\n\treturn newDashboardGroupClientFromBaseClient(baseClient, provider)\n}", "title": "" }, { "docid": "2f84393f44c57e5ecd47986abc25e52f", "score": "0.5645206", "text": "func NewDatabaseClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client DatabaseClient, err error) {\n\tbaseClient, err := common.NewClientWithConfig(configProvider)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tclient = DatabaseClient{BaseClient: baseClient}\n\tclient.BasePath = \"20160918\"\n\terr = client.setConfigurationProvider(configProvider)\n\treturn\n}", "title": "" }, { "docid": "6ea85e6b7d23a7e8d89679c7b33e053f", "score": "0.5639214", "text": "func (client *RecipientInvitationClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "title": "" }, { "docid": "025b592c299201f503631334d99d723f", "score": "0.563072", "text": "func NewTransferApplianceClientWithOboToken(configProvider common.ConfigurationProvider, oboToken string) (client TransferApplianceClient, err error) {\n\tbaseClient, err := common.NewClientWithOboToken(configProvider, oboToken)\n\tif err != nil {\n\t\treturn client, err\n\t}\n\n\treturn newTransferApplianceClientFromBaseClient(baseClient, configProvider)\n}", "title": "" }, { "docid": "4e06f40e6c55cb25b220c689e59dc81c", "score": "0.55925727", "text": "func NewScheduledJobClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client ScheduledJobClient, err error) {\n\tif enabled := common.CheckForEnabledServices(\"osmanagementhub\"); !enabled {\n\t\treturn client, fmt.Errorf(\"the Alloy configuration disabled this service, this behavior is controlled by OciSdkEnabledServicesMap variables. Please check if your local alloy_config file configured the service you're targeting or contact the cloud provider on the availability of this service\")\n\t}\n\tprovider, err := auth.GetGenericConfigurationProvider(configProvider)\n\tif err != nil {\n\t\treturn client, err\n\t}\n\tbaseClient, e := common.NewClientWithConfig(provider)\n\tif e != nil {\n\t\treturn client, e\n\t}\n\treturn newScheduledJobClientFromBaseClient(baseClient, provider)\n}", "title": "" }, { "docid": "661e9e99b96b87d63eab9ccdfc9f52ea", "score": "0.55755234", "text": "func NewKmsVaultClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client KmsVaultClient, err error) {\n\tbaseClient, err := common.NewClientWithConfig(configProvider)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tclient = KmsVaultClient{BaseClient: baseClient}\n\tclient.BasePath = \"\"\n\terr = client.setConfigurationProvider(configProvider)\n\treturn\n}", "title": "" }, { "docid": "14ef4b0944f051595bad2bb4b231e67b", "score": "0.55740845", "text": "func (client *AuthenticationClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error {\n\tif ok, err := common.IsConfigurationProviderValid(configProvider); !ok {\n\t\treturn err\n\t}\n\n\t// Error has been checked already\n\tregion, _ := configProvider.Region()\n\tclient.config = &configProvider\n\tif regionURL, ok := os.LookupEnv(\"OCI_SDK_AUTH_CLIENT_REGION_URL\"); ok {\n\t\tclient.Host = regionURL\n\t} else {\n\t\tclient.Host = fmt.Sprintf(common.DefaultHostURLTemplate, \"auth\", string(region))\n\t}\n\tclient.BasePath = \"/v1\"\n\treturn nil\n}", "title": "" }, { "docid": "51c082147d8639c9763f5d5d981217a3", "score": "0.55379903", "text": "func NewFileStorageClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client FileStorageClient, err error) {\n\tprovider, err := auth.GetGenericConfigurationProvider(configProvider)\n\tif err != nil {\n\t\treturn client, err\n\t}\n\tbaseClient, e := common.NewClientWithConfig(provider)\n\tif e != nil {\n\t\treturn client, e\n\t}\n\treturn newFileStorageClientFromBaseClient(baseClient, provider)\n}", "title": "" }, { "docid": "26e9cf537fac18a7491a94ca44109306", "score": "0.55050576", "text": "func configureProvider(d *schema.ResourceData) (interface{}, error) {\n\tbaseURL := d.Get(\"root_url\").(string)\n\n\ttransport := httptransport.New(baseURL, \"/\", nil)\n\ttransport.Producers[\"application/json\"] = runtime.JSONProducer()\n\ttransport.SetDebug(true)\n\tclient := billtrustclient.New(transport, strfmt.Default)\n\n\treturn client, nil\n}", "title": "" }, { "docid": "a35c5608c5bed5ae32c5ae08d85b4d3e", "score": "0.5473156", "text": "func (client *RecipientInvitationClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error {\n\tif ok, err := common.IsConfigurationProviderValid(configProvider); !ok {\n\t\treturn err\n\t}\n\n\t// Error has been checked already\n\tregion, _ := configProvider.Region()\n\tclient.SetRegion(region)\n\tif client.Host == \"\" {\n\t\treturn fmt.Errorf(\"invalid region or Host. Endpoint cannot be constructed without endpointServiceName or serviceEndpointTemplate for a dotted region\")\n\t}\n\tclient.config = &configProvider\n\treturn nil\n}", "title": "" }, { "docid": "d39616e8575a67230c0fd0eefcc726f9", "score": "0.5379881", "text": "func (client *KmsVaultClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error {\n\tif ok, err := common.IsConfigurationProviderValid(configProvider); !ok {\n\t\treturn err\n\t}\n\n\t// Error has been checked already\n\tregion, _ := configProvider.Region()\n\tclient.SetRegion(region)\n\tclient.config = &configProvider\n\treturn nil\n}", "title": "" }, { "docid": "61d0b3dab27a972aade14be04c72c271", "score": "0.53513783", "text": "func NewConfigurationProvider(cfg *Config) (common.ConfigurationProvider, error) {\n\tvar conf common.ConfigurationProvider\n\tif cfg != nil {\n\t\terr := cfg.Validate()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif cfg.UseInstancePrincipals {\n\t\t\tcp, err := auth.InstancePrincipalConfigurationProvider()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn cp, nil\n\t\t}\n\n\t\tconf = common.NewRawConfigurationProvider(\n\t\t\tcfg.Auth.TenancyID,\n\t\t\tcfg.Auth.UserID,\n\t\t\tcfg.Auth.Region,\n\t\t\tcfg.Auth.Fingerprint,\n\t\t\tcfg.Auth.PrivateKey,\n\t\t\tcommon.String(cfg.Auth.Passphrase))\n\n\t} else {\n\t\tconf = common.DefaultConfigProvider()\n\t}\n\n\treturn conf, nil\n}", "title": "" }, { "docid": "a6e3b016526aebba058ede271610584a", "score": "0.5349137", "text": "func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) {\n\tvar (\n\t\tdiags diag.Diagnostics\n\t\tapiVersion = d.Get(\"api_version\").(string)\n\t\thost = d.Get(\"host\").(string)\n\t)\n\tcli := NewClient(host, apiVersion)\n\treturn cli, diags\n}", "title": "" }, { "docid": "67b750c7eb8c4799e88b44b71d23228f", "score": "0.53384787", "text": "func (client *ScheduledJobClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "title": "" }, { "docid": "c4fa7b9f9672163a4109c181df083e43", "score": "0.5292875", "text": "func (client *FileStorageClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "title": "" }, { "docid": "e3d966e0e5d2561daad70e06d7b31622", "score": "0.5292509", "text": "func providerConfigure(d *schema.ResourceData) (interface{}, error) {\n\tconfig, err := NewConfig(d)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmyClient, err := config.Client()\n\t// myClient.SwitchDebug()\n\tlog.Printf(\"[VMWS] Fi: provider.go Fu: providerConfigure Obj:%#v\\n\", d)\n\tlog.Printf(\"[VMWS] Fi: provider.go Fu: providerConfigure Obj:%#v\\n\", config)\n\treturn myClient, err\n}", "title": "" }, { "docid": "d0efc50a9cca064f8812ae04cd45ff70", "score": "0.52793705", "text": "func NewConfigurationProvider(t mockConstructorTestingTNewConfigurationProvider) *ConfigurationProvider {\n\tmock := &ConfigurationProvider{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "19ef34dc9dd2746ca03814959c82cade", "score": "0.52585655", "text": "func NewProvider(ctx context.Context, config map[string]string) (blockstorage.Provider, error) {\n\tazCli, err := NewClient(ctx, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AdStorage{azCli: azCli}, nil\n}", "title": "" }, { "docid": "000db777478aa38ea0ee7f176bba3d87", "score": "0.52176845", "text": "func (client *DashboardGroupClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "title": "" }, { "docid": "6717f45b43fc719d2d1109907bfc71ed", "score": "0.52087176", "text": "func (client *DatabaseClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "title": "" }, { "docid": "a843374f8448c2702bf19a7df62cf03e", "score": "0.51620805", "text": "func NewProvider(tlsConfigProvider TLSClientConfigurationProvider) Provider {\n\treturn &provider{tlsConfigProvider: tlsConfigProvider}\n}", "title": "" }, { "docid": "c3b5b7bee8d94120eea968ad4b38240b", "score": "0.51530665", "text": "func (client *ScheduledJobClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error {\n\tif ok, err := common.IsConfigurationProviderValid(configProvider); !ok {\n\t\treturn err\n\t}\n\n\t// Error has been checked already\n\tregion, _ := configProvider.Region()\n\tclient.SetRegion(region)\n\tif client.Host == \"\" {\n\t\treturn fmt.Errorf(\"invalid region or Host. Endpoint cannot be constructed without endpointServiceName or serviceEndpointTemplate for a dotted region\")\n\t}\n\tclient.config = &configProvider\n\treturn nil\n}", "title": "" }, { "docid": "7d54978cf8cfe2f5d02faa56b65818eb", "score": "0.5144542", "text": "func (client *FileStorageClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error {\n\tif ok, err := common.IsConfigurationProviderValid(configProvider); !ok {\n\t\treturn err\n\t}\n\n\t// Error has been checked already\n\tregion, _ := configProvider.Region()\n\tclient.SetRegion(region)\n\tif client.Host == \"\" {\n\t\treturn fmt.Errorf(\"Invalid region or Host. Endpoint cannot be constructed without endpointServiceName or serviceEndpointTemplate for a dotted region\")\n\t}\n\tclient.config = &configProvider\n\treturn nil\n}", "title": "" }, { "docid": "8bad159cb47c79cc2ab9beed86f13801", "score": "0.51076204", "text": "func ClientFromConfig(cfg *Config) (*Client, error) {\n\tvar gc Client\n\n\t// Set up Vault client with default token\n\tconf := api.DefaultConfig()\n\tclient, err := api.NewClient(conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.SetToken(cfg.GuardianToken)\n\tgc.vault = client\n\n\t// Set up Okta client\n\toktaConfig := okta.NewConfig().WithOrgUrl(fmt.Sprintf(\"https://%s.okta.com\", cfg.OktaURL)).WithToken(cfg.OktaToken)\n\toktaClient := okta.NewClient(oktaConfig, nil, nil)\n\tgc.okta = oktaClient\n\treturn &gc, nil\n}", "title": "" }, { "docid": "da71fdcfa6da6eff401c53493e9ad65d", "score": "0.5094778", "text": "func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) {\n\tvar diags diag.Diagnostics\n\ttoken := d.Get(schemaKeyToken).(string)\n\tprojectToken := d.Get(projectKeyToken).(string)\n\tbaseURL := d.Get(schemaKeyBaseURL).(string)\n\tc := client.NewClient(baseURL, token)\n\tpc := client.NewClient(baseURL, projectToken)\n\treturn map[string]*client.RollbarAPIClient{schemaKeyToken: c, projectKeyToken: pc}, diags\n}", "title": "" }, { "docid": "18d03e183866902aa3fdccaeebd107c3", "score": "0.5074554", "text": "func (client *DashboardGroupClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error {\n\tif ok, err := common.IsConfigurationProviderValid(configProvider); !ok {\n\t\treturn err\n\t}\n\n\t// Error has been checked already\n\tregion, _ := configProvider.Region()\n\tclient.SetRegion(region)\n\tif client.Host == \"\" {\n\t\treturn fmt.Errorf(\"invalid region or Host. Endpoint cannot be constructed without endpointServiceName or serviceEndpointTemplate for a dotted region\")\n\t}\n\tclient.config = &configProvider\n\treturn nil\n}", "title": "" }, { "docid": "2ef1bbc6ed19aac9d2621a8ba03262cb", "score": "0.50623745", "text": "func (client *DatabaseClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error {\n\tif ok, err := common.IsConfigurationProviderValid(configProvider); !ok {\n\t\treturn err\n\t}\n\n\t// Error has been checked already\n\tregion, _ := configProvider.Region()\n\tclient.SetRegion(region)\n\tclient.config = &configProvider\n\treturn nil\n}", "title": "" }, { "docid": "cd2ceb09bfd34727f9225a5eac6cc23f", "score": "0.50594294", "text": "func NewClientWithConfiguration(ctx context.Context) *ProjectManagerClient {\n\treturn &ProjectManagerClient{\n\t\tctx: ctx,\n\t\tcfg: &Config{\n\t\t\tAPIServer: viper.GetString(\"bcs.apiserver\"),\n\t\t\tAuthToken: viper.GetString(\"bcs.token\"),\n\t\t\tOperator: viper.GetString(\"bcs.operator\"),\n\t\t},\n\t\tdebug: viper.GetBool(\"debug\"),\n\t}\n}", "title": "" }, { "docid": "a54abfe199c52715a1a2a8679ac758d0", "score": "0.5052826", "text": "func RouteTableClientProvider(client client.Client) networking_enterprise_mesh_gloo_solo_io_v1beta1.RouteTableClient {\n\treturn networking_enterprise_mesh_gloo_solo_io_v1beta1.NewRouteTableClient(client)\n}", "title": "" }, { "docid": "c2e7217569b550008200d826d4114cab", "score": "0.5002085", "text": "func NewClient(cfg Config) (*Client, error) {\n\tu, err := url.Parse(strings.TrimRight(cfg.Address, \"/\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttp, err := transport.New(transport.Config{\n\t\tURL: u,\n\t\tRegion: cfg.Region,\n\t\tSigner: cfg.Signer,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create transport: %s\", err)\n\t}\n\n\tclient := &Client{\n\t\tTransport: tp,\n\t\tAPI: api.New(tp),\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "fdb6753dc5e8eb86ee5e13f8d17a1ce1", "score": "0.49768275", "text": "func SettingsClientProvider(client client.Client) gloo_solo_io_v1.SettingsClient {\n\treturn gloo_solo_io_v1.NewSettingsClient(client)\n}", "title": "" }, { "docid": "ccc15ea6a612a2018b5d11020a1b93d1", "score": "0.49205574", "text": "func CreateClientWithConfig(config *vaultapi.Config, token string) (*Client, error) {\n\tclient, err := vaultapi.NewClient(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tapiClient := &APIClientImpl{client}\n\tapiClient.SetToken(token)\n\treturn CreateClientWithAPIClient(apiClient), nil\n}", "title": "" }, { "docid": "43f0367f1d22e67db96b53ae2774d119", "score": "0.49118316", "text": "func UpstreamClientProvider(client client.Client) gloo_solo_io_v1.UpstreamClient {\n\treturn gloo_solo_io_v1.NewUpstreamClient(client)\n}", "title": "" }, { "docid": "f5976bac1be342ee12fe20e8d21324ab", "score": "0.48869878", "text": "func NewClient(cfg *aws.Config) Client { return Client{*sts.New(*cfg)} }", "title": "" }, { "docid": "c953b45ab50ee2d7d2212ef34652bcee", "score": "0.48790568", "text": "func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) {\n\tapiKey := d.Get(\"API_KEY\").(string)\n\tsubdomain := d.Get(\"subdomain\").(string)\n\n\tif apiKey == \"\" {\n\t\terr := errors.New(\"API_KEY is not set or empty.\")\n\t\treturn nil, diag.FromErr(err)\n\t}\n\tif subdomain == \"\" {\n\t\terr := errors.New(\"BAMBOOHR_SUBDOMAIN is not set or empty.\")\n\t\treturn nil, diag.FromErr(err)\n\t}\n\n\treturn buildClient(subdomain, apiKey)\n}", "title": "" }, { "docid": "6e584c5fd14b515430c1bfccce5bc363", "score": "0.48719648", "text": "func WithTraceProvider(tp trace.TracerProvider) ClientOption {\n\treturn func(o *ClientOptions) {\n\t\tif tp != nil {\n\t\t\to.tp = tp\n\t\t} else {\n\t\t\to.tp = trace.NewNoopTracerProvider()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4a73f0b83cfb6559f5763b4a726e0fa2", "score": "0.48611325", "text": "func New(configuration *config.Config) *Client {\n\treturn NewWithFactory(configuration, keyvault.NewVaultsClient)\n}", "title": "" }, { "docid": "62e2b7e00736b0c18e0567d21c1dc36d", "score": "0.4856977", "text": "func NewClient(h http.Header, token, region *string) *Client {\n\tclient := Client{Region: region, Token: token}\n\n\tclient.HTTPClient = &http.Client{\n\t\tTimeout: time.Second * 30,\n\t}\n\n\tif u, err := url.Parse(BaseURL); err != nil {\n\t\tpanic(\"Could not init Provider client to Conformity\")\n\t} else {\n\t\tclient.BaseUrl = u\n\t}\n\n\tif h != nil {\n\t\tclient.Headers = h\n\t}\n\n\treturn &client\n}", "title": "" }, { "docid": "770c1b55db14e61efc2200c59a09bf4c", "score": "0.48333988", "text": "func newSvcProviderConfig(config *Config) (*svcProvider, error) {\n\tif config == nil {\n\t\treturn nil, errors.New(\"joker: the configuration of the DNS provider is nil\")\n\t}\n\n\tif config.Username == \"\" || config.Password == \"\" {\n\t\treturn nil, errors.New(\"joker: credentials missing\")\n\t}\n\n\tclient := svc.NewClient(config.Username, config.Password)\n\n\treturn &svcProvider{config: config, client: client}, nil\n}", "title": "" }, { "docid": "b0af7b821d5ff7eb7d7748ced1e0c561", "score": "0.48307496", "text": "func New(conf ClientConfig) (*OktaClient, error) {\n\tif conf.OktaDomain == \"\" {\n\t\treturn nil, fmt.Errorf(\"ClientConfig.OktaDomain can't be blank\")\n\t}\n\n\tif conf.Prompts == nil {\n\t\treturn nil, fmt.Errorf(\"ClientConfig.Prompts can't be nil\")\n\t}\n\n\trootURL, err := url.Parse(conf.OktaDomain)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ClientConfig.OktaDomain is not valid: %v\", err)\n\t}\n\n\tif rootURL.Scheme == \"\" {\n\t\trootURL.Scheme = \"https\"\n\t\trootURL.Host = rootURL.Path\n\t}\n\n\treturn &OktaClient{\n\t\tdomain: rootURL.Host,\n\t\trootURL: fmt.Sprintf(\"%s://%s\", rootURL.Scheme, rootURL.Host),\n\t\tprompts: conf.Prompts,\n\t\tlogger: conf.DebugLogger,\n\t\thttpClient: &http.Client{\n\t\t\tTransport: conf.RoundTripper,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "e77c524d350fb12d516b78db3e4b0a80", "score": "0.481474", "text": "func NewClient(config *Config) (*Client, error) {\n\tbaseURL := getBaseURLFromEnviorment(config.Enviorment)\n\tauthHandler := &auth{\n\t\tclientID: config.ClientKey,\n\t\tclientSecret: config.ClientSecret,\n\t\tbaseURL: baseURL,\n\t}\n\n\tauthHandler.FetchToken()\n\n\tcustomerHandler := &customer{\n\t\tauthHandler: authHandler,\n\t\tbaseURL: baseURL,\n\t}\n\n\trootHandler := &account{\n\t\tauthHandler: authHandler,\n\t\tbaseURL: baseURL,\n\t}\n\n\t_, err := rootHandler.setupRoot()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbusinessClassificationsHandler := &business{\n\t\tauthHandler: authHandler,\n\t\tbaseURL: baseURL,\n\t}\n\n\tpaymentHandler := &massPayment{\n\t\tauthHandler: authHandler,\n\t\tbaseURL: baseURL,\n\t}\n\n\twebhookHandler := &webhook{\n\t\tauthHandler: authHandler,\n\t\tbaseURL: baseURL,\n\t}\n\n\ttransferHandler := &transfer{\n\t\tauthHandler: authHandler,\n\t\tbaseURL: baseURL,\n\t}\n\n\tfundingSourceHandler := &fundingSource{\n\t\tauthHandler: authHandler,\n\t\tbaseURL: baseURL,\n\t}\n\n\treturn &Client{\n\t\tAuth: authHandler,\n\t\tCustomer: customerHandler,\n\t\tAccount: rootHandler,\n\t\tBusiness: businessClassificationsHandler,\n\t\tPayment: paymentHandler,\n\t\tWebhookSubscriptions: webhookHandler,\n\t\tTransfer: transferHandler,\n\t\tFundingSource: fundingSourceHandler,\n\t}, nil\n}", "title": "" }, { "docid": "10e67886698b94639ce130db68e19389", "score": "0.4801884", "text": "func Provider(cfg Config) *Vault {\n\thttpClient := &http.Client{Timeout: cfg.Timeout}\n\tclient, err := api.NewClient(&api.Config{Address: cfg.Address, HttpClient: httpClient})\n\tif err != nil {\n\t\treturn nil\n\t}\n\tclient.SetToken(cfg.Token)\n\n\treturn &Vault{client: client, cfg: cfg}\n}", "title": "" }, { "docid": "d8f5bc3f906ba7be26ae49fb56bcaa0f", "score": "0.4774606", "text": "func (sdk *FabricSDK) ConfigProvider() apiconfig.Config {\n\treturn sdk.configProvider\n}", "title": "" }, { "docid": "3f1007fdfdbae134561b9a1f51bd5648", "score": "0.47346458", "text": "func ExamplePartnerConfigurationsClient_AuthorizePartner() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armeventgrid.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewPartnerConfigurationsClient().AuthorizePartner(ctx, \"examplerg\", armeventgrid.Partner{\n\t\tAuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-01-28T01:20:55.142Z\"); return t }()),\n\t\tPartnerName: to.Ptr(\"Contoso.Finance\"),\n\t\tPartnerRegistrationImmutableID: to.Ptr(\"941892bc-f5d0-4d1c-8fb5-477570fc2b71\"),\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.PartnerConfiguration = armeventgrid.PartnerConfiguration{\n\t// \tName: to.Ptr(\"default\"),\n\t// \tType: to.Ptr(\"Microsoft.EventGrid/partnerConfigurations\"),\n\t// \tID: to.Ptr(\"/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default\"),\n\t// \tLocation: to.Ptr(\"global\"),\n\t// \tProperties: &armeventgrid.PartnerConfigurationProperties{\n\t// \t\tPartnerAuthorization: &armeventgrid.PartnerAuthorization{\n\t// \t\t\tAuthorizedPartnersList: []*armeventgrid.Partner{\n\t// \t\t\t\t{\n\t// \t\t\t\t\tAuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-01-28T01:20:55.142Z\"); return t}()),\n\t// \t\t\t\t\tPartnerName: to.Ptr(\"Contoso.Finance\"),\n\t// \t\t\t\t\tPartnerRegistrationImmutableID: to.Ptr(\"941892bc-f5d0-4d1c-8fb5-477570fc2b71\"),\n\t// \t\t\t\t},\n\t// \t\t\t\t{\n\t// \t\t\t\t\tAuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-02-20T01:00:00.142Z\"); return t}()),\n\t// \t\t\t\t\tPartnerName: to.Ptr(\"fabrikam.HR\"),\n\t// \t\t\t\t\tPartnerRegistrationImmutableID: to.Ptr(\"5362bdb6-ce3e-4d0d-9a5b-3eb92c8aab38\"),\n\t// \t\t\t}},\n\t// \t\t\tDefaultMaximumExpirationTimeInDays: to.Ptr[int32](10),\n\t// \t\t},\n\t// \t},\n\t// \tTags: map[string]*string{\n\t// \t\t\"tag1\": to.Ptr(\"value1\"),\n\t// \t\t\"tag2\": to.Ptr(\"value2\"),\n\t// \t},\n\t// }\n}", "title": "" }, { "docid": "20bb408d31d9cfac78ae46d4ff5c6457", "score": "0.47243938", "text": "func NewConfigProvider(pub *ecdsa.PublicKey, session conf.SessionInterface, client v1auth.TokenClientInterface) *ConfigProvider {\n\treturn &ConfigProvider{\n\t\tProviderBasis: &ProviderBasis{\n\t\t\tExpireWindow: DefaultExpireWindow,\n\t\t\tPub: pub,\n\t\t},\n\t\tSession: session,\n\t\tClient: client,\n\t}\n}", "title": "" }, { "docid": "774bb1655fa932dd476c0bcf86a9d6f5", "score": "0.47205928", "text": "func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Anchoreclient {\n\t// ensure nullable parameters have default\n\tif cfg == nil {\n\t\tcfg = DefaultTransportConfig()\n\t}\n\n\t// create transport and client\n\ttransport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)\n\treturn New(transport, formats)\n}", "title": "" }, { "docid": "e12e5430510f7f6c24e15a24130bc853", "score": "0.4680877", "text": "func GetAppProviderClient(opts ...Option) (appprovider.ProviderAPIClient, error) {\n\tappProviders.m.Lock()\n\tdefer appProviders.m.Unlock()\n\n\toptions := newOptions(opts...)\n\tif c, ok := appProviders.conn[options.Endpoint]; ok {\n\t\treturn c.(appprovider.ProviderAPIClient), nil\n\t}\n\n\tconn, err := NewConn(options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tv := appprovider.NewProviderAPIClient(conn)\n\tappProviders.conn[options.Endpoint] = v\n\treturn v, nil\n}", "title": "" }, { "docid": "c5019289e7e29158106e0dc7ff1a217a", "score": "0.46687368", "text": "func newClient(region string, accessKeyID string, secretAccessKey string, credPath string, profile string) *Config {\n\tconf := &aws.Config{\n\t\tCredentials: GetCredentials(accessKeyID, secretAccessKey, credPath, profile),\n\t\tRegion: aws.String(region),\n\t}\n\n\tsess := session.Must(session.NewSession(conf))\n\n\tsvc := &Config{\n\t\tProfile: profile,\n\t\tRegion: region,\n\t\tSession: sess,\n\t\tAwsConfig: conf,\n\t}\n\n\tsvc.PrintInfo()\n\treturn svc\n}", "title": "" }, { "docid": "4f02f21b166a2fe785cabcbd89ff911b", "score": "0.46670195", "text": "func newKeyVaultClient(vaultURL string, config AzureConfiguration) (*KeyVault, error) {\n\n\tkeyClient := keyvault.New()\n\n\tcredentials := azureAuth.NewClientCredentialsConfig(config.ClientID, config.ClientSecret, config.TenantID)\n\t// set the correct resource for keyvault, trim the trailing /\n\tcredentials.Resource = strings.TrimRight(azure.PublicCloud.KeyVaultEndpoint, \"/\")\n\ta, err := credentials.Authorizer()\n\n\tif err != nil {\n\t\tgolog.Errorf(\"Failed to create KeyVault client. [%s]\", err.Error())\n\t\treturn nil, err\n\t}\n\n\tkeyClient.Authorizer = a\n\n\tk := &KeyVault{\n\t\tvaultURL: vaultURL,\n\t\tclient: &keyClient,\n\t}\n\n\treturn k, nil\n}", "title": "" }, { "docid": "f63507a010bde1b8d7ae8d5c48923035", "score": "0.4664521", "text": "func VirtualGatewayClientProvider(client client.Client) networking_enterprise_mesh_gloo_solo_io_v1beta1.VirtualGatewayClient {\n\treturn networking_enterprise_mesh_gloo_solo_io_v1beta1.NewVirtualGatewayClient(client)\n}", "title": "" }, { "docid": "b8cf3b381d2597f640d59c187f17c72e", "score": "0.4661003", "text": "func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationsClient {\n\tcp := arm.ClientOptions{}\n\tif options != nil {\n\t\tcp = *options\n\t}\n\tif len(cp.Host) == 0 {\n\t\tcp.Host = arm.AzurePublicCloud\n\t}\n\treturn &ConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}\n}", "title": "" }, { "docid": "5311c5f402289e20ed8da049b7d52f16", "score": "0.46606606", "text": "func NewAppConfiguration() config.AppConfiguration {\n\twire.Build(configdi.ProviderSet)\n\treturn config.AppConfiguration{}\n}", "title": "" }, { "docid": "4ade36630b7d2c5d920bd06e1252e783", "score": "0.46522787", "text": "func New(ctx context.Context, cfg Config) (*Client, error) {\n\tif err := cfg.CheckAndSetDefaults(); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tc := &Client{c: cfg}\n\tif err := c.connect(ctx); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "d3af108e8ef507a5ca3f83455248dd38", "score": "0.4638541", "text": "func InstancePrincipalConfigurationProviderWithCustomClient(modifier func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error)) (common.ConfigurationProvider, error) {\n\treturn newInstancePrincipalConfigurationProvider(\"\", modifier)\n}", "title": "" }, { "docid": "342c403f0d1b42671a7c09ba798c0dfb", "score": "0.46250173", "text": "func VirtualDestinationClientProvider(client client.Client) networking_enterprise_mesh_gloo_solo_io_v1beta1.VirtualDestinationClient {\n\treturn networking_enterprise_mesh_gloo_solo_io_v1beta1.NewVirtualDestinationClient(client)\n}", "title": "" }, { "docid": "9afed137cd5b4d1a4ce8cf633798ac40", "score": "0.46224946", "text": "func NewWithFactory(configuration *config.Config, factory factoryFunc) *Client {\n\treturn &Client{\n\t\tconfig: configuration,\n\t\tfactory: factory,\n\t}\n}", "title": "" }, { "docid": "f2f88489f22dd177feb96704aeaacd37", "score": "0.46192217", "text": "func createAWSSDKProvider(configReader io.Reader) (*awsSDKProvider, error) {\n\tcfg, err := readAWSCloudConfig(configReader)\n\tif err != nil {\n\t\tklog.Errorf(\"Couldn't read config: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tif err = validateOverrides(cfg); err != nil {\n\t\tklog.Errorf(\"Unable to validate custom endpoint overrides: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tconfig := aws.NewConfig().\n\t\tWithRegion(getRegion()).\n\t\tWithEndpointResolver(getResolver(cfg))\n\n\tconfig, err = setMaxRetriesFromEnv(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsess, err := session.NewSession(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// add cluster-autoscaler to the user-agent to make it easier to identify\n\tagent := fmt.Sprintf(\"cluster-autoscaler/v%s\", version.ClusterAutoscalerVersion)\n\tsess.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler(agent))\n\n\tprovider := &awsSDKProvider{\n\t\tsession: sess,\n\t}\n\n\treturn provider, nil\n}", "title": "" }, { "docid": "f7b9f68fb7abcf5c3c8977e5dc905b68", "score": "0.46190387", "text": "func NewClient(timeoutInSeconds int, cfg Config) (*AccountClient, error) {\n\tif cfg.Address == \"\" {\n\t\tcfg.Address = defaultAddress\n\t}\n\tu, err := url.Parse(cfg.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.Path = strings.TrimRight(u.Path, \"/\")\n\tu.Path += accountsAPI\n\n\treturn &AccountClient{\n\t\tendpoint: u,\n\t\thttpClient: &http.Client{},\n\t\ttimeout: time.Second * time.Duration(timeoutInSeconds),\n\t}, nil\n}", "title": "" }, { "docid": "5cb21797ecc719f026b72bdb0040ab00", "score": "0.46123976", "text": "func NewConfigTemplateClient() *ConfigTemplateClient {\n\treturn &ConfigTemplateClient{\n\t\tstoreName: \"rbdef\",\n\t\ttagMeta: \"confdefmetadata\",\n\t\ttagContent: \"confdefcontent\",\n\t}\n}", "title": "" }, { "docid": "171012ceb99b6c4d76fc66de679b3d93", "score": "0.45932016", "text": "func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {\n\topts := Options{\n\t\tRegion: cfg.Region,\n\t\tRetryer: cfg.Retryer,\n\t\tHTTPClient: cfg.HTTPClient,\n\t\tCredentials: cfg.Credentials,\n\t\tAPIOptions: cfg.APIOptions,\n\t}\n\tresolveAWSEndpointResolver(cfg, &opts)\n\treturn New(opts, optFns...)\n}", "title": "" }, { "docid": "6afb012e17163f01e3451e6b022d3ea2", "score": "0.4589628", "text": "func NewProviderNetClient() *ProviderNetClient {\n\treturn &ProviderNetClient{\n\t\tdb: ncmtypes.ClientDbInfo{\n\t\t\tStoreName: \"cluster\",\n\t\t\tTagMeta: \"networkmetadata\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3cca0c86b091da83bad5ed37c490121d", "score": "0.4585623", "text": "func newTJSONConfig(url string, timeout time.Duration, config *clientConfig) (*clientConfig, error) {\n\ttrans, err := defaultTTransport(url, timeout, config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Error creating realis clientConfig\")\n\t}\n\n\thttpTrans := (trans).(*thrift.THttpClient)\n\thttpTrans.SetHeader(\"Content-Type\", \"application/x-thrift\")\n\thttpTrans.SetHeader(\"User-Agent\", \"gorealis v\"+VERSION)\n\n\treturn &clientConfig{transport: trans, protoFactory: thrift.NewTJSONProtocolFactory()}, nil\n}", "title": "" }, { "docid": "44bf67b84d958bf56ce5a6ca91520e18", "score": "0.45815128", "text": "func (client TransferApplianceClient) CreateTransferAppliance(ctx context.Context, request CreateTransferApplianceRequest) (response CreateTransferApplianceResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\n\tif !(request.OpcRetryToken != nil && *request.OpcRetryToken != \"\") {\n\t\trequest.OpcRetryToken = common.String(common.RetryToken())\n\t}\n\n\tociResponse, err = common.Retry(ctx, request, client.createTransferAppliance, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = CreateTransferApplianceResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = CreateTransferApplianceResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(CreateTransferApplianceResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into CreateTransferApplianceResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "859a073bfd9d287dc5ab9359e846d571", "score": "0.45764247", "text": "func (client TransferApplianceClient) createTransferAppliance(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodPost, \"/transferJobs/{id}/transferAppliances\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response CreateTransferApplianceResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"\"\n\t\terr = common.PostProcessServiceError(err, \"TransferAppliance\", \"CreateTransferAppliance\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "3638fc0c6cf332c941ae5b1809ec5ba4", "score": "0.45670933", "text": "func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *CETLiteForCoinExChain {\n\t// ensure nullable parameters have default\n\tif cfg == nil {\n\t\tcfg = DefaultTransportConfig()\n\t}\n\n\t// create transport and client\n\ttransport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)\n\treturn New(transport, formats)\n}", "title": "" }, { "docid": "2c9f4728aca30994167209e053ab8801", "score": "0.45670095", "text": "func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Client {\n\t// ensure nullable parameters have default\n\tif cfg == nil {\n\t\tcfg = DefaultTransportConfig()\n\t}\n\n\t// create transport and client\n\ttransport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)\n\treturn New(transport, formats)\n}", "title": "" }, { "docid": "4cbc0bee9c3a7edb76937311039b1c39", "score": "0.45581937", "text": "func newClient(svc *Service) *sdk.Client {\n\t// enable multi-region hostnames\n\tvar tenantScoped = enableTenantScope\n\n\tvar serviceURL *url.URL\n\tvar hostURL = getHostURL()\n\tserviceURL, err := url.Parse(hostURL)\n\tvar scheme string\n\tif scheme = serviceURL.Scheme; scheme == \"\" {\n\t\tif scheme = svc.Scheme; scheme == \"\" {\n\t\t\tscheme = defaultScheme\n\t\t}\n\t}\n\n\tvar port string\n\tif port = serviceURL.Port(); port == \"\" {\n\t\tif port = svc.Port; port == \"\" {\n\t\t\tport = defaultPort\n\t\t}\n\t}\n\n\t// hostname obtained from default.yaml contains api. prefix that GoSDK client will append\n\thost := strings.TrimPrefix(svc.Host, \"api.\")\n\toverrideHost := serviceURL.Hostname()\n\n\tvar overrideHostPort string\n\tvar hostPort string\n\tif overrideHost != \"\" {\n\t\toverrideHostPort = overrideHost + \":\" + port\n\t} else {\n\t\thostPort = host + \":\" + port\n\t}\n\n\ttlsConfig := &tls.Config{InsecureSkipVerify: isInsecure()}\n\n\tregion := getRegion()\n\ttenantScopedSetting := getTenantScoped()\n\tif tenantScopedSetting != false {\n\t\ttenantScoped = tenantScopedSetting\n\t}\n\n\t// Load client cert\n\tcaCert := getCaCert()\n\n\t// -insecure=false -scheme=https -ca-cert=<path-to-file.crt>\n\tif !isInsecure() && scheme == defaultScheme && caCert != \"\" {\n\t\trootCAs, _ := x509.SystemCertPool()\n\t\tif rootCAs == nil {\n\t\t\trootCAs = x509.NewCertPool()\n\t\t}\n\t\tcerts, err := ioutil.ReadFile(caCert)\n\t\tif err != nil {\n\t\t\tutil.Warning(\"Failed to append %q to RootCAs: %v\", caCert, err)\n\t\t}\n\t\tif ok := rootCAs.AppendCertsFromPEM(certs); !ok {\n\t\t\tutil.Warning(\"No certs appended, using system certs only\")\n\t\t}\n\t\t// set the RootCA\n\t\ttlsConfig.RootCAs = rootCAs\n\t}\n\n\tvar scloudVersion string\n\tscloudVersion = fmt.Sprintf(\"%s/%s\", version.UserAgent, version.ScloudVersion)\n\n\tvar roundTripper http.RoundTripper\n\n\troundTripper = util.NewCustomSdkTransport(&GlogWrapper{}, &http.Transport{\n\t\tTLSClientConfig: tlsConfig,\n\t\tProxy: http.ProxyFromEnvironment,\n\t})\n\n\ttestdryrun, _ := cf.GlobalFlags[\"testhookdryrun\"].(bool)\n\tif testdryrun {\n\t\troundTripper = createTesthookLogger(true)\n\t} else {\n\t\ttesthook, _ := cf.GlobalFlags[\"testhook\"].(bool)\n\t\tif testhook {\n\t\t\troundTripper = createTesthookLogger(false)\n\t\t}\n\t}\n\n\tclientConfig := &services.Config{\n\t\tToken: getToken(),\n\t\tHost: hostPort,\n\t\tOverrideHost: overrideHostPort,\n\t\tScheme: scheme,\n\t\tTimeout: getTimeoutForConfig(),\n\t\tResponseHandlers: []services.ResponseHandler{&services.DefaultRetryResponseHandler{}},\n\t\tRoundTripper: roundTripper,\n\t\tClientVersion: scloudVersion,\n\t\tTenantScoped: tenantScoped,\n\t\tRegion: region,\n\t}\n\n\tresult, err := sdk.NewClient(clientConfig)\n\tif err != nil {\n\t\tutil.Fatal(err.Error())\n\t}\n\treturn result\n}", "title": "" }, { "docid": "05e0a51f6e4582bb66c1c44c1e36a5a7", "score": "0.45569292", "text": "func NewClient(gatewayCfg *config.GatewayConfig) (*Client, error) {\n\treturn &Client{\n\t\tcfg: gatewayCfg,\n\t}, nil\n}", "title": "" }, { "docid": "49d03c9518c84c3554e57ea6580a0948", "score": "0.4556584", "text": "func WasmDeploymentClientProvider(client client.Client) networking_enterprise_mesh_gloo_solo_io_v1beta1.WasmDeploymentClient {\n\treturn networking_enterprise_mesh_gloo_solo_io_v1beta1.NewWasmDeploymentClient(client)\n}", "title": "" }, { "docid": "72cac42e415dbceb8dbe32dba159a3d5", "score": "0.45381972", "text": "func NewOAuthClientProvider(config *oauth.Config) harvest.HttpClientProvider {\n\tclientProvider := &oauth.Transport{Config: config}\n\treturn harvest.ClientProviderFunc(clientProvider.Client)\n}", "title": "" }, { "docid": "5db2e977a44db62442b0265ee6852afe", "score": "0.453818", "text": "func UseProviderConfig(ctx context.Context, c client.Client, mg resource.Managed, region string) (*aws.Config, error) { // nolint:gocyclo\n\tpc := &v1beta1.ProviderConfig{}\n\tif err := c.Get(ctx, types.NamespacedName{Name: mg.GetProviderConfigReference().Name}, pc); err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot get referenced Provider\")\n\t}\n\n\tt := resource.NewProviderConfigUsageTracker(c, &v1beta1.ProviderConfigUsage{})\n\tif err := t.Track(ctx, mg); err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot track ProviderConfig usage\")\n\t}\n\n\tswitch s := pc.Spec.Credentials.Source; s { //nolint:exhaustive\n\tcase xpv1.CredentialsSourceInjectedIdentity:\n\t\tif pc.Spec.AssumeRole != nil || pc.Spec.AssumeRoleARN != nil {\n\t\t\tcfg, err := UsePodServiceAccountAssumeRole(ctx, []byte{}, DefaultSection, region, pc)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn SetResolver(pc, cfg), nil\n\t\t}\n\t\tif pc.Spec.AssumeRoleWithWebIdentity != nil && pc.Spec.AssumeRoleWithWebIdentity.RoleARN != nil {\n\t\t\tcfg, err := UsePodServiceAccountAssumeRoleWithWebIdentity(ctx, []byte{}, DefaultSection, region, pc)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn SetResolver(pc, cfg), nil\n\t\t}\n\t\tcfg, err := UsePodServiceAccount(ctx, []byte{}, DefaultSection, region)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn SetResolver(pc, cfg), nil\n\tdefault:\n\t\tdata, err := resource.CommonCredentialExtractor(ctx, s, c, pc.Spec.Credentials.CommonCredentialSelectors)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"cannot get credentials\")\n\t\t}\n\t\tif pc.Spec.AssumeRole != nil || pc.Spec.AssumeRoleARN != nil {\n\t\t\tcfg, err := UseProviderSecretAssumeRole(ctx, data, DefaultSection, region, pc)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn SetResolver(pc, cfg), nil\n\t\t}\n\t\tcfg, err := UseProviderSecret(ctx, data, DefaultSection, region)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn SetResolver(pc, cfg), nil\n\t}\n}", "title": "" }, { "docid": "164a3c265c5bcb1a052fa55e2bec3b58", "score": "0.45361295", "text": "func NewForConfig(c *rest.Config) (*GuanceV1Client, error) {\n\tconfig := *c\n\tif err := setConfigDefaults(&config); err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := rest.RESTClientFor(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &GuanceV1Client{client}, nil\n}", "title": "" }, { "docid": "7f6281e8ee31f18fb05e84841ef8e76f", "score": "0.4520768", "text": "func NewWithConfig(config Config) Client {\n\tif config.TimeOut == 0 {\n\t\tconfig.TimeOut = time.Second * 5\n\t}\n\n\tclient := Client{\n\t\tURL: getSandboxURL(),\n\t\tSecret: config.Secret,\n\t\tTimeOut: config.TimeOut,\n\t}\n\tif config.IsProduction {\n\t\tclient.URL = ProductionURL\n\t}\n\n\treturn client\n}", "title": "" }, { "docid": "33c34239c6427082afb632fa5137301e", "score": "0.45168936", "text": "func NewClient(conf Config) Client {\n\tsc := Client{}\n\tif ed := conf.Endpoint; ed == \"\" {\n\t\tconf.Endpoint = DefaultEndPoint\n\t}\n\tsc.conf = &conf\n\n\treturn sc\n}", "title": "" }, { "docid": "b4ec6f4953ad906e1d151aa2ebcd3d32", "score": "0.45160195", "text": "func NewFromConfig(mode Mode, config Config) (*Client, error) {\n if mode == SANDBOX || mode == PRODUCTION {\n return &Client{mode, config.Token, config.Credentials}, nil\n } else {\n return nil, errors.New(\"Invalid mode\")\n }\n}", "title": "" }, { "docid": "d34f299e6d5319d624ddef999742c33c", "score": "0.45086178", "text": "func NewClient(c *Config) (Client, error) {\n\n\trawClient := api.NewClient(c.AccessToken, c.AccessTokenSecret, c.Zone)\n\trawClient.UserAgent = fmt.Sprintf(\"k8s-sakura-cloud-controller-manager/v%s\", version.Version)\n\n\trawClient.TraceMode = c.TraceMode\n\tif c.AcceptLanguage != \"\" {\n\t\trawClient.AcceptLanguage = c.AcceptLanguage\n\t}\n\tif c.RetryMax > 0 {\n\t\trawClient.RetryMax = c.RetryMax\n\t}\n\tif c.RetryIntervalSec > 0 {\n\t\trawClient.RetryInterval = time.Duration(c.RetryIntervalSec) * time.Second\n\t}\n\tif c.APIRootURL != \"\" {\n\t\tapi.SakuraCloudAPIRoot = c.APIRootURL\n\t}\n\n\treturn &client{rawClient: rawClient}, nil\n}", "title": "" }, { "docid": "9d88fe9492b7bcaa70abfc476c5fca60", "score": "0.4508551", "text": "func New(region string, accessKeyID string, secretAccessKey string, credPath string, profile string) *Config {\n\treturn newClient(region, accessKeyID, secretAccessKey, credPath, profile)\n}", "title": "" }, { "docid": "95c1eacf80c4c1f80e09b279a6763d35", "score": "0.45084447", "text": "func NewWithClient(restClient kubernetes.Interface) (*Backend, error) {\n\tfor _, env := range []string{teleportReplicaNameEnv, NamespaceEnv} {\n\t\tif len(os.Getenv(env)) == 0 {\n\t\t\treturn nil, trace.BadParameter(\"environment variable %q not set or empty\", env)\n\t\t}\n\t}\n\n\treturn NewWithConfig(\n\t\tConfig{\n\t\t\tNamespace: os.Getenv(NamespaceEnv),\n\t\t\tSecretName: fmt.Sprintf(\n\t\t\t\t\"%s-%s\",\n\t\t\t\tos.Getenv(teleportReplicaNameEnv),\n\t\t\t\tsecretIdentifierName,\n\t\t\t),\n\t\t\tFieldManager: os.Getenv(teleportReplicaNameEnv),\n\t\t\tReleaseName: os.Getenv(ReleaseNameEnv),\n\t\t\tKubeClient: restClient,\n\t\t},\n\t)\n}", "title": "" }, { "docid": "ca75d8ab40ed29f3ecbd90c1fdb9a5d9", "score": "0.44865495", "text": "func (c *ClusterProvider) NewClientConfig() (*ClientConfig, error) {\n\tclusterName := fmt.Sprintf(\"%s.%s.eksctl.io\", c.cfg.ClusterName, c.cfg.Region)\n\tcontextName := fmt.Sprintf(\"%s@%s\", c.getUsername(), clusterName)\n\n\tclientConfig := &ClientConfig{\n\t\tCluster: c.cfg,\n\t\tClient: &clientcmdapi.Config{\n\t\t\tClusters: map[string]*clientcmdapi.Cluster{\n\t\t\t\tclusterName: {\n\t\t\t\t\tServer: c.cfg.MasterEndpoint,\n\t\t\t\t\tCertificateAuthorityData: c.cfg.CertificateAuthorityData,\n\t\t\t\t},\n\t\t\t},\n\t\t\tContexts: map[string]*clientcmdapi.Context{\n\t\t\t\tcontextName: {\n\t\t\t\t\tCluster: clusterName,\n\t\t\t\t\tAuthInfo: contextName,\n\t\t\t\t},\n\t\t\t},\n\t\t\tAuthInfos: map[string]*clientcmdapi.AuthInfo{\n\t\t\t\tcontextName: &clientcmdapi.AuthInfo{},\n\t\t\t},\n\t\t\tCurrentContext: contextName,\n\t\t},\n\t\tClusterName: clusterName,\n\t\tContextName: contextName,\n\t\troleARN: c.svc.arn,\n\t\tsts: c.svc.sts,\n\t}\n\n\treturn clientConfig, nil\n}", "title": "" }, { "docid": "0e66f5a8a27e388fab384001976b28c8", "score": "0.4484474", "text": "func NewApplicationClient(lc logger.LoggingClient, asyncCh chan<- *sdkModel.AsyncValues, nw nw.Network, tc tc.Transfer, deviceName string) (Application, error) {\n\tprofileName := db.DB().GetProfileName(deviceName)\n\tswitch profileName {\n\tcase lightApp.Name:\n\t\treturn lightApp.NewClient(lc, asyncCh, nw, tc)\n\tcase sensorApp.Name:\n\t\treturn sensorApp.NewClient(lc, asyncCh, nw, tc)\n\tcase lightGroupApp.Name:\n\t\treturn lightGroupApp.NewClient(lc, asyncCh, nw, tc)\n\tcase scenarioApp.Name:\n\t\treturn scenarioApp.NewClient(lc)\n\tcase gatewayApp.Name:\n\t\treturn gatewayApp.NewClient(lc, nw)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown profile '%s' requested of object '%s' \", profileName, deviceName)\n\t}\n}", "title": "" }, { "docid": "6f899b5d7f8968ea01d0448792b71724", "score": "0.4478583", "text": "func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {\n\tif config == nil {\n\t\treturn nil, errors.New(\"conoha: the configuration of the DNS provider is nil\")\n\t}\n\n\tif config.TenantID == \"\" || config.Username == \"\" || config.Password == \"\" {\n\t\treturn nil, errors.New(\"conoha: some credentials information are missing\")\n\t}\n\n\tidentifier, err := internal.NewIdentifier(config.Region)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"conoha: failed to create identity client: %w\", err)\n\t}\n\n\tif config.HTTPClient != nil {\n\t\tidentifier.HTTPClient = config.HTTPClient\n\t}\n\n\tauth := internal.Auth{\n\t\tTenantID: config.TenantID,\n\t\tPasswordCredentials: internal.PasswordCredentials{\n\t\t\tUsername: config.Username,\n\t\t\tPassword: config.Password,\n\t\t},\n\t}\n\n\ttokens, err := identifier.GetToken(context.TODO(), auth)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"conoha: failed to log in: %w\", err)\n\t}\n\n\tclient, err := internal.NewClient(config.Region, tokens.Access.Token.ID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"conoha: failed to create client: %w\", err)\n\t}\n\n\tif config.HTTPClient != nil {\n\t\tclient.HTTPClient = config.HTTPClient\n\t}\n\n\treturn &DNSProvider{config: config, client: client}, nil\n}", "title": "" }, { "docid": "897db4825ed71a176499e3fdff20563a", "score": "0.4458467", "text": "func newVaultClient() (*vaultapi.Client, error) {\n\n\tvconf := vaultapi.DefaultConfig()\n\n\tvaultClient, err := vaultapi.NewClient(vconf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error initializing vault api client: %v\", err)\n\t}\n\n\treturn vaultClient, nil\n}", "title": "" }, { "docid": "a8f416ea5883bbf27b49c84195d308d4", "score": "0.4458175", "text": "func (c *webRoleClient) ConfigProvider() aws.Config {\n\treturn c.session\n}", "title": "" }, { "docid": "63d34af87f09ba7cd70b05f927deff92", "score": "0.44510832", "text": "func newAzureClient() (*keyvault.BaseClient, error) {\n\tauthorizer, err := azauth.NewAuthorizerFromEnvironment()\n\tif err != nil {\n\t\treturn &keyvault.BaseClient{}, err\n\t}\n\tclient := keyvault.New()\n\tclient.Authorizer = authorizer\n\treturn &client, nil\n}", "title": "" }, { "docid": "884357c2fe1791d013c15e2742bd3bfa", "score": "0.44509834", "text": "func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *HarborAPI {\n\t// ensure nullable parameters have default\n\tif cfg == nil {\n\t\tcfg = DefaultTransportConfig()\n\t}\n\n\t// create transport and client\n\ttransport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)\n\treturn New(transport, formats)\n}", "title": "" }, { "docid": "d7f26536849fe21fcce7f0f21d7682fd", "score": "0.44415215", "text": "func RateLimiterServerConfigClientProvider(client client.Client) networking_enterprise_mesh_gloo_solo_io_v1beta1.RateLimiterServerConfigClient {\n\treturn networking_enterprise_mesh_gloo_solo_io_v1beta1.NewRateLimiterServerConfigClient(client)\n}", "title": "" }, { "docid": "285d14ffcd5b8741b04fd4bd54be016a", "score": "0.4440137", "text": "func NewClient(cfg ClientConfig) *Client {\n\n\t// handle \"\" or \"/prod\" Chroot gracefully.\n\tif !strings.HasSuffix(cfg.Chroot, \"/\") {\n\t\tcfg.Chroot += \"/\"\n\t}\n\n\tif cfg.Retry == nil {\n\t\tcfg.Retry = DefaultRetry\n\t}\n\tif cfg.SessionTimeout == 0 {\n\t\tcfg.SessionTimeout = 10 * time.Second\n\t}\n\tif len(cfg.Acl) == 0 {\n\t\tcfg.Acl = zk.WorldACL(zk.PermAll)\n\t}\n\tcli := &Client{\n\t\tCfg: cfg,\n\t}\n\treturn cli\n}", "title": "" }, { "docid": "f56f15db984e981b5eac4dbcba8ff819", "score": "0.44396898", "text": "func NewClient(config Config, authConfRaw interface{}) (*Client, error) {\n\ta, err := getBackendClient(config.ActiveClientConfig, authConfRaw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts, err := getBackendClient(config.ShadowClientConfig, authConfRaw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\tcfg: config,\n\t\tactive: a,\n\t\tshadow: s,\n\t}, nil\n}", "title": "" }, { "docid": "e2c108dfd60ec1ba13d814aa0f779983", "score": "0.4434725", "text": "func NewProvider(config *rest.Config, httpClient *http.Client, scheme *runtime.Scheme, logger logr.Logger, makeBroadcaster EventBroadcasterProducer) (*Provider, error) {\n\tif httpClient == nil {\n\t\tpanic(\"httpClient must not be nil\")\n\t}\n\n\tcorev1Client, err := corev1client.NewForConfigAndClient(config, httpClient)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to init client: %w\", err)\n\t}\n\n\tp := &Provider{scheme: scheme, logger: logger, makeBroadcaster: makeBroadcaster, evtClient: corev1Client.Events(\"\")}\n\treturn p, nil\n}", "title": "" }, { "docid": "2ca0c95eb715d5dc2ef104a696479f60", "score": "0.44331515", "text": "func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {\n\tclient = &Client{}\n\terr = client.InitWithOptions(regionId, config, credential)\n\treturn\n}", "title": "" }, { "docid": "616c72417ffd690a5a3dbe2e963a0779", "score": "0.44330534", "text": "func newClient(c clientConfig) (client, error) {\n\tif c.app.tokenURL == \"\" {\n\t\tc.app.tokenURL = tokenURL\n\t}\n\n\tif c.app.unauthenticated() {\n\t\treturn &appClient{\n\t\t\tapp: &c.app,\n\t\t}, nil\n\t}\n\n\tif err := c.app.validateAuth(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newAppClient(c)\n}", "title": "" }, { "docid": "bd1dd5c4f4abd4a6c5654eb23e0cbd67", "score": "0.44288844", "text": "func Provider() terraform.ResourceProvider {\n\treturn &schema.Provider{\n\t\tSchema: map[string]*schema.Schema{\n\t\t\t\"tenant_name\": &schema.Schema{\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"CONOHA_TENANT\", nil),\n\t\t\t\tDescription: \"A ConoHa tenant name.\",\n\t\t\t},\n\n\t\t\t\"username\": &schema.Schema{\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"CONOHA_USERNAME\", nil),\n\t\t\t\tDescription: \"A ConoHa user name.\",\n\t\t\t},\n\n\t\t\t\"password\": &schema.Schema{\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"CONOHA_PASSWORD\", nil),\n\t\t\t\tDescription: \"A ConoHa user password.\",\n\t\t\t},\n\t\t},\n\n\t\tResourcesMap: map[string]*schema.Resource{\n\t\t\t\"conoha_container\": resourceConohaContainer(),\n\t\t},\n\n\t\tConfigureFunc: providerConfigure,\n\t}\n}", "title": "" }, { "docid": "acfa07956c51026cf25460f70242cf42", "score": "0.4423218", "text": "func NewClientConfig(nodeURI, chainID string, broadcastMode BroadcastMode, feesStr string, gas uint64, gasAdjustment float64,\n\tgasPricesStr string) (\n\tcliConfig ClientConfig, err error) {\n\tvar fees, gasPrices DecCoins\n\tif len(feesStr) != 0 {\n\t\tfees, err = ParseDecCoins(feesStr)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif len(gasPricesStr) != 0 {\n\t\tif gasAdjustment <= 1 {\n\t\t\treturn cliConfig, errors.New(\"failed. gasAdjustment must be greater than 1 with the auto gas calculating\")\n\t\t}\n\n\t\tgasPrices, err = ParseDecCoins(gasPricesStr)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn ClientConfig{\n\t\tNodeURI: nodeURI,\n\t\tChainID: chainID,\n\t\tBroadcastMode: broadcastMode,\n\t\tGas: gas,\n\t\tGasAdjustment: gasAdjustment,\n\t\tFees: fees,\n\t\tGasPrices: gasPrices,\n\t}, err\n}", "title": "" }, { "docid": "5b70139e290cb257a9ad4aae2f34b5d1", "score": "0.44171056", "text": "func New(ctx context.Context, cfg Config) (*Client, error) {\n\tif err := cfg.checkAndSetDefaults(); err != nil {\n\t\treturn nil, err\n\t}\n\tc := &Client{cfg: cfg}\n\n\tif err := c.readClientUsername(); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif err := c.readClientSize(); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif err := c.connect(ctx); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tc.start()\n\treturn c, nil\n}", "title": "" } ]
38aa5716ba0f7f656660e7065a5bfc73
ClearKYCDate clears the value of the "KYC_Date" field.
[ { "docid": "f3ca31bf87eb9a653651c79e6ecc9cd0", "score": "0.815087", "text": "func (ru *ReportwallettbUpdate) ClearKYCDate() *ReportwallettbUpdate {\n\tru.mutation.ClearKYCDate()\n\treturn ru\n}", "title": "" } ]
[ { "docid": "b51c3bf773fd694006a8cd44e7afb961", "score": "0.80672234", "text": "func (ruo *ReportwallettbUpdateOne) ClearKYCDate() *ReportwallettbUpdateOne {\n\truo.mutation.ClearKYCDate()\n\treturn ruo\n}", "title": "" }, { "docid": "314d738a7b388d26ac2de01ecfb2b925", "score": "0.8010408", "text": "func (pu *PendingkycUpdate) ClearKYCDate() *PendingkycUpdate {\n\tpu.mutation.ClearKYCDate()\n\treturn pu\n}", "title": "" }, { "docid": "382188ba968a8a6b25e6870a45ed587c", "score": "0.79035026", "text": "func (puo *PendingkycUpdateOne) ClearKYCDate() *PendingkycUpdateOne {\n\tpuo.mutation.ClearKYCDate()\n\treturn puo\n}", "title": "" }, { "docid": "5972ead9b15afe312a268dd0d6f6556c", "score": "0.7079087", "text": "func (ruo *ReportwallettbUpdateOne) SetKYCDate(t time.Time) *ReportwallettbUpdateOne {\n\truo.mutation.SetKYCDate(t)\n\treturn ruo\n}", "title": "" }, { "docid": "df57f4983d5cfd04eafd878f147d5834", "score": "0.7026575", "text": "func (puo *PendingkycUpdateOne) SetKYCDate(s string) *PendingkycUpdateOne {\n\tpuo.mutation.SetKYCDate(s)\n\treturn puo\n}", "title": "" }, { "docid": "c8f090cf54dbd62a3dc48b581678f51a", "score": "0.69432575", "text": "func (ru *ReportwallettbUpdate) SetKYCDate(t time.Time) *ReportwallettbUpdate {\n\tru.mutation.SetKYCDate(t)\n\treturn ru\n}", "title": "" }, { "docid": "51f4609ea9c8741b5267c7bad0a28b19", "score": "0.6910263", "text": "func (pu *PendingkycUpdate) SetKYCDate(s string) *PendingkycUpdate {\n\tpu.mutation.SetKYCDate(s)\n\treturn pu\n}", "title": "" }, { "docid": "12cd63eac62c2c87db70675f932d481c", "score": "0.63065207", "text": "func (pu *PrizeUpdate) ClearDate() *PrizeUpdate {\n\tpu.mutation.ClearDate()\n\treturn pu\n}", "title": "" }, { "docid": "b16892f97413a7d774bd86c136faf04e", "score": "0.6277037", "text": "func (cu *ConfigpointUpdate) ClearUpdateDate() *ConfigpointUpdate {\n\tcu.mutation.ClearUpdateDate()\n\treturn cu\n}", "title": "" }, { "docid": "647c2fb78998abb5af7632179c9b9c0a", "score": "0.62500846", "text": "func (ru *ReportwallettbUpdate) ClearUpdateDate() *ReportwallettbUpdate {\n\tru.mutation.ClearUpdateDate()\n\treturn ru\n}", "title": "" }, { "docid": "e1cc90624e612abbf887246a749f4c15", "score": "0.6193306", "text": "func (puo *PrizeUpdateOne) ClearDate() *PrizeUpdateOne {\n\tpuo.mutation.ClearDate()\n\treturn puo\n}", "title": "" }, { "docid": "009413cffc27a7e0bc87ead3e98ada39", "score": "0.61535674", "text": "func (ruo *ReportwallettbUpdateOne) SetNillableKYCDate(t *time.Time) *ReportwallettbUpdateOne {\n\tif t != nil {\n\t\truo.SetKYCDate(*t)\n\t}\n\treturn ruo\n}", "title": "" }, { "docid": "0e8ae92571e58398cb6805e7f19a2db4", "score": "0.61430097", "text": "func (ru *ReportwallettbUpdate) SetNillableKYCDate(t *time.Time) *ReportwallettbUpdate {\n\tif t != nil {\n\t\tru.SetKYCDate(*t)\n\t}\n\treturn ru\n}", "title": "" }, { "docid": "93e6dae028d3b5e549c0a9feabf2f900", "score": "0.6134377", "text": "func (puo *PendingkycUpdateOne) SetNillableKYCDate(s *string) *PendingkycUpdateOne {\n\tif s != nil {\n\t\tpuo.SetKYCDate(*s)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "d64db8b72b683941ce18cf35743dd389", "score": "0.61178917", "text": "func (pu *PendingkycUpdate) SetNillableKYCDate(s *string) *PendingkycUpdate {\n\tif s != nil {\n\t\tpu.SetKYCDate(*s)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "e6631eb1d9e7ad8d8cc9581a0093e931", "score": "0.60843956", "text": "func (cu *ConfigpointUpdate) ClearExpireDate() *ConfigpointUpdate {\n\tcu.mutation.ClearExpireDate()\n\treturn cu\n}", "title": "" }, { "docid": "4ee18ae0cd10c1697ac0d0b315bf6cbd", "score": "0.6074811", "text": "func (ruo *ReportwallettbUpdateOne) ClearUpdateDate() *ReportwallettbUpdateOne {\n\truo.mutation.ClearUpdateDate()\n\treturn ruo\n}", "title": "" }, { "docid": "60a810cda9d5ac5fda6d8d5c105dfe17", "score": "0.6046318", "text": "func (cuo *ConfigpointUpdateOne) ClearUpdateDate() *ConfigpointUpdateOne {\n\tcuo.mutation.ClearUpdateDate()\n\treturn cuo\n}", "title": "" }, { "docid": "ad0c6b1feba05cb8ea2e44c567a26a70", "score": "0.60442966", "text": "func (ru *ReportwallettbUpdate) ClearIsKYC() *ReportwallettbUpdate {\n\tru.mutation.ClearIsKYC()\n\treturn ru\n}", "title": "" }, { "docid": "df5abac20fd56eccc82b4ca73aea165d", "score": "0.6023727", "text": "func (ruo *ReportwallettbUpdateOne) ClearIsKYC() *ReportwallettbUpdateOne {\n\truo.mutation.ClearIsKYC()\n\treturn ruo\n}", "title": "" }, { "docid": "aa1e1b1445dd81aa013a27f7ca712e48", "score": "0.6019596", "text": "func (pu *PendingkycUpdate) ClearDateGen() *PendingkycUpdate {\n\tpu.mutation.ClearDateGen()\n\treturn pu\n}", "title": "" }, { "docid": "53585d7b4b44a798282370ab097e0db1", "score": "0.58827966", "text": "func (squo *SurveyQuestionUpdateOne) ClearDateData() *SurveyQuestionUpdateOne {\n\tsquo.mutation.ClearDateData()\n\treturn squo\n}", "title": "" }, { "docid": "121dcffc8cabd34d65622f1782622a10", "score": "0.58659345", "text": "func (cuo *ConfigpointUpdateOne) ClearExpireDate() *ConfigpointUpdateOne {\n\tcuo.mutation.ClearExpireDate()\n\treturn cuo\n}", "title": "" }, { "docid": "f03770f7c3c0e6032ae1b765a960da4e", "score": "0.58301353", "text": "func (puo *PendingkycUpdateOne) ClearDateGen() *PendingkycUpdateOne {\n\tpuo.mutation.ClearDateGen()\n\treturn puo\n}", "title": "" }, { "docid": "7a7fe50fe2d88cf7dc396b30313a3f25", "score": "0.5768494", "text": "func (squ *SurveyQuestionUpdate) ClearDateData() *SurveyQuestionUpdate {\n\tsqu.mutation.ClearDateData()\n\treturn squ\n}", "title": "" }, { "docid": "65ef2abcd13d5ee6bb88ecbff27a8bbb", "score": "0.576377", "text": "func KYCDate(v time.Time) predicate.Reportwallettb {\n\treturn predicate.Reportwallettb(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldKYCDate), v))\n\t})\n}", "title": "" }, { "docid": "d4587b61e9d871377d7852c7d1cd6d4c", "score": "0.5576778", "text": "func (ru *ReportwallettbUpdate) ClearRegisterDate() *ReportwallettbUpdate {\n\tru.mutation.ClearRegisterDate()\n\treturn ru\n}", "title": "" }, { "docid": "a5017e13e20d78d7385727c29a500650", "score": "0.54596776", "text": "func (lu *LogexportUpdate) ClearExportDate() *LogexportUpdate {\n\tlu.mutation.ClearExportDate()\n\treturn lu\n}", "title": "" }, { "docid": "c750911c272f6018563b37735519b371", "score": "0.54349095", "text": "func (ruo *ReportwallettbUpdateOne) ClearRegisterDate() *ReportwallettbUpdateOne {\n\truo.mutation.ClearRegisterDate()\n\treturn ruo\n}", "title": "" }, { "docid": "b5a8e34e84b7ba588ab2aa564ca16e7a", "score": "0.5353028", "text": "func ClearCE() { print(ansiescape.ClearLineCE) }", "title": "" }, { "docid": "ef5ecac0c6b86417b63dfad732b24f7c", "score": "0.5335475", "text": "func (t *today) Clear() {\n\tt.lines = []string{\"\"}\n\tt.ToFile()\n}", "title": "" }, { "docid": "752f46851932bb7bd1c12c5facfc4967", "score": "0.5300715", "text": "func (luo *LogexportUpdateOne) ClearExportDate() *LogexportUpdateOne {\n\tluo.mutation.ClearExportDate()\n\treturn luo\n}", "title": "" }, { "docid": "bca06e08d1e353fe05cea3909ad8bc0c", "score": "0.528034", "text": "func KYCDateIsNil() predicate.Reportwallettb {\n\treturn predicate.Reportwallettb(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldKYCDate)))\n\t})\n}", "title": "" }, { "docid": "a980ed15d20c3d05d5e7480ea18c0aec", "score": "0.5260951", "text": "func (o GetKeysKeyOutput) DeleteDate() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetKeysKey) string { return v.DeleteDate }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "604a68a797632e418e8b97d3e2ba41f5", "score": "0.51844686", "text": "func (r *CalendarsService) Clear(calendarId string) *CalendarsClearCall {\n\tc := &CalendarsClearCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.calendarId = calendarId\n\treturn c\n}", "title": "" }, { "docid": "5fd144dc81f30f8212b2d8905d47f914", "score": "0.516821", "text": "func (m *MealplanMutation) ResetDate() {\n\tm.date = nil\n}", "title": "" }, { "docid": "c8c78c586bd695fd9350cffee09e60cc", "score": "0.5081242", "text": "func (f FieldUnixTime) Clear() {\n\tf.h.Clear(f.k)\n}", "title": "" }, { "docid": "e7301c2d2bcd67e7a75684516f4b6d6c", "score": "0.5050193", "text": "func (pu *PersonUpdate) ClearDateOfBirth() *PersonUpdate {\n\tpu.mutation.ClearDateOfBirth()\n\treturn pu\n}", "title": "" }, { "docid": "348db9e1d5a76c92d511bb1e149a8fae", "score": "0.5027605", "text": "func (puo *PersonUpdateOne) ClearDateOfBirth() *PersonUpdateOne {\n\tpuo.mutation.ClearDateOfBirth()\n\treturn puo\n}", "title": "" }, { "docid": "db28cd6ea1ffc7ec24c105a57f915a3e", "score": "0.49800658", "text": "func KYCDateEQ(v time.Time) predicate.Reportwallettb {\n\treturn predicate.Reportwallettb(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldKYCDate), v))\n\t})\n}", "title": "" }, { "docid": "12215131f95e56bd133c34570103955c", "score": "0.4965476", "text": "func (c *Clock) Reset() { c.Clock.Reset() }", "title": "" }, { "docid": "43090f249473fa4f0e1466f449df095e", "score": "0.493857", "text": "func (o EncryptionDetailsResponseOutput) KekCertExpiryDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EncryptionDetailsResponse) *string { return v.KekCertExpiryDate }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "da75c719302b863eb74c79a8329ecb53", "score": "0.49353242", "text": "func ClearLineCE() { print(ansiescape.ClearLineCE) }", "title": "" }, { "docid": "46753567ba984b3f8e993e279e9ead8e", "score": "0.49350905", "text": "func (f *FuncDepSet) clearKey() {\n\tf.setKey(opt.ColSet{}, noKey)\n}", "title": "" }, { "docid": "d7a40bd703f306ef9432672a2e237d0b", "score": "0.49196061", "text": "func (rr *resultDataRepo) Clear(date int64) error {\n\terrReply := make(chan error)\n\treply := make(chan interface{})\n\trr.pipe <- commandResultData{action: clearResultData, error: errReply, result: reply, timestamp: date}\n\terr := <-errReply\n\tif err != nil {\n\t\treturn error(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1265102f80af6e228f297f6c27cc9122", "score": "0.49121067", "text": "func (o EncryptionDetailsResponsePtrOutput) KekCertExpiryDate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EncryptionDetailsResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.KekCertExpiryDate\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c974f233fa606f642c70f0f1e9964fa0", "score": "0.49086624", "text": "func (ruo *ReportwallettbUpdateOne) ClearCitizenId() *ReportwallettbUpdateOne {\n\truo.mutation.ClearCitizenId()\n\treturn ruo\n}", "title": "" }, { "docid": "c3e37c837b519978159bdbee3c4de19b", "score": "0.49048525", "text": "func (k *Kurtosis) Clear() {\n\tif k.IsSetCore() {\n\t\tk.core.Clear()\n\t}\n}", "title": "" }, { "docid": "402bd9135bed6b820eb6fc4e6271f176", "score": "0.48977634", "text": "func (c *change) Clear() {\n\tc.value = nil\n}", "title": "" }, { "docid": "b9468918492ced066b38ab7783712e3b", "score": "0.48830438", "text": "func (dl *DL) Clear(cst byte) {\n\tdl.restart(4)\n\tdl.wr32(CLEAR | uint32(cst))\n}", "title": "" }, { "docid": "7bb891189b5e6b04644659dd6a15a90c", "score": "0.48776278", "text": "func (ru *ReportwallettbUpdate) ClearCitizenId() *ReportwallettbUpdate {\n\tru.mutation.ClearCitizenId()\n\treturn ru\n}", "title": "" }, { "docid": "52f069b21e7dfd2758db208286778e28", "score": "0.4862105", "text": "func Clear(w http.ResponseWriter) {\n\tcookie := &http.Cookie{\n\t\tName: cookieName,\n\t\tValue: \"\",\n\t\tPath: \"/\",\n\t\tMaxAge: -1,\n\t}\n\thttp.SetCookie(w, cookie)\n}", "title": "" }, { "docid": "70b851d12b2b55f2ac2ffd32b314a3ef", "score": "0.48533618", "text": "func Clear() {\n\tEmitLn(\"CLR D0\")\n}", "title": "" }, { "docid": "f73995df3b5a7031d1c66791a41f2b9d", "score": "0.4843794", "text": "func (ou *OfficeUpdate) ClearDoctor() *OfficeUpdate {\n\tou.mutation.ClearDoctor()\n\treturn ou\n}", "title": "" }, { "docid": "0a59c6264b0eb9313256c3413bb13970", "score": "0.4839054", "text": "func (m Message) ClearingBusinessDate() (*field.ClearingBusinessDateField, quickfix.MessageRejectError) {\n\tf := &field.ClearingBusinessDateField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "0a59c6264b0eb9313256c3413bb13970", "score": "0.4839054", "text": "func (m Message) ClearingBusinessDate() (*field.ClearingBusinessDateField, quickfix.MessageRejectError) {\n\tf := &field.ClearingBusinessDateField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "3a4477dbf1b40fff339563bf84d45326", "score": "0.48225328", "text": "func (ouo *OfficeUpdateOne) ClearDoctor() *OfficeUpdateOne {\n\touo.mutation.ClearDoctor()\n\treturn ouo\n}", "title": "" }, { "docid": "07eda72d50a40db930e615585092ebbd", "score": "0.47931147", "text": "func ClearKeyring(c *CecConfig) error {\n\t// Best effort to remove known keys from keyring\n\tif err := keyring.Delete(getKeyringServiceName(), key(c.Url, c.User)); err != nil {\n\t\tif err.Error() != \"secret not found in keyring\" {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "63a3361652ebfb974ee38ad7b9149cbc", "score": "0.47793624", "text": "func (client *QbClient) clearCookie() {\n\tclient.cookie = \"\"\n}", "title": "" }, { "docid": "2c5d709d90624dc4c7ad4cbd88d4cc40", "score": "0.47661152", "text": "func (d *ConsulStateDriver) ClearState(key string) error {\n\tkey = processKey(key)\n\t_, err := d.Client.KV().Delete(key, nil)\n\treturn err\n}", "title": "" }, { "docid": "28b31a6261e23c71306181e6b2a06c16", "score": "0.47604322", "text": "func (m *CustomerMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Customer nullable field %s\", name)\n}", "title": "" }, { "docid": "be10a78077c8b96b0c559246ab9d263c", "score": "0.47480148", "text": "func (c *Counter) Clear() {\n\tc.Value = 0\n}", "title": "" }, { "docid": "2b323c6c906bc752f7f1297cc26571dc", "score": "0.47471687", "text": "func ClearLine(conn io.Writer) error {\n\tclearline := \"\\x1B[2K\"\n\treturn Write(conn, clearline+\"\\r\", color.ModeNone)\n}", "title": "" }, { "docid": "3de8a7e28d15dabfefba93b01e1dca9f", "score": "0.4746278", "text": "func Clear(key string) error {\n\n\tif key == \"\" {\n\t\treturn fmt.Errorf(\"Nil key\")\n\t}\n\n\tk := toKey(key)\n\n\tif !codec.Exists(k){\n\t\treturn nil\n\t}\n\n\treturn codec.Delete(toKey(key))\n\n}", "title": "" }, { "docid": "6f2cc7f08e53252169e3e638f0f79086", "score": "0.47440016", "text": "func (me *XsdGoPkgHasElems_color_clearsequenceevaluatesequencepasssequencetechniquesequenceprofile_glsl_typeschema_ColorClear_TfxClearcolorType_) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElems_color_clearsequenceevaluatesequencepasssequencetechniquesequenceprofile_glsl_typeschema_ColorClear_TfxClearcolorType_; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor _, x := range me.ColorClears {\r\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "91b4629ae62c0f6b1c71684927dc5479", "score": "0.47385183", "text": "func (m *CertificateMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Certificate nullable field %s\", name)\n}", "title": "" }, { "docid": "1cd99586f1abcf2267df27af29f31272", "score": "0.47356167", "text": "func (c *memcacheClient) Clear(_ context.Context) error {\n\treturn c.client.FlushAll()\n}", "title": "" }, { "docid": "bf1425c4f3bd27cbed57b2c8c3283cde", "score": "0.47280455", "text": "func (ru *RankingUpdate) ClearRegisDate() *RankingUpdate {\n\tru.mutation.ClearRegisDate()\n\treturn ru\n}", "title": "" }, { "docid": "656ba9ec7b297689587abf76ac4e33c0", "score": "0.4723481", "text": "func Clearln() {\n\tfmt.Print(\"\\r \\r\")\n}", "title": "" }, { "docid": "eb7f82a632ca59a58a9680dc1aaa0e8c", "score": "0.4714893", "text": "func (x *fastReflection_CreditType) Clear(fd protoreflect.FieldDescriptor) {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.CreditType.abbreviation\":\n\t\tx.Abbreviation = \"\"\n\tcase \"regen.ecocredit.v1.CreditType.name\":\n\t\tx.Name = \"\"\n\tcase \"regen.ecocredit.v1.CreditType.unit\":\n\t\tx.Unit = \"\"\n\tcase \"regen.ecocredit.v1.CreditType.precision\":\n\t\tx.Precision = uint32(0)\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.CreditType\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.CreditType does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "0a8af9d6250d672c45e323e9253ba873", "score": "0.47112584", "text": "func (r *StatesService) Clear(stateKey int64) *StatesClearCall {\n\treturn &StatesClearCall{\n\t\ts: r.s,\n\t\tstateKey: stateKey,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"states/{stateKey}/clear\",\n\t\tcontext_: googleapi.NoContext,\n\t}\n}", "title": "" }, { "docid": "322b8d4ab8ae583ebde07642c7c6ca21", "score": "0.4711112", "text": "func (r *Request) ClearCookie(key ...string) {\n\tr.Context.ClearCookie(key...)\n}", "title": "" }, { "docid": "e7026b41c905ca9dad3ace3427451e3c", "score": "0.47096637", "text": "func (ruo *RankingUpdateOne) ClearRegisDate() *RankingUpdateOne {\n\truo.mutation.ClearRegisDate()\n\treturn ruo\n}", "title": "" }, { "docid": "c4d670ad3b157150d77cbc7372243a69", "score": "0.47045547", "text": "func ClearCredHelperKey() error {\n\tcr, err := crocker.NewWithStrategy(crocker.MemThenStockStrategy{})\n\n\tif err != nil {\n\t\treturn helperNotFound\n\t}\n\n\tlogrus.Debugf(\"found cred helper instance %x\", cr)\n\terr = cr.Erase(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.Debugf(\"cleared cred helper creds\")\n\treturn nil\n}", "title": "" }, { "docid": "ab2d4745884a74ef6b530184342274e8", "score": "0.47008973", "text": "func (m *DoctorMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Doctor nullable field %s\", name)\n}", "title": "" }, { "docid": "24572d92e6fe06910f1476eb0d54cf44", "score": "0.4691199", "text": "func (r *TerminalRenderer) ClearEntries(date string) (string, error) {\n\treturn fmt.Sprintf(\"Cleared all entries for %s\\n\", date), nil\n}", "title": "" }, { "docid": "9d2379c4df5ae4cbc7ea52ecde812f80", "score": "0.4689076", "text": "func (c *Connection) ClearEvent(kind EventKind, id EventRequestID) error {\n\treq := struct {\n\t\tKind EventKind\n\t\tID EventRequestID\n\t}{\n\t\tKind: kind,\n\t\tID: id,\n\t}\n\terr := c.get(cmdSetEventRequest, 2, req, nil)\n\treturn err\n}", "title": "" }, { "docid": "035af83dc4f48fc10d9f769f3a35e6c2", "score": "0.4678987", "text": "func (c *Controller) ClearCtlAppPath() {\n\tc.CtlPathSl = []string{}\n}", "title": "" }, { "docid": "96882f96951e3aabfbbcaa3468300ba4", "score": "0.46764824", "text": "func (r *TerminalRenderer) ClearEntry(date string, entry *model.Entry) (string, error) {\n\treturn fmt.Sprintf(\"Cleared entry %d %s for %s\\n\", entry.Calories, entry.Food, date), nil\n}", "title": "" }, { "docid": "c76389584d0bba6116c51b324f7b4f1e", "score": "0.46724132", "text": "func KYCDateNotNil() predicate.Reportwallettb {\n\treturn predicate.Reportwallettb(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldKYCDate)))\n\t})\n}", "title": "" }, { "docid": "024652709b8de54874cd3a1ef18d8c44", "score": "0.46613333", "text": "func (ruo *ReportwallettbUpdateOne) SetIsKYC(s string) *ReportwallettbUpdateOne {\n\truo.mutation.SetIsKYC(s)\n\treturn ruo\n}", "title": "" }, { "docid": "86789c107f1eea974ae1669ccffe6094", "score": "0.4654688", "text": "func (p *PlotWidget) Clear() {\n\tp.data = []timedata{}\n}", "title": "" }, { "docid": "481634c8e289c2ff7c622d2b8715bcbc", "score": "0.46525842", "text": "func (fuo *FixUpdateOne) ClearCustomer() *FixUpdateOne {\n\tfuo.mutation.ClearCustomer()\n\treturn fuo\n}", "title": "" }, { "docid": "2a1602fd2a649468c8d301033be8d5e0", "score": "0.46495873", "text": "func ClearToEndOfLine() string {\n\treturn fmt.Sprintf(\"%s%dK\", csi, 0)\n}", "title": "" }, { "docid": "ab92ea660f58fcb002645e848536047d", "score": "0.46343294", "text": "func (m *CardMutation) ClearExpiredAt() {\n\tm.expired_at = nil\n\tm.clearedFields[card.FieldExpiredAt] = struct{}{}\n}", "title": "" }, { "docid": "ff0c98c233e4ee372c7adff10ae29105", "score": "0.4626293", "text": "func (c *Controller) clearKeyExpires(key string) {\n\tdelete(c.expires, key)\n}", "title": "" }, { "docid": "aee00eb29c6c7e9feec523a2cca6c539", "score": "0.46193817", "text": "func (cuo *ConstructionUpdateOne) ClearCity() *ConstructionUpdateOne {\n\tcuo.mutation.ClearCity()\n\treturn cuo\n}", "title": "" }, { "docid": "93fb5abc059b98af1086babe6a60c975", "score": "0.46120307", "text": "func (t *Term) Clear() {\n\tt.Write(chars(Clear))\n}", "title": "" }, { "docid": "969e9fb26971b31fcd21a1b97e87a9c6", "score": "0.46067956", "text": "func (x *XKCD) Date() *time.Time {\n\tt, err := time.Parse(\n\t\t\"2006-1-2\",\n\t\tfmt.Sprintf(\"%s-%s-%s\", x.Year, x.Month, x.Day),\n\t)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn &t\n}", "title": "" }, { "docid": "7a448538a19ab874a15c7fbc5a823f35", "score": "0.46060747", "text": "func (lcd *Lcd) Clear() {\n\tif !lcd.on {\n\t\treturn\n\t}\n\tlcd.m.Lock()\n\tdefer lcd.m.Unlock()\n\tlcd.command(_CMD_Clear_Display)\n}", "title": "" }, { "docid": "e59e30b538452f2dfe050253f65717bf", "score": "0.45981717", "text": "func (o *NiaapiVersionRegexAllOf) UnsetDcnm() {\n\to.Dcnm.Unset()\n}", "title": "" }, { "docid": "83c0373b87095e8d332a406ddd2bfee7", "score": "0.45957157", "text": "func (o *EventLog) UnsetExecutionDate() {\n\to.ExecutionDate.Unset()\n}", "title": "" }, { "docid": "86cf1f090f556850af9d4ffbd9ce1b9c", "score": "0.45948565", "text": "func (c *Canvas) Clear() error {\n\treturn c.regular.Clear()\n}", "title": "" }, { "docid": "cdd8a5f9e14eb3d7b80bbf5d7dbc739a", "score": "0.45895442", "text": "func (me *XsdGoPkgHasElems_depth_clearsequenceevaluatesequencepasssequencetechniquesequenceprofile_glsl_typeschema_DepthClear_TfxCleardepthType_) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElems_depth_clearsequenceevaluatesequencepasssequencetechniquesequenceprofile_glsl_typeschema_DepthClear_TfxCleardepthType_; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor _, x := range me.DepthClears {\r\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "f40c61027bfa5bae4b541a339a36d172", "score": "0.4582994", "text": "func KYCDateGTE(v time.Time) predicate.Reportwallettb {\n\treturn predicate.Reportwallettb(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldKYCDate), v))\n\t})\n}", "title": "" }, { "docid": "736ab102be614cd90639c18776676733", "score": "0.45827055", "text": "func (c *CouchbasePersistence) Clear(correlationId string) (err error) {\n\t// Return error if collection is not set\n\tif c.BucketName == \"\" {\n\t\treturn cerr.NewError(\"Bucket name is not defined\")\n\t}\n\n\tflushErr := c.Bucket.Manager(c.Connection.Authenticator.Username, c.Connection.Authenticator.Password).Flush()\n\tif flushErr != nil {\n\t\treturn cerr.NewConnectionError(correlationId, \"FLUSH_FAILED\", \"Couchbase bucket flush failed\").\n\t\t\tWithCause(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bbefb7f38c23fc6201349e5e4c0f98ee", "score": "0.4581578", "text": "func (self *Commands) Clear(key string) {\n\tself.scopeable.Scope().Set(key, nil)\n}", "title": "" }, { "docid": "b49f2344a77f86d30ea4a7e78828ffad", "score": "0.45804843", "text": "func (ru *RankingUpdate) ClearNextDateCalRank() *RankingUpdate {\n\tru.mutation.ClearNextDateCalRank()\n\treturn ru\n}", "title": "" }, { "docid": "b9740d15ea867b88d3d5525c0c1fa6a6", "score": "0.4572388", "text": "func (t Terminfo) ClearLine() string {\n\treturn t.FmtClearLine\n}", "title": "" }, { "docid": "ec96252c684cc2a6e60959bb5e2876e7", "score": "0.45702168", "text": "func (o *NullableClass) UnsetDatetimeProp() {\n\to.DatetimeProp.Unset()\n}", "title": "" } ]
f8f659ef8a3da0c4118ed517f2668e1e
Check if current address is less than or equal to rhs address Compare is either Strict (Addr+Cidr+Type) or Value only
[ { "docid": "bad74d4fef7b9faa5cc3fd7394b0e5ad", "score": "0.6057488", "text": "func (addr *IPAddress) LE(rhs IPAddress, compMode AddrCompareType) bool {\n\treturn addr.Compare(rhs, LE, compMode)\n}", "title": "" } ]
[ { "docid": "0b68a6e3cb03554f86d78f899b82d72f", "score": "0.68836945", "text": "func (addr *IPAddress) Compare(rhs IPAddress, compOps AddrCompareOperator, compMode AddrCompareType) bool {\n\tlhsTop := new(IPAddress)\n\trhsTop := new(IPAddress)\n\n\tif (len(addr.IP) != len(rhs.IP)) && compMode == Strict {\n\t\tif compOps == NE {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif compMode == Strict { // Strict includes the CIDR in compare\n\t\tlhsTop = addr.End()\n\t\trhsTop = rhs.End()\n\t} else {\n\t\tif len(addr.IP) == 0 {\n\t\t\tlhsTop = nil\n\t\t} else {\n\t\t\tlhsTop.IP = make(net.IP, len(addr.IP))\n\t\t\tcopy(lhsTop.IP, addr.IP)\n\t\t}\n\n\t\tif len(rhs.IP) == 0 {\n\t\t\trhsTop = nil\n\t\t} else {\n\t\t\trhsTop.IP = make(net.IP, len(rhs.IP))\n\t\t\tcopy(rhsTop.IP, rhs.IP)\n\t\t}\n\t}\n\n\tresult := 0\n\tif lhsTop == nil && rhsTop != nil {\n\t\tresult = -1\n\t} else if lhsTop != nil && rhsTop == nil {\n\t\tresult = 1\n\t} else if lhsTop == nil && rhsTop == nil {\n\t\tresult = 0\n\t} else {\n\t\tif len(rhsTop.IP) != len(lhsTop.IP) {\n\t\t\tif compOps == NE {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tfor i := 0; i < len(rhsTop.IP); i++ {\n\t\t\tif lhsTop.IP[i] < rhsTop.IP[i] {\n\t\t\t\tresult = -1\n\t\t\t\tbreak\n\t\t\t} else if lhsTop.IP[i] > rhsTop.IP[i] {\n\t\t\t\tresult = 1\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch compOps {\n\tcase LE:\n\t\treturn result == -1 || result == 0\n\tcase LT:\n\t\treturn result == -1\n\tcase GE:\n\t\treturn result == 1 || result == 0\n\tcase GT:\n\t\treturn result == 1\n\tcase EQ:\n\t\treturn result == 0\n\tcase NE:\n\t\treturn result == -1 || result == 1\n\tdefault:\n\t\treturn false\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "80a36ac9164302a1bb96bad683910ae7", "score": "0.6308761", "text": "func (addr *IPAddress) LT(rhs IPAddress, compMode AddrCompareType) bool {\n\treturn addr.Compare(rhs, LT, compMode)\n}", "title": "" }, { "docid": "dd7e28fade816bd04294adab6c528454", "score": "0.62845576", "text": "func addrIsGreater(a net.IP, b net.IP) bool {\n\tif bytes.Compare(a, b) == 1 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8dc686954ad6d6c1d8fd3ab76310a25a", "score": "0.6245285", "text": "func (addr *IPAddress) Contains(rhs IPAddress, compareType AddrCompareType) bool {\n\tlhsEnd := addr.End()\n\tlhsStart := addr.Start()\n\trhsEnd := rhs.End()\n\trhsStart := rhs.Start()\n\n\tif lhsEnd == nil || rhsEnd == nil || lhsStart == nil || rhsStart == nil {\n\t\treturn false\n\t}\n\n\tisEqual := lhsStart.LE(*rhsStart, Value) && lhsEnd.GE(*rhsEnd, Value)\n\tisStrict := lhsStart.LT(*rhsStart, Value) && lhsEnd.GT(*rhsEnd, Value)\n\n\tif compareType == Value {\n\t\treturn isEqual\n\t} else {\n\t\treturn isStrict\n\t}\n}", "title": "" }, { "docid": "21545ef9bd0b52725c92498edb7b686b", "score": "0.6037878", "text": "func (addr *IPAddress) Within(rhs IPAddress, comparetype AddrCompareType) bool {\n\tlhsEnd := addr.End()\n\tlhsStart := addr.Start()\n\trhsEnd := rhs.End()\n\trhsStart := rhs.Start()\n\n\tif lhsEnd == nil || rhsEnd == nil || rhsStart == nil || lhsStart == nil {\n\t\treturn false\n\t}\n\n\tisEqual := lhsStart.GE(*rhsStart, Value) && lhsEnd.LE(*rhsEnd, Value)\n\tisStrict := lhsStart.GT(*rhsStart, Value) && lhsEnd.LT(*rhsEnd, Value)\n\n\tif comparetype == Value {\n\t\treturn isEqual\n\t} else {\n\t\treturn isStrict\n\t}\n}", "title": "" }, { "docid": "c4aaa8c78f61fdc1db2b7abdabe18d38", "score": "0.598506", "text": "func (c byAddress) Less(i, j int) bool {\n\tiAddr := c[i].addr\n\tjAddr := c[j].addr\n\tif iAddr.seriesID < jAddr.seriesID {\n\t\treturn true\n\t}\n\tif iAddr.seriesID > jAddr.seriesID {\n\t\treturn false\n\t}\n\n\t// The seriesID are equal, so compare index.\n\tif iAddr.index < jAddr.index {\n\t\treturn true\n\t}\n\tif iAddr.index > jAddr.index {\n\t\treturn false\n\t}\n\n\t// The seriesID and index are equal, so compare branch.\n\tif iAddr.branch < jAddr.branch {\n\t\treturn true\n\t}\n\tif iAddr.branch > jAddr.branch {\n\t\treturn false\n\t}\n\n\t// The seriesID, index, and branch are equal, so compare hash.\n\ttxidComparison := bytes.Compare(c[i].OutPoint.Hash[:], c[j].OutPoint.Hash[:])\n\tif txidComparison < 0 {\n\t\treturn true\n\t}\n\tif txidComparison > 0 {\n\t\treturn false\n\t}\n\n\t// The seriesID, index, branch, and hash are equal, so compare output\n\t// index.\n\treturn c[i].OutPoint.Index < c[j].OutPoint.Index\n}", "title": "" }, { "docid": "46046193c077ecdc3b8933e46a81d39f", "score": "0.5964232", "text": "func (s JSONAddresses) Less(i, j int) bool {\n\tsi := strings.Split(s[i].Address, \"/\")\n\tsj := strings.Split(s[j].Address, \"/\")\n\tsi0, _ := strconv.Atoi(si[0])\n\tsj0, _ := strconv.Atoi(sj[0])\n\tsi1, _ := strconv.Atoi(si[1])\n\tsj1, _ := strconv.Atoi(sj[1])\n\tif si0 < sj0 {\n\t\treturn true\n\t} else if si0 == sj0 && si1 < sj1 {\n\t\treturn true\n\t} else if len(si) == 3 {\n\t\tsi2, _ := strconv.Atoi(si[2])\n\t\tsj2, _ := strconv.Atoi(sj[2])\n\t\tif si0 == sj0 && si1 == sj1 && si2 < sj2 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "06e00d6d87c51348690cdd48d1975685", "score": "0.5948075", "text": "func (r IPRange) less(other IPRange) bool {\n\tif cmp := r.from.Compare(other.from); cmp != 0 {\n\t\treturn cmp < 0\n\t}\n\treturn other.to.Less(r.to)\n}", "title": "" }, { "docid": "a8faa7b8fd111b2579495728c4d424b1", "score": "0.5920326", "text": "func (ip IP) Less(ip2 IP) bool { return ip.Compare(ip2) == -1 }", "title": "" }, { "docid": "37aedb2a03267094d6d0b09ef7e58a87", "score": "0.584359", "text": "func (addr *IPAddress) GT(rhs IPAddress, compMode AddrCompareType) bool {\n\treturn addr.Compare(rhs, GT, compMode)\n}", "title": "" }, { "docid": "ba6e7bd15ef0231415d2299539e85e77", "score": "0.5816995", "text": "func (ipa IPAddress) LessThan(comp *IPAddress) bool {\n\tfor idx := range ipa.IP {\n\t\tif ipa.IP[idx] > comp.IP[idx] {\n\t\t\treturn false\n\t\t} else if ipa.IP[idx] < comp.IP[idx] {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1fc8b09607154d3089ecbc715b460c36", "score": "0.5810649", "text": "func (c Int16Compare) IsLess(lhs, rhs int16) bool { return c(lhs, rhs) }", "title": "" }, { "docid": "74f5781c9eb2c213df0dd9cf47118c7b", "score": "0.5715643", "text": "func (addr *IPAddress) GE(rhs IPAddress, compMode AddrCompareType) bool {\n\treturn addr.Compare(rhs, GE, compMode)\n}", "title": "" }, { "docid": "e0f02cc129cbd3a0819223e911cad09f", "score": "0.56903887", "text": "func lte(s sort.Interface, a, b int) bool {\n\treturn !s.Less(b, a)\n}", "title": "" }, { "docid": "c249a7c56dbda5940d8ba65371156b9f", "score": "0.56669647", "text": "func (c Uint32Compare) IsLess(lhs, rhs uint32) bool { return c(lhs, rhs) }", "title": "" }, { "docid": "62027d462213ea339c45251d5bfb0567", "score": "0.56129766", "text": "func (self NetAddr) IsEq(other NetAddr) bool { return bool(C.netaddr_is_eq(self.inner, other.inner)) }", "title": "" }, { "docid": "30b3810109016c721e300bbc659530f5", "score": "0.55988497", "text": "func (a Address) Min(b Address) Address {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "d046f5f22e3ff75aaa17abd3a341622e", "score": "0.5597067", "text": "func AddressLTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "18e35e2f66946ca9d8fde3be5139a6da", "score": "0.55667704", "text": "func (addr *IPAddress) NE(rhs IPAddress, compMode AddrCompareType) bool {\n\treturn addr.Compare(rhs, NE, compMode)\n}", "title": "" }, { "docid": "a08b11aeeefa2f1297e83533f7f84e02", "score": "0.5555743", "text": "func (addr DevAddr) Equal(other DevAddr) bool { return addr == other }", "title": "" }, { "docid": "e3b04d628dd8903b9cd61b9695f52715", "score": "0.5516336", "text": "func CompareBound32(first *Bound32, second *Bound32) bool {\n\tfirstBoundRange := first.Upper - first.Lower\n\tsecondBoundRange := second.Upper - second.Lower\n\n\tif firstBoundRange > secondBoundRange {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0c65b26303b7051633cb6d2491b35740", "score": "0.5483546", "text": "func AddressLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "7a326283107f80883f8dceb41cbf0dbc", "score": "0.5420084", "text": "func Less(a, b externalapi.DomainSubnetworkID) bool {\n\treturn cmp(a, b) < 0\n}", "title": "" }, { "docid": "dc01114315b373fe1bd4f6cac1209d4d", "score": "0.5416294", "text": "func (s *endpointAddressMultiSorter) Less(i, j int) bool {\n\tp, q := s.addresses[i], s.addresses[j]\n\n\t// Try all but the last comparison.\n\tvar k int\n\tfor k = 0; k < len(s.less)-1; k++ {\n\t\tless := s.less[k]\n\t\tswitch {\n\t\tcase less(&p, &q):\n\t\t\treturn true\n\t\tcase less(&q, &p):\n\t\t\treturn false\n\t\t}\n\t\t// p == q; try the next comparison.\n\t}\n\n\treturn s.less[k](&p, &q)\n}", "title": "" }, { "docid": "6403f18a2613c8e0980a5ea369f98d7d", "score": "0.53910524", "text": "func StrictlyGreaterThanOrEquals(larger *Resource, smaller *Resource) bool {\n if larger == nil {\n larger = Zero\n }\n if smaller == nil {\n smaller = Zero\n }\n\n for k, v := range larger.Resources {\n if smaller.Resources[k] > v {\n return false\n }\n }\n\n for k, v := range smaller.Resources {\n if larger.Resources[k] < v {\n return false\n }\n }\n\n return true\n}", "title": "" }, { "docid": "ee86a95503729e6386e474b3aa0264e4", "score": "0.53868127", "text": "func (addr *IPAddress) EQ(rhs IPAddress, compMode AddrCompareType) bool {\n\treturn addr.Compare(rhs, EQ, compMode)\n}", "title": "" }, { "docid": "a89aaf374a7e0e5550d15739f528a933", "score": "0.53852236", "text": "func less(c1, c2 Cost) bool {\n\tswitch {\n\tcase c1.OpCode != c2.OpCode:\n\t\treturn c1.OpCode < c2.OpCode\n\tcase c1.IsUnique == c2.IsUnique:\n\t\treturn c1.VindexCost <= c2.VindexCost\n\tdefault:\n\t\treturn c1.IsUnique\n\t}\n}", "title": "" }, { "docid": "c20c7474a0e8c3e6457ef2d656c5eeb4", "score": "0.5355119", "text": "func lessOrEqualFunc(x float64, y float64) bool {\n\treturn x <= y\n}", "title": "" }, { "docid": "bfec94d8269292461fe9bcc6f2f6c7c8", "score": "0.5318245", "text": "func (s ByPrefix) Less(left, right int) bool {\n\t// compare the addresses a byte at a time\n\tfor i := 0; i < len(s[left].IP); i++ {\n\t\tswitch {\n\t\tcase s[left].IP[i] < s[right].IP[i]:\n\t\t\treturn true\n\t\tcase s[left].IP[i] > s[right].IP[i]:\n\t\t\treturn false\n\t\tcase s[left].IP[i] == s[right].IP[i]:\n\t\t\tcontinue\n\t\t}\n\t}\n\n\t// compare the netmask if everything is equal so far!\n\tfor i := 0; i < len(s[left].Mask); i++ {\n\t\tswitch {\n\t\tcase s[left].Mask[i] < s[right].Mask[i]:\n\t\t\treturn true\n\t\tcase s[left].Mask[i] > s[right].Mask[i]:\n\t\t\treturn false\n\t\tcase s[left].Mask[i] == s[right].Mask[i]:\n\t\t\tcontinue\n\t\t}\n\t}\n\n\t// they're identical...\n\treturn true\n}", "title": "" }, { "docid": "5b3579f7ada861e690124efb5861ffbd", "score": "0.53109604", "text": "func TestLessThan(t *testing.T) {\n\tassert.True(t, lessThan(net.ParseIP(\"1.0.0.0\"), net.ParseIP(\"1.0.0.1\")))\n\tassert.False(t, lessThan(net.ParseIP(\"1.0.2.0\"), net.ParseIP(\"1.0.0.1\")))\n\tassert.True(t, lessThan(net.ParseIP(\"1.0.0.255\"), net.ParseIP(\"1.0.1.0\")))\n\tassert.False(t, lessThan(net.ParseIP(\"1.0.0.0\"), net.ParseIP(\"1.0.0.0\")))\n}", "title": "" }, { "docid": "0d3235e0696cdeef97564fdd3bc6214a", "score": "0.53095603", "text": "func (ip IP) Less(ip2 IP) bool {\n\ta, b := ip, ip2\n\t// Zero value sorts first.\n\tif a.ipImpl == nil {\n\t\treturn b.ipImpl != nil\n\t}\n\tif b.ipImpl == nil {\n\t\treturn false\n\t}\n\n\t// At this point, a and b are both either v4 or v6.\n\n\tif a4, ok := a.ipImpl.(v4Addr); ok {\n\t\tif b4, ok := b.ipImpl.(v4Addr); ok {\n\t\t\treturn bytes.Compare(a4[:], b4[:]) < 0\n\t\t}\n\t\t// v4 sorts before v6.\n\t\treturn true\n\t}\n\n\t// At this point, a and b are both v6 or v6+zone.\n\ta16 := a.ipImpl.as16()\n\tb16 := b.ipImpl.as16()\n\tswitch bytes.Compare(a16[:], b16[:]) {\n\tcase -1:\n\t\treturn true\n\tdefault:\n\t\treturn a.Zone() < b.Zone()\n\tcase 1:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "05b2ae467157d09f519cf7ed6944a59e", "score": "0.5308061", "text": "func (first RowKeyType) LowerBound(second RowKeyType) bool {\n\treturn int(first) >= int(second)\n}", "title": "" }, { "docid": "10d5e28ba83e06b439503960c4fc5314", "score": "0.52983105", "text": "func (v Value) CanAddr() bool {\n\tiv := v.internal()\n\treturn iv.flag&flagAddr != 0\n}", "title": "" }, { "docid": "1a225d01bb3d00eb724285f888b48a5f", "score": "0.528584", "text": "func IsSameAddress(addrA string, addrB string) bool {\n\t// TODO:\n\treturn false\n}", "title": "" }, { "docid": "4ebff7fa7aa01de42efadda764d56bda", "score": "0.52760345", "text": "func CompareBound64(first *Bound64, second *Bound64) bool {\n\tfirstBoundRange := first.Upper - first.Lower\n\tsecondBoundRange := second.Upper - second.Lower\n\n\tif firstBoundRange > secondBoundRange {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7a45c27c065cead97ddf1a23eacb6787", "score": "0.52745503", "text": "func (a Address) Cmp(b wire.Address) int {\n\tbTyped, ok := b.(*Address)\n\tif !ok {\n\t\tpanic(\"wrong type\")\n\t}\n\treturn bytes.Compare(a[:], bTyped[:])\n}", "title": "" }, { "docid": "548f6afafa822c77e6a19d61ea9f8589", "score": "0.5270011", "text": "func (a Address) Equal(b Address) bool {\n\tif a.TON != b.TON || a.NPI != b.NPI {\n\t\treturn false\n\t}\n\tif a.Addr == nil && b.Addr == nil {\n\t\treturn true\n\t}\n\tif (a.Addr == nil) != (b.Addr == nil) {\n\t\treturn false\n\t}\n\tvar at, bt bool\n\tswitch a.Addr.(type) {\n\tcase GSM7bitString:\n\t\tat = true\n\tdefault:\n\t\tat = false\n\t}\n\tswitch b.Addr.(type) {\n\tcase GSM7bitString:\n\t\tbt = true\n\tdefault:\n\t\tbt = false\n\t}\n\tif at != bt {\n\t\treturn false\n\t}\n\treturn a.Addr.String() == b.Addr.String()\n}", "title": "" }, { "docid": "1dee7abf70bc8604829a31df64938b2a", "score": "0.525719", "text": "func CmpLess(x, y interface{}) bool { return x.(Comparable).Compare(y.(Comparable)) < 0 }", "title": "" }, { "docid": "405432984dbc69592d94e1d97c6879d4", "score": "0.52472514", "text": "func (s SubnetsSorter) Less(i, j int) bool {\n\treturn fmt.Sprintf(\"%s/%d\", s[i].SubnetAddress, s[i].Mask) < fmt.Sprintf(\"%s/%d\", s[j].SubnetAddress, s[j].Mask)\n}", "title": "" }, { "docid": "74a14ac049607317ed7c0abf7398a8c0", "score": "0.5235478", "text": "func (c Uint32EnumCompare) IsLess(nLHS int, lhs uint32, nRHS int, rhs uint32) bool {\n\treturn c(nLHS, lhs, nRHS, rhs)\n}", "title": "" }, { "docid": "0d8cfc7a56ced4b9ecb1ca5783a0aa13", "score": "0.52261806", "text": "func (vt Number) Less(rhs Value) (bool, error) {\n\tswitch other := rhs.(type) {\n\tcase Number:\n\t\treturn vt.v < other.v, nil\n\tdefault:\n\t\treturn false, ValueError{\"comparing incompatible types\"}\n\t}\n}", "title": "" }, { "docid": "eb1658691b4dcc47cbfc0e212f925af7", "score": "0.5206516", "text": "func Less(a, b Score) bool {\n\taply, ach := a.err.(checkmateError)\n\tbply, bch := b.err.(checkmateError)\n\tswitch {\n\tcase ach && bch:\n\t\tswitch awin, bwin := aply&1 != 0, bply&1 != 0; {\n\t\tcase awin && bwin:\n\t\t\treturn aply > bply\n\t\tcase !awin && !bwin:\n\t\t\treturn aply < bply\n\t\tdefault:\n\t\t\treturn bwin\n\t\t}\n\tcase ach:\n\t\treturn aply&1 == 0\n\tcase bch:\n\t\treturn bply&1 != 0\n\t}\n\treturn a.n < b.n\n}", "title": "" }, { "docid": "c155c20302803205436c6c5c50b91bdb", "score": "0.5194093", "text": "func DistanceCmp(a, x, y Address) (int, error) {\n\tab, xb, yb := a.b, x.b, y.b\n\n\tif len(ab) != len(xb) || len(ab) != len(yb) {\n\t\treturn 0, errors.New(\"address length must match\")\n\t}\n\n\tfor i := range ab {\n\t\tdx := xb[i] ^ ab[i]\n\t\tdy := yb[i] ^ ab[i]\n\t\tif dx == dy {\n\t\t\tcontinue\n\t\t} else if dx < dy {\n\t\t\treturn 1, nil\n\t\t}\n\t\treturn -1, nil\n\t}\n\treturn 0, nil\n}", "title": "" }, { "docid": "2b8dad0eac2e457b03e6a163b0477770", "score": "0.51638424", "text": "func (c Int16EnumCompare) IsLess(nLHS int, lhs int16, nRHS int, rhs int16) bool {\n\treturn c(nLHS, lhs, nRHS, rhs)\n}", "title": "" }, { "docid": "96ff2414d43b51b484076439999c9cf5", "score": "0.51525867", "text": "func adjust(addr uint64, offset int64) (uint64, bool) {\n\tadj := uint64(int64(addr) + offset)\n\tif offset < 0 {\n\t\tif adj >= addr {\n\t\t\treturn 0, true\n\t\t}\n\t} else {\n\t\tif adj < addr {\n\t\t\treturn 0, true\n\t\t}\n\t}\n\treturn adj, false\n}", "title": "" }, { "docid": "9b5b2246cf7dd329e41b55e1ec0f561a", "score": "0.5150438", "text": "func (aTx AutoTxInit) less(than AutoTxInit) bool {\n\treturn (aTx.Trigger.ToFloat() < than.Trigger.ToFloat())\n}", "title": "" }, { "docid": "df959ce612f08fee2382508240a78a6b", "score": "0.51460505", "text": "func ge(arg1, arg2 reflect.Value) (bool, error) {\n\t// >= is the inverse of <.\n\tlessThan, err := lt(arg1, arg2)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn !lessThan, nil\n}", "title": "" }, { "docid": "3df9ec5059df53e2e845bdf5ed5f1541", "score": "0.5142709", "text": "func less(lhsKey, rhsKey string) bool {\n\tif isPreflightKey(lhsKey) {\n\t\tif isPreflightKey(rhsKey) {\n\t\t\t// ignore skip prefix\n\t\t\treturn lhsKey[4:] < rhsKey[4:]\n\t\t}\n\t\t// lhs is preflight, rhs is not preflight\n\t\treturn false\n\t}\n\n\tif isPreflightKey(rhsKey) {\n\t\t// lhs is not preflight, rhs is preflight\n\t\treturn true\n\t}\n\n\t// lhs is not preflight, rhs is not preflight\n\treturn lhsKey < rhsKey\n}", "title": "" }, { "docid": "d8a93bf1f630ab2ae4945f934076d042", "score": "0.51393175", "text": "func (s AnyValue) IsLessOrEqualTo(expected interface{}) bool {\n\treturn s.value != expected\n}", "title": "" }, { "docid": "c7e1ebcccbc5fe263c4379ff9515aa59", "score": "0.5126937", "text": "func (n Fixed64) IsLesser(value interface{}) bool {\n\treturn n.i64 < New(value).i64\n}", "title": "" }, { "docid": "66ce6fd764305aae5d7bfeaa0038c3ba", "score": "0.5124599", "text": "func (r IPRange) entirelyBefore(other IPRange) bool {\n\treturn r.to.Less(other.from)\n}", "title": "" }, { "docid": "c2c1d0a848b4d3685c0ac46b68d81567", "score": "0.5117976", "text": "func StrictlyGreaterThan(larger *Resource, smaller *Resource) bool {\n if larger == nil {\n larger = Zero\n }\n if smaller == nil {\n smaller = Zero\n }\n\n delta := Quantity(0)\n\n for k, v := range larger.Resources {\n if smaller.Resources[k] > v {\n return false\n }\n delta += v - smaller.Resources[k]\n }\n\n for k, v := range smaller.Resources {\n if larger.Resources[k] < v {\n return false\n }\n delta += larger.Resources[k] - v\n }\n\n return delta > 0\n}", "title": "" }, { "docid": "8a0ee9ff8e294a12b02483380afc01b6", "score": "0.51162803", "text": "func inRange(r ipRange, ipAddress net.IP) bool {\n // strcmp type byte comparison\n if bytes.Compare(ipAddress, r.start) >= 0 && bytes.Compare(ipAddress, r.end) < 0 {\n return true\n }\n return false\n}", "title": "" }, { "docid": "8291f556b5781189476fc9dea2f95ca6", "score": "0.50966585", "text": "func (c Coordinate) strictCmp(o Coordinate) int {\n\tswitch {\n\tcase c.Lat < o.Lat && c.Lon < o.Lon:\n\t\treturn less\n\tcase c.Lat > o.Lat && c.Lon > o.Lon:\n\t\treturn more\n\tcase c.Lat <= o.Lat && c.Lon <= o.Lon:\n\t\treturn lessOrEq\n\tcase c.Lat >= o.Lat && c.Lon >= o.Lon:\n\t\treturn moreOrEq\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "d8b08b5d4d59ca4dcf221978bd8cb796", "score": "0.5080985", "text": "func lessValue(a, b reflect.Value) bool {\n\taValue, aNumerical := numericalValue(a)\n\tbValue, bNumerical := numericalValue(b)\n\n\tif aNumerical && bNumerical {\n\t\treturn aValue < bValue\n\t}\n\n\tif !aNumerical && !bNumerical {\n\t\t// In theory this should mean they are both strings. In reality\n\t\t// they could be any other type and the String() representation\n\t\t// will be something like \"<bool>\" if it is not a string. Since\n\t\t// distinct values of non-strings still return the same value\n\t\t// here that's what makes the ordering undefined.\n\t\treturn strings.Compare(a.String(), b.String()) < 0\n\t}\n\n\t// Numerical values are always treated as less than other types\n\t// (including strings that might represent numbers themselves). The\n\t// inverse is also true.\n\treturn aNumerical && !bNumerical\n}", "title": "" }, { "docid": "7cb7aeda494e0e1a6a8b2bc78a4d3d57", "score": "0.50806284", "text": "func isAddrEqual(left, right string) bool {\n\tleftIP := net.ParseIP(left)\n\trightIP := net.ParseIP(right)\n\tif rightIP == nil {\n\t\treturn leftIP == nil\n\t}\n\treturn rightIP.Equal(leftIP)\n}", "title": "" }, { "docid": "0b3955201c615d601051b1d7d728bccc", "score": "0.50772226", "text": "func (r IPRange) coveredBy(other IPRange) bool {\n\treturn other.from.lessOrEq(r.from) && r.to.lessOrEq(other.to)\n}", "title": "" }, { "docid": "d5a8186124b9112c45afbce45fa65f9d", "score": "0.5064036", "text": "func isEqual(addr1, addr2 net.Addr) bool {\n\tif addr1.Network() != addr2.Network() {\n\t\treturn false\n\t}\n\ta1Str := addr1.String()\n\ta2Str := addr2.String()\n\tif a1Str == a2Str {\n\t\treturn true\n\t}\n\t// This allows for ipv6 vs ipv4 local addresses to compare as equal. This\n\t// scenario is common when listening on localhost.\n\tconst ipv6prefix = \"[::]\"\n\ta1Str = strings.TrimPrefix(a1Str, ipv6prefix)\n\ta2Str = strings.TrimPrefix(a2Str, ipv6prefix)\n\tconst ipv4prefix = \"0.0.0.0\"\n\ta1Str = strings.TrimPrefix(a1Str, ipv4prefix)\n\ta2Str = strings.TrimPrefix(a2Str, ipv4prefix)\n\treturn a1Str == a2Str\n}", "title": "" }, { "docid": "189e93ab543a032f98a053f122c65f53", "score": "0.5053838", "text": "func (_Reserve *ReserveCaller) IsOtherReserveAddress(opts *bind.CallOpts, arg0 common.Address) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _Reserve.contract.Call(opts, out, \"isOtherReserveAddress\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "2e28b92bae604c9e17f22af6771096d5", "score": "0.5051545", "text": "func (items ipPairs) Less(i, j int) bool {\n return items[i].startIP >= items[j].startIP\n}", "title": "" }, { "docid": "a671dc9efcea9a102576eb9c699db602", "score": "0.50489736", "text": "func less(value1 int, value2 int) bool {\n\treturn value1 < value2\n}", "title": "" }, { "docid": "20efb897e3d01a946dcd2b800e1fe34d", "score": "0.50446975", "text": "func (s IPListEntrySlice) Less(i, j int) bool {\n\t_, iNet, _ := net.ParseCIDR(*s[i].Cidr)\n\t_, jNet, _ := net.ParseCIDR(*s[j].Cidr)\n\tiPrefixSize, _ := iNet.Mask.Size()\n\tjPrefixSize, _ := jNet.Mask.Size()\n\tif iPrefixSize == jPrefixSize {\n\t\treturn bytes.Compare(iNet.IP, jNet.IP) < 0\n\t}\n\treturn iPrefixSize < jPrefixSize\n}", "title": "" }, { "docid": "22eb4daa6b11c5215205160683e60d5d", "score": "0.5043838", "text": "func (c *CPU) compareA(val byte) {\n\tc.subtractBytes(c.registers.AF.low, val)\n\n\tif c.registers.AF.low < val {\n\t\tc.registers.setFlag(flagC)\n\t} else {\n\t\tc.registers.resetFlag(flagC)\n\n\t}\n}", "title": "" }, { "docid": "a3b861cc4717729d363b4084f19277c4", "score": "0.5042756", "text": "func (me NodeId) LessThan(other bt.Comparable) bool {\n return bytes.Compare(me[:], getNodeIdSlice(other)) < 0\n}", "title": "" }, { "docid": "9c8642cc84cd03bdb6842f489b96d093", "score": "0.5041075", "text": "func (s AnyValue) IsLessThan(expected interface{}) bool {\n\treturn s.value != expected\n}", "title": "" }, { "docid": "2e6efc213641e8ab03bdee5f201fe0b5", "score": "0.50349534", "text": "func isBorrow(vals ...uint8) bool {\n\tdiffSoFar := vals[0]\n\tfor i := 1; i < len(vals); i++ {\n\t\tif diffSoFar < vals[i] {\n\t\t\treturn true\n\t\t}\n\t\tdiffSoFar -= vals[i]\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e7d6616acd153ea06adb8612f74fd86b", "score": "0.5018009", "text": "func (mr *MutableRange) Check(b []byte) error {\n\tfor _, addr := range mr.Addrs {\n\t\toffset := addr.fullOffset()\n\t\tfor i, value := range mr.Old {\n\t\t\tif b[offset+i] != value {\n\t\t\t\treturn fmt.Errorf(\"expected %x at %x; found %x\",\n\t\t\t\t\tmr.Old[i], offset+i, b[offset+i])\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "381a89f67faa2dfecf27f854dae15d18", "score": "0.50139785", "text": "func (v *Zcash) ValidateAddress(addr string, network NetworkType) *Result {\n\tif addrType := ZcashlikeNormalAddrType(v, addr, network); addrType != Unknown {\n\t\treturn &Result{Success, true, addrType, \"\"}\n\t}\n\n\treturn &Result{Success, false, Unknown, \"\"}\n}", "title": "" }, { "docid": "371327f17e79a6e3a0343e3db743622b", "score": "0.5010079", "text": "func CompareAndSwapStrongInt64RelaxedRelaxed(addr *int64, old, new int64) bool", "title": "" }, { "docid": "736c277aabd65754d358eadcd91bc39b", "score": "0.50099087", "text": "func isLess(x, y reflect.Value) bool {\n\tswitch x.Type().Kind() {\n\tcase reflect.Bool:\n\t\treturn !x.Bool() && y.Bool()\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn x.Int() < y.Int()\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn x.Uint() < y.Uint()\n\tcase reflect.Float32, reflect.Float64:\n\t\tfx, fy := x.Float(), y.Float()\n\t\treturn fx < fy || math.IsNaN(fx) && !math.IsNaN(fy)\n\tcase reflect.Complex64, reflect.Complex128:\n\t\tcx, cy := x.Complex(), y.Complex()\n\t\trx, ix, ry, iy := real(cx), imag(cx), real(cy), imag(cy)\n\t\tif rx == ry || (math.IsNaN(rx) && math.IsNaN(ry)) {\n\t\t\treturn ix < iy || math.IsNaN(ix) && !math.IsNaN(iy)\n\t\t}\n\t\treturn rx < ry || math.IsNaN(rx) && !math.IsNaN(ry)\n\tcase reflect.Ptr, reflect.UnsafePointer, reflect.Chan:\n\t\treturn x.Pointer() < y.Pointer()\n\tcase reflect.String:\n\t\treturn x.String() < y.String()\n\tcase reflect.Array:\n\t\tfor i := 0; i < x.Len(); i++ {\n\t\t\tif isLess(x.Index(i), y.Index(i)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif isLess(y.Index(i), x.Index(i)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn false\n\tcase reflect.Struct:\n\t\tfor i := 0; i < x.NumField(); i++ {\n\t\t\tif isLess(x.Field(i), y.Field(i)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif isLess(y.Field(i), x.Field(i)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn false\n\tcase reflect.Interface:\n\t\tvx, vy := x.Elem(), y.Elem()\n\t\tif !vx.IsValid() || !vy.IsValid() {\n\t\t\treturn !vx.IsValid() && vy.IsValid()\n\t\t}\n\t\ttx, ty := vx.Type(), vy.Type()\n\t\tif tx == ty {\n\t\t\treturn isLess(x.Elem(), y.Elem())\n\t\t}\n\t\tif tx.Kind() != ty.Kind() {\n\t\t\treturn vx.Kind() < vy.Kind()\n\t\t}\n\t\tif tx.String() != ty.String() {\n\t\t\treturn tx.String() < ty.String()\n\t\t}\n\t\tif tx.PkgPath() != ty.PkgPath() {\n\t\t\treturn tx.PkgPath() < ty.PkgPath()\n\t\t}\n\t\t// This can happen in rare situations, so we fallback to just comparing\n\t\t// the unique pointer for a reflect.Type. This guarantees deterministic\n\t\t// ordering within a program, but it is obviously not stable.\n\t\treturn reflect.ValueOf(vx.Type()).Pointer() < reflect.ValueOf(vy.Type()).Pointer()\n\tdefault:\n\t\t// Must be Func, Map, or Slice; which are not comparable.\n\t\tpanic(fmt.Sprintf(\"%T is not comparable\", x.Type()))\n\t}\n}", "title": "" }, { "docid": "a9b06804ae9083d78886960cf4b490f5", "score": "0.5004847", "text": "func (coin DecCoin) IsLT(other DecCoin) bool {\n\tif coin.Denom != other.Denom {\n\t\tpanic(fmt.Sprintf(\"invalid coin denominations; %s, %s\", coin.Denom, other.Denom))\n\t}\n\n\treturn coin.Amount.LT(other.Amount)\n}", "title": "" }, { "docid": "cbcdaa1e2fe3efb12339afbf411df3df", "score": "0.50036556", "text": "func AndInt32AcqRel(addr *int32, value int32) int32", "title": "" }, { "docid": "013ab4dae4d3083aacd5cd7487c7ab9a", "score": "0.5003523", "text": "func (c Condition) Less(rhs interface{}) bool {\n\treturn c.compare(c.lhs, reflect.ValueOf(rhs)) < 0\n}", "title": "" }, { "docid": "9d5a91ca6d3cbf613e4cf81d9654de95", "score": "0.50009876", "text": "func (p *Proposal) IsLEThan(other *Proposal) bool {\n\treturn p.IsLowerThan(other) || p.IsEqualTo(other)\n}", "title": "" }, { "docid": "3f9056d885f89e47dbaf278a47aa33f9", "score": "0.49997318", "text": "func (v *UintValue) LessThan(o Value) Possibility {\n\ta, b := v.span(), o.(*UintValue).span()\n\tswitch {\n\tcase a.End-1 < b.Start:\n\t\treturn True\n\tcase a.Start >= b.End-1:\n\t\treturn False\n\tdefault:\n\t\treturn Maybe\n\t}\n}", "title": "" }, { "docid": "19f726c274fb37a320e055c57270a7ac", "score": "0.49995133", "text": "func (r *Ranges) CheckAddress(address string) (bool, error) {\n\tfor _, prefix := range r.Prefixes {\n\t\t_, network, _ := net.ParseCIDR(prefix.IP)\n\t\tif network.Contains(net.ParseIP(address)) {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "8930aa00e5a67d35d00f9b7b2dc53cdf", "score": "0.49890655", "text": "func csLess(cs1, cs2 *CallSite) bool {\n\tif cs2 == nil {\n\t\treturn true\n\t}\n\n\t// fast code path\n\tif p1, p2 := cs1.Pos, cs2.Pos; p1 != nil && p2 != nil {\n\t\tif posLess(*p1, *p2) {\n\t\t\treturn true\n\t\t}\n\t\tif posLess(*p2, *p1) {\n\t\t\treturn false\n\t\t}\n\t\t// for sanity, should not occur in practice\n\t\treturn fmt.Sprintf(\"%v.%v\", cs1.RecvType, cs2.Name) < fmt.Sprintf(\"%v.%v\", cs2.RecvType, cs2.Name)\n\t}\n\n\t// code path rarely exercised\n\tif cs2.Pos == nil {\n\t\treturn true\n\t}\n\tif cs1.Pos == nil {\n\t\treturn false\n\t}\n\t// should very rarely occur in practice\n\treturn fmt.Sprintf(\"%v.%v\", cs1.RecvType, cs2.Name) < fmt.Sprintf(\"%v.%v\", cs2.RecvType, cs2.Name)\n}", "title": "" }, { "docid": "7fae04b0b0c558ff0cf4403bf9bcdebb", "score": "0.4985826", "text": "func BytesLt(a, b Bytes) Bool {\n\treturn TrimBool(&bytesLt{\n\t\tV1: a,\n\t\tV2: b,\n\t\thash: hashWithId(3464, a, b),\n\t\thasVariable: a.HasVariable() || b.HasVariable(),\n\t})\n}", "title": "" }, { "docid": "4155db5c4267cddf74e79f1f3075b1a2", "score": "0.49806547", "text": "func sna32LT(i1, i2 uint32) bool {\n\treturn (i1 < i2 && i2-i1 < 1<<31) || (i1 > i2 && i1-i2 > 1<<31)\n}", "title": "" }, { "docid": "9e327fd59efebbec50ca16c736e0e522", "score": "0.49778625", "text": "func Le(a, b interface{}) bool {\n\tleft, right := getValues(a, b)\n\treturn left <= right\n}", "title": "" }, { "docid": "08690611d2dc63e8f6cc1e9b14abd486", "score": "0.49710026", "text": "func (i IP) Before(x IP) bool {\n\treturn i.ToInt() < x.ToInt()\n}", "title": "" }, { "docid": "b7570065148e2bc3f5600159fa4d597d", "score": "0.49659023", "text": "func cmpstackvarlt(a, b *Node) bool {\n\tif (a.Class() == PAUTO) != (b.Class() == PAUTO) {\n\t\treturn b.Class() == PAUTO\n\t}\n\n\tif a.Class() != PAUTO {\n\t\treturn a.Xoffset < b.Xoffset\n\t}\n\n\tif a.Name.Used() != b.Name.Used() {\n\t\treturn a.Name.Used()\n\t}\n\n\tap := types.Haspointers(a.Type)\n\tbp := types.Haspointers(b.Type)\n\tif ap != bp {\n\t\treturn ap\n\t}\n\n\tap = a.Name.Needzero()\n\tbp = b.Name.Needzero()\n\tif ap != bp {\n\t\treturn ap\n\t}\n\n\tif a.Type.Width != b.Type.Width {\n\t\treturn a.Type.Width > b.Type.Width\n\t}\n\n\treturn a.Sym.Name < b.Sym.Name\n}", "title": "" }, { "docid": "88275381893a4cbc032f1951b4847c47", "score": "0.49658957", "text": "func (ip ipV4) Less(then btree.Item) bool {\n\tswitch v := then.(type) {\n\tcase *IPItemFix:\n\t\treturn !v.StartIP.IsIPv4() || ip.Compare(v.StartIP.IPv4()) < 0\n\tcase *IPItemV4:\n\t\treturn ip.Compare(v.StartIP) < 0\n\tcase ipV4:\n\t\treturn ip.Compare(v) < 0\n\tcase *ipFix:\n\t\treturn !v.IsIPv4() || ip.Compare(v.IPv4()) < 0\n\t}\n\treturn false\n}", "title": "" }, { "docid": "26f9ad5ae9db06896c48973d5bc9e0df", "score": "0.49658954", "text": "func IPLessThan(a, b net.IP) bool {\n\tif len(a) != len(b) { // ipv6 comes after ipv4\n\t\treturn len(a) < len(b)\n\t}\n\tfor i := range a { // go left to right and compare each one\n\t\tif a[i] != b[i] {\n\t\t\treturn a[i] < b[i]\n\t\t}\n\t}\n\treturn false // they are equal\n}", "title": "" }, { "docid": "c1c3272924c29a5ffe0cc91d3f68c0ca", "score": "0.49595243", "text": "func lessEq(_ *regbank, st *stack, args []byte) ([]byte, bool) {\n\ta := st.pop()\n\tst.vals[st.top-1] = boolToInt(st.vals[st.top-1] <= a)\n\treturn args, st.top < stackMax\n}", "title": "" }, { "docid": "573f8391d0962c8c70c813cf5c7ebc89", "score": "0.49534622", "text": "func testAddress(tc *testContext, prefix string, gotAddr ManagedAddress, wantAddr *expectedAddr) bool {\n\tif gotAddr.Account() != tc.account {\n\t\ttc.t.Errorf(\"ManagedAddress.Account: unexpected account - got \"+\n\t\t\t\"%d, want %d\", gotAddr.Account(), tc.account)\n\t\treturn false\n\t}\n\n\tif gotAddr.Address().EncodeAddress() != wantAddr.address {\n\t\ttc.t.Errorf(\"%s EncodeAddress: unexpected address - got %s, \"+\n\t\t\t\"want %s\", prefix, gotAddr.Address().EncodeAddress(),\n\t\t\twantAddr.address)\n\t\treturn false\n\t}\n\n\tif !reflect.DeepEqual(gotAddr.AddrHash(), wantAddr.addressHash) {\n\t\ttc.t.Errorf(\"%s AddrHash: unexpected address hash - got %x, \"+\n\t\t\t\"want %x\", prefix, gotAddr.AddrHash(),\n\t\t\twantAddr.addressHash)\n\t\treturn false\n\t}\n\n\tif gotAddr.Internal() != wantAddr.internal {\n\t\ttc.t.Errorf(\"%s Internal: unexpected internal flag - got %v, \"+\n\t\t\t\"want %v\", prefix, gotAddr.Internal(), wantAddr.internal)\n\t\treturn false\n\t}\n\n\tif gotAddr.Compressed() != wantAddr.compressed {\n\t\ttc.t.Errorf(\"%s Compressed: unexpected compressed flag - got \"+\n\t\t\t\"%v, want %v\", prefix, gotAddr.Compressed(),\n\t\t\twantAddr.compressed)\n\t\treturn false\n\t}\n\n\tif gotAddr.Imported() != wantAddr.imported {\n\t\ttc.t.Errorf(\"%s Imported: unexpected imported flag - got %v, \"+\n\t\t\t\"want %v\", prefix, gotAddr.Imported(), wantAddr.imported)\n\t\treturn false\n\t}\n\n\tswitch addr := gotAddr.(type) {\n\tcase ManagedPubKeyAddress:\n\t\tif !testManagedPubKeyAddress(tc, prefix, addr, wantAddr) {\n\t\t\treturn false\n\t\t}\n\n\tcase ManagedScriptAddress:\n\t\tif !testManagedScriptAddress(tc, prefix, addr, wantAddr) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "8d264d6057240aad4e9a54b83e31d368", "score": "0.49497342", "text": "func AddressLine1LTE(v string) predicate.Invitee {\n\treturn predicate.Invitee(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldAddressLine1), v))\n\t})\n}", "title": "" }, { "docid": "7cbce1faaa95afa694c6978954a97bcb", "score": "0.49470347", "text": "func (v *Litecoin) ValidateAddress(addr string, network NetworkType) *Result {\n\tif addrType := NormalAddrType(v, addr, network); addrType != Unknown {\n\t\treturn &Result{Success, true, addrType, \"\"}\n\t}\n\n\treturn &Result{Success, false, Unknown, \"\"}\n}", "title": "" }, { "docid": "dd8554ea20fb6fecbdba5aa3681760e3", "score": "0.49436298", "text": "func (ip *ipFix) Less(then btree.Item) bool {\n\tswitch v := then.(type) {\n\tcase *IPItemFix:\n\t\treturn ip.Compare(&v.StartIP) < 0\n\tcase *IPItemV4:\n\t\treturn ip.IsIPv4() && ip.IPv4().Compare(v.StartIP) < 0\n\tcase ipV4:\n\t\treturn ip.IsIPv4() && ip.IPv4().Compare(v) < 0\n\tcase *ipFix:\n\t\treturn ip.Compare(v) < 0\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f0a839ca4a369a7f71325cebaddd4cfe", "score": "0.4942232", "text": "func TestCompareIP(t *testing.T) {\n\t// bad input\n\t_, err := ipx.CompareIP(make(net.IP, 3), net.ParseIP(\"bad\"))\n\trequire.Error(t, err, \"should not compare IP addresses\")\n\tassert.ErrorIs(t, err, ipx.ErrInvalidIP)\n\tassert.Panics(t, func() {\n\t\tipx.MustCompareIP(make(net.IP, 3), net.ParseIP(\"bad\"))\n\t})\n\n\t// IPv4\n\tassert.EqualValues(t, -1, // less than /24\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"192.168.0.10\"),\n\t\t\tnet.ParseIP(\"192.168.0.20\"),\n\t\t))\n\tassert.EqualValues(t, +1, // greater than /24\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"192.168.0.20\"),\n\t\t\tnet.ParseIP(\"192.168.0.10\"),\n\t\t))\n\tassert.EqualValues(t, 0, // equal /24\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"192.168.0.10\"),\n\t\t\tnet.ParseIP(\"192.168.0.10\"),\n\t\t))\n\tassert.EqualValues(t, -1, // less than /16\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"192.168.10.20\"),\n\t\t\tnet.ParseIP(\"192.168.20.10\"),\n\t\t))\n\tassert.EqualValues(t, +1, // greater than /16\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"192.168.20.10\"),\n\t\t\tnet.ParseIP(\"192.168.10.20\"),\n\t\t))\n\tassert.EqualValues(t, 0, // equal /16\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"192.168.10.0\"),\n\t\t\tnet.ParseIP(\"192.168.10.0\"),\n\t\t))\n\n\t// IPv4 in IPv6\n\tassert.EqualValues(t, -1, // less than /24\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"::192.168.0.10\"),\n\t\t\tnet.ParseIP(\"::192.168.0.20\"),\n\t\t))\n\tassert.EqualValues(t, +1, // greater than /24\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"::192.168.0.20\"),\n\t\t\tnet.ParseIP(\"::192.168.0.10\"),\n\t\t))\n\tassert.EqualValues(t, 0, // equal /24\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"::192.168.0.10\"),\n\t\t\tnet.ParseIP(\"::192.168.0.10\"),\n\t\t))\n\tassert.EqualValues(t, -1, // less than /16\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"::192.168.10.20\"),\n\t\t\tnet.ParseIP(\"::192.168.20.10\"),\n\t\t))\n\tassert.EqualValues(t, +1, // greater than /16\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"::192.168.20.10\"),\n\t\t\tnet.ParseIP(\"::192.168.10.20\"),\n\t\t))\n\tassert.EqualValues(t, 0, // equal /16\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"::192.168.10.0\"),\n\t\t\tnet.ParseIP(\"::192.168.10.0\"),\n\t\t))\n\n\t// IPv6\n\tassert.EqualValues(t, -1, // less than /16\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:0370:6000\"),\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:0370:7000\"),\n\t\t))\n\tassert.EqualValues(t, +1, // greater than /16\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:0370:7000\"),\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:0370:6000\"),\n\t\t))\n\tassert.EqualValues(t, 0, // equal /16\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:0370:6000\"),\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:0370:6000\"),\n\t\t))\n\tassert.EqualValues(t, -1, // less than /32\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:6000:7000\"),\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:7000:6000\"),\n\t\t))\n\tassert.EqualValues(t, +1, // greater than /32\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:7000:6000\"),\n\t\t\tnet.ParseIP(\"2001:0db8:85a3:0000:0000:8a2e:6000:7000\"),\n\t\t))\n\tassert.EqualValues(t, -1, // less than /128\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"2001:eeee:eeee:eeee:eeee:eeee:eeee:eeee\"),\n\t\t\tnet.ParseIP(\"3001:eeee:eeee:eeee:eeee:eeee:eeee:eeee\"),\n\t\t))\n\tassert.EqualValues(t, +1, // greater than /128\n\t\tipx.MustCompareIP(\n\t\t\tnet.ParseIP(\"3001:eeee:eeee:eeee:eeee:eeee:eeee:eeee\"),\n\t\t\tnet.ParseIP(\"2001:eeee:eeee:eeee:eeee:eeee:eeee:eeee\"),\n\t\t))\n}", "title": "" }, { "docid": "b97889a5dcd7924bb182a4a4366609ae", "score": "0.4942033", "text": "func ValidateAddress(sender string) error {\n\t_, err := sdk.AccAddressFromBech32(sender)\n\treturn err\n}", "title": "" }, { "docid": "196d0331a066d5fc1fd3e39f8b128ddf", "score": "0.49415755", "text": "func CompareAndSwapStrongInt32RelaxedRelaxed(addr *int32, old, new int32) bool", "title": "" }, { "docid": "3e87f021b5985b53d897998dfbfe05bd", "score": "0.49389666", "text": "func (b *Validator) ValidateAddress(address string, isTestnet bool) (isValid bool, msg string) {\n\tvar addrType string\n\tswitch {\n\tcase b.isP2PKH(address, isTestnet):\n\t\taddrType = \"P2PKH\"\n\tcase b.isP2SH(address, isTestnet):\n\t\taddrType = \"P2SH\"\n\tcase b.isP2WPKH(address, isTestnet):\n\t\taddrType = \"P2WPKH\"\n\tcase b.isP2WSH(address, isTestnet):\n\t\taddrType = \"P2WSH\"\n\tdefault:\n\t\taddrType = \"Unknown\"\n\t}\n\n\tif addrType != \"Unknown\" && contains(b.EnabledTypes, addrType) {\n\t\tisValid = true\n\t}\n\treturn isValid, addrType\n}", "title": "" }, { "docid": "d9b4de0fc07995cc69278a19ea4be3d7", "score": "0.4937898", "text": "func (recv *RangeAccessible) Equals(other *RangeAccessible) bool {\n\treturn other.ToC() == recv.ToC()\n}", "title": "" }, { "docid": "afe0c33b0a249e09f84b6accd5726fe5", "score": "0.49312305", "text": "func checkaddr(ctxt *Link, p *Prog, a *Addr) {\n\tswitch a.Type {\n\tcase TYPE_NONE, TYPE_REGREG2, TYPE_REGLIST:\n\t\treturn\n\n\tcase TYPE_BRANCH, TYPE_TEXTSIZE:\n\t\tif a.Reg != 0 || a.Index != 0 || a.Scale != 0 || a.Name != 0 {\n\t\t\tbreak\n\t\t}\n\t\treturn\n\n\tcase TYPE_MEM:\n\t\treturn\n\n\tcase TYPE_CONST:\n\t\t// TODO(rsc): After fixing SHRQ, check a.Index != 0 too.\n\t\tif a.Name != 0 || a.Sym != nil || a.Reg != 0 {\n\t\t\tctxt.Diag(\"argument is TYPE_CONST, should be TYPE_ADDR, in %v\", p)\n\t\t\treturn\n\t\t}\n\n\t\tif a.Reg != 0 || a.Scale != 0 || a.Name != 0 || a.Sym != nil || a.Val != nil {\n\t\t\tbreak\n\t\t}\n\t\treturn\n\n\tcase TYPE_FCONST, TYPE_SCONST:\n\t\tif a.Reg != 0 || a.Index != 0 || a.Scale != 0 || a.Name != 0 || a.Offset != 0 || a.Sym != nil {\n\t\t\tbreak\n\t\t}\n\t\treturn\n\n\tcase TYPE_REG:\n\t\t// TODO(rsc): After fixing PINSRQ, check a.Offset != 0 too.\n\t\t// TODO(rsc): After fixing SHRQ, check a.Index != 0 too.\n\t\tif a.Scale != 0 || a.Name != 0 || a.Sym != nil {\n\t\t\tbreak\n\t\t}\n\t\treturn\n\n\tcase TYPE_ADDR:\n\t\tif a.Val != nil {\n\t\t\tbreak\n\t\t}\n\t\tif a.Reg == 0 && a.Index == 0 && a.Scale == 0 && a.Name == 0 && a.Sym == nil {\n\t\t\tctxt.Diag(\"argument is TYPE_ADDR, should be TYPE_CONST, in %v\", p)\n\t\t}\n\t\treturn\n\n\tcase TYPE_SHIFT, TYPE_REGREG:\n\t\tif a.Index != 0 || a.Scale != 0 || a.Name != 0 || a.Sym != nil || a.Val != nil {\n\t\t\tbreak\n\t\t}\n\t\treturn\n\n\tcase TYPE_INDIR:\n\t\t// Expect sym and name to be set, nothing else.\n\t\t// Technically more is allowed, but this is only used for *name(SB).\n\t\tif a.Reg != 0 || a.Index != 0 || a.Scale != 0 || a.Name == 0 || a.Offset != 0 || a.Sym == nil || a.Val != nil {\n\t\t\tbreak\n\t\t}\n\t\treturn\n\t}\n\n\tctxt.Diag(\"invalid encoding for argument %v\", p)\n}", "title": "" }, { "docid": "70cee605ced72d559d5f58e733a87789", "score": "0.4930314", "text": "func minMaxTakeFromFirst(a, b *Piecewise, isMin bool) bool {\n aStart, bStart := a.Eval(1), b.Eval(1)\n\n switch {\n case aStart < bStart:\n return isMin\n\n case bStart < aStart:\n return !isMin\n\n // They intersect at x=1, so take the one with the smaller slope, or\n // pick a if they coincide.\n default:\n switch {\n case a.segments[0].f.a < b.segments[0].f.a:\n return isMin\n case b.segments[0].f.a > a.segments[0].f.a:\n return !isMin\n default:\n return true\n }\n }\n}", "title": "" }, { "docid": "16fd7505e8eaa1732dcaa403dc98b8d7", "score": "0.49293151", "text": "func (d Decimal) LessThan(other Decimal) bool {\n\tv, o := d.value, other.value\n\tif v == nil {\n\t\tv = zero()\n\t}\n\tif o == nil {\n\t\to = zero()\n\t}\n\treturn !v.IsNaN(0) && !o.IsNaN(0) && v.Cmp(o) < 0\n}", "title": "" }, { "docid": "8460157bf63b82025e8a819d6b465051", "score": "0.49215287", "text": "func (a Value) Approx(b Qualified, within float64) bool {\n\tok, _ := a.Compare(b, func(a, b float64) bool { return math.Abs(a-b) < within })\n\treturn ok\n}", "title": "" }, { "docid": "e5d3772f93c37035651427ed86f3332d", "score": "0.49205872", "text": "func (ip IP) Compare(ip2 IP) int {\n\tf1, f2 := ip.BitLen(), ip2.BitLen()\n\tif f1 < f2 {\n\t\treturn -1\n\t}\n\tif f1 > f2 {\n\t\treturn 1\n\t}\n\tif hi1, hi2 := ip.addr.hi, ip2.addr.hi; hi1 < hi2 {\n\t\treturn -1\n\t} else if hi1 > hi2 {\n\t\treturn 1\n\t}\n\tif lo1, lo2 := ip.addr.lo, ip2.addr.lo; lo1 < lo2 {\n\t\treturn -1\n\t} else if lo1 > lo2 {\n\t\treturn 1\n\t}\n\tif ip.Is6() {\n\t\tza, zb := ip.Zone(), ip2.Zone()\n\t\tif za < zb {\n\t\t\treturn -1\n\t\t} else if za > zb {\n\t\t\treturn 1\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "e6f2231105e98191f9d6d4d98bc38122", "score": "0.49186724", "text": "func (h ZobristHash) LowerBound() bool {\n\treturn h&1 != 0\n}", "title": "" } ]
98eb30b7214c877c432b4760da8688fe
Sends to a buffered channel block only when the buffer is full. Receives block when the buffer is empty.
[ { "docid": "4ffab824c8a59735af540047530ea590", "score": "0.0", "text": "func main() {\n\tch := make(chan int, 2)\n\tch <- 1\n\tch <- 2\n\tfmt.Println(<-ch)\n\tfmt.Println(<-ch)\n}", "title": "" } ]
[ { "docid": "2d7c61da9faf1bd9c49214c197f57be3", "score": "0.621069", "text": "func (queue *BufferedQueue) FlushBuffer() {\n\tflushing := make(chan bool, 1)\n\tqueue.flushStatus <- flushing\n\tqueue.flushCommand <- true\n\t<-flushing\n\treturn\n}", "title": "" }, { "docid": "defcb90e3f6dca3ee94c3e8cf568346f", "score": "0.5976744", "text": "func (s *sender) SendBuffered(receiver string, m interface{}) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tbuf, ok := s.outputs[receiver]\n\tif !ok {\n\t\tbuf = make([]interface{}, 0, s.bufsize)\n\t\ts.outputs[receiver] = buf\n\t}\n\tif len(buf) >= s.bufsize {\n\t\terr := s.send(receiver, buf)\n\t\tif err == nil {\n\t\t\tbuf = make([]interface{}, 0, s.bufsize)\n\t\t\tbuf = append(buf, m)\n\t\t\ts.outputs[receiver] = buf\n\t\t\treturn nil\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tbuf = append(buf, m)\n\t\ts.outputs[receiver] = buf\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "243ed3ecb199cd13dd7c5ad3e436fbe4", "score": "0.5965166", "text": "func (*SocketChannel) WaitForNonEmpty(unused time.Duration) error {\n\treturn nil\n}", "title": "" }, { "docid": "e8f1818c911b474ee9f62ca3bde3066e", "score": "0.5835984", "text": "func bufferedChan() {\n\tch := make(chan int, 2)\n\tch <- 1\n\tch <- 2\n\t//ch <- 3 blocks and deadlocks\n\tfmt.Println(<-ch)\n\tfmt.Println(<-ch)\n}", "title": "" }, { "docid": "2278e030c1b254d8fdeec521f80bfc7e", "score": "0.5812433", "text": "func fillRecieverChannel(c io.ReadCloser,\n\tchReciever chan []byte,\n\tdone <-chan struct{},\n\tbufConfig bufferConfig,\n) error {\n\tconst op = \"uploadserver.recieveAndSendToChan()\"\n\t// timeout is set via http.Server{Timeout...}\n\tdefer func() {\n\n\t\tclose(chReciever)\n\t}()\n\n\tnbytessent := int64(0)\n\n\t// this makes sure bigBufferCap is bigger then bufConfig.SizeOfRecieverBuffer\n\tbigBufferCap := bufConfig.BlocksCount * bufConfig.Multiplicity\n\tbigBufLen := 0\n\n\t// bigBuffer escapes\n\tbigBuffer := make([]byte, bigBufferCap) // allocate\n\n\t// b is a buffer for current read. there may be many reads. b is noescape.\n\tb := make([]byte, bufConfig.Multiplicity)\n\n\ti := 0\n\n\tfor { // endless recieve loop\n\n\t\tn, err := c.Read(b) // usually reads Request.Body\n\t\t// looks like n is mostly always 4096. tcp segment size?\n\n\t\tif err != nil && err != io.EOF {\n\n\t\t\treturn Error.E(op, err, errConnectionReadError, 0, \"\") // or timeout?\n\t\t}\n\t\tif n > 0 {\n\n\t\t\tfreespace := bigBufferCap - bigBufLen\n\t\t\tncopied := 0\n\n\t\t\t// if bigBuffer is not full\n\t\t\tif freespace > 0 {\n\t\t\t\tnallowed := n\n\t\t\t\tif freespace < n {\n\t\t\t\t\tnallowed = freespace\n\t\t\t\t}\n\n\t\t\t\tncopied = copy(bigBuffer[bigBufLen:], b[:nallowed])\n\t\t\t\tbigBufLen += ncopied\n\t\t\t\tfreespace -= ncopied\n\t\t\t}\n\t\t\tif freespace == 0 {\n\n\t\t\t\tbigBufferEscapes := make([]byte, bigBufLen) // allocate because it goes into another goroutine\n\t\t\t\tcopy(bigBufferEscapes, bigBuffer[:bigBufLen]) // copy\n\n\t\t\t\t// if write to disk in neigbour goroutine failed that goroutine closes chReciever\n\t\t\t\t// and allows us to know there is no need to recieve more from connection.\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\t\treturn Error.E(op, nil, 0, 0, \"chReciever is ordered to close\")\n\t\t\t\tcase chReciever <- bigBufferEscapes[:bigBufLen]: // buffered chReciever\n\t\t\t\t\tnbytessent += int64(bigBufLen)\n\t\t\t\t}\n\n\t\t\t\tbigBufLen = 0\n\t\t\t\tleftinb := len(b) - ncopied\n\t\t\t\tif leftinb > 0 {\n\t\t\t\t\t// if in b left something\n\t\t\t\t\tncopied2 := copy(bigBuffer, b[ncopied:n])\n\t\t\t\t\tbigBufLen = ncopied2\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t// DEBUG!!! //time.Sleep(2 * time.Millisecond)\n\n\t\tif err == io.EOF {\n\t\t\tif bigBufLen > 0 {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase chReciever <- bigBuffer[:bigBufLen]:\n\t\t\t\t\tnbytessent += int64(bigBufLen)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tDebugprint(\"in fillRecieverChannel() nbytessent = %d\", nbytessent)\n\t\t\treturn nil // success reading\n\t\t}\n\n\t\ti++\n\t}\n\n}", "title": "" }, { "docid": "42cc4243ba7a6b284ee1ed41444fa20e", "score": "0.57947075", "text": "func TestBufferedChannel(t *testing.T) {\n\tchannel := make(chan string, 3)\n\n\t// penulisan tanpa go routine\n\tchannel <- \"Zakaria\"\n\tchannel <- \"Wahyu\"\n\n\tfmt.Println(<- channel)\n\tfmt.Println(<- channel)\n\n\t// penulisan dengan goroutine\n\tgo func() {\n\t\tchannel <- \"Zakaria\"\n\t\tchannel <- \"Wahyu\"\n\t}()\n\n\tgo func() {\n\t\tfmt.Println(<- channel)\n\t\tfmt.Println(<- channel)\n\t}()\n\n\ttime.Sleep(2 * time.Second)\n\tclose(channel)\n}", "title": "" }, { "docid": "55d8cf6db28e93e9f1310021d51b35cc", "score": "0.57256603", "text": "func (c *conn) buffer(quit chan bool, updates chan []byte, errors chan error) {\n\tbuf := make([]byte, 2048)\n\tfor {\n\t\ti, err := c.Conn.Read(buf)\n\t\tif err != nil {\n\t\t\terrors <- err\n\t\t}\n\t\tif i > 0 {\n\t\t\t//fmt.Println(\"TX length\", len(buf[:i]))\n\t\t\tu := make([]byte, i)\n\t\t\tcopy(u, buf[:i])\n\t\t\tupdates <- u\n\t\t} else {\n\t\t\ttime.Sleep(time.Duration(30) * time.Millisecond)\n\t\t}\n\t\tselect {\n\t\tcase <-quit:\n\t\t\tbreak\n\t\tdefault:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "036299cdd6f870673cd18788aa464647", "score": "0.5724734", "text": "func BufferedChannel() {\n\tchannel := make(chan string, 2)\n\tchannel <- \"ABCD\"\n\tchannel <- \"EFGHI\"\n\tfmt.Println(<-channel)\n\tfmt.Println(<-channel)\n}", "title": "" }, { "docid": "90a3c04c86e6881fe8a0af7d0e4dc07f", "score": "0.56348735", "text": "func IsFull[T any](c <-chan T) bool {\n\treturn len(c) == cap(c)\n}", "title": "" }, { "docid": "d97eef9302d429e24c3c2ffdeb8f551f", "score": "0.5624883", "text": "func (b *Bchan) drain() {\n\t// empty chan\n\tfor {\n\t\tselect {\n\t\tcase <-b.Ch:\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2ab1cb30da576c3aa00ebaa68985d58c", "score": "0.55680203", "text": "func (m Master) Block() {\n\tvar ch chan bool\n\n\t<-ch\n}", "title": "" }, { "docid": "78e2d1adcd1d316af3f6bfd35042b89d", "score": "0.5516845", "text": "func (w *watchFS) bufferEvents(send chan<- ESlice, l time.Duration) {\n\tdefer close(send)\n\n\tticker := time.NewTicker(l)\n\ttick := ticker.C\n\tbuf := make(ESlice, 0, 10)\n\tvar out chan<- ESlice\n\n\tfor {\n\t\tselect {\n\t\t// buffer the events\n\t\tcase e := <-w.watcher.Events:\n\t\t\tbuf = append(buf, &Event{Path: e.Name, Op: Op(e.Op)})\n\t\tcase err := <-w.watcher.Errors:\n\t\t\tif w.out != nil {\n\t\t\t\tfmt.Fprintln(w.out, err)\n\t\t\t}\n\t\t\treturn\n\t\t// check if we have any events\n\t\tcase <-tick:\n\t\t\tif len(buf) > 0 {\n\t\t\t\tout = send\n\t\t\t}\n\t\t// if nil skip, otherwise send when it's ready\n\t\tcase out <- buf:\n\t\t\tbuf = make(ESlice, 0, 10)\n\t\t\tout = nil\n\t\tcase <-w.done:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "63232540302f1b34922b4211b8cbd50e", "score": "0.5515561", "text": "func Test_ChannelNoBuffer(t *testing.T) {\n\tChannelNoBuffer()\n}", "title": "" }, { "docid": "17379adb6fd07af8c708336879c5ed85", "score": "0.5503627", "text": "func (b *Bchan) fill() {\n\tfor {\n\t\tselect {\n\t\tcase b.Ch <- b.cur:\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9c9287751c2e47de7a235336bdf9ddd2", "score": "0.549509", "text": "func (suite *TestSuite) TestBufferedFlush(c *C) {\n\tq := CreateBufferedQueue(redisHost, redisPort, redisPassword, redisDB, \"buffered_test4\", 1000)\n\terr := q.Start()\n\tc.Assert(err, Equals, nil)\n\ttime.Sleep(100 * time.Millisecond)\n\tfor i := 0; i < 999; i++ {\n\t\tc.Check(q.Put(\"testpayload\"), Equals, nil)\n\t}\n\tc.Check(len(q.Buffer), Not(Equals), 0)\n\tq.FlushBuffer()\n\tc.Check(len(q.Buffer), Equals, 0)\n}", "title": "" }, { "docid": "dcbd558a5fb894b458625ee5b6b6de5a", "score": "0.5484658", "text": "func (s *bufferedAsyncSender) Flush(_ context.Context) error {\n\tselect {\n\tcase s.needsFlush <- true:\n\tdefault:\n\t\t// Nooping is fine because needsFlush already has a message telling the sender to flush.\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cbcf2a5a80eb3b78f8aee004d2c48618", "score": "0.54714715", "text": "func (b *BufferedMessageReceiver) clear() {\n\tl := len(b.inputChan)\n\tfor i := 0; i < l; i++ {\n\t\t<-b.inputChan\n\t}\n}", "title": "" }, { "docid": "e7231074eb769e029ac9770e0eff41f5", "score": "0.54491824", "text": "func TestChannel0(t *testing.T) {\n\tbuf := make([]byte, 8192)\n\tch := make(chan []byte, 0)\n\n\ttimes := 1000000\n\tgo func() {\n\t\tfor i := 0; i < times; i++ {\n\t\t\tch <- buf\n\t\t}\n\t}()\n\n\tbtime := time.Now()\n\tfor i := 0; i < times; i++ {\n\t\tnbuf := <-ch\n\t\tif len(nbuf) != len(buf) {\n\t\t\tt.Fail()\n\t\t}\n\t}\n\tetime := time.Now()\n\tdtime := etime.Sub(btime)\n\tt.Log(etime.Sub(btime), float64(times*len(buf)/1024/1024)/dtime.Seconds(), \"MB/s\",\n\t\tfloat64(times)/dtime.Seconds())\n\t// channel数据传输速度很快,10GB/s以上没问题\n\t// 但是传输次数会怎么样呢\n}", "title": "" }, { "docid": "b75c628215ffd474b56b476e3c931817", "score": "0.54288554", "text": "func nonBlockingSend(ch chan *Directory, dir *Directory) {\n\tselect {\n\tcase ch <- dir:\n\tdefault:\n\t\tgo func() { ch <- dir }()\n\t}\n}", "title": "" }, { "docid": "a0c99710502476bbb116ecdd5b6aa98f", "score": "0.54247284", "text": "func (v *BufferedWriter) Flush() error {\n\tdefer v.buffer.Clear()\n\tfor !v.buffer.IsEmpty() {\n\t\tnBytes, err := v.writer.Write(v.buffer.Bytes())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tv.buffer.SliceFrom(nBytes)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ff312dd0ba7851e7792685d0d54f347", "score": "0.54068255", "text": "func (t *Buffered) Wait() {\n\tdone := make(chan struct{})\n\tselect {\n\tcase t.queue <- op{wait: done}:\n\tcase <-t.ctx.Done():\n\t\treturn\n\t}\n\n\tselect {\n\tcase <-done:\n\tcase <-t.ctx.Done():\n\t}\n}", "title": "" }, { "docid": "6435159de81569514a68dc5f926b1a13", "score": "0.5402225", "text": "func HandleRawData(recvChan chan []byte, packetChan chan Packet, pi PacketInfo) {\n //var buffer bytes.Buffer\n buffer := new(bytes.Buffer)\n\n for b := range recvChan {\n //fmt.Println(\"b:\",b)\n buffer.Write(b)\n log.Debugf(\"handle %d bytes at %s \", len(b), time.Now())\n log.Debug(buffer.Bytes())\n //for buffer.Len() >= pi.MinLength {\n for buffer.Len() >= 10 {\n //值传递!\n pkt, ok := ExtractPacket(buffer.Bytes(), pi)\n if !ok {\n abyte, _ := buffer.ReadByte()\n log.Debugf(\"Drop one byte: %X\", abyte)\n } else {\n buffer.Next(pkt.Len())\n packetChan <- pkt\n }\n }\n }\n}", "title": "" }, { "docid": "a7921052eeb787912544c676cad25d0b", "score": "0.53815866", "text": "func pushOrReplace(blockReqChan chan *blockSyncRequest, blockReq *blockSyncRequest) {\n\tfor {\n\t\t//push the req into queue\n\t\tselect {\n\t\tcase blockReqChan <- blockReq:\n\t\t\treturn\n\t\tdefault:\n\t\t\tlog.Debug(\"block sync queue is full\")\n\t\t}\n\n\t\t//drop the first req in sync queue\n\t\tselect {\n\t\tcase <-blockReqChan:\n\t\t\tlog.Info(\"drop the oldest req in sync queue\")\n\t\t\tcontinue\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7bef7835a2a031bb2e4af746ade333ef", "score": "0.53800213", "text": "func drain(channel <-chan any) {\n\t// drain the channel\n\tfor range channel {\n\t}\n}", "title": "" }, { "docid": "a2ad98625c33ca9222e1451af1cd85c8", "score": "0.53760785", "text": "func (ch *Chan) Send(val interface{}, block bool) (ok bool) {\n\tch.m.RLock()\n\tif ch.q != closedChan {\n\t\tif block {\n\t\t\tselect {\n\t\t\tcase <-ch.done:\n\t\t\tcase ch.q <- val:\n\t\t\t\tok = true\n\t\t\t}\n\t\t} else {\n\t\t\tselect {\n\t\t\tcase <-ch.done:\n\t\t\tcase ch.q <- val:\n\t\t\t\tok = true\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}\n\tch.m.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "a9532c287af44f1cec69ef98ab7106e0", "score": "0.5369698", "text": "func (syncer *BlockSyncer) recvHandler() {\n\tmsgChan := syncer.p2p.MessageChan()\n\tfor {\n\t\tselect {\n\t\tcase msg := <-msgChan:\n\t\t\tswitch msg.Payload.(type) {\n\t\t\tcase *message.Block:\n\t\t\t\tbmsg := msg.Payload.(*message.Block)\n\t\t\t\tsyncer.sendChan <- bmsg.Block\n\t\t\tcase *message.BlockReq:\n\t\t\t\tbrmsg := msg.Payload.(*message.BlockReq)\n\t\t\t\tblock, err := syncer.blockChain.GetBlockByHash(brmsg.HeaderHash)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tbmsg := &message.Block{\n\t\t\t\t\tBlock: block,\n\t\t\t\t}\n\t\t\t\terr = syncer.p2p.SendMsg(msg.From, bmsg)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"failed to send message to peer %s, as: %v\", msg.From.ToString(), err)\n\t\t\t\t}\n\t\t\tcase *message.BlockHeaders:\n\t\t\t\tcurrentBlock := syncer.blockChain.GetCurrentBlock()\n\t\t\t\tbhmsg := msg.Payload.(*message.BlockHeaders)\n\t\t\t\tfor i := 0; i < len(bhmsg.Headers); i++ {\n\t\t\t\t\tif bhmsg.Headers[i].Height <= currentBlock.Header.Height {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tbrmsg := &message.BlockReq{\n\t\t\t\t\t\tHeaderHash: common.HeaderHash(bhmsg.Headers[i]),\n\t\t\t\t\t}\n\t\t\t\t\terr := syncer.p2p.SendMsg(msg.From, brmsg)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(\"failed to send message to peer %s, as: %v\", msg.From.ToString(), err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase *message.BlockHeaderReq:\n\t\t\t\tbrmsg := msg.Payload.(*message.BlockHeaderReq)\n\t\t\t\tif brmsg.Len <= 0 {\n\t\t\t\t\tbrmsg.Len = message.MAX_BLOCK_HEADER_NUM\n\t\t\t\t}\n\t\t\t\tblockHeaders := make([]*types.Header, 0)\n\t\t\t\tblockStop, err := syncer.blockChain.GetBlockByHash(brmsg.HashStop)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Warn(\"have no block with Hash %x in local database\", brmsg.HashStop)\n\t\t\t\t} else {\n\t\t\t\t\tfor i := 1; i <= int(brmsg.Len); i++ {\n\t\t\t\t\t\tblock, err := syncer.blockChain.GetBlockByHeight(blockStop.Header.Height + uint64(i))\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Warn(\"failed to get block with height %d, as:%v\", blockStop.Header.Height+uint64(i), err)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblockHeaders = append(blockHeaders, block.Header)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbMsg := &message.BlockHeaders{\n\t\t\t\t\tHeaders: blockHeaders,\n\t\t\t\t}\n\t\t\t\terr = syncer.p2p.SendMsg(msg.From, bMsg)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"failed to send message to peer %s, as: %v\", msg.From.ToString(), err)\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-syncer.quitChan:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dcb05fe3b77ebd0223d5ebb64083d831", "score": "0.53503346", "text": "func (c *OneConnection) append_to_send_buffer(d []byte) {\r\n\troom_left := SendBufSize - c.SendBufProd\r\n\tif room_left >= len(d) {\r\n\t\tcopy(c.sendBuf[c.SendBufProd:], d)\r\n\t\troom_left = c.SendBufProd + len(d)\r\n\t} else {\r\n\t\tcopy(c.sendBuf[c.SendBufProd:], d[:room_left])\r\n\t\tcopy(c.sendBuf[:], d[room_left:])\r\n\t}\r\n\tc.SendBufProd = (c.SendBufProd + len(d)) & SendBufMask\r\n}", "title": "" }, { "docid": "c7d348344e3c84e281b3f5f7aa838023", "score": "0.53294814", "text": "func BufferSize[T any](c <-chan T) int {\n\treturn cap(c)\n}", "title": "" }, { "docid": "2da2090477d347533d10952cbb4f10f5", "score": "0.53173953", "text": "func buffered() {\n\tc := make(chan int, 10)\n\tvar a string\n\n\tgo func() {\n\t\ta = \"hello, world\"\n\t\tc <- 0\n\t}()\n\n\t<-c\n\n\t// We are guaranteed to print \"hello, world\".\n\tfmt.Println(a)\n}", "title": "" }, { "docid": "489cae69f75581ac33f238b958ddf61c", "score": "0.5312704", "text": "func (pool *BufferPool) Give(buf *bytes.Buffer) error {\n\tif buf.Len() != pool.bufferSize {\n\t\treturn errors.New(\"Gave an incorrectly sized buffer to the pool.\")\n\t}\n\n\tselect {\n\tcase pool.pool <- buf:\n\t\t// Everything went smoothly!\n\tdefault:\n\t\treturn errors.New(\"Gave a buffer to a full pool.\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26a394c72268d04bb373dff89615e94c", "score": "0.5298538", "text": "func (rf *Raft) nonBlockChSend(ch chan bool, val bool) {\n\tselect {\n\tcase ch <- val:\n\t\tDPrintf(\"Server %d ----- Term %d: signal send\", rf.me, rf.currentTerm)\n\tdefault:\n\t\tDPrintf(\"Server %d ----- Term %d: signal not send\", rf.me, rf.currentTerm)\n\t}\n}", "title": "" }, { "docid": "b7795a2386dbb16e8b4fc47130c9fedf", "score": "0.5295957", "text": "func (suite *TestSuite) TestBufferedQueueNoWait(c *C) {\n\tq := CreateBufferedQueue(redisHost, redisPort, redisPassword, redisDB, \"buffered_test3\", 100)\n\terr := q.Start()\n\tc.Assert(err, Equals, nil)\n\n\tc.Check(q.Put(\"testpayload\"), Equals, nil)\n\ttime.Sleep(1 * time.Second)\n\tconsumer, err := q.AddConsumer(\"testconsumer\")\n\tc.Assert(err, Equals, nil)\n\n\tp, err := consumer.Get()\n\tc.Check(err, Equals, nil)\n\tc.Check(p.Ack(), Equals, nil)\n\n\tc.Check(q.GetInputLength(), Equals, int64(0))\n\tc.Check(consumer.GetUnackedLength(), Equals, int64(0))\n}", "title": "" }, { "docid": "1d1ab31d1e82b2697f5a933e70898de2", "score": "0.5294885", "text": "func (b *Buffer) Reset() {\n\tb.c = make(chan byte, cap(b.c))\n}", "title": "" }, { "docid": "6d14ac8ce9b4407c57e7f66808bfc356", "score": "0.52844095", "text": "func (b *Buffer) End() {\n\tif len(b.v) >= b.cap {\n\t\tb.flush(b.safeLen)\n\t}\n\tb.mu.Unlock()\n}", "title": "" }, { "docid": "0940aa6035ff9eeb851c6e655a1dc0e4", "score": "0.5280834", "text": "func (s *bufferedSender) Close() error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif s.closed {\n\t\treturn nil\n\t}\n\n\ts.cancel()\n\tif len(s.buffer) > 0 {\n\t\ts.flush()\n\t}\n\ts.closed = true\n\n\treturn nil\n}", "title": "" }, { "docid": "e11f738c0184a9f83adffdc7b692dad1", "score": "0.52615124", "text": "func NewBuffered(cap int) *Chan {\n\tch := &Chan{\n\t\tq: make(chan interface{}, cap),\n\t\tdone: make(chan struct{}),\n\t}\n\treturn ch\n}", "title": "" }, { "docid": "680a3da3ce57e2401a158864f6c09647", "score": "0.526118", "text": "func (t *Buffered) Send(body map[string]interface{}) error {\n\tselect {\n\tcase t.queue <- op{send: body}:\n\t\treturn nil\n\tcase <-t.ctx.Done():\n\t\treturn errClosed\n\tdefault:\n\t\treturn errBufferFull\n\t}\n}", "title": "" }, { "docid": "88514e573a7afcf414aa07c6a9c96470", "score": "0.52554256", "text": "func (c *Client) queue(msg Message) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tc.wg.Add(1)\n\tc.buffer = append(c.buffer, msg)\n\n\tdebug(\"buffer (%d/%d) %v\", len(c.buffer), c.FlushAt, msg)\n\n\tif len(c.buffer) >= c.FlushAt {\n\t\tgo c.Flush()\n\t}\n}", "title": "" }, { "docid": "d1409c5166092aa861768ace2cd9f27d", "score": "0.51989394", "text": "func (b *Bchan) Clear() {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\tb.on = false\n\tb.drain()\n\tb.cur = nil\n}", "title": "" }, { "docid": "7172e70eb084bbbf3c0dd437881f4ca5", "score": "0.51864415", "text": "func (b *Buffer) Flush() {\n\tb.mu.Lock()\n\tb.flush(0)\n\tb.mu.Unlock()\n}", "title": "" }, { "docid": "c2d880e0c7b37865ae19104c48035f77", "score": "0.5181647", "text": "func unsuccessfulBuffer() {\n\tc := make(chan int, 1)\n\n\tc <- 4333\n\tc <- 443\n\n\tfmt.Println(<-c)\n}", "title": "" }, { "docid": "6bfd097604ae390dd4ba19ed55fd2176", "score": "0.51697284", "text": "func buf_fill(L *Pa_log_t, limited bool) (got_some bool) {\n for {\n\tselect {\n\tcase op := <-L.Q_tx:\n\t got_some = true\n\t buf_accum(L, op.data, op.closure)\n\t if limited && L.Buf_empty() {\n\t\treturn\n\t }\n\tdefault: // Q_tx is empty\n\t return\n\t}\n }\n}", "title": "" }, { "docid": "c6f4b2dfed4dad8e2441eca1ff33e0f1", "score": "0.51670814", "text": "func (s *bufferedAsyncSender) Send(msg message.Composer) {\n\tif err := s.ctx.Err(); err != nil {\n\t\ts.ErrorHandler()(errors.Wrap(err, \"sending message\"), msg)\n\t}\n\n\tif !s.Level().ShouldLog(msg) {\n\t\treturn\n\t}\n\n\tselect {\n\tcase s.incoming <- msg:\n\tdefault:\n\t\ts.ErrorHandler()(errors.New(\"the message was dropped because the buffer was full\"), msg)\n\t}\n}", "title": "" }, { "docid": "cb4f0e45bc3c17313e85ccdd3ebec69c", "score": "0.5144894", "text": "func push(body map[string]interface{}) {\n\tif len(bodyChannel) < Buffer {\n\t\twaitGroup.Add(1)\n\t\tbodyChannel <- body\n\t} else {\n\t\trollbarError(\"buffer full, dropping error on the floor\")\n\t}\n}", "title": "" }, { "docid": "adc8e610d2dad1cf20d4850e854d69bc", "score": "0.5137912", "text": "func (c *Client) queue(msg Message) {\n\tc.bufferMutex.Lock()\n\tdefer c.bufferMutex.Unlock()\n\n\tc.buffer = append(c.buffer, msg)\n\n\tdebug(\"buffer (%d/%d) %v\", len(c.buffer), c.FlushAt, msg)\n\n\tif len(c.buffer) >= c.FlushAt {\n\t\tgo c.flush()\n\t}\n}", "title": "" }, { "docid": "c645ff25c9e85ea5046764f649fe6444", "score": "0.51027185", "text": "func (engine *WSEngine) HandleSendQueueFull(h func(cli *WSClient, msg interface{})) {\n\tengine.sendQueueFullHandler = h\n}", "title": "" }, { "docid": "ec161dac8380dae089d989d1d3a792ea", "score": "0.5095226", "text": "func BenchmarkChannel(b *testing.B) {\n\tb.Skip(\"Here just for reference\")\n\tc := make(chan ([]byte), 1024)\n\tgo func() {\n\t\tbuf := make([]byte, 0, 10)\n\t\tfor i := b.N; i > 0; i-- {\n\t\t\tc <- buf\n\t\t}\n\t\tclose(c)\n\t}()\n\tfor b := range c {\n\t\tLine = b\n\t}\n}", "title": "" }, { "docid": "c4e325bd08da0e21f30d43eb96c7fe86", "score": "0.50711083", "text": "func PutBuffer(b []byte) {\r\n\tif b == nil {\r\n fmt.Println(\"Nil buffer\")\r\n\t\treturn \r\n\t}\r\n Queue.enqueue(b)\r\n}", "title": "" }, { "docid": "9e19b9b5bd9282902d0f0d3697d295cd", "score": "0.5069817", "text": "func broadcastWsBlock(blk interface{}, dontDrop ...bool) {\n\twsClientsMu.RLock()\n\twsClientsCopy := lo.MergeMaps(make(map[uint64]*wsclient), wsClients)\n\twsClientsMu.RUnlock()\n\tfor _, wsClient := range wsClientsCopy {\n\t\tif len(dontDrop) > 0 {\n\t\t\tselect {\n\t\t\tcase <-wsClient.exit:\n\t\t\tcase wsClient.channel <- blk:\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-wsClient.exit:\n\t\tcase wsClient.channel <- blk:\n\t\tdefault:\n\t\t\t// potentially drop if slow consumer\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e8723b6d867bfa4924b8b47abcce8af", "score": "0.50693715", "text": "func Full(buf Buffer) bool {\n\treturn buf.Len() == buf.Cap()\n}", "title": "" }, { "docid": "6f36de543e3bfac2931445af9584b160", "score": "0.5062562", "text": "func (qb *BatchChan) Flush() {\n\tqb.m.Lock()\n\tdefer qb.m.Unlock()\n\n\tqb.sendToMainQBuf()\n\n\tqb.buf = [][]byte{}\n}", "title": "" }, { "docid": "30dfcd0636d4cb7951c257d03b4b7981", "score": "0.50386256", "text": "func (s *ChannelReadWriter) shuffle() {\n\tvar buf bytes.Buffer\n\td := make([]byte, 1)\n\t// Tracks whether we have a byte in our inFlight buffer\n\tinFlight := false\n\n\trun := true\n\n\tfor run {\n\t\t// If we have data to send keep sending until we are done\n\t\tfor run && (buf.Len() > 0 || inFlight) {\n\t\t\t// Make sure we have a byte to send\n\t\t\tif !inFlight {\n\t\t\t\tbuf.Read(d)\n\t\t\t\tinFlight = true\n\t\t\t}\n\n\t\t\t// Wait for a chance to send, data to read, or a stop signal\n\t\t\tselect {\n\t\t\tcase s.bytesOut <- d[0]:\n\t\t\t\t// data sent\n\t\t\t\tinFlight = false\n\t\t\tcase b := <-s.bytesIn:\n\t\t\t\t// keep pulling in more data\n\t\t\t\tbuf.Write([]byte{b})\n\t\t\tcase _ = <-s.shCl:\n\t\t\t\trun = false\n\t\t\t}\n\t\t}\n\n\t\t// No data left to send, block until we get more data or stop signal\n\tLoop:\n\t\tfor run {\n\t\t\tselect {\n\t\t\tcase b := <-s.bytesIn:\n\t\t\t\tbuf.Write([]byte{b})\n\t\t\t\tbreak Loop\n\t\t\tcase _ = <-s.shCl:\n\t\t\t\trun = false\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "675d591d64d86941ec4d3f29064e1f79", "score": "0.50323933", "text": "func (b *Buffer) Write(packet []byte) (n int, err error) {\n\t// Copy the packet before adding it.\n\tpacket = append([]byte{}, packet...)\n\n\tb.mutex.Lock()\n\n\t// Make sure we're not closed.\n\tif b.closed {\n\t\tb.mutex.Unlock()\n\t\treturn 0, io.ErrClosedPipe\n\t}\n\n\t// Check if there is available capacity\n\tif b.limitCount != 0 && len(b.packets)+1 > b.limitCount {\n\t\tb.mutex.Unlock()\n\t\treturn 0, ErrFull\n\t}\n\n\t// Check if there is available capacity\n\tif b.limitSize != 0 && b.size+len(packet) > b.limitSize {\n\t\tb.mutex.Unlock()\n\t\treturn 0, ErrFull\n\t}\n\n\tvar notify chan struct{}\n\n\t// Decide if we need to wake up any readers.\n\tif b.subs {\n\t\t// If so, close the notify channel and make a new one.\n\t\t// This effectively behaves like a broadcast, waking up any blocked goroutines.\n\t\t// We close after we release the lock to reduce contention.\n\t\tnotify = b.notify\n\t\tb.notify = make(chan struct{})\n\n\t\t// Reset the subs marker.\n\t\tb.subs = false\n\t}\n\n\t// Add the packet to the queue.\n\tb.packets = append(b.packets, packet)\n\tb.size += len(packet)\n\tb.mutex.Unlock()\n\n\t// Actually close the notify channel down here.\n\tif notify != nil {\n\t\tclose(notify)\n\t}\n\n\treturn len(packet), nil\n}", "title": "" }, { "docid": "0d3f0a794820ff5b45964f8de9a589e8", "score": "0.50147194", "text": "func sender(pipeline chan []byte) {\n\trecord := new(bytes.Buffer)\n\ttickStart := time.Now()\n\tfor {\n\t\tselect {\n\t\tcase line := <-pipeline:\n\t\t\t// Check if we are overflowing the 50kB maximum Kinesis message size.\n\t\t\tif len(line)+record.Len() > recordCap {\n\t\t\t\t// Respect the minTick - we don't want to send more often than once per minTick.\n\t\t\t\tsinceStart := time.Since(tickStart)\n\t\t\t\tif sinceStart < minTickDuration {\n\t\t\t\t\ttime.Sleep(minTickDuration - sinceStart)\n\t\t\t\t}\n\n\t\t\t\tsendAndReset(record)\n\t\t\t\ttickStart = time.Now()\n\t\t\t}\n\n\t\t\t_, err := record.Write(line)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(\"Sender failed to write into the record buffer: %s\\n\", err)\n\t\t\t}\n\t\tdefault:\n\t\t\t// Poll for some more data to come.\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\n\t\t// Wait for data for maxTick, then send what we have.\n\t\tif time.Since(tickStart) > maxTickDuration {\n\t\t\tif record.Len() > 0 {\n\t\t\t\tsendAndReset(record)\n\t\t\t}\n\t\t\ttickStart = time.Now()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2b0cec124deb8f17232292c1dca40e3c", "score": "0.500769", "text": "func (ns *NetServer) SetChanBufferSize(size uint32) bool {\n return false\n}", "title": "" }, { "docid": "2c256a8a9006fd01c1ddc35b49b22fae", "score": "0.49946642", "text": "func (b *Buffer) IsFull() bool {\n\treturn b.end == int32(len(b.v))\n}", "title": "" }, { "docid": "3db99d0f8636fc157a3917b2e5479690", "score": "0.49887168", "text": "func (b *B) full() bool {\n\n\tb.mu.RLock()\n\tdefer b.mu.RUnlock()\n\n\treturn b.idx >= b.buffersize\n}", "title": "" }, { "docid": "c3f6089824244dd801371d0fa183dc14", "score": "0.49734652", "text": "func (p *bufferPool) putBuffer(buf *bytes.Buffer) {\n\tbuf.Reset()\n\tselect {\n\tcase p.freeList <- buf:\n\t\t// buffer is back on the freelist\n\tdefault:\n\t\t// freeList is full... buffer will be gc'd\n\t\tp.logger.Debugf(\"Throwing away buffer of size %d\", buf.Len())\n\t}\n}", "title": "" }, { "docid": "546eed7d7c7902f7e58c58e28cadf590", "score": "0.49692297", "text": "func (bc *Blockchain) BroadcastNewBlock() {\n // Your code here\n bc.mu.Lock()\n args := AddBlockArgs{\n Index: bc.newBlock.Index,\n PreviousHash: bc.newBlock.PreviousHash,\n Timestamp: bc.newBlock.Timestamp,\n Hash: bc.newBlock.Hash,\n Data: bc.newBlock.Data,\n Nonce: bc.newBlock.Nonce,\n }\n bc.mu.Unlock()\n type ResponseMsg struct {\n AddBlockReply\n IsOk bool\n PeerIndex int\n }\n\n responseChan := make(chan ResponseMsg)\n // send requests concurrently\n for i, _ := range bc.peers {\n if i == bc.me {\n continue\n }\n\n go func(peerIndex int) {\n resp := AddBlockReply{}\n resp.Approved = true\n ok := bc.sendAddBlock(peerIndex, &args, &resp)\n responseChan <- ResponseMsg{\n resp,\n ok,\n peerIndex,\n }\n }(i)\n }\n\n // Collect response\n totalCount := len(bc.peers)\n currentCount := 1\n for resp := range responseChan {\n if resp.AddBlockReply.Approved == false {\n bc.newBlock = Block{}\n go bc.DownloadBlockchainFromPeers()\n return\n } else {\n currentCount++\n if currentCount == totalCount {\n fmt.Printf(\"node %d received all approval\\n\", bc.me)\n bc.mu.Lock()\n if bc.newBlock.Index == len(bc.chains) {\n bc.chains = append(bc.chains, bc.newBlock)\n bc.newBlock = Block{}\n bc.mu.Unlock()\n } else {\n // This happens when the node accepts another peer's mined block\n bc.newBlock = Block{}\n bc.mu.Unlock()\n go bc.DownloadBlockchainFromPeers()\n return\n }\n\n bc.commandChannel <- \"Done\"\n return\n }\n }\n }\n}", "title": "" }, { "docid": "3881d751d69a74d4b526685e41918f5b", "score": "0.4968728", "text": "func (self *CStreamWriterT) MayBlock() (ret bool) {\n\n\tcRet := C.cefingo_stream_writer_may_block((*C.cef_stream_writer_t)(self.pc_stream_writer))\n\n\tret = cRet == 1\n\treturn ret\n}", "title": "" }, { "docid": "13e618f8db25d1c76e8030238d33b916", "score": "0.49669313", "text": "func (b *FlushableBuffer) Flush() (n int, err error) {\n\treturn b.stream.Write(b.Bytes())\n}", "title": "" }, { "docid": "31cf1bb9f272680b64f515ae887993e0", "score": "0.49640378", "text": "func (buf *Buffer) IsFull() bool {\n\treturn buf.write >= len(buf.buffer)\n}", "title": "" }, { "docid": "c9a9d186a9ac91dbd9524b488c27753c", "score": "0.49619284", "text": "func (buf Buffer) Flush() error {\n\tif buf.w != nil {\n\t\tif _, err := buf.w.Write(buf.Buffer.Bytes()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.Reset()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "65ecaa6ff011ea790982cbb6e7c607c1", "score": "0.4960035", "text": "func (c *NetConn) realNonblockingWrite(b []byte) (n int, err error) {\n\treturn c.fakeNonblockingWrite(b)\n}", "title": "" }, { "docid": "51187f357ed0d27dd9b8da99e09e2459", "score": "0.49562743", "text": "func EmptyBuffer(numChannels NumChannels, bufferSize BufferSize) Buffer {\n\tresult := Buffer(make([][]float64, numChannels))\n\tfor i := range result {\n\t\tresult[i] = make([]float64, bufferSize)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "37da6e5fb4270d1f57666965fa735f87", "score": "0.49473202", "text": "func (cb *CyclicBuffer) Empty() bool {\n\treturn !cb.NotEmpty()\n}", "title": "" }, { "docid": "4bb0bc78b4cbec9bbe893e7692a644b6", "score": "0.49452177", "text": "func listenForBlocks() error {\n\tconn, err := ethclient.Dial(\"wss://\" + os.Getenv(\"ENVIRONMENT\") + \".infura.io/ws\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Cannot dial websocket connection %v\", err)\n\t}\n\n\tch := make(chan *types.Header)\n\tsub, err := conn.SubscribeNewHead(context.Background(), ch)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Cannot subscribe to head %v\", err)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase msg := <-ch:\n\t\t\tlog.Println(\"New Block:\", msg.Number.String())\n\t\t\tgetBlock(msg.Number)\n\t\tcase err := <-sub.Err():\n\t\t\tlog.Println(\"Connection error:\", err)\n\t\tcase <-time.After(15 * time.Second):\n\t\t\tfmt.Println(\"Waiting for blocks...\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d5e5a6b026dcab2ee31f032b7ae8979b", "score": "0.49449342", "text": "func New() *Chan { return NewBuffered(0) }", "title": "" }, { "docid": "360649f4dd95b1739d909fc864d9abb1", "score": "0.4927847", "text": "func (p *ByteSink) Flush() error {\n\treturn nil\n}", "title": "" }, { "docid": "c00f034a8198ec8c2b45d9b76cd348e4", "score": "0.4925587", "text": "func (b *Buffer) rawSend(data []byte) bool {\n\t// combine output to reduce syscall.write\n\tsz := len(data)\n\tbinary.BigEndian.PutUint16(b.cache, uint16(sz))\n\tcopy(b.cache[2:], data)\n\n\t// wiret data\n\tn, err := b.conn.Write(b.cache[:sz+2])\n\tif err != nil {\n\t\tlog.Warningf(\"Error send reply data, byte: %v reason %v\", n, err)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "499c01d4876b31e0f1a85cd62083d43d", "score": "0.49194673", "text": "func (b *Reader) fill() {\n\tif b.r > 0 {\n\t\tcopy(b.buf, b.buf[b.r:b.w]) // 相当于重新覆盖了b.buf\n\t\tb.w -= b.r\n\t\tb.r = 0\n\t}\n\tif b.w >= len(b.buf) {\n\t\tpanic(\"bufio: tried to fill full buffer\")\n\t}\n\tfor i := maxConseutiveEmptyReads; i > 0; i-- {\n\t\tn, err := b.rd.Read(b.buf[b.w:])\n\t\tif n < 0 {\n\t\t\tpanic(errNegativeRead)\n\t\t}\n\t\tb.w += n\n\t\tif err != nil {\n\t\t\tb.err = err\n\t\t\treturn\n\t\t}\n\t\tif n > 0 {\n\t\t\treturn\n\t\t}\n\t}\n\tb.err = io.ErrNoProgress\n}", "title": "" }, { "docid": "4b2f0cd6851b837fd043c347d2d2cf46", "score": "0.49180168", "text": "func (c *controlBuffer) throttle() {\n\tch, _ := c.trfChan.Load().(chan struct{})\n\tif ch != nil {\n\t\tselect {\n\t\tcase <-ch:\n\t\tcase <-c.done:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "28efe81f59e1e6716a004b3134c9b5f9", "score": "0.49128586", "text": "func runBlock(block chan Block, wg *sync.WaitGroup) {\n defer wg.Done()\n\n b := <- block\n\n for j := 0; j != b.RelCount; j++ {\n b.block()\n }\n}", "title": "" }, { "docid": "244ade432241b9cc5998d9a9f7f0027d", "score": "0.49118555", "text": "func nullEventChannelReceiver(wg *sync.WaitGroup, event_channel <-chan struct{}) {\n\tdefer wg.Done()\n\tfor {\n\t\t<-event_channel\n\t}\n}", "title": "" }, { "docid": "62644953416adb882d0cb6a449f53bf7", "score": "0.49054053", "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": "cffd6367821814823c6110a84455d2be", "score": "0.49023736", "text": "func (k Keeper) BlockingSend(ctx sdk.Context, action vm.Jsonable) (string, error) {\n\tbz, err := json.Marshal(action)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn k.callToController(ctx, string(bz))\n}", "title": "" }, { "docid": "3f784fce93cb3c01580b00c48840808e", "score": "0.49014348", "text": "func Test_deadlock_nil_chan(t *testing.T) {\n\tvar c chan string\n\n\tgo func() {\n\t\t// ERROR chan receive (nil chan)\n\t\tfor s := range c {\n\t\t\tt.Logf(\"received data \\\"%s\\\"\\n\", s)\n\t\t}\n\t}()\n\n\t// ERROR: chan send (nil chan)\n\tc <- \"string 01\"\n\tclose(c)\n\t\n\tt.Log(\"never finish\")\n}", "title": "" }, { "docid": "545aed6007441f0ee79b60c4c180d903", "score": "0.4897218", "text": "func (c *Client) Blocking() <-chan amqp.Blocking {\n\treturn c.blocking\n}", "title": "" }, { "docid": "7127293bc698e67cd30b7221c7218da7", "score": "0.48963368", "text": "func BlockUntilSpare(amount ByteSize, duration time.Duration) <-chan bool {\n\tr := Request{amount: amount, duration: duration, satisfied: make(chan bool)}\n\trequest <- r\n\treturn r.satisfied\n}", "title": "" }, { "docid": "d29bac1ea9721312a60ca01dd979f3f9", "score": "0.48950845", "text": "func (a *Async) flushBuf(b *buffer) {\n\ttasks := b.Tasks()\n\tif len(tasks) > 0 {\n\t\tfor _, t := range tasks {\n\t\t\ta.wait.Add(1)\n\t\t\tgo func(t *task) {\n\t\t\t\tt.Do()\n\t\t\t\ta.wait.Done()\n\t\t\t}(t)\n\t\t}\n\t\ta.wait.Wait()\n\t\tb.Reset()\n\t}\n}", "title": "" }, { "docid": "4e1e4f7ed1518cf3881cddc0c4179206", "score": "0.48872802", "text": "func (s *Statsd) send(data string, rate float32) {\n\tif rate < 1 && s.r != nil {\n\t\tif s.r.Float32() < rate {\n\t\t\treturn\n\t\t}\n\t}\n\tselect {\n\tcase s.stats <- data:\n\tdefault:\n\t\tlog.Warn(\"Statsd stat channel is full\")\n\t}\n}", "title": "" }, { "docid": "32b9cc081bb97edf9025dcf3402d8663", "score": "0.4883924", "text": "func (s *Stream) onBufferReleased(nBytesReleased int) {\n\tif nBytesReleased <= 0 {\n\t\treturn\n\t}\n\n\ts.lock.Lock()\n\n\tfromAmount := s.bufferedAmount\n\n\tif s.bufferedAmount < uint64(nBytesReleased) {\n\t\ts.bufferedAmount = 0\n\t\ts.log.Errorf(\"[%s] released buffer size %d should be <= %d\",\n\t\t\ts.name, nBytesReleased, s.bufferedAmount)\n\t} else {\n\t\ts.bufferedAmount -= uint64(nBytesReleased)\n\t}\n\n\ts.log.Tracef(\"[%s] bufferedAmount = %d\", s.name, s.bufferedAmount)\n\n\tif s.onBufferedAmountLow != nil && fromAmount > s.bufferedAmountLow && s.bufferedAmount <= s.bufferedAmountLow {\n\t\tf := s.onBufferedAmountLow\n\t\ts.lock.Unlock()\n\t\tf()\n\t\treturn\n\t}\n\n\ts.lock.Unlock()\n}", "title": "" }, { "docid": "d21c34f5457fb7ecc94288367ba91ca0", "score": "0.48760155", "text": "func (qb *BatchChan) Push(rec []byte) {\n\tqb.m.Lock()\n\n\tqb.buf = append(qb.buf, rec)\n\n\tif len(qb.buf) > qb.bufSize {\n\t\tqb.m.Unlock()\n\t\tqb.Flush()\n\t} else {\n\t\tqb.m.Unlock()\n\t}\n}", "title": "" }, { "docid": "6a6085f4574b02db17bd83e381d421aa", "score": "0.48753756", "text": "func (p *Parser) flushRingbuffer() {\n\tfor range p.ringbufferFlushChannel {\n\t\t// Go through ringbuffer and flush out all available packets\n\t\tfor i := p.ringbufferStart; true; i++ {\n\t\t\tringBufferIndex := i % p.ringbufferSize\n\t\t\tif !p.ringbufferUsedlist[ringBufferIndex] {\n\t\t\t\tp.ringbufferStart = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif p.ringbuffer[ringBufferIndex].HasTCP {\n\t\t\t\tp.pool.AddTCPPacket(&p.ringbuffer[ringBufferIndex])\n\t\t\t} else if p.ringbuffer[ringBufferIndex].HasUDP {\n\t\t\t\tp.pool.AddUDPPacket(&p.ringbuffer[ringBufferIndex])\n\t\t\t}\n\t\t\tp.ringbufferUsedlist[ringBufferIndex] = false\n\t\t}\n\t}\n\tp.wgRingbufferFlush.Done()\n}", "title": "" }, { "docid": "3ff4555cbe4cb032347f433453f490bc", "score": "0.4871874", "text": "func S51_Buffer(bufSize int) (consumer chan int, producer chan int) {\n\tbuffer := make([]int, bufSize)\n\tconsumer = make(chan int)\n\tproducer = make(chan int)\n\n\tin, out := 0, 0\n\tgo func() {\n\t\tfor {\n\t\t\tif in < out+10 {\n\t\t\t\t// We have room in the buffer, check the producer.\n\t\t\t\tselect {\n\t\t\t\tcase i := <-producer:\n\t\t\t\t\tbuffer[in%bufSize] = i\n\t\t\t\t\tin++\n\t\t\t\tdefault: // don't block\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif out < in {\n\t\t\t\t// We have something in the buffer, check the consumer.\n\t\t\t\tselect {\n\t\t\t\tcase consumer <- buffer[out%bufSize]:\n\t\t\t\t\tout++\n\t\t\t\tdefault: // don't block\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Sleep for a bit here to avoid busy waiting?\n\t\t}\n\t}()\n\n\treturn consumer, producer\n}", "title": "" }, { "docid": "2e6d087a2b46b25c879af7de093824c1", "score": "0.48677546", "text": "func (s *sender) Flush() error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tfor receiver, buf := range s.outputs {\n\t\tif len(buf) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\terr := s.send(receiver, buf)\n\t\tif err == nil {\n\t\t\tdelete(s.outputs, receiver)\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "406f07d303705b375d3ebd6e47e1489c", "score": "0.48604384", "text": "func putBuffer(buf []byte) {\n\tselect {\n\tcase bufPool <- buf:\n\t\t// Pushed. Default discards and lets the GC clean it\n\t\t// up.\n\t}\n}", "title": "" }, { "docid": "db9da2f299630f1a48ad521d67b03bdc", "score": "0.48604083", "text": "func (me *Bitstream) flush_write_buffer() error {\n\tif me.iotype == BS_OUTPUT {\n\t\tvar l int = int(me.cur_bit >> BSHIFT) // number of bytes written already\n\t\tn, err := me.writer.Write(me.buf[:l])\n\n\t\tif err != nil {\n\t\t\tme.seterror(E_WRITE_FAILED)\n\t\t\treturn err\n\t\t}\n\n\t\tif n != l {\n\t\t\tme.seterror(E_WRITE_FAILED)\n\t\t\treturn io.ErrShortWrite\n\t\t}\n\n\t\t// are there any left over bits?\n\t\tif me.cur_bit&0x7 != 0 {\n\t\t\tme.buf[0] = me.buf[l] // copy the left-over bits\n\t\t\tfill_slice(me.buf[1:], 0) // zero-out rest of buffer\n\t\t} else {\n\t\t\tfill_slice(me.buf[:], 0) // zero-out entire buffer\n\t\t}\n\t\tme.cur_bit &= 7\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c3c292ad5072d859878b39757dcb4067", "score": "0.486009", "text": "func (b *buffer) Full() bool {\n\treturn b.write == len(b.data)\n}", "title": "" }, { "docid": "33413b55a67d408f30176eb12a13fb3c", "score": "0.48547038", "text": "func (b *bufferSink) Sync() error {\n\treturn nil\n}", "title": "" }, { "docid": "1276042a3a9eebb35a9784e366c0a1f3", "score": "0.48521677", "text": "func (r *RateBasedLimiter) BlockUntilCanWriteBytes() (int64, time.Time) {\n // To calculate how long we should block, we essentially remove the earliest sample and\n // recalculate when we should write the next one to maintain the ideal write rate.\n\n totalBytesWithoutEarliest := r.totalBytesWritten - r.bytesWritten[r.earliestSample]\n startTimeWithoutEarliest := r.timeWritten[(r.earliestSample + 1) % NumSamples]\n\n numBytesToWrite := r.targetBytesPerSample\n\n idealTimeToWriteAllSamples := time.Duration((totalBytesWithoutEarliest + numBytesToWrite) * (SamplingWindow.Nanoseconds() / (r.targetBytesPerSample * int64(NumSamples))))\n\n idealNextWriteTime := startTimeWithoutEarliest.Add(idealTimeToWriteAllSamples)\n // If the time for the next sample is far enough in the future, sleep to wait for it.\n timeToWait := idealNextWriteTime.Sub(r.clock.Now())\n if timeToWait >= MinimumTimeToSleep {\n r.clock.Sleep(timeToWait)\n }\n\n return numBytesToWrite, r.clock.Now()\n}", "title": "" }, { "docid": "1084999e2bf1fc478c69e7c97cbb15c0", "score": "0.4851121", "text": "func (ec *explorerClient) logBufferFullWithExpBackoff(data []byte) {\n\tcount := ec.dropMessageCount.Add(1)\n\tif count > 0 && (count%100 == 0 || count&(count-1) == 0) {\n\t\tec.lggr.Warnw(\"explorer client buffer full, dropping message\", \"data\", data, \"droppedCount\", count)\n\t}\n}", "title": "" }, { "docid": "4d45c602ea5d769106e9bf7724fcdb92", "score": "0.4847596", "text": "func Send(c Conn, m Message) error {\n\tselect {\n\tcase c.WriteChannel() <- m:\n\t\t// do nothing.\n\tdefault:\n\t\treturn fmt.Errorf(\"Send queue to %q full; dropping %q message.\",\n\t\t\tc.Endpoint(), m.Type)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "34d8dafd781f30ee3ddd71aa95751cdc", "score": "0.48449394", "text": "func (cb *CyclicBuffer) NotEmpty() bool {\n\treturn (cb.full || (cb.index > 0))\n}", "title": "" }, { "docid": "6b424b2051797ecb5588d699d1c93610", "score": "0.48441267", "text": "func (engine *WSEngine) OnSendQueueFull(cli *WSClient, msg interface{}) {\n\tif engine.sendQueueFullHandler != nil {\n\t\tengine.sendQueueFullHandler(cli, msg)\n\t}\n}", "title": "" }, { "docid": "2fb78440b5caa747f64d5b07fa71956f", "score": "0.48404133", "text": "func sendChanTimeouted(c interface{}, v interface{}, d ...time.Duration) bool {\n\tcty := reflect.TypeOf(c)\n\tif cty.Kind() != reflect.Chan {\n\t\treturn false\n\t}\n\tvty := reflect.TypeOf(v)\n\tif vty.AssignableTo(cty.Elem()) || vty.ConvertibleTo(cty.Elem()) {\n\t} else {\n\t\treturn false\n\t}\n\n\trd := 10 * time.Second\n\tif len(d) > 0 {\n\t\trd = d[0]\n\t}\n\n\tsendok := true\n\tdefer func() {\n\t\tif x := recover(); x != nil {\n\t\t\tlog.Printf(\"wow should be closed channel: %v\", x)\n\t\t\tsendok = false\n\t\t}\n\t}()\n\n\tcv := reflect.ValueOf(c)\n\tvv := reflect.ValueOf(v)\n\tcases := []reflect.SelectCase{\n\t\t{Dir: reflect.SelectSend, Chan: cv, Send: vv},\n\t\t{Dir: reflect.SelectDefault},\n\t}\n\tchosen, _, _ := reflect.Select(cases)\n\tif chosen == 1 {\n\t\tlog.Println(\"send busch blocked:\", cv.Len())\n\t\t// 这种情况是为什么呢,应该怎么办呢?\n\t\t// 這種情況下,是chan寫滿了,所以block了。\n\t\t// debug1.PrintStack()\n\t\tctx, ccfn := context.WithTimeout(context.Background(), rd)\n\t\tdefer ccfn()\n\t\tfunc(ctx context.Context) {\n\t\t\tcases := []reflect.SelectCase{\n\t\t\t\t{Dir: reflect.SelectSend, Chan: cv, Send: vv},\n\t\t\t\t{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(ctx.Done())},\n\t\t\t}\n\t\t\tchosen, _, _ := reflect.Select(cases)\n\t\t\tif chosen == 1 {\n\t\t\t\tlog.Println(ctx.Err())\n\t\t\t\tmsg := fmt.Sprintf(\"send busch timeout: %d, dropped\", cv.Len())\n\t\t\t\tlog.Println(msg)\n\t\t\t}\n\t\t}(ctx) // 使用一个函数,明确ctx的使用\n\t}\n\n\treturn sendok\n}", "title": "" }, { "docid": "9596476b56edd6e72a59cfc4362505ca", "score": "0.48328882", "text": "func (buf *Buffer) raw_send(data []byte) bool {\n\t// combine output to reduce syscall.write\n\tsz := len(data)\n\tbinary.BigEndian.PutUint16(buf.cache, uint16(sz))\n\tcopy(buf.cache[2:], data)\n\n\t// write data\n\tn, err := buf.conn.Write(buf.cache[:sz+2])\n\tif err != nil {\n\t\tlog.Warningf(\"Error send reply data, bytes: %v reason: %v\", n, err)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "7d234ef502e290cb25057265cafe0aa4", "score": "0.48296106", "text": "func (r *FixedDelayLimiter) BlockUntilCanWriteBytes() (int64, time.Time) {\n resultTimestamp := r.lineTimestamp\n r.lineTimestamp = r.lineTimestamp.Add(r.timeAdvancePerLine)\n r.clock.Sleep(r.sleepPerLine)\n return 1, resultTimestamp\n}", "title": "" }, { "docid": "5d34588143ad7fb08bcac27924b47909", "score": "0.48281634", "text": "func buf_flush(L *Pa_log_t, flag byte) {\n switch flag {\n case 0:\n\tL.nFlush_0++\n case 1:\n\tL.nFlush_1++\n default:\n\tL.nFlush_x++\n }\n\n /* Process requests from Q_tx into Q_ser */\n got_some := buf_fill(L, flag == 0)\n\n /* If serializer called flush but there is nothing to send, remember he is starving */\n if flag == 0 && !got_some && L.Buf_empty() {\n\tL.starving = true\n\tL.nStarve++\n\treturn\n }\n\n /* If the buffer is non-empty then it is a partial buffer which we will now\n * process into Q_ser in satisfaction of the flush request.\n *\n * Note when flag == 0, buf_fill stopped as soon as it triggered a\n * write (resulting in an empty buffer). In that case we have accomplished\n * the purpose of relieving starvation in the serializer.\n */\n\n /* Write any partial buffer remaining */\n if !L.Buf_empty() {\n\t/* Check the buffer for a partially-filled sector */\n\tsector_bytes := L.buffer[L.buf_sector_ofs:L.buf_sector_ofs+int(L.Cfg.Bytes_per_sector)]\n\thdr := hdr_of_sector(sector_bytes)\n\tif hdr.xslots > 0 {\n\t /* There are some transactions pending in this sector -- finish it */\n\t sector_finish(sector_bytes, L.pa_get_bytes, L.sector_seqno, L.refresh_slot, &L.Cfg)\n\t L.sector_seqno++\n\t L.refresh_slot += int(L.Cfg.Rslots_max_per_sector)\n\t if L.refresh_slot >= int(L.Cfg.Slot_max) {\n\t\tL.refresh_slot -= int(L.Cfg.Slot_max)\n\t }\n\t L.buf_sector_ofs += int(L.Cfg.Bytes_per_sector)\n\t}\n\n\tslot_start_ofs := L.File_pa_ofs + int(L.Cfg.Slot_start_ofs)\n\tslot_end_ofs := slot_start_ofs + int(L.Cfg.Bytes_in_slot_area)\n\n\t/* Send the buffer and its associated closure list to the serializer */\n\tL.Q_ser <- write_closure(L, L.buffer[0:L.buf_sector_ofs], L.closure)\n\tL.nQ_ser_flush++\n\n\t/* Track high-watermark of Q_ser */\n\tl := len(L.Q_ser)\n\tif L.hQ_ser < l {\n\t L.hQ_ser = l\n\t}\n\n\tL.ser_flush_size_cum += L.buf_sector_ofs\n\tL.file_writeofs += L.buf_sector_ofs\n\tif L.file_writeofs >= slot_end_ofs {\n\t L.file_writeofs = slot_start_ofs\n\t}\n\tL.buffer, L.closure = nil, nil\n\tL.buf_sector_ofs = 0\n\tL.buf_xslot_ofs = 0\n\tL.starving = false\n }\n\n /* Check for close request */\n if flag == 0xff {\n\tclose(L.Q_ser)\n\tclose(L.Q_tx)\n\tL.logging_active = false\n\tif VERBOSE {\n\t Rusage_dump(\"logger\")\n\t}\n\truntime.Goexit()\n }\n}", "title": "" }, { "docid": "d9e0e9705815a861128e5d9aab0ef402", "score": "0.48211837", "text": "func channel_non_blocking() {\r\n\tmessages := make(chan string)\r\n\tsignals := make(chan bool)\r\n\r\n\tselect {\r\n\tcase msg := <-messages:\r\n\t\tfmt.Println(\"received message\", msg)\r\n\tdefault:\r\n\t\tfmt.Println(\"no message received\")\r\n\t}\r\n\r\n\tmsg := \"hi\"\r\n\tselect {\r\n\tcase messages <- msg:\r\n\t\tfmt.Println(\"send message\", msg)\r\n\tdefault:\r\n\t\tfmt.Println(\"no message sent\")\r\n\t}\r\n\r\n\tselect {\r\n\tcase msg := <-messages:\r\n\t\tfmt.Println(\"received message\", msg)\r\n\tcase sig := <-signals:\r\n\t\tfmt.Println(\"received signal\", sig)\r\n\tdefault:\r\n\t\tfmt.Println(\"no activity\")\r\n\t}\r\n}", "title": "" }, { "docid": "90fe4d5b30098e7179e296c4ea8c4697", "score": "0.48203725", "text": "func (streamer *ServerStreamer) sendAsChunks(content []byte, forceFlush bool) error {\n\t// we're writing in two places below, so we define a local function for conciseness.\n\twriteOneChunk := func(data []byte) error {\n\t\tif _, err := streamer.output.Write(data); err != nil {\n\t\t\treturn fmt.Errorf(\"error writing streamed http chunk: %s\\n chunk: %q\", err.Error(), string(data))\n\t\t}\n\n\t\t// Flush() causes the chunk to be sent immediately, and chunked transfer encoding to\n\t\t// be set in the HTTP headers before the first chunk.\n\t\t// cf. https://stackoverflow.com/a/30603654\n\t\tstreamer.flusher.Flush()\n\t\treturn nil\n\t}\n\n\tif _, err := streamer.buffer.Write(content); err != nil {\n\t\treturn err\n\t}\n\n\tif streamer.chunkSize > 0 {\n\t\tfor streamer.buffer.Len() >= streamer.chunkSize {\n\t\t\tif err := writeOneChunk(streamer.buffer.Next(streamer.chunkSize)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif streamer.buffer.Len() == 0 {\n\t\t\t// reuse memory when possible\n\t\t\tstreamer.buffer.Reset()\n\t\t}\n\n\t}\n\n\tif streamer.chunkSize <= 0 || forceFlush {\n\t\tif err := writeOneChunk(streamer.buffer.Bytes()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tstreamer.buffer.Reset()\n\t}\n\n\treturn nil\n}", "title": "" } ]
b41991d5e5ada5530fe512a418f9e5ac
TestDecrypt tests decrypting strings and tests backward compatibility in the event that changes are made to the decryption algorithm.
[ { "docid": "4b91f924d421fe4572a7bad7d4562ee1", "score": "0.78549224", "text": "func TestDecrypt(t *testing.T) {\n\ttests := []struct {\n\t\tkey Key\n\t\tcipherText string\n\t\tclearText string\n\t\terrText string\n\t}{\n\t\t{\n\t\t\t// Version 0\n\t\t\tkey: Key{\n\t\t\t\t0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n\t\t\t\t0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n\t\t\t\t0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,\n\t\t\t\t0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,\n\t\t\t},\n\t\t\tcipherText: \"oEXNDp3tIpcLoSBpLpD3OKCO6YuQaRL6Odp6J\" +\n\t\t\t\t\"Aye1pQwXR8yQf9QI8S+Tsy1iTL7pk+En5z6UKjnIE7LRh\" +\n\t\t\t\t\"uhbw==\",\n\t\t\tclearText: \"hello world\",\n\t\t},\n\t\t{\n\t\t\tkey: Key{\n\t\t\t\t0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,\n\t\t\t\t0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,\n\t\t\t\t0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,\n\t\t\t\t0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,\n\t\t\t},\n\t\t\tcipherText: \"yNccukj+CPCYZHm1m2qgCM9kv+tNo3aH6+yIHU\" +\n\t\t\t\t\"El4LujwghrJQQ/2eq+pevI4DV9ywqVoQJMqV7ElToccyNA\" +\n\t\t\t\t\"ce6tr9ofug9n6Bk/toO+fkJQZUpNh9ROLcWAVtWv3gDt0J\" +\n\t\t\t\t\"d79kDDJ/H5DSusZDwm3b+brViXqad2SRu821ju9fU=\",\n\t\t\tclearText: \"now is the time for all good men to come to the aid of the party\",\n\t\t},\n\t}\n\n\tfor i, tt := range tests {\n\t\tclearText, err := tt.key.DecryptString(tt.cipherText)\n\t\tif err != nil {\n\t\t\tif tt.errText == \"\" {\n\t\t\t\tt.Errorf(\"%d: %v\", i, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif got, want := err.Error(), tt.errText; got != want {\n\t\t\t\tt.Errorf(\"%d: got=%q want=%q\", i, got, want)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif got, want := clearText, tt.clearText; got != want {\n\t\t\tt.Errorf(\"%d: got=%q want=%q\", i, got, want)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "a1b8dba54dff77d23f16c62f120b24bf", "score": "0.7650864", "text": "func TestDecrypt(t *testing.T) {\n\tbs, err := ioutil.ReadFile(\"SS_1595586703.txt\")\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\n\tuls := decryptSuscription(bs)\n\tfor _, v := range uls {\n\t\tlog.Println(v)\n\t}\n\n}", "title": "" }, { "docid": "33eed672cd95bec81317ad5de8bfb348", "score": "0.7134319", "text": "func TestEncryptDecrypt(t *testing.T) {\n\tpriv, err := GenerateKey(128)\n\tif err != nil {\n\t\tt.Errorf(\"%v\\n\", err)\n\t\treturn\n\t}\n\tmessage := []byte(\"Cannnnnnnn do.\")\n\tciphertext := EncryptNoPadding(message, priv.PublicKey)\n\tlog.Printf(\"private %+v\\n\", priv)\n\tlog.Printf(\"public %+v\\n\", priv.PublicKey)\n\tlog.Printf(\"ciphertext %v\\n\", ciphertext)\n\tplaintext := DecryptNoPadding(ciphertext, priv)\n\tlog.Printf(\"plaintext %v\\n\", plaintext)\n\tif string(plaintext) != string(message) {\n\t\tt.Errorf(\"decrypted message did not match plaintext\")\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "12f1372a026536d6d5c7206a92a0489d", "score": "0.7120544", "text": "func TestDecryptAES(t *testing.T) {\n\tfh, err := os.Open(\"./7.txt\")\n\tif err != nil {\n\t\tt.Errorf(\"Test failed because file could not be opened.\\n%v\", err)\n\t}\n\tdefer fh.Close()\n\n\tstats, err := fh.Stat()\n\tif err != nil {\n\t\tt.Errorf(\"Test failed because file stats could not be opened.\\n%v\", err)\n\t}\n\treader := b64.NewDecoder(b64.StdEncoding, fh)\n\tsize := stats.Size()\n\tt.Logf(\"File has a size of %v bytes.\", size)\n\n\tcipher := make([]byte, size)\n\tbytesRead, err := io.ReadFull(reader, cipher)\n\tt.Logf(\"%v bytes read into buffer after decoding base64.\", bytesRead)\n\n\tt.Logf(\"Value returned:\\n%v\", DecryptAES(cipher[:bytesRead], []byte(\"YELLOW SUBMARINE\")))\n\n}", "title": "" }, { "docid": "a4a778a233a59ba1986526fde783b919", "score": "0.6975778", "text": "func testDecryption(s *subset, id string, secKey *sk, cipher *hdr, l int) (mes *BN462.FP12) {\n\tinit := time.Now()\n\n\tmes, _ = decrypt(s, id, secKey, cipher)\n\n\telapsed := time.Since(init)\n\n\tfmt.Println(\"Decryption for l = \", l, \" took\", elapsed)\n\n\treturn mes\n}", "title": "" }, { "docid": "3df10c5c2c2fff979e977cbe8010b6cd", "score": "0.6968103", "text": "func EncryptDecryptTest(t *testing.T, mode ModeInterface, ck []byte, nonce []byte) {\n\tdata := rand.GetRand(int(BlockSize) * 5 / 2) // partial block to test padding and unpadding\n\texpected := make([]byte, len(data))\n\tcopy(expected, data)\n\t// Setup input for encryption\n\tin := bytes.NewReader(data)\n\tout := mbytes.NewReadWriteSeeker(make([]byte, 0))\n\tmode.Encrypt(0, uint64(len(data)), in, out, ck, nonce)\n\t// Setup input for decryption\n\tdData := out.Bytes()\n\tdIn := bytes.NewReader(dData)\n\tdOut := mbytes.NewReadWriteSeeker(make([]byte, 0))\n\tmode.Decrypt(0, uint64(len(dData)), dIn, dOut, ck, nonce)\n\tif x := dOut.Bytes(); !bytes.Equal(x, expected) {\n\t\tt.Errorf(\"Encryption followed by decryption failed with %s\", hex.EncodeToString(x))\n\t}\n}", "title": "" }, { "docid": "0e154d2a0934e241ecbfa7b53ba08bfd", "score": "0.6897156", "text": "func decrypt(s string, num int) (res string) {\n\ta := []byte(s)\n\tres = crypt(a, -num)\n\treturn\n}", "title": "" }, { "docid": "089217dc828684c9f3bfea50b2bfa5ec", "score": "0.6843557", "text": "func TestEncryptDecrypt(t *testing.T) {\n\tprv1, err := GenerateKey(rand.Reader, DefaultCurve, nil)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tt.FailNow()\n\t}\n\n\tprv2, err := GenerateKey(rand.Reader, DefaultCurve, nil)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tt.FailNow()\n\t}\n\n\tmessage := []byte(\"Hello, world.\")\n\tct, err := Encrypt(rand.Reader, &prv2.PublicKey, message, nil, nil)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tt.FailNow()\n\t}\n\n\tpt, err := prv2.Decrypt(ct, nil, nil)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tt.FailNow()\n\t}\n\n\tif !bytes.Equal(pt, message) {\n\t\tfmt.Println(\"ecies: plaintext doesn't match message\")\n\t\tt.FailNow()\n\t}\n\n\t_, err = prv1.Decrypt(ct, nil, nil)\n\tif err == nil {\n\t\tfmt.Println(\"ecies: encryption should not have succeeded\")\n\t\tt.FailNow()\n\t}\n}", "title": "" }, { "docid": "0d851b0897cfd73e628d81992ed766bc", "score": "0.6790919", "text": "func decrypt(cipherTextString string, block *cipher.Block) (string, error) {\n\tif block == nil {\n\t\treturn \"\", errors.New(\"block is not initialized\")\n\t}\n\tcipherTextBytes, err := base64.StdEncoding.DecodeString(cipherTextString)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(cipherTextBytes) < aes.BlockSize {\n\t\treturn \"\", errors.New(\"cipher text is too short\")\n\t}\n\t// Get the iv from cipher text\n\tiv := cipherTextBytes[:aes.BlockSize]\n\tcipherTextBytes = cipherTextBytes[aes.BlockSize:]\n\tif len(cipherTextBytes)%aes.BlockSize != 0 {\n\t\treturn \"\", errors.New(\"cipher text is not a multiple of the block size\")\n\t}\n\t// Decrypt\n\tmode := cipher.NewCBCDecrypter(*block, iv)\n\tmode.CryptBlocks(cipherTextBytes, cipherTextBytes)\n\t// Unpadding\n\tcipherTextBytes = pkcs7Unpadding(cipherTextBytes)\n\tciphertextStr := string(cipherTextBytes)\n\treturn ciphertextStr, nil\n}", "title": "" }, { "docid": "99c9fad620a47c55d67cdcc763d6c463", "score": "0.6721815", "text": "func (c *DefaultCipher) Decrypt(src string) (string, error) {\n\treturn \"d: \" + src, nil\n}", "title": "" }, { "docid": "1729e4ad82c7ab9453b5f9ec7e61ba9b", "score": "0.67011565", "text": "func decrypt(encryptedString string) string {\n\n\t// validate we aren't passing in an already decrypted string!\n\tif !isFernetToken([]byte(encryptedString)) {\n\t\treturn encryptedString\n\t}\n\n\treturn string(fernet.VerifyAndDecrypt([]byte(encryptedString), 0, fernet.MustDecodeKeys(encoded_key)))\n}", "title": "" }, { "docid": "1c454a9ab6293ebf08707fbeefb9c83d", "score": "0.6681442", "text": "func decrypt(data, password, salt, iv []byte, keyBits, iterations int) ([]byte, error) {\n\tkey := deriveKey(password, salt, keyBits, iterations)\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(data)%aes.BlockSize != 0 {\n\t\treturn nil, errUnpaddedString\n\t}\n\tmode := cipher.NewCBCDecrypter(block, iv)\n\tmode.CryptBlocks(data, data)\n\treturn removePadding(data), nil\n}", "title": "" }, { "docid": "0a8f3dab4bbe2f0f9730c5576c7e6649", "score": "0.6655998", "text": "func Decrypt(cryptoText string) (string, bool) {\n\tciphertext, _ := base64.URLEncoding.DecodeString(cryptoText)\n\tkey, _ := hex.DecodeString(config.EncKey256())\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", false\n\t}\n\n\tif len(ciphertext) < aes.BlockSize {\n\t\tlogger.Error(\"Improper cipher text size.\")\n\t\treturn \"\", false\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\treturn fmt.Sprintf(\"%s\", ciphertext), true\n}", "title": "" }, { "docid": "a6c817024045a2c46f647259ca6a5804", "score": "0.6652883", "text": "func Decrypt(encrypted string, passphrase string) (decrypted []byte, err error) {\n\ts := strings.Split(encrypted, \".\")\n\tif len(s) != 3 {\n\t\terr = errors.New(\"incorrect decryption string\")\n\t\treturn\n\t}\n\tvar encryptedBytes, salt, iv []byte\n\tencryptedBytes, err = base64.URLEncoding.DecodeString(s[2])\n\tif err != nil {\n\t\treturn\n\t}\n\tsalt, err = base64.URLEncoding.DecodeString(s[1])\n\tif err != nil {\n\t\treturn\n\t}\n\tiv, err = base64.URLEncoding.DecodeString(s[0])\n\tif err != nil {\n\t\treturn\n\t}\n\tdecrypted, err = DecryptByte(encryptedBytes, []byte(passphrase), salt, iv)\n\treturn\n}", "title": "" }, { "docid": "d95f3352c3adc054b2e884b6b632d382", "score": "0.6590002", "text": "func Decrypt(encrypt string) string {\n\n\tencoded, _ := hex.DecodeString(encrypt)\n\tkeyText := \"astaxie12798akljzmknm.ahkjkljl;k\"\n\tc, err := aes.NewCipher([]byte(keyText))\n\tif err != nil {\n\t\tfmt.Printf(\"Error: NewCipher(%d bytes) = %s\", len(keyText), err)\n\t\tos.Exit(-1)\n\t}\n\tcfbdec := cipher.NewCFBDecrypter(c, commonIV)\n\tplaintextCopy := make([]byte, len(encoded))\n\tcfbdec.XORKeyStream(plaintextCopy, encoded)\n\n\treturn string(plaintextCopy)\n}", "title": "" }, { "docid": "3ce834aba6570408688eaaa5babb2260", "score": "0.65897924", "text": "func (sd aesECBSecureData) Decrypt(encryptedText string) (string, error) {\n\tif encryptedText == \"\" {\n\t\treturn encryptedText, nil\n\t}\n\tdecrypted, err := sd.decrypt([]byte(encryptedText))\n\treturn string(decrypted), err\n}", "title": "" }, { "docid": "160241ae55b7c2d01b3c8ca4bda36737", "score": "0.65893376", "text": "func decryptString(password []byte, ciphertext string) (plaintext string, err error) {\n\tcipherBytes, err := hex.DecodeString(ciphertext)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tplain, err := decrypt(password, cipherBytes)\n\tplaintext = string(plain)\n\treturn\n}", "title": "" }, { "docid": "3c4ff61af4ff86a2f635870bf61580a3", "score": "0.657443", "text": "func (b BuildModel) Decrypt(str string) string {\n\n\t// // TODO: should fix auto read from stream\n\t// encrypted, _ := hex.DecodeString(str)\n\t// bReader := bytes.NewReader(encrypted)\n\t// stream := cipher.NewOFB(b.block, b.iv)\n\t// reader := &cipher.StreamReader{S: stream, R: bReader}\n\n\t// buf := new(bytes.Buffer)\n\t// buf.ReadFrom(reader)\n\t// return buf.String()\n\n\t//------------------------- different method with CTR specific length\n\tencrypt, _ := hex.DecodeString(str)\n\tresult := make([]byte, b.length)\n\tstream := cipher.NewCTR(b.block, b.iv)\n\tstream.XORKeyStream(result, encrypt)\n\n\tresult = trimResult(result)\n\treturn string(result)\n\n}", "title": "" }, { "docid": "b695797e5d1ec1ec24a797e40d8a4e7a", "score": "0.657038", "text": "func Decrypt(str string) (string, error) {\n\tciphertext, err := base64.URLEncoding.DecodeString(str)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tblock, err := aes.NewCipher([]byte(key))\n\tif err != nil {\n\t\tg.Fatalf(\"%s:FATAL err %v\", tagCrypt, err)\n\t}\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tif len(ciphertext) < aes.BlockSize {\n\t\tpanic(\"ciphertext too short\")\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t// XORKeyStream can work in-place if the two arguments are the same.\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\treturn fmt.Sprintf(\"%s\", ciphertext), nil\n}", "title": "" }, { "docid": "a6df3c72dc02e3df324643a9604b8334", "score": "0.65613055", "text": "func (priv *PrivateKey) Decrypt(rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) {}", "title": "" }, { "docid": "5d6cfd4e3f0c331ed5d78fd2146605c4", "score": "0.6546986", "text": "func Decrypt(ciphertext []byte, secret []byte) (string, error) {\r\n\r\n\tciphertext = ciphertext[4:]\r\n\r\n\tif len(ciphertext) < aes.BlockSize {\r\n\t\treturn \"\", errors.New(\"ciphertext too short\")\r\n\t}\r\n\r\n\tiv := ciphertext[:aes.BlockSize]\r\n\tciphertext = ciphertext[aes.BlockSize:]\r\n\r\n\tif len(ciphertext)%aes.BlockSize != 0 {\r\n\t\treturn \"\", errors.New(\"ciphertext is not a multiple of the block size\")\r\n\t}\r\n\r\n\tkey := pbkdf2.Key(secret, iv, 2048, 32, sha256.New)\r\n\r\n\tblock, err := aes.NewCipher(key)\r\n\tif err != nil {\r\n\t\treturn \"\", err\r\n\t}\r\n\r\n\tmode := cipher.NewCBCDecrypter(block, iv)\r\n\tmode.CryptBlocks(ciphertext, ciphertext)\r\n\r\n\tunpadded, err := func(b []byte, blocksize int) ([]byte, error) {\r\n\r\n\t\tif len(b)%blocksize != 0 {\r\n\t\t\treturn nil, errors.New(\"Invalid PKCS7 padding size\")\r\n\t\t}\r\n\t\tc := b[len(b)-1]\r\n\t\tn := int(c)\r\n\t\tif n == 0 || n > len(b) {\r\n\t\t\treturn nil, errors.New(\"Invalid PKCS7 padding size\")\r\n\t\t}\r\n\t\tfor i := 0; i < n; i++ {\r\n\t\t\tif b[len(b)-n+i] != c {\r\n\t\t\t\treturn nil, errors.New(\"Invalid PKCS7 padding size\")\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn b[:len(b)-n], nil\r\n\t}(ciphertext, aes.BlockSize)\r\n\r\n\treturn string(unpadded), err\r\n\r\n}", "title": "" }, { "docid": "59becca4011eeceef0117190aa7ea282", "score": "0.6511497", "text": "func DecryptString(cipherKey string, message string) (retVal interface{}, err error) {\n\tblock, aesErr := aesCipher(cipherKey)\n\tif aesErr != nil {\n\t\treturn \"***decrypt error***\", fmt.Errorf(\"decrypt error aes cipher: %s\", aesErr)\n\t}\n\n\tvalue, decodeErr := base64.StdEncoding.DecodeString(message)\n\tif decodeErr != nil {\n\t\treturn \"***decrypt error***\", fmt.Errorf(\"decrypt error on decode: %s\", decodeErr)\n\t}\n\tdecrypter := cipher.NewCBCDecrypter(block, []byte(valIV))\n\t//to handle decryption errors\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tretVal, err = \"***decrypt error***\", fmt.Errorf(\"decrypt error: %s\", r)\n\t\t}\n\t}()\n\tdecrypted := make([]byte, len(value))\n\tdecrypter.CryptBlocks(decrypted, value)\n\treturn fmt.Sprintf(\"%s\", string(unpadPKCS7(decrypted))), nil\n}", "title": "" }, { "docid": "df5c9b03178130285e60118042d1bc8c", "score": "0.65095925", "text": "func decrypt(key, text []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(text) < aes.BlockSize {\n\t\treturn nil, fmt.Errorf(\"Encrypted secrets file is too short - possibly corrupted?\")\n\t}\n\tiv := text[:aes.BlockSize]\n\ttext = text[aes.BlockSize:]\n\tcfb := cipher.NewCFBDecrypter(block, iv)\n\tcfb.XORKeyStream(text, text)\n\tdata, err := base64.StdEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error decrypting secrets file - maybe your passphrase is wrong?\")\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "500508401371797dd5cd1e62732a3157", "score": "0.64790744", "text": "func (util *PasswordUtil) Decrypt(cryptoText string) string {\n\tciphertext, _ := base64.URLEncoding.DecodeString(cryptoText)\n\tkey := util.GetKey()\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tif len(ciphertext) < aes.BlockSize {\n\t\tpanic(\"ciphertext too short\")\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t// XORKeyStream can work in-place if the two arguments are the same.\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\treturn fmt.Sprintf(\"%s\", ciphertext)\n}", "title": "" }, { "docid": "c715a854a22c0e7bfd1ddd4611d9e81d", "score": "0.64718115", "text": "func Decrypt(cipherText []byte, privKey *rsa.PrivateKey) ([]byte, error) {\n\treturn rsa.DecryptOAEP(sha256.New(), rand.Reader, privKey, cipherText, nil)\n}", "title": "" }, { "docid": "5885e10b1cb1bdd8cc9ded3793779b76", "score": "0.6455208", "text": "func Decrypt(key []byte, ct []byte) (msg []byte, err error) {\n\tc, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Make sure we don't touch the original slice.\n\ttmp_ct := make([]byte, len(ct))\n\tcopy(tmp_ct, ct)\n\tiv := tmp_ct[:aes.BlockSize]\n\tif len(iv) != aes.BlockSize {\n\t\treturn msg, ErrInvalidIV\n\t}\n\tmsg = tmp_ct[aes.BlockSize:]\n\n\tcbc := cipher.NewCBCDecrypter(c, iv)\n\tcbc.CryptBlocks(msg, msg)\n\tmsg, err = UnpadBuffer(msg)\n\treturn\n}", "title": "" }, { "docid": "e66b68b820ae857ce223dbfb9d38e819", "score": "0.64551824", "text": "func decrypt(key []byte, cryptoText string) string {\n\tciphertext, _ := base64.URLEncoding.DecodeString(cryptoText)\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tif len(ciphertext) < aes.BlockSize {\n\t\tlog.Fatal(\"ciphertext too short\")\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t// XORKeyStream can work in-place if the two arguments are the same.\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\treturn fmt.Sprintf(\"%s\", ciphertext)\n}", "title": "" }, { "docid": "20e0504ca63070d33bfd9d0d317ee311", "score": "0.644459", "text": "func (c *cipher) Decryption(cipherText string) string {\r\n return c.cipherAlgorithm(cipherText, func(a, b int) int { return a - b })\r\n}", "title": "" }, { "docid": "9b8967531d33eeaf45059e606af16922", "score": "0.6432087", "text": "func Decrypt(password []byte, cipherText []byte) []byte {\n\n\tif len(cipherText)%aes.BlockSize != 0 {\n\t\tpanic(\"cipher text size must be multiple of block size\")\n\t}\n\n\tblock, err := aes.NewCipher(password)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tiv := cipherText[:aes.BlockSize]\n\n\tmode := cipher.NewCBCDecrypter(block, iv)\n\n\tdecryptedText := make([]byte, len(cipherText)-aes.BlockSize)\n\n\t//cipherText[aes.BlockSize:] vi bytes needn't to be decrypted\n\tmode.CryptBlocks(decryptedText, cipherText[aes.BlockSize:])\n\n\tunpadedData, err := pkcs7Unpad(decryptedText, aes.BlockSize)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn unpadedData\n}", "title": "" }, { "docid": "14446185114825832c60cedf981eccb6", "score": "0.6429738", "text": "func Decrypt(key []byte, cipherText []byte) (string, error) {\n\tif len(cipherText) < aes.BlockSize {\n\t\treturn \"\", exception.New(fmt.Sprintf(\"Cannot decrypt string: `cipherText` is smaller than AES block size (%v)\", aes.BlockSize))\n\t}\n\n\tiv := cipherText[:aes.BlockSize]\n\tcipherText = cipherText[aes.BlockSize:]\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcfb := cipher.NewCFBDecrypter(block, iv)\n\tcfb.XORKeyStream(cipherText, cipherText)\n\treturn string(cipherText), nil\n}", "title": "" }, { "docid": "d3d360c0472674e8edf7e3129145bd67", "score": "0.64222795", "text": "func (g *gRPCService) Decrypt(cipher []byte) ([]byte, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), g.callTimeout)\n\tdefer cancel()\n\n\trequest := &kmsapi.DecryptRequest{Cipher: cipher, Version: kmsapiVersion}\n\tresponse, err := g.kmsClient.Decrypt(ctx, request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn response.Plain, nil\n}", "title": "" }, { "docid": "c994431f8c80d6decbdb301320f37fb1", "score": "0.64134896", "text": "func Decrypt(encrypted string, passphrase string) (string) {\n\tct, _ := b64.StdEncoding.DecodeString(encrypted)\n\tif len(ct) < 16 || string(ct[:8]) != \"Salted__\" {\n\t\treturn \"\"\n\t}\n\n\tsalt := ct[8:16]\n\tct = ct[16:]\n\tkey, iv := __DeriveKeyAndIv(passphrase, string(salt))\n\n\tblock, err := aes.NewCipher([]byte(key))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcbc := cipher.NewCBCDecrypter(block, []byte(iv))\n\tdst := make([]byte, len(ct))\n\tcbc.CryptBlocks(dst, ct)\n\n\treturn string(__PKCS7Trimming(dst))\n}", "title": "" }, { "docid": "269035b4a65bfe1d688acf73317322f3", "score": "0.64025337", "text": "func decrypt(key []byte, cryptoText string) string {\n\tciphertext, _ := base64.URLEncoding.DecodeString(cryptoText)\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\terrors.New(\"Server Error\")\n\t}\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tif len(ciphertext) < aes.BlockSize {\n\t\terrors.New(\"ciphertext too short\")\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t// XORKeyStream can work in-place if the two arguments are the same.\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\treturn fmt.Sprintf(\"%s\", ciphertext)\n}", "title": "" }, { "docid": "16f51fb805fe8944b712eae5cbd54a7e", "score": "0.6394464", "text": "func (t *TestWrapper) Decrypt(_ context.Context, dwi *BlobInfo, opts ...Option) ([]byte, error) {\n\tswitch t.envelope {\n\tcase true:\n\t\tkeyPlaintext, err := t.obscureBytes(dwi.KeyInfo.WrappedKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tenvInfo := &EnvelopeInfo{\n\t\t\tKey: keyPlaintext,\n\t\t\tIv: dwi.Iv,\n\t\t\tCiphertext: dwi.Ciphertext,\n\t\t}\n\t\tplaintext, err := EnvelopeDecrypt(envInfo, nil)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error decrypting data with envelope: %w\", err)\n\t\t}\n\t\treturn plaintext, nil\n\tdefault:\n\n\t\treturn t.obscureBytes(dwi.Ciphertext)\n\t}\n}", "title": "" }, { "docid": "b0f309e87e93017e3df9f7f7ce77adf9", "score": "0.63835216", "text": "func AesDecrypt(encryptedStr, keyStr string) ([]byte, error) {\n\tkey, encrypted := []byte(keyStr), []byte(encryptedStr)\n\tblock := getBlock(key)\n\tif !block.success {\n\t\treturn nil, errors.New(block.errMsg)\n\t}\n\torigData := make([]byte, len(encrypted))\n\tblock.decryptor.CryptBlocks(origData, encrypted)\n\torigData = _PKCS5UnPadding(origData)\n\treturn origData, nil\n}", "title": "" }, { "docid": "cab066321e097dc975c57f55f40aa3d4", "score": "0.63674676", "text": "func (r *RemoteCrypto) Decrypt(cipher, aad, nonce []byte, keyURL interface{}) ([]byte, error) {\n\tstartDecrypt := time.Now()\n\tdestination := fmt.Sprintf(\"%s\", keyURL) + decryptURI\n\n\tdReq := decryptReq{\n\t\tCipherText: base64.URLEncoding.EncodeToString(cipher),\n\t\tNonce: base64.URLEncoding.EncodeToString(nonce),\n\t\tAdditionalData: base64.URLEncoding.EncodeToString(aad),\n\t}\n\n\thttpReqBytes, err := r.marshalFunc(dReq)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshal decryption request for Decrypt failed [%s, %w]\", destination, err)\n\t}\n\n\tresp, err := r.postHTTPRequest(destination, httpReqBytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"posting Decrypt ciphertext failed [%s, %w]\", destination, err)\n\t}\n\n\t// handle response\n\tdefer closeResponseBody(resp.Body, logger, \"Decrypt\")\n\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read decryption response for Decrypt failed [%s, %w]\", destination, err)\n\t}\n\n\thttpResp := &decryptResp{}\n\n\terr = r.unmarshalFunc(respBody, httpResp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal decryption for Decrypt failed [%s, %w]\", destination, err)\n\t}\n\n\tplaintTextBytes, err := base64.URLEncoding.DecodeString(httpResp.PlainText)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO switch to Debug once perf testing with remote server is done.\n\tlogger.Infof(\"overall Decrypt duration: %s\", time.Since(startDecrypt))\n\n\treturn plaintTextBytes, nil\n}", "title": "" }, { "docid": "9df557bbdd382f4f8d9a9d6e9503dbf7", "score": "0.63653773", "text": "func (ae *AESEncrypter) Decrypt(data []byte) []byte {\n\tret := make([]byte, len(data))\n\tmode := cipher.NewCBCDecrypter(ae.block, ae.encryptionIV)\n\tmode.CryptBlocks(ret, data)\n\treturn ret\n}", "title": "" }, { "docid": "ceea2f80aa0ed3e0ab296cbec661ee57", "score": "0.6363841", "text": "func Decrypt(value []byte) string {\n\tkey := deskey(vnckey, true)\n\treturn string(desfunc(value, key))\n}", "title": "" }, { "docid": "ed4f605213078e786636f6a6b4731a0f", "score": "0.63511956", "text": "func Decrypt(key, text string) (string, error) {\n\tkeyBytes := []byte(key)\n\ttextBytes, _ := hex.DecodeString(text)\n\tresponse, err := zboxutil.Decrypt(keyBytes, textBytes)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(response), nil\n}", "title": "" }, { "docid": "6787d2ec277003af388b07ec532c143a", "score": "0.6346974", "text": "func Decrypt(key int, message string) string {\n\n\tif key > 26 {\n\t\tkey = key % 26\n\t}\n\n\tvar (\n\t\tdecryptedMessage strings.Builder\n\t\tval int\n\t)\n\tdecryptedMessage.Grow(len(message))\n\n\tfor _, char := range message {\n\t\tasciiVal := int(char)\n\n\t\tif unicode.IsUpper(char) {\n\t\t\tval = (asciiVal+26-key-65)%26 + 65\n\t\t} else {\n\t\t\tval = (asciiVal+26-key-97)%26 + 97\n\t\t}\n\n\t\tfmt.Fprintf(&decryptedMessage, \"%c\", rune(val))\n\t}\n\n\tstr := decryptedMessage.String()\n\n\treturn str\n}", "title": "" }, { "docid": "8b2f04bf21c157ba0d20c2c3aec29d33", "score": "0.6340651", "text": "func Decrypt(cryptoText string) (*string, error) {\n\n\tkey := []byte(\"thisisa32byteslongencryptionkey!\")\n\tciphertext, _ := base64.URLEncoding.DecodeString(cryptoText)\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ciphertext) < aes.BlockSize {\n\t\tpanic(\"ciphertext too short\")\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\tresult := string(ciphertext)\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "4aff00e91112111ccf9a0146ccdac044", "score": "0.6319186", "text": "func (s *ServiceImpl) Decrypt(ctx context.Context, data []byte) ([]byte, error) {\n\treturn s.crypto.DecryptByte(data)\n}", "title": "" }, { "docid": "111f0f1143a617b8d5f6d98fff195f90", "score": "0.6298574", "text": "func (s *BcryptSuite) TestEncryptDecryptIncorrect() {\n\tservice := NewBcrypt()\n\n\tfor _, testPassword := range testingPasswords {\n\t\thash := service.Encrypt(testPassword)\n\t\tassert.NotEqual(s.T(), true, service.Validate(hash, wrongPassword))\n\t}\n\n}", "title": "" }, { "docid": "1237e6a086d9be179054b901111a151f", "score": "0.62975967", "text": "func (obj *encryption) Decrypt(encryptedText string) ([]byte, error) {\n\tcipherText, cipherTextErr := base64.StdEncoding.DecodeString(encryptedText)\n\tif cipherTextErr != nil {\n\t\treturn nil, cipherTextErr\n\t}\n\n\tblock, blockErr := aes.NewCipher(obj.hashedPass)\n\tif blockErr != nil {\n\t\treturn nil, blockErr\n\t}\n\n\tif len(cipherText) < aes.BlockSize {\n\t\treturn nil, errors.New(\"the encrypted text cannot be decoded using this password: ciphertext block size is too short\")\n\t}\n\n\t//IV needs to be unique, but doesn't have to be secure.\n\t//It's common to put it at the beginning of the ciphertext.\n\tiv := cipherText[:aes.BlockSize]\n\tcipherText = cipherText[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\tstream.XORKeyStream(cipherText, cipherText)\n\n\t// returns the decoded message:\n\treturn cipherText, nil\n}", "title": "" }, { "docid": "888e51cdea9cd8e67596b7687a493537", "score": "0.6293374", "text": "func decrypt(block cipher.Block, value []byte) ([]byte, error) {\n\tsize := block.BlockSize()\n\tif len(value) > size {\n\t\t// Extract iv.\n\t\tiv := value[:size]\n\t\t// Extract ciphertext.\n\t\tvalue = value[size:]\n\t\t// Decrypt it.\n\t\tstream := cipher.NewCTR(block, iv)\n\t\tstream.XORKeyStream(value, value)\n\t\treturn value, nil\n\t}\n\treturn nil, errDecryptionFailed\n}", "title": "" }, { "docid": "e3cc47b589a9d5ee24d746546c08b2f9", "score": "0.6287385", "text": "func (t *TinyEncryptionAlgorithm) Decrypt(dst, src []byte) {\n\tv0, v1 := binary.BigEndian.Uint32(src[0:4]), binary.BigEndian.Uint32(src[4:8])\n\n\tsum := delta << 5\n\tfor i := 0; i < 32; i++ {\n\t\tv1 -= ((v0 << 4) + t.k2) ^ (v0 + sum) ^ ((v0 >> 5) + t.k3)\n\t\tv0 -= ((v1 << 4) + t.k0) ^ (v1 + sum) ^ ((v1 >> 5) + t.k1)\n\t\tsum -= delta\n\t}\n\n\tbinary.BigEndian.PutUint32(dst, v0)\n\tbinary.BigEndian.PutUint32(dst[4:], v1)\n}", "title": "" }, { "docid": "0af1360f3c32228c7ffe13e0c7653a6c", "score": "0.62844276", "text": "func Decrypt(cipher string, key string) string {\n // Create another array of same length\n output := make([]rune, len(cipher))\n keyUpper := strings.ToUpper(key)\n keyLen := len(keyUpper)\n\n for index, charCode := range cipher {\n keyPtr := index % keyLen\n shift := int32(keyUpper[keyPtr]) - letterutil.UpperCaseA\n output[index] = letterutil.ShiftLetter(charCode, -shift)\n }\n\n return string(output)\n}", "title": "" }, { "docid": "12ffd1f39da42b049b26c94ee10424ba", "score": "0.62796324", "text": "func Decrypt(encryptedData string, key string) string {\n\tiv := []byte(encryptedData[32:48])\n\n\tencryptedByteData := []byte(encryptedData[48:])\n\n\tm := sha256.New()\n\tm.Write([]byte(key))\n\n\tsymmetricKey := m.Sum(nil)[:32]\n\tblock, err := aes.NewCipher(symmetricKey)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tmode := cipher.NewCBCDecrypter(block, iv)\n\n\tmode.CryptBlocks(encryptedByteData, encryptedByteData)\n\n\treturn string(encryptedByteData)\n}", "title": "" }, { "docid": "16b054626a8a2a61f70adcc7a26f858e", "score": "0.6271633", "text": "func (ae *AES) Decrypt(decryptText []byte, src []byte) ([]byte, error) {\n\tae.mutex.Lock()\n\tdefer ae.mutex.Unlock()\n\tsrclen := len(src) - ae.hdrlen\n\tif srclen%aes.BlockSize != 0 {\n\t\treturn nil, fmt.Errorf(\"AES Decrypt, invalid input length, %d % %d = %d(should be zero, nonce cut off)\", srclen, aes.BlockSize, srclen%aes.BlockSize)\n\t}\n\tif len(decryptText) < srclen {\n\t\tdecryptText = make([]byte, srclen)\n\t}\n\tdecryptText = decryptText[:srclen]\n\t// get nonce, no error handle\n\tae.nonce = binary.BigEndian.Uint64(src[:ae.hdrlen])\n\t// update nonce ae.deiv\n\tae.ivnonce(ae.nonce, false)\n\t//fmt.Printf(\"AES, Decrypt IV(%d): %x\\n\", ae.nonce, ae.deiv)\n\tae.blockDecrypt = cipher.NewCBCDecrypter(ae.block, ae.deiv)\n\tae.blockDecrypt.CryptBlocks(decryptText, src[ae.hdrlen:])\n\tvar err error\n\tdecryptText, err = ae.decryptUnPack(decryptText)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn decryptText, nil\n}", "title": "" }, { "docid": "43bca6774cfc60f3cc511c9947cdf5cc", "score": "0.6247576", "text": "func decrypt(text, key string) string {\n\tkeyLen := len(key)\n\tkeyPos := 0\n\tvar decrypted string\n\tfor _, c := range text {\n\t\tkeyChr := key[keyPos]\n\t\tnewChr := int(c)\n\t\tnewChr2 := string((newChr - int(keyChr)) % 255)\n\t\tdecrypted += newChr2\n\t\tkeyPos += 1\n\t\tkeyPos = keyPos % keyLen\n\t}\n\treturn decrypted\n}", "title": "" }, { "docid": "6b9cc4ee603dffbf9630bc1ce7d25c61", "score": "0.62383974", "text": "func TestDecryptSymmetricKeyAndEncryptedDataPacket(t *testing.T) {\n\tfor _, testCase := range keyAndIpePackets {\n\t\t// Key\n\t\tbuf := readerFromHex(testCase.packets)\n\t\tpacket, err := Read(buf)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to read SymmetricKeyEncrypted: %s\", err)\n\t\t}\n\t\tske, ok := packet.(*SymmetricKeyEncrypted)\n\t\tif !ok {\n\t\t\tt.Fatal(\"didn't find SymmetricKeyEncrypted packet\")\n\t\t}\n\t\t// Decrypt key\n\t\tkey, cipherFunc, err := ske.Decrypt([]byte(testCase.password))\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tpacket, err = Read(buf)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to read SymmetricallyEncrypted: %s\", err)\n\t\t}\n\t\t// Decrypt contents\n\t\tvar edp EncryptedDataPacket\n\t\tswitch packet.(type) {\n\t\tcase *SymmetricallyEncrypted:\n\t\t\tedp, _ = packet.(*SymmetricallyEncrypted)\n\t\tcase *AEADEncrypted:\n\t\t\tedp, _ = packet.(*AEADEncrypted)\n\t\tdefault:\n\t\t\tt.Fatal(\"no integrity protected packet\")\n\t\t}\n\t\tr, err := edp.Decrypt(cipherFunc, key)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tcontents, err := ioutil.ReadAll(r)\n\t\tif err != nil && err != io.EOF && err != io.ErrUnexpectedEOF {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\texpectedContents, _ := hex.DecodeString(testCase.contents)\n\t\tif !bytes.Equal(expectedContents, contents) {\n\t\t\tt.Errorf(\"bad contents got:%x want:%x\", contents, expectedContents)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2adca23ae3984e0c73a59f2b816d924d", "score": "0.62373567", "text": "func decrypt(value string) string {\n\tkmsClient := kms.New(session.New())\n\tdecodedBytes, err := base64.StdEncoding.DecodeString(value)\n\tif err != nil {\n\t\t\tpanic(err)\n\t}\n\tinput := &kms.DecryptInput{\n\t\t\tCiphertextBlob: decodedBytes,\n\t}\n\tresponse, err := kmsClient.Decrypt(input)\n\tif err != nil {\n\t\t\tpanic(err)\n\t}\n\t// Plaintext is a byte array, so convert to string\n\treturn string(response.Plaintext[:])\n}", "title": "" }, { "docid": "31b5c15d754189ff5cf5d8a4457ccde8", "score": "0.6235362", "text": "func Decrypt(data []byte, masterKey []byte) ([]byte, error) {\n\treturn cryptico.Decrypt(data, masterKey)\n}", "title": "" }, { "docid": "9c9086b78097f60cf7aee908b123583b", "score": "0.62318254", "text": "func Decrypt(key []byte, cryptoText string) string {\n ciphertext, _ := base64.URLEncoding.DecodeString(cryptoText)\n\n block, err := aes.NewCipher(key)\n if err != nil {\n panic(err)\n }\n\n // The IV needs to be unique, but not secure. Therefore it's common to\n // include it at the beginning of the ciphertext.\n if len(ciphertext) < aes.BlockSize {\n panic(\"ciphertext too short\")\n }\n iv := ciphertext[:aes.BlockSize]\n ciphertext = ciphertext[aes.BlockSize:]\n\n stream := cipher.NewCFBDecrypter(block, iv)\n\n // XORKeyStream can work in-place if the two arguments are the same.\n stream.XORKeyStream(ciphertext, ciphertext)\n\n return fmt.Sprintf(\"%s\", ciphertext)\n}", "title": "" }, { "docid": "7462b3b447046fb9aa783e47c3678e0e", "score": "0.6230055", "text": "func (c *Cipher) Decrypt(data []byte, passphrase []byte) ([]byte, error) {\n\treturn c.encrypt.Decrypt(data, passphrase)\n}", "title": "" }, { "docid": "e9b340110989a6ffd7176da9b2cacfd0", "score": "0.6222422", "text": "func ExampleCipher_Decrypt() {\n\t// Key and tweak should be byte arrays. Put your key and tweak here.\n\t// To make it easier for demo purposes, decode from a hex string here.\n\tkey, err := hex.DecodeString(\"2B7E151628AED2A6ABF7158809CF4F3C\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttweak, err := hex.DecodeString(\"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Create a new FF1 cipher \"object\"\n\t// 10 is the radix/base, and 8 is the tweak length.\n\tFF1, err := NewCipher(8, key, tweak)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tciphertext := []byte{24, 248, 199, 117, 158, 133, 225, 104, 8, 235, 62, 45}\n\n\tplaintext, err := FF1.Decrypt(ciphertext)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(string(plaintext))\n\t// Output: Hello, World\n}", "title": "" }, { "docid": "425ddb145ae45504ce2d04b57c3b3538", "score": "0.62098867", "text": "func testEncryptDecrypt(t *testing.T, bufSize int, copySize int64) {\n\tc, err := newCipher(NameEncryptionStandard, \"\", \"\", true, nil)\n\tassert.NoError(t, err)\n\tc.cryptoRand = &zeroes{} // zero out the nonce\n\tbuf := make([]byte, bufSize)\n\tsource := newRandomSource(copySize)\n\tencrypted, err := c.newEncrypter(source, nil)\n\tassert.NoError(t, err)\n\tdecrypted, err := c.newDecrypter(io.NopCloser(encrypted))\n\tassert.NoError(t, err)\n\tsink := newRandomSource(copySize)\n\tn, err := io.CopyBuffer(sink, decrypted, buf)\n\tassert.NoError(t, err)\n\tassert.Equal(t, copySize, n)\n\tblocks := copySize / blockSize\n\tif (copySize % blockSize) != 0 {\n\t\tblocks++\n\t}\n\tvar expectedNonce = nonce{byte(blocks), byte(blocks >> 8), byte(blocks >> 16), byte(blocks >> 32)}\n\tassert.Equal(t, expectedNonce, encrypted.nonce)\n\tassert.Equal(t, expectedNonce, decrypted.nonce)\n}", "title": "" }, { "docid": "27000da9e13357c804a004853f2197c9", "score": "0.6205841", "text": "func Decrypt(key []byte, cryptoText string) string {\n ciphertext, err := base64.StdEncoding.DecodeString(cryptoText)\n if err != nil {\n panic(err)\n }\n \n block, err := aes.NewCipher(key)\n if err != nil {\n panic(err)\n }\n \n // The IV needs to be unique, but not secure. Therefore it's common to\n // include it at the beginning of the ciphertext.\n if len(ciphertext) < aes.BlockSize {\n panic(\"ciphertext too short\")\n }\n iv := ciphertext[:aes.BlockSize]\n ciphertext = ciphertext[aes.BlockSize:]\n stream := cipher.NewCFBDecrypter(block, iv)\n \n // XORKeyStream can work in-place if the two arguments are the same.\n stream.XORKeyStream(ciphertext, ciphertext)\n return fmt.Sprintf(\"%s\", ciphertext)\n}", "title": "" }, { "docid": "58ae02c39da8e761cdf62d4d71d98510", "score": "0.6202656", "text": "func (a AESCrypto) Decrypt(key, ciphertext []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ciphertext) < aes.BlockSize {\n\t\treturn nil, errors.New(\"ciphertext is incorrect length\")\n\t}\n\n\t// Define the slice for the initialisation vector from the ciphertext\n\tivector := ciphertext[:aes.BlockSize]\n\t// And the same for the encrypted text\n\ttext := ciphertext[aes.BlockSize:]\n\n\t// Decrypt the ciphertext with cipher feedback mode\n\tcfb := cipher.NewCFBDecrypter(block, ivector)\n\tcfb.XORKeyStream(text, text)\n\n\tplaintext, err := base64.StdEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "cc0dee8fb995648d49fff8827b199958", "score": "0.62016237", "text": "func (c *Cipher) Decrypt(dst, src []byte) {\n\tif len(src) < blockSize {\n\t\tpanic(\"kuznyechik: input not full block\")\n\t}\n\tif len(dst) < blockSize {\n\t\tpanic(\"kuznyechik: output not full block\")\n\t}\n\tc.doDecrypt(dst, src)\n}", "title": "" }, { "docid": "9c45dbb86e9fca0555cc3478a38f32ec", "score": "0.61965793", "text": "func (c *Codec) Decrypt(ciphertext []byte) ([]byte, error) {\n\treturn c.DecryptBehavior(ciphertext)\n}", "title": "" }, { "docid": "17dd64caacf82e1589957505efda2739", "score": "0.6196472", "text": "func Decrypt(url string, sample string, options *ExploitOptions) ([]byte, error) {\n\treturn newExploiter(url, sample, options).decrypt()\n}", "title": "" }, { "docid": "f665f75cc31c9915d29356a88a774cfb", "score": "0.61920863", "text": "func (m *MockEncryptionService) Decrypt(creds agent.Credentials) (agent.Credentials, error) {\n\tret := m.ctrl.Call(m, \"Decrypt\", creds)\n\tret0, _ := ret[0].(agent.Credentials)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "268c5dbc26e9fa609f91f1056ad20602", "score": "0.61915195", "text": "func decrypt(b []byte) (string, error) {\n\n\tmsg := fmt.Sprintf(\"%s\", string(b))\n\ts := strings.Replace(msg, \"\\n\", \"\", -1)\n\targs := []string{\"decrypt\", \"-m\", s}\n\tout, err := exec.Command(\"keybase\", args...).Output()\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(out), nil\n}", "title": "" }, { "docid": "14d6aa14cf5d1c1b47fb53d51995fec0", "score": "0.61907643", "text": "func Decrypt(key, text []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(text) < aes.BlockSize {\n\t\treturn nil, errors.New(\"ciphertext too short\")\n\t}\n\n\tiv := text[:aes.BlockSize]\n\ttext = text[aes.BlockSize:]\n\tcfb := cipher.NewCFBDecrypter(block, iv)\n\tcfb.XORKeyStream(text, text)\n\tdata, err := base64.StdEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "fd3764b7d8e4ab1c2f16c05def64f15d", "score": "0.618555", "text": "func (s *BcryptSuite) TestEncryptDecryptCorrect() {\n\tservice := NewBcrypt()\n\n\tfor _, testPassword := range testingPasswords {\n\t\thash := service.Encrypt(testPassword)\n\t\tassert.Equal(s.T(), true, service.Validate(hash, testPassword))\n\t}\n\n}", "title": "" }, { "docid": "1cbe49775fa2f512dc9200636fab758d", "score": "0.6169049", "text": "func decrypt(password []byte, toDecrypt []byte) []byte {\n\tkey := createSha2(password)\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif len(toDecrypt) < aes.BlockSize {\n\t\tpanic(\"Somehow the ciphertext is too short\")\n\t}\n\tiv := toDecrypt[:aes.BlockSize]\n\tciphertext := toDecrypt[aes.BlockSize:]\n\tcfb := cipher.NewCFBDecrypter(block, iv)\n\n\tdecoded := make([]byte, len(ciphertext))\n\tcfb.XORKeyStream(decoded, ciphertext)\n\n\treturn decoded\n}", "title": "" }, { "docid": "8f8a4d77aa7ea27490f7c3a6c0106678", "score": "0.61685866", "text": "func (constr Construction) Decrypt(_, _ []byte) {}", "title": "" }, { "docid": "108bca3a420b1152af05d135911ecb2f", "score": "0.6166998", "text": "func (c *TerraformAesStateCipher) Decrypt(ciphertext string) (string, error) {\n\t// Extract the iv from the ciphertext's first block\n\tiv := []byte(ciphertext[:aes.BlockSize])\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tb := []byte(ciphertext)\n\tcfb := cipher.NewCFBDecrypter(c.cipherBlock, iv)\n\tcfb.XORKeyStream(b, b)\n\n\t// Unpad the decrypted text\n\tunpadded, err := c.unpad(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(unpadded), nil\n}", "title": "" }, { "docid": "2d68b0e6006285440610ab85b010c736", "score": "0.61653084", "text": "func (c *Cipher) doDecrypt(dst, src []byte) {\n\thigh := binary.BigEndian.Uint64(src[0:8])\n\tlow := binary.BigEndian.Uint64(src[8:16])\n\n\thigh, low = inverseL(high, low)\n\t_ = c.decryptRoundKeys[numRounds-1]\n\tfor index := numRounds - 1; index > 1; index-- {\n\t\thigh ^= c.decryptRoundKeys[index][0]\n\t\tlow ^= c.decryptRoundKeys[index][1]\n\t\thigh, low = inverseSL(high, low)\n\t}\n\thigh ^= c.decryptRoundKeys[1][0]\n\tlow ^= c.decryptRoundKeys[1][1]\n\thigh, low = inverseS(high, low)\n\thigh ^= c.decryptRoundKeys[0][0]\n\tlow ^= c.decryptRoundKeys[0][1]\n\n\tbinary.BigEndian.PutUint64(dst[0:8], high)\n\tbinary.BigEndian.PutUint64(dst[8:16], low)\n}", "title": "" }, { "docid": "01d3bcb1dc6e86369d7c41399021002c", "score": "0.6151447", "text": "func doTestCleanup() {\n\t_decryptFunc = DecryptKeyTextByKMS\n}", "title": "" }, { "docid": "4382b910bbd5cd2fda87f66ee3c7d59d", "score": "0.6147514", "text": "func (t *tea) Decrypt(dst, src []byte) {\n\te := binary.BigEndian\n\tv0, v1 := e.Uint32(src), e.Uint32(src[4:])\n\tk0, k1, k2, k3 := e.Uint32(t.key[0:]), e.Uint32(t.key[4:]), e.Uint32(t.key[8:]), e.Uint32(t.key[12:])\n\n\tdelta := uint32(delta)\n\tsum := delta * uint32(t.rounds/2) // in general, sum = delta * n\n\n\tfor i := 0; i < t.rounds/2; i++ {\n\t\tv1 -= ((v0 << 4) + k2) ^ (v0 + sum) ^ ((v0 >> 5) + k3)\n\t\tv0 -= ((v1 << 4) + k0) ^ (v1 + sum) ^ ((v1 >> 5) + k1)\n\t\tsum -= delta\n\t}\n\n\te.PutUint32(dst, v0)\n\te.PutUint32(dst[4:], v1)\n}", "title": "" }, { "docid": "8575755ab47b2e9e80cfd65d789253ec", "score": "0.6138048", "text": "func Decrypt(cipher string, shift int32) string {\n\t// Create another array of same length\n\toutput := make([]rune, len(cipher))\n\n\tfor index, charCode := range cipher {\n\t\toutput[index] = letterutil.ShiftLetter(charCode, -shift)\n\t}\n\n\treturn string(output)\n}", "title": "" }, { "docid": "072672cbf76f89b4168dde6321c5cc1a", "score": "0.61367893", "text": "func Decrypt(password string, data []byte) ([]byte, error) {\n\treturn new(avault.Vault).Decrypt(password, data)\n}", "title": "" }, { "docid": "826462bb6f764a8f53db8104dc8f5f60", "score": "0.61266065", "text": "func EncryptDecrypt(input string) (output string) {\n\tkey := xorKey\n\tfor i := 0; i < len(input); i++ {\n\t\toutput += string(input[i] ^ key[i%len(key)])\n\t}\n\n\treturn output\n}", "title": "" }, { "docid": "fde63192437ecba783d265c99a7e0d72", "score": "0.6121567", "text": "func (r *EDData) Decrypt(ct string) (cs string, e error) {\n\tif !utf8.ValidString(ct) {\n\t\tc := 0\n\t\tsize := 0\n\t\tfor i := 0; i < len(ct); i += size {\n\t\t\tr, size := utf8.DecodeRuneInString(ct)\n\t\t\tif r == utf8.RuneError {\n\t\t\t\treturn \"\", fmt.Errorf(\n\t\t\t\t\t\"ciphertext has invalid UTF8 at offset: %d, hex value: 0x%X\",\n\t\t\t\t\tc, ct[i:i+1])\n\t\t\t}\n\t\t\tct = ct[size:]\n\t\t\tc++\n\t\t}\n\t}\n\trr := make([]rune, 0)\n\tter := []rune(ct)\n\tfor _, v := range ter {\n\t\tuv, ok := r.dm[v]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\trr = append(rr, uv)\n\t}\n\treturn string(rr), nil\n}", "title": "" }, { "docid": "97439200620563ad03bb2e0d7c8705c8", "score": "0.6118041", "text": "func decrypt(buf []byte) string {\n\tkey := byte(171)\n\tresult := make([]byte, len(buf))\n\tfor i, b := range buf {\n\t\tresult[i] = key ^ b\n\t\tkey = b\n\t}\n\treturn string(result)\n}", "title": "" }, { "docid": "4101321479eecae681c551fbe7cab37b", "score": "0.61152095", "text": "func Decrypt(encryptd []byte, decrypter Decrypter) ([]byte, error) {\n\tif decrypter == nil {\n\t\treturn nil, ErrCannotDecrypt{msg: \"no decrypter specified\"}\n\t}\n\tr := api.MaybeEncryptedRecord{}\n\tif err := proto.Unmarshal(encryptd, &r); err != nil {\n\t\t// nope, this wasn't marshalled as a MaybeEncryptedRecord\n\t\treturn nil, ErrCannotDecrypt{msg: \"unable to unmarshal as MaybeEncryptedRecord\"}\n\t}\n\tplaintext, err := decrypter.Decrypt(r)\n\tif err != nil {\n\t\treturn nil, ErrCannotDecrypt{msg: err.Error()}\n\t}\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "a6702937d73a2d55ef436fb3e3fb916b", "score": "0.6100602", "text": "func (sd aesECBSecureData) decrypt(ciphertext []byte) ([]byte, error) {\n\tcipher, err := aes.NewCipher(sd.key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ciphertext)%aes.BlockSize != 0 {\n\t\treturn nil, ErrInvalidAlgorithm\n\t}\n\n\tdecryptedFull := make([]byte, len(ciphertext))\n\n\tfor bs, be := 0, aes.BlockSize; bs < len(ciphertext); bs, be = bs+aes.BlockSize, be+aes.BlockSize {\n\t\tcipher.Decrypt(decryptedFull[bs:be], ciphertext[bs:be])\n\t}\n\n\tpadLen := int(decryptedFull[len(decryptedFull)-1])\n\n\tif padLen > len(decryptedFull) {\n\t\treturn nil, ErrInvalidAlgorithm\n\t}\n\n\tdecryptedLen := len(decryptedFull) - padLen\n\tdecripted := make([]byte, decryptedLen)\n\n\tcopy(decripted, decryptedFull[:decryptedLen])\n\n\treturn decripted, nil\n}", "title": "" }, { "docid": "2fc501773154dadf98162418aede387d", "score": "0.60666925", "text": "func Decrypt(cmd *Command) ([]string, error) {\n\treturn nil, api.DecryptFile(*cmd.InFile, *cmd.OutFile, cmd.Conf)\n}", "title": "" }, { "docid": "1ec1a24aec365d327bb9874d05ae55f3", "score": "0.60645175", "text": "func (s *Substitution) Decrypt(ct string) string {\n\tbs, _ := upperOnly(ct)\n\tr := reverseMap(s.key)\n\tfor i, b := range bs {\n\t\tbs[i] = r[b]\n\t}\n\treturn string(bs)\n}", "title": "" }, { "docid": "95a6811d0f5ffdaee26c83aa30d1f4a6", "score": "0.60630804", "text": "func (_m *IKMSService) Decrypt(cipherTextBlob []byte, encryptionContext map[string]*string) ([]byte, error) {\n\tret := _m.Called(cipherTextBlob, encryptionContext)\n\n\tvar r0 []byte\n\tif rf, ok := ret.Get(0).(func([]byte, map[string]*string) []byte); ok {\n\t\tr0 = rf(cipherTextBlob, encryptionContext)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]byte)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func([]byte, map[string]*string) error); ok {\n\t\tr1 = rf(cipherTextBlob, encryptionContext)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "8ece67ce5581e81a9caa8f7a1c6cfe97", "score": "0.6060161", "text": "func doDecrypt(ctx context.Context, data string) ([]byte, error) {\n\tvaultsClient, vaultBaseURL, keyName, keyVersion, err := getKeysClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparameter := kv.KeyOperationsParameters {\n\t\tAlgorithm: kv.RSA15,\n\t\tValue: &data,\n\t}\n\t\n\tresult, err := vaultsClient.Decrypt(vaultBaseURL, keyName, keyVersion, parameter)\n\tif err != nil {\n\t\tfmt.Print(\"failed to decrypt, error: %v\", err)\n\t\treturn nil, err\n\t}\n\tbytes, err := base64.RawURLEncoding.DecodeString(*result.Result)\n\treturn bytes, nil\n}", "title": "" }, { "docid": "31333f5423ed38ed0a739ccaaad55ad3", "score": "0.605734", "text": "func Decrypt(bytes []byte, encryptionKey []byte) ([]byte, error) {\n\tif (len(bytes) % aes.BlockSize) != 0 {\n\t\treturn nil, errp.New(\"The length of the encrypted bytes has to match the AES block size.\")\n\t}\n\n\tblock, err := aes.NewCipher(encryptionKey)\n\tif err != nil {\n\t\treturn nil, errp.WithStack(err)\n\t}\n\n\tiv := bytes[:aes.BlockSize]\n\tdecryptedBytes := bytes[aes.BlockSize:]\n\tcipher.NewCBCDecrypter(block, iv).CryptBlocks(decryptedBytes, decryptedBytes)\n\treturn unpad(decryptedBytes)\n}", "title": "" }, { "docid": "585b756a0dc6024bf10f7e8e0e91b2de", "score": "0.6042479", "text": "func CBCDecrypt(src, key, iv []byte, p padding.Padding) ([]byte, error) {\n\tif len(src) < ides.BlockSize || len(src)%ides.BlockSize != 0 {\n\t\treturn nil, ErrDesSrcSize\n\t}\n\tif len(iv) != ides.BlockSize {\n\t\treturn nil, ErrDesIVSize\n\t}\n\tblock, err := ides.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmode := icipher.NewCBCDecrypter(block, iv)\n\tdecryptText := make([]byte, len(src))\n\tmode.CryptBlocks(decryptText, src)\n\tif p == nil {\n\t\treturn decryptText, nil\n\t} else {\n\t\treturn p.Unpadding(decryptText, ides.BlockSize)\n\t}\n}", "title": "" }, { "docid": "2b317bb75c8ab5c5b3e36d2127827556", "score": "0.6037538", "text": "func (me *Aes) Decrypt(src []byte) []byte {\n\tif len(src)%me.dec.BlockSize() != 0 {\n\t\tsrc = me.padSlice(src)\n\t}\n\tdst := make([]byte, len(src))\n\tme.dec.CryptBlocks(dst, src)\n\treturn dst\n}", "title": "" }, { "docid": "12f67c98759ca0b8fd5fc6aa0dde5bc0", "score": "0.6036713", "text": "func decrypt(file string) string {\n\tfileContents, _ := ioutil.ReadFile(file)\n\tdecrypted, _ := decryptString(string(fileContents), RuntimeArgs.Passphrase)\n\treturn decrypted\n}", "title": "" }, { "docid": "8134cc555e26eb3cd48b39df20161e37", "score": "0.6030585", "text": "func (ch *CryptoHandler) DecryptString(encryptedText string) (string, error) {\n\tciphertext, err := base64.URLEncoding.DecodeString(encryptedText)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\n\tblock, err := aes.NewCipher([]byte(ch.SecretKey))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\treturn fmt.Sprintf(\"%s\", ciphertext), nil\n}", "title": "" }, { "docid": "baded919ffbdb47cde8f5981df9678c6", "score": "0.60296917", "text": "func Decrypt(s string) (string, error) {\n\tdecodeString, err := hex.DecodeString(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\taesgcm, err := _createCipher()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tnonceSize := aesgcm.NonceSize()\n\tif len(decodeString) < nonceSize {\n\t\treturn \"\", errors.New(\"nonce size > parameter size\")\n\t}\n\n\tnonce, ciphertext := decodeString[:nonceSize], decodeString[nonceSize:]\n\tplaintext, err := aesgcm.Open(nil, nonce, ciphertext, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(plaintext), nil\n}", "title": "" }, { "docid": "edd40e1a7a87ebc2d05a1e5d04257265", "score": "0.6025799", "text": "func DoTest(ctx context.Context) {\n\trawssn := \"012-34-5678\" // likely the way people will enter it\n\tssn := rlib.Stripchars(rawssn, \"- .\") // remove everything except the digits\n\tencssn, err := rlib.Encrypt(ssn) // simple encryption that will be used on the db\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\tos.Exit(1)\n\t}\n\tdecssn, err := rlib.Decrypt(encssn) // decrypted as the db routines would do after pulling from db\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\tos.Exit(1)\n\t}\n\t// We do not print the encssn, it is different every time, even with the same input string and key\n\tfmt.Printf(\"raw ssn: %s\\n\", rawssn)\n\tif App.Verbose {\n\t\tfmt.Printf(\"ciphertext: %x\\n\", encssn)\n\t}\n\tfmt.Printf(\"ssn: %s\\n\", ssn)\n\tfmt.Printf(\"decrypted ssn: %s\\n\", decssn)\n\n\t// Here are some pre-saved encrypted sstrings that should all decode to the same thing...\n\tciphers := []string{\n\t\t\"fae8d6d0fb6c7cc07e83320b9365f39d010df23cee8c72903c80e8ae9b6a71d7d93911eed6\",\n\t\t\"491657366c81500837275ba11b31ec0443da7dc0760448070633d04c17c7916ff76702c726\",\n\t\t\"00798a295c2f4b544fd3e8a244165edb8af5d2bc1593d7167b87e8b3a7bab748648da79210\",\n\t\t\"5b67481ca0edc40b07a8fb74e284710da988eabd6e8215fe00e53efddb6217562e07458055\",\n\t\t\"e513e0e59baaf52647a4f30bbd069a500948a8ce6bf2e968efbb661e342819ee6cb66e848b\",\n\t\t\"5e526cb389650e7a4edf0c0349130e33e5d4c4a94f7a22f7312f79cbbe8bd4f0c80cfa4e2b\",\n\t\t\"fae8d6d0fb6c7cc07e83320b9365f39d010df23cee8c72903c80e8ae9b6a71d7d93911eed6\",\n\t\t\"4fe875cd81267c0f2cd1754f295a95ea2b341c3c66e25f865f9297ac963a562b82cbefac81\",\n\t}\n\n\tfor i := 0; i < len(ciphers); i++ {\n\t\tfmt.Printf(\"presaved chars: %s\\n\", ciphers[i])\n\t\tb, err := hex.DecodeString(ciphers[i])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfmt.Printf(\"decoded hexbytes: %x\\n\", b)\n\t\tdssn, err := rlib.Decrypt(b)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfmt.Printf(\"decrypted: %s\\n\", dssn)\n\n\t}\n}", "title": "" }, { "docid": "456e46994cf72e39fd0c130bee97685b", "score": "0.6024578", "text": "func (env *Env) Decrypt(encData []byte) ([]byte, error) {\n\tif len(encData) < env.aead.NonceSize() {\n\t\treturn nil, errors.New(\"invalid ciphertext\")\n\t}\n\n\treturn env.aead.Open(nil, encData[:env.aead.NonceSize()], encData[env.aead.NonceSize():], nil)\n}", "title": "" }, { "docid": "cff6b51289cbb1a737b450fd11bda5e4", "score": "0.60215056", "text": "func DecryptAES_ECB(cipherTextBytes, keyBytes []byte) (string, error) {\n\n\tcipherTextLen := len(cipherTextBytes)\n\tmod := cipherTextLen % BlockSize\n\n\tif mod != 0 {\n\t\tpanic(\"ciphertext is not a multiple of the block size\")\n\t}\n\n\tblock, err := aes.NewCipher(keyBytes)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tnumBlocks := cipherTextLen / BlockSize\n\n\tblockBytes := make([]byte, BlockSize)\n\tvar buffer bytes.Buffer\n\n\tfor i := 0; i < numBlocks; i++ {\n\t\tblock.Decrypt(blockBytes, cipherTextBytes)\n\t\tbuffer.Write(blockBytes)\n\t\tcipherTextBytes = cipherTextBytes[BlockSize:]\n\t}\n\n\tdecrypedData := buffer.Bytes()\n\tif IsPkcs7(decrypedData, BlockSize) {\n\t\tdecrypedData = Unpad_Pkcs7(decrypedData, BlockSize)\n\t}\n\n\ttext := secutils.BytesToASCIIString(decrypedData)\n\treturn text, nil\n}", "title": "" }, { "docid": "e6d0121fddaa83f9d77ea366ae79bd73", "score": "0.6016148", "text": "func TestExtractPassword_decrypted_pwd(t *testing.T) {\r\n\r\n\tprivateKey, err := ssh.ParseRawPrivateKey([]byte(`\r\n-----BEGIN RSA PRIVATE KEY-----\r\nMIIEpQIBAAKCAQEAo1ODZgwMVdTJYim9UYuYhowoPMhGEuV5IRZjcJ315r7RBSC+\r\nyEiBb1V+jhf+P8fzAyU35lkBzZGDr7E3jxSesbOuYT8cItQS4ErUnI1LGuqvMxwv\r\nX3GMyE/HmOcaiODF1XZN3Ur5pMJdVknnmczgUsW0hT98Udrh3MQn9WSuh/6LRy6+\r\nx1QsKHOCLFPnkhWa3LKyxmpQq/Gvhz+6NLe+gt8MFullA5mKQxBJ/K6laVHeaMlw\r\nJG3GCX0EZhRlvzoV8koIBKZtbKFolFr8ZtxBm3R5LvnyrtOvp22sa+xeItUT5kG1\r\nZnbGNdK87oYW+VigEUfzT/+8R1i6E2QIXoeZiQIDAQABAoIBAQCVZ70IqbbTAW8j\r\nRAlyQh/J3Qal65LmkFJJKUDX8TfT1/Q/G6BKeMEmxm+Zrmsfj1pHI1HKftt+YEG1\r\ng4jOc09kQXkgbmnfll6aHPn3J+1vdwXD3GGdjrL5PrnYrngAhJWU2r8J0x8hT8ew\r\nOrUJZXhDX6XuSpAAFRmOKUZgXbSmo4X+LZX76ACnarselJt5FL724ECvpWJ7xxC4\r\nFMzvp4RqMmNFvv/Uq9lE/EmoSk4dviYyIZZ16DbDNyc9k/sGqCAMktCEwZ3EQm//\r\nS5bkNhgP6oUXjluWy53aPRgykEylgDWo5SSdSEyKnw/fciU0xdprA9JrBGIcTyHS\r\n/k2kgD4xAoGBANTkJ88Q0YrxX3fZNZVqcn00XKTxPGmxN5LRs7eV743q30AxK5Db\r\nQU8iwaAA1IKUWV5DLhgUTNsDCOPUPue4aOSBD3/sj+WEmvIhj7afDL5didkYHsqf\r\nfDnhFHq7y/3i57d428C7BwwR79pGWVyi7vH3pfu9A1iwl1aNOae+zvbVAoGBAMRm\r\nAmwQ9fJ3Qc44jysFK/yliLRGdShjkMMah5G3JlrelwfPtwPwEL2EHHhJB/C1acMs\r\nn6Q6RaoF6WNSZUY65ksQg7aPOYf2X0FTFwQJvwDJ4qlWjmq7w+tQ0AoGJG+dVUmQ\r\nzHZ/Y+HokSXzz9c4oevk4v/rMgAQ00WHrTdtIhnlAoGBALIJJ72D7CkNGHCq5qPQ\r\nxHQukPejgolFGhufYXM7YX3GmPMe67cVlTVv9Isxhoa5N0+cUPT0LR3PGOUm/4Bb\r\neOT3hZXOqLwhvE6XgI8Rzd95bClwgXekDoh80dqeKMdmta961BQGlKskaPiacmsF\r\nG1yhZV70P9Mwwy8vpbLB4GUNAoGAbTwbjsWkNfa0qCF3J8NZoszjCvnBQfSW2J1R\r\n1+8ZKyNwt0yFi3Ajr3TibNiZzPzp1T9lj29FvfpJxA9Y+sXZvthxmcFxizix5GB1\r\nha5yCNtA8VSOI7lJkAFDpL+j1lyYyjD6N9JE2KqEyKoh6J+8F7sXsqW7CqRRDfQX\r\nmKNfey0CgYEAxcEoNoADN2hRl7qY9rbQfVvQb3RkoQkdHhl9gpLFCcV32IP8R4xg\r\n09NbQK5OmgcIuZhLVNzTmUHJbabEGeXqIFIV0DsqECAt3WzbDyKQO23VJysFD46c\r\nKSde3I0ybDz7iS2EtceKB7m4C0slYd+oBkm4efuF00rCOKDwpFq45m0=\r\n-----END RSA PRIVATE KEY-----\r\n`))\r\n\tif err != nil {\r\n\t\tt.Fatalf(\"Error parsing private key: %s\\n\", err)\r\n\t}\r\n\r\n\tvar dejson interface{}\r\n\tsejson := []byte(`{\"password\":\"PP8EnwPO9DhEc8+O/6CKAkPF379mKsUsfFY6yyw0734XXvKsSdV9KbiHQ2hrBvzeZxtGMrlFaikVunCRizyLLWLMuOi4hoH+qy9F9sQid61gQIGkxwDAt85d/7Eau2/KzorFnZhgxArl7IiqJ67X6xjKkR3zur+Yp3V/mtVIehpPYIaAvPbcp2t4mQXl1I9J8yrQfEZOctLL1L4heDEVXnxvNihVLK6pivlVggp6SZCtjj9cduZGrYGsxsOCso1dqJQr7GCojfwvuLOoG0OYwEGuWVTZppxWxi/q1QgeHFhGKA5QUXlz7pS71oqpjYsTeViuHnfvlqb5TVYZpQ1haw==\"}`)\r\n\r\n\terr = json.Unmarshal(sejson, &dejson)\r\n\tfmt.Printf(\"%v\\n\", dejson)\r\n\tif err != nil {\r\n\t\tt.Fatalf(\"%s\", err)\r\n\t}\r\n\tresp := servers.GetPasswordResult{Result: gophercloud.Result{Body: dejson}}\r\n\r\n\tpwd, err := resp.ExtractPassword(privateKey.(*rsa.PrivateKey))\r\n\tth.AssertNoErr(t, err)\r\n\tth.AssertEquals(t, \"ruZKK0tqxRfYm5t7lSJq\", pwd)\r\n}", "title": "" }, { "docid": "2012e57c6466a3d527d934b991f0da6b", "score": "0.60130656", "text": "func (c *AES256Cipher) Decrypt(data []byte, password []byte) ([]byte, error) {\n\tsalt := data[len(data)-defaultSaltSize:]\n\n\tkey := pbkdf2.Key(password, salt, 4096, 32, sha256.New)\n\n\tblockCipher, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"creating block cipher\")\n\t}\n\n\tmodeCipher, err := cipher.NewGCM(blockCipher)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"creating block mode cipher\")\n\t}\n\n\tif len(data) < modeCipher.NonceSize() {\n\t\treturn nil, errors.New(\"malformed ciphertext\")\n\t}\n\n\tplaintext, err := modeCipher.Open(nil, data[:modeCipher.NonceSize()], data[modeCipher.NonceSize():len(data)-defaultSaltSize], nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"decrypting data\")\n\t}\n\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "0b1519a851df83e31012fa6fb11f73ef", "score": "0.60089624", "text": "func Decrypt(data []byte, key []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Decrypt cipher allocation: %v\", err)\n\t}\n\n\tif len(data) < aes.BlockSize {\n\t\treturn nil, fmt.Errorf(\"Decrypt: too small ciphertext, no space for the initial vector\")\n\t}\n\n\tiv := data[:aes.BlockSize]\n\ttext := data[aes.BlockSize:]\n\tcfb := cipher.NewCFBDecrypter(block, iv)\n\n\tdestination := make([]byte, len(data)-aes.BlockSize)\n\tcfb.XORKeyStream(destination, text)\n\n\treturn destination, nil\n}", "title": "" }, { "docid": "168bd9d5f398e4009e1b64a4e9545680", "score": "0.60082626", "text": "func (c *Cipher) Decrypt(key, ciphertext []byte) ([]byte, error) {\n\treturn Decrypt(key, ciphertext)\n}", "title": "" }, { "docid": "c399a66706bc65f9c82a1ef95ddcef22", "score": "0.6000001", "text": "func (s *AuthInfoStore) decodeAndDecrypt(str string) (string, error) {\n\t// Bail out if empty string since it'll cause a segfault in Decrypt\n\tif str == \"\" {\n\t\treturn \"\", nil\n\t}\n\tdecoded, err := base64.StdEncoding.DecodeString(str)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdecrypted, err := s.secretsService.Decrypt(context.Background(), decoded)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(decrypted), nil\n}", "title": "" }, { "docid": "ab751384adb6d34fa4ce7a6a1e292991", "score": "0.59852123", "text": "func DecryptCipher(cryptoText string) string {\n\tqrKey := \"*.$pyCh4773r_MX*.S3cr3t_QR_k3y!.\"\n\tkey := []byte(qrKey)\n\n\tciphertext, _ := base64.URLEncoding.DecodeString(cryptoText)\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tif len(ciphertext) < aes.BlockSize {\n\t\trevel.ERROR.Print(\"Cipher text too short\")\n\t\treturn \"\"\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t// XORKeyStream can work in-place if the two arguments are the same.\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\treturn fmt.Sprintf(\"%s\", ciphertext)\n}", "title": "" }, { "docid": "a9978a8f61bb3f1a6172f5c555891f5d", "score": "0.598037", "text": "func Decryption(cipher, key []byte) (encodedString string, encodedBytes []byte) {\n\tiv := cipher[:userlib.BlockSize]\n\tciphertext := cipher[userlib.BlockSize:]\n\tcfbDecrypter := userlib.CFBDecrypter(key, iv)\n\tcfbDecrypter.XORKeyStream(ciphertext, ciphertext)\n\treturn hex.EncodeToString(ciphertext), ciphertext\n}", "title": "" }, { "docid": "fd3776b7978e02746e8609304a216108", "score": "0.59788686", "text": "func Decrypt(k, in []byte) ([]byte, bool) {\n\tif len(in) < aes.BlockSize {\n\t\treturn nil, false\n\t}\n\n\tc, err := aes.NewCipher(k)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\n\tctr := cipher.NewCTR(c, in[:aes.BlockSize])\n\tctr.XORKeyStream(in[aes.BlockSize:], in[aes.BlockSize:])\n\treturn in[aes.BlockSize:], true\n\n}", "title": "" }, { "docid": "c8fbdaeb9c99ae41ff34d674e3a96848", "score": "0.59742707", "text": "func (this *MyEncryption) AESdecrypt() {\n\tthis.MyCypherBlock, this.MyAES_Error = aes.NewCipher(this.MyAES_key)\n\tif this.MyAES_Error != nil {\n\t\tlog.Println(\"[AES] Cannot add NewCipher: \", this.MyAES_Error)\n\t\treturn\n\t}\n\n\tif len(this.MyText_encrypted) < aes.BlockSize {\n\t\tthis.MyAES_Error = errors.New(\"Ciphertext too short\")\n\t\tlog.Println(\"[AES] Ciphertext too short\")\n\t\treturn\n\t}\n\tthis.MyIv = this.MyText_encrypted[:aes.BlockSize]\n\tthis.MyText_encrypted = this.MyText_encrypted[aes.BlockSize:]\n\tcfb := cipher.NewCFBDecrypter(this.MyCypherBlock, this.MyIv)\n\tcfb.XORKeyStream(this.MyText_encrypted, this.MyText_encrypted)\n\n\t// this.MyText_cleartext, this.MyAES_Error = hex.DecodeString(string(this.MyText_encrypted))\n\n\tthis.MyText_cleartext, this.MyAES_Error = base64.StdEncoding.DecodeString(string(this.MyText_encrypted))\n\tif this.MyAES_Error != nil {\n\t\tlog.Println(\"[AES] Error while decrypting \", this.MyAES_Error)\n\t\tthis.MyText_cleartext = nil\n\n\t}\n\treturn\n}", "title": "" } ]
2e367c7b80cd81288400c39833c7ef66
InjectArtificialHeartbeat provides a mock function with given fields: sender, msg
[ { "docid": "7a6e246430d52c96e45d797d92bdc3d0", "score": "0.70207727", "text": "func (_m *LeaderMonitor) InjectArtificialHeartbeat(sender uint64, msg *smartbftprotos.Message) {\n\t_m.Called(sender, msg)\n}", "title": "" } ]
[ { "docid": "82edbb4f5ef75dc81e141f4d1faedca1", "score": "0.60289574", "text": "func (m *MockTransport) SetHeartbeatHandler(arg0 func(raft.RPC)) {\n\tm.ctrl.Call(m, \"SetHeartbeatHandler\", arg0)\n}", "title": "" }, { "docid": "b165c70fb293d9495af913c06d096de8", "score": "0.5814327", "text": "func mockMsgHandler(payload []byte) {\n\tlogger.Debugf(\"Payload received is %s\", payload)\n}", "title": "" }, { "docid": "3f067ecaf1671a255dce33de06cea205", "score": "0.5779952", "text": "func (m *MockService) Heartbeat(arg0, arg1 string, arg2 types.Client) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Heartbeat\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "da47d19ed8671f8b2363ce4e04056a1f", "score": "0.568422", "text": "func (_m *Client) RecordActivityHeartbeat(ctx context.Context, taskToken []byte, details ...interface{}) error {\n\tvar _ca []interface{}\n\t_ca = append(_ca, ctx, taskToken)\n\t_ca = append(_ca, details...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, []byte, ...interface{}) error); ok {\n\t\tr0 = rf(ctx, taskToken, details...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "0a205138943c7f592276240ab6952d32", "score": "0.5632949", "text": "func (m *MockWorkflowServiceClient) RecordActivityTaskHeartbeat(ctx context.Context, in *workflowservice.RecordActivityTaskHeartbeatRequest, opts ...grpc.CallOption) (*workflowservice.RecordActivityTaskHeartbeatResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"RecordActivityTaskHeartbeat\", varargs...)\n\tret0, _ := ret[0].(*workflowservice.RecordActivityTaskHeartbeatResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "037cf157a975c4784eb2986fc39cea04", "score": "0.5606144", "text": "func (_m *LeaderMonitor) HeartbeatWasSent() {\n\t_m.Called()\n}", "title": "" }, { "docid": "db852c9e4534bffdb35ee8be97662cda", "score": "0.5572211", "text": "func (m *MockMutableState) UpdateActivityWithTimerHeartbeat(arg0 *v111.ActivityInfo, arg1 time.Time) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateActivityWithTimerHeartbeat\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ac356ff23f9920c4c7d592b5fb24e6f2", "score": "0.55315906", "text": "func (_m *Engine) Notify(_a0 common.Message) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(common.Message) 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": "a36a97c1e89d5d09276b8476c19771dc", "score": "0.5527572", "text": "func (_m *FrontendClient) RecordActivityTaskHeartbeat(ctx context.Context, request *shared.RecordActivityTaskHeartbeatRequest, opts ...yarpc.CallOption) (*shared.RecordActivityTaskHeartbeatResponse, error) {\n\tret := _m.Called(ctx, request)\n\n\tvar r0 *shared.RecordActivityTaskHeartbeatResponse\n\tif rf, ok := ret.Get(0).(func(context.Context, *shared.RecordActivityTaskHeartbeatRequest) *shared.RecordActivityTaskHeartbeatResponse); ok {\n\t\tr0 = rf(ctx, request)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*shared.RecordActivityTaskHeartbeatResponse)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, *shared.RecordActivityTaskHeartbeatRequest) error); ok {\n\t\tr1 = rf(ctx, request)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "f16e8add4ae8e0ea500b27e6eaf45527", "score": "0.5464439", "text": "func (m *MockWorkflowServiceServer) RecordActivityTaskHeartbeat(arg0 context.Context, arg1 *workflowservice.RecordActivityTaskHeartbeatRequest) (*workflowservice.RecordActivityTaskHeartbeatResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecordActivityTaskHeartbeat\", arg0, arg1)\n\tret0, _ := ret[0].(*workflowservice.RecordActivityTaskHeartbeatResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8f3a7b6cf88c964a0b3d3264501a41f9", "score": "0.5439074", "text": "func (m *MockClient) RecordActivityTaskHeartbeat(arg0 context.Context, arg1 *types.HistoryRecordActivityTaskHeartbeatRequest, arg2 ...yarpc.CallOption) (*types.RecordActivityTaskHeartbeatResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"RecordActivityTaskHeartbeat\", varargs...)\n\tret0, _ := ret[0].(*types.RecordActivityTaskHeartbeatResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "50c9f8b7d59ec5c475c54638b21baa94", "score": "0.539874", "text": "func (m *MockMutableState) AddWorkflowTaskScheduledEventAsHeartbeat(bypassTaskGeneration bool, originalScheduledTimestamp *time.Time, workflowTaskType v18.WorkflowTaskType) (*WorkflowTaskInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddWorkflowTaskScheduledEventAsHeartbeat\", bypassTaskGeneration, originalScheduledTimestamp, workflowTaskType)\n\tret0, _ := ret[0].(*WorkflowTaskInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c6cdfdf70e9d3ce61412ea5904ad1301", "score": "0.5346455", "text": "func (_m *MessagingClient) Publish(msg *messaging.Msg) error {\n\tret := _m.Called(msg)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*messaging.Msg) error); ok {\n\t\tr0 = rf(msg)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "8f4b401297c27672c5d68e4f94ae1aef", "score": "0.53365445", "text": "func (_m *MockDataReceiverService_PutEventServer) SendMsg(m interface{}) error {\n\tret := _m.Called(m)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(interface{}) error); ok {\n\t\tr0 = rf(m)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "44da11e30d0f8a3b22167f157149528d", "score": "0.5244459", "text": "func (m *MockMutableState) GetActivityInfoWithTimerHeartbeat(scheduledEventID int64) (*v111.ActivityInfo, time.Time, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetActivityInfoWithTimerHeartbeat\", scheduledEventID)\n\tret0, _ := ret[0].(*v111.ActivityInfo)\n\tret1, _ := ret[1].(time.Time)\n\tret2, _ := ret[2].(bool)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "9a4021e503770fa216560fabf99ebe72", "score": "0.5220329", "text": "func TestHeartBeatRequestToMep(t *testing.T) {\n\tconvey.Convey(\"HeartBeatRequestToMep\", t, func() {\n\t\tregisterResponse := string(`{\"serName\": \"get\", \"livenessInterval\": 30, \"serInstanceId\":\"12345\", \"_links\": { \"self\" : { \"liveness\": \"/mec_service_mgmt/v1/applications/5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f/service/5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f/liveness\" }}}`)\n\n\t\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tw.WriteHeader(http.StatusNoContent)\n\n\t\t}))\n\t\tpatch1 := gomonkey.ApplyFunc(config.GetServerUrl, func() (config.ServerUrl, error) {\n\t\t\treturn config.ServerUrl{MepHeartBeatUrl: ts.URL}, nil\n\t\t})\n\t\tpatch2 := gomonkey.ApplyFunc(service.TlsConfig, func() (*tls.Config, error) {\n\t\t\treturn nil, nil\n\t\t})\n\n\t\tdefer ts.Close()\n\t\tdefer patch1.Reset()\n\t\tdefer patch2.Reset()\n\n\t\tutil.MepToken = model.TokenModel{AccessToken: \"akakak\", TokenType: \"Bear\", ExpiresIn: 3600}\n\n\t\tserviceInfo := model.ServiceInfoPost{}\n\t\terrJsonUnMarshal := json.Unmarshal([]byte(registerResponse), &serviceInfo)\n\t\tif errJsonUnMarshal !=nil {\n\t\t\tlog.Error(\"Failed to marshal service info to object\", errJsonUnMarshal.Error())\n\t\t}\n\t\tservice.HeartBeatRequestToMep(serviceInfo)\n\t})\n}", "title": "" }, { "docid": "1509ae8b6d4cd2dbd554655dec630b15", "score": "0.52184165", "text": "func TestClientOnHeartbeat(t *testing.T) {\n\tdialer := &websocket.Dialer{\n\t\tHandshakeTimeout: time.Second * 1,\n\t}\n\tclient, err := NewClient(\"wss://api.rmm.dev/cable\", dialer)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tvar actual Payload\n\tdone := make(chan struct{})\n\n\tclient.OnHeartbeat(func(conn *websocket.Conn, sample *Payload) error {\n\t\tactual.event = sample.event\n\t\tdone <- struct{}{}\n\t\treturn nil\n\t})\n\n\terr = client.Serve()\n\tcheckError(err, t)\n\n\t// give enough time for ping (3500 wasnt enough)\n\treceiveSleep(4000, done)\n\tassert(actual.event.Type, \"ping\", t)\n}", "title": "" }, { "docid": "9ef97ab39048849c1637c94cfd2cfc16", "score": "0.51974154", "text": "func TestHeartbeat(t *testing.T) {\n\tf := heartbeatFixture{t: t}\n\tdefer f.Cleanup()\n\n\tf.Bootstrap()\n\tf.Grow()\n\tf.Grow()\n\n\ttime.Sleep(1 * time.Second) // Wait for join notifiation triggered heartbeats to complete.\n\n\tleader := f.Leader()\n\tleaderState := f.State(leader)\n\n\t// Artificially mark all nodes as down\n\terr := leaderState.DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {\n\t\tmembers, err := tx.GetNodes(ctx)\n\t\trequire.NoError(t, err)\n\t\tfor _, member := range members {\n\t\t\terr := tx.SetNodeHeartbeat(member.Address, time.Now().Add(-time.Minute))\n\t\t\trequire.NoError(t, err)\n\t\t}\n\n\t\treturn nil\n\t})\n\trequire.NoError(t, err)\n\n\t// Perform the heartbeat requests.\n\tleader.Cluster = leaderState.DB.Cluster\n\theartbeat, _ := cluster.HeartbeatTask(leader)\n\tctx := context.Background()\n\theartbeat(ctx)\n\n\t// The heartbeat timestamps of all nodes got updated\n\terr = leaderState.DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {\n\t\tmembers, err := tx.GetNodes(ctx)\n\t\trequire.NoError(t, err)\n\n\t\tofflineThreshold, err := tx.GetNodeOfflineThreshold(ctx)\n\t\trequire.NoError(t, err)\n\n\t\tfor _, member := range members {\n\t\t\tassert.False(t, member.IsOffline(offlineThreshold))\n\t\t}\n\n\t\treturn nil\n\t})\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "1b2431b3448bdbdb3ce25bf617f65573", "score": "0.51656497", "text": "func (m_2 *MockTicketRedeemer_MonitorMaxFloatServer) SendMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e4991b902d67ff38d006607139606297", "score": "0.51316017", "text": "func (mc *MockRoundTripper) Expect(callerFunc interface{}, status int, body interface{}) *Response {\n\tmc.Lock()\n\tdefer mc.Unlock()\n\n\tcaller := getFunctionName(callerFunc)\n\tbodyPL, ok := body.(ResponsePayload)\n\tif !ok {\n\t\tbodyPL = JSON{body}\n\t}\n\tresp := &Response{Status: status, Body: bodyPL, Mutex: &mc.Mutex}\n\tmc.Responses[caller] = append(mc.Responses[caller], resp)\n\treturn resp\n}", "title": "" }, { "docid": "0b11ca3b37d77d0603bce790e3a85af1", "score": "0.5041875", "text": "func TestMqttMsgSensor(t *testing.T) {\n\tconst SENSOR = \"sensor1\"\n\tconst ORG = \"org1\"\n\n\tlog := GetLogger(t)\n\tdb := GetDb(t)\n\tinfluxDb := GetInfluxDb(t, log)\n\tmysqlDb := GetMysqlDb(t, log)\n\tmqtt := getMqtt(t, log, db, influxDb, mysqlDb)\n\n\tCleanDb(t, db)\n\tsensorId := CreateThing(t, db, SENSOR)\n\tSetSensorMeasurementTopic(t, db, sensorId, SENSOR+\"/\"+\"value\")\n\torgId := CreateOrg(t, db, ORG)\n\tAddOrgThing(t, db, orgId, SENSOR)\n\n\t// send unit message to registered thing\n\tmqtt.ProcessMessage(fmt.Sprintf(\"org/%s/%s/unit\", ORG, SENSOR), \"C\")\n\n\t// send temperature message to registered thing\n\tmqtt.ProcessMessage(fmt.Sprintf(\"org/%s/%s/value\", ORG, SENSOR), \"23\")\n\n\t// check if influxdb was called\n\tEquals(t, 1, len(influxDb.Calls))\n\tEquals(t, \"23\", influxDb.Calls[0].Value)\n\tEquals(t, SENSOR, influxDb.Calls[0].Thing.Name)\n\n\t// check if mysql was called\n\tEquals(t, 1, len(mysqlDb.Calls))\n\tEquals(t, \"23\", mysqlDb.Calls[0].Value)\n\tEquals(t, SENSOR, mysqlDb.Calls[0].Thing.Name)\n\n\t// second round of calls to check proper functionality for high load\n\tmqtt.ProcessMessage(fmt.Sprintf(\"org/%s/%s/unit\", ORG, SENSOR), \"C\")\n\tmqtt.ProcessMessage(fmt.Sprintf(\"org/%s/%s/value\", ORG, SENSOR), \"23\")\n}", "title": "" }, { "docid": "eaa81db8bf3c46adee6264d766700e2e", "score": "0.5037406", "text": "func (m_2 *MockWatchService_WatchServer) SendMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d37f193b5d46a637bc3d76c4d05ebb84", "score": "0.50361246", "text": "func TestHeartBeat(t *testing.T) {\n\trecorder := httptest.NewRecorder()\n\thandler := http.HandlerFunc(routes.HeartBeat)\n\n\tnodelist.AddNode(\"test\", &nodelist.Node{\n\t\tAddress: \"0.0.0.0\",\n\t\tLastOnline: time.Now().Format(time.RFC850),\n\t\tIsOnline: true,\n\t\tSynced: false,\n\t\tMeta: &nodelist.NodeMetadata{\n\t\t\tUUID: \"test\",\n\t\t\tVersion: \"0.0.0\",\n\t\t},\n\t})\n\theartbeat := &nodelist.NodeHeartbeat{\n\t\tUUID: \"test\",\n\t\tSynced: strconv.FormatBool(true),\n\t}\n\n\tserial, err := json.Marshal(&heartbeat)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\treq, err := http.NewRequest(\"POST\", \"/heartbeat\", bytes.NewBuffer(serial))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\thandler.ServeHTTP(recorder, req)\n\n\tif status := recorder.Code; status != http.StatusOK {\n\t\tt.Errorf(\"handler returned wrong status code: got %v want %v\",\n\t\t\tstatus, http.StatusOK)\n\t}\n\tif nodelist.GetNodeByUUID(\"test\").Synced == false {\n\t\tt.Errorf(\"Node was not updated\")\n\t}\n}", "title": "" }, { "docid": "1bb21c5788a5905fb4d686d65ff6738e", "score": "0.50361055", "text": "func (_m *RedisClient) Send(topic string, message types.MessageEnvelope) error {\n\tret := _m.Called(topic, message)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, types.MessageEnvelope) error); ok {\n\t\tr0 = rf(topic, message)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "238fcb04524e43933e56dd0e99765b64", "score": "0.50274837", "text": "func (m_2 *MockBackupService_StreamToServer) SendMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "10e2fac0753d8250a9c8f23e9ff2ccd8", "score": "0.50224143", "text": "func TestMessageService_HandleNewMessage(t *testing.T) {\n\tctx := context.Background()\n\tsomeErr := errors.New(\"some error\")\n\n\tchatID := int64(123)\n\tuser := &bot.User{\n\t\tID: 122334,\n\t\tFirstName: \"John\",\n\t\tLastName: \"Doe\",\n\t\tUserName: \"the_john\",\n\t\tLanguageCode: \"en\",\n\t\tIsBot: false,\n\t}\n\n\tuLoc := &types.UserCoordinates{\n\t\tLocationID: 31415,\n\t\tLatitude: \"12.32\",\n\t\tLongitude: \"45.16\",\n\t}\n\tbotLoc := &bot.Location{\n\t\tLongitude: 45.16,\n\t\tLatitude: 12.32,\n\t}\n\n\twr := &types.FullWeatherReport{\n\t\tCityName: \"some_location\",\n\t\tData: []*types.Stat{\n\t\t\t{\n\t\t\t\tPartOfDay: Day,\n\t\t\t\tCityName: \"some_location\",\n\t\t\t\tDateTime: \"\",\n\t\t\t\tWindDirection: \"\",\n\t\t\t\tSunriseTime: \"\",\n\t\t\t\tSunsetTime: \"\",\n\t\t\t\tRelativeHumidity: 0,\n\t\t\t\tWindSpeedMs: 0,\n\t\t\t\tIndexUV: 0,\n\t\t\t\tPrecipitation: 0,\n\t\t\t\tPressureMb: 0,\n\t\t\t\tTemperature: 0,\n\t\t\t\tFeelsLikeTemp: 0,\n\t\t\t\tHighTemp: 0,\n\t\t\t\tLowTemp: 0,\n\t\t\t\tWeather: types.Weather{},\n\t\t\t\tCloudCoverage: 0,\n\t\t\t\tSnow: 0,\n\t\t\t\tIndexAirQuality: 0,\n\t\t\t},\n\t\t},\n\t}\n\n\t// Keyboards\n\tsimpleButton := bot.NewKeyboardButton(\"some_text\")\n\tlocationButton := bot.NewKeyboardButtonLocation(\"some_text\")\n\trowWithTwoSimpleButtons := bot.NewKeyboardButtonRow(simpleButton, simpleButton)\n\trowWithThreeSimpleButtons := bot.NewKeyboardButtonRow(simpleButton, simpleButton, simpleButton)\n\n\tmainMenu := bot.NewReplyKeyboard(bot.NewKeyboardButtonRow(locationButton), bot.NewKeyboardButtonRow(simpleButton))\n\tchPeriod := bot.NewReplyKeyboard(rowWithTwoSimpleButtons, rowWithTwoSimpleButtons)\n\tchHours := bot.NewReplyKeyboard(rowWithThreeSimpleButtons, rowWithThreeSimpleButtons)\n\tchDays := bot.NewReplyKeyboard(rowWithThreeSimpleButtons, rowWithThreeSimpleButtons)\n\n\t// Updates.\n\tvar (\n\t\tstop = &bot.Update{UpdateID: 11, Message: &bot.Message{MessageID: 111, Text: Stop, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\tstart = &bot.Update{UpdateID: 24, Message: &bot.Message{MessageID: 112, Text: Start, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\tback2mm = &bot.Update{UpdateID: 35, Message: &bot.Message{MessageID: 113, Text: BackToMainMenu, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\tback = &bot.Update{UpdateID: 42, Message: &bot.Message{MessageID: 114, Text: Back, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\tbyHours = &bot.Update{UpdateID: 53, Message: &bot.Message{MessageID: 115, Text: ByHours, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\tbyDays = &bot.Update{UpdateID: 69, Message: &bot.Message{MessageID: 116, Text: ByDays, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\tcurrent = &bot.Update{UpdateID: 72, Message: &bot.Message{MessageID: 117, Text: CurrentWeather, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\tdays5 = &bot.Update{UpdateID: 88, Message: &bot.Message{MessageID: 118, Text: FiveDays, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\thours96 = &bot.Update{UpdateID: 90, Message: &bot.Message{MessageID: 119, Text: NinetySixHours, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\there = &bot.Update{UpdateID: 14, Message: &bot.Message{MessageID: 120, Text: WeatherHere, From: user, Chat: &bot.Chat{ID: chatID}, Location: botLoc}}\n\t\tthere = &bot.Update{UpdateID: 21, Message: &bot.Message{MessageID: 120, Text: WeatherElsewhere, From: user, Chat: &bot.Chat{ID: chatID}}}\n\t\ttallinn = &bot.Update{UpdateID: 33, Message: &bot.Message{MessageID: 121, Text: \"Tallinn\", From: user, Chat: &bot.Chat{ID: chatID}}}\n\t)\n\n\ttests := []struct {\n\t\tname string\n\t\tprepare func(\n\t\t\tbc *mock.MockBotClient,\n\t\t\tfc *mock.MockForecastClient,\n\t\t\trf *mock.MockReportFormatter,\n\t\t\tbr *mock.MockBotUIRepo,\n\t\t\tlr *mock.MockLocationRepo,\n\t\t\tulr *mock.MockUserLocationRepo,\n\t\t\tur *mock.MockUserDataRepo,\n\t\t)\n\t\tupd *bot.Update\n\t\twantErr bool\n\t}{\n\t\t{\n\t\t\tname: \"1. Error on handling Stop\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tresp := bot.NewMessage(chatID, commentsEn[\"End\"])\n\t\t\t\tresp.ReplyMarkup = bot.ReplyKeyboardHide{HideKeyboard: true}\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, someErr)\n\t\t\t},\n\t\t\tupd: stop,\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"2. Error on adding user to db on Start\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tur.EXPECT().AddUserIfNotExists(ctx, user).Return(someErr)\n\t\t\t},\n\t\t\tupd: start,\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"3. Error on getting user's recent location from db on Now\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tulr.EXPECT().GetUserRecentLocation(ctx, user.ID).Return(nil, someErr)\n\t\t\t},\n\t\t\tupd: current,\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"4. Error on getting a forecast on Now\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tulr.EXPECT().GetUserRecentLocation(ctx, user.ID).Return(uLoc, nil)\n\t\t\t\tfc.EXPECT().GetForecast(ctx, uLoc, current.Message.Text).Return(nil, someErr)\n\t\t\t},\n\t\t\tupd: current,\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"5. No error, but failed saving location name on Now\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tulr.EXPECT().GetUserRecentLocation(ctx, user.ID).Return(uLoc, nil)\n\t\t\t\tfc.EXPECT().GetForecast(ctx, uLoc, current.Message.Text).Return(wr, nil)\n\t\t\t\trf.EXPECT().FormatNow(ctx, wr).Return(\"formatted_report\")\n\t\t\t\tresp := bot.NewMessage(chatID, \"formatted_report\")\n\t\t\t\tresp.ReplyMarkup = chPeriod\n\t\t\t\tbr.EXPECT().GetDaysOrHoursKeyboard().Return(chPeriod)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t\tulr.EXPECT().SaveUserLocationName(ctx, user.ID, wr.CityName).Return(someErr)\n\t\t\t},\n\t\t\tupd: current,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"6. Error on adding user's location from db on WeatherHere\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tulr.EXPECT().AddUserLocationByCoordinates(ctx, user.ID, here.Message.Location).Return(someErr)\n\t\t\t},\n\t\t\tupd: here,\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"7. No error, but failed to get coordinates from db when handling location by text\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tlr.EXPECT().GetCoordinatesByCityName(ctx, tallinn.Message.Text).Return(&bot.Location{}, someErr)\n\t\t\t\tresp := bot.NewMessage(chatID, commentsEn[\"Unknown\"])\n\t\t\t\tresp.ReplyMarkup = mainMenu\n\t\t\t\tbr.EXPECT().GetMainMenuKeyboard().Return(mainMenu)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t},\n\t\t\tupd: tallinn,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"8. Success on handling Stop\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tresp := bot.NewMessage(chatID, commentsEn[\"End\"])\n\t\t\t\tresp.ReplyMarkup = bot.ReplyKeyboardHide{HideKeyboard: true}\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t},\n\t\t\tupd: stop,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"9. Success on handling Start\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tur.EXPECT().AddUserIfNotExists(ctx, user).Return(nil)\n\t\t\t\tresp := bot.NewMessage(chatID, fmt.Sprintf(\"%s\\n%s\", commentsEn[\"DefaultMessage\"], pickASaying(start.Message.MessageID, sayingsEn)))\n\t\t\t\tresp.ReplyMarkup = mainMenu\n\t\t\t\tbr.EXPECT().GetMainMenuKeyboard().Return(mainMenu)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t},\n\t\t\tupd: start,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"10. Success on handling BackToMainMenu\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tresp := bot.NewMessage(chatID, commentsEn[\"ChooseLocation\"])\n\t\t\t\tresp.ReplyMarkup = mainMenu\n\t\t\t\tbr.EXPECT().GetMainMenuKeyboard().Return(mainMenu)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t},\n\t\t\tupd: back2mm,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"11. Success on handling Back\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tresp := bot.NewMessage(chatID, commentsEn[\"ChoosePeriodType\"])\n\t\t\t\tresp.ReplyMarkup = chPeriod\n\t\t\t\tbr.EXPECT().GetDaysOrHoursKeyboard().Return(chPeriod)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t},\n\t\t\tupd: back,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"12. Success on handling ByHours\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tresp := bot.NewMessage(chatID, commentsEn[\"ChoosePeriod\"])\n\t\t\t\tresp.ReplyMarkup = chHours\n\t\t\t\tbr.EXPECT().GetHoursKeyboard().Return(chHours)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t},\n\t\t\tupd: byHours,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"13. Success on handling ByDays\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tresp := bot.NewMessage(chatID, commentsEn[\"ChoosePeriod\"])\n\t\t\t\tresp.ReplyMarkup = chDays\n\t\t\t\tbr.EXPECT().GetDaysKeyboard().Return(chDays)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t},\n\t\t\tupd: byDays,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"14. Success on handling Now\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tulr.EXPECT().GetUserRecentLocation(ctx, user.ID).Return(uLoc, nil)\n\t\t\t\tfc.EXPECT().GetForecast(ctx, uLoc, current.Message.Text).Return(wr, nil)\n\t\t\t\trf.EXPECT().FormatNow(ctx, wr).Return(\"formatted_report\")\n\t\t\t\tresp := bot.NewMessage(chatID, \"formatted_report\")\n\t\t\t\tresp.ReplyMarkup = chPeriod\n\t\t\t\tbr.EXPECT().GetDaysOrHoursKeyboard().Return(chPeriod)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t\tulr.EXPECT().SaveUserLocationName(ctx, user.ID, wr.CityName).Return(nil)\n\t\t\t},\n\t\t\tupd: current,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"15. Success on handling FiveDays\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tulr.EXPECT().GetUserRecentLocation(ctx, user.ID).Return(uLoc, nil)\n\t\t\t\tfc.EXPECT().GetForecast(ctx, uLoc, days5.Message.Text).Return(wr, nil)\n\t\t\t\trf.EXPECT().FormatDays(ctx, wr, extractNumerals(days5.Message.Text)).Return(\"formatted_report\")\n\t\t\t\tresp := bot.NewMessage(chatID, \"formatted_report\")\n\t\t\t\tresp.ReplyMarkup = chDays\n\t\t\t\tbr.EXPECT().GetDaysKeyboard().Return(chDays)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t\tulr.EXPECT().SaveUserLocationName(ctx, user.ID, wr.CityName).Return(nil)\n\t\t\t},\n\t\t\tupd: days5,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"16. Success on handling NinetySixHours\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tulr.EXPECT().GetUserRecentLocation(ctx, user.ID).Return(uLoc, nil)\n\t\t\t\tfc.EXPECT().GetForecast(ctx, uLoc, hours96.Message.Text).Return(wr, nil)\n\t\t\t\trf.EXPECT().FormatHours(ctx, wr, extractNumerals(hours96.Message.Text)).Return(\"formatted_report\")\n\t\t\t\tresp := bot.NewMessage(chatID, \"formatted_report\")\n\t\t\t\tresp.ReplyMarkup = chHours\n\t\t\t\tbr.EXPECT().GetHoursKeyboard().Return(chHours)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t\tulr.EXPECT().SaveUserLocationName(ctx, user.ID, wr.CityName).Return(nil)\n\t\t\t},\n\t\t\tupd: hours96,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"17. Success on handling WeatherHere\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tulr.EXPECT().AddUserLocationByCoordinates(ctx, user.ID, here.Message.Location).Return(nil)\n\t\t\t\tresp := bot.NewMessage(chatID, commentsEn[\"CoordsAccepted\"])\n\t\t\t\tresp.ReplyMarkup = chPeriod\n\t\t\t\tbr.EXPECT().GetDaysOrHoursKeyboard().Return(chPeriod)\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t},\n\t\t\tupd: here,\n\t\t\twantErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"18. Success on handling WeatherElsewhere\",\n\t\t\tprepare: func(bc *mock.MockBotClient, fc *mock.MockForecastClient, rf *mock.MockReportFormatter, br *mock.MockBotUIRepo, lr *mock.MockLocationRepo, ulr *mock.MockUserLocationRepo, ur *mock.MockUserDataRepo) {\n\t\t\t\tresp := bot.NewMessage(chatID, commentsEn[\"DiffPlaceAccepted\"])\n\t\t\t\tresp.ReplyMarkup = bot.ReplyKeyboardHide{HideKeyboard: true}\n\t\t\t\tbc.EXPECT().Send(resp).Return(bot.Message{}, nil)\n\t\t\t},\n\t\t\tupd: there,\n\t\t\twantErr: false,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tctrl := gomock.NewController(t)\n\t\t\tdefer ctrl.Finish()\n\n\t\t\tbc := mock.NewMockBotClient(ctrl)\n\t\t\tfc := mock.NewMockForecastClient(ctrl)\n\t\t\trf := mock.NewMockReportFormatter(ctrl)\n\t\t\tur := mock.NewMockUserDataRepo(ctrl)\n\t\t\tbr := mock.NewMockBotUIRepo(ctrl)\n\t\t\tulr := mock.NewMockUserLocationRepo(ctrl)\n\t\t\tlr := mock.NewMockLocationRepo(ctrl)\n\n\t\t\ttt.prepare(bc, fc, rf, br, lr, ulr, ur)\n\n\t\t\ts := NewMessageService(bc, fc, rf, br, lr, ulr, ur)\n\t\t\tif err := s.HandleNewMessage(ctx, tt.upd); (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"HandleNewMessage() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "3506efc9cb59eda23bdaa4f04b783116", "score": "0.50112325", "text": "func (_m *MockRemotePeer) sendMessage(msg msgOrder) {\n\t_m.Called(msg)\n}", "title": "" }, { "docid": "6770abc31192f12fe3ec07d44631a311", "score": "0.5009672", "text": "func (m *MockOpenStorageWatch_WatchServer) SendMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SendMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8fef004f75164cdb14df4f34e1a1ee9d", "score": "0.49987456", "text": "func (m_2 *MockBackupService_StreamFromServer) SendMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "79d8d941223b5eaaffdc2d1fb825ccdc", "score": "0.4991671", "text": "func (m_2 *MockTicketRedeemer_MonitorMaxFloatClient) SendMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "90bdf1d2fe5186348f183a268a152b9f", "score": "0.49909246", "text": "func (m *MockWorkflowServiceClient) RecordActivityTaskHeartbeatById(ctx context.Context, in *workflowservice.RecordActivityTaskHeartbeatByIdRequest, opts ...grpc.CallOption) (*workflowservice.RecordActivityTaskHeartbeatByIdResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"RecordActivityTaskHeartbeatById\", varargs...)\n\tret0, _ := ret[0].(*workflowservice.RecordActivityTaskHeartbeatByIdResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d77a20402e2ed733728539980bc1577b", "score": "0.49835995", "text": "func handleheartbeatmsg(msg detector.Msg_t) {\n fmt.Printf(\"Heartbeat from %s_%d at %d with Timestamp %d received (our current neigh is %v).\\n\", msg.Node_id.IPV4_addr, \n msg.Node_id.Timestamp, msg.Node_hash, msg.Timestamp, neigh)\n beatable.Log_beat(int(msg.Node_hash), msg.Timestamp) //Call the data structure itself\n}", "title": "" }, { "docid": "6bdd420fe985758ebde60b0e423d9c10", "score": "0.49759555", "text": "func (_m *MessageSender) SendMessage(queueID string, payload []byte) error {\n\tret := _m.Called(queueID, payload)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, []byte) error); ok {\n\t\tr0 = rf(queueID, payload)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "41d75dea032ec7933ccbe58e7756f619", "score": "0.4958082", "text": "func (_m *MockClient) Publish(_a0 string, _a1 []byte) error {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, []byte) error); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "bafdf02e446e9d582d84f8903cd0df0b", "score": "0.49517328", "text": "func (_m *MockAutoScalingAPI) RecordLifecycleActionHeartbeat(_param0 *autoscaling.RecordLifecycleActionHeartbeatInput) (*autoscaling.RecordLifecycleActionHeartbeatOutput, error) {\n\tret := _m.ctrl.Call(_m, \"RecordLifecycleActionHeartbeat\", _param0)\n\tret0, _ := ret[0].(*autoscaling.RecordLifecycleActionHeartbeatOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5969feee2215fdbe75e249725117ed79", "score": "0.49494186", "text": "func TestBroker_Received(t *testing.T) {\n\tsim := service.NewSimulator()\n\tn1 := sim.NewNode()\n\tn2 := sim.NewNode()\n\n\tbroker := NewBroker(n1)\n\tbroker.Start()\n\n\tinboxer := &MockInboxer{nil, instanceId1.Id()}\n\tbroker.Register(inboxer)\n\n\tserMsg := createMessage(t, instanceId1)\n\tn2.Broadcast(ProtoName, serMsg)\n\n\trecv := <-inboxer.inbox\n\n\tassert.True(t, recv.msg.Message.InstanceId[0] == instanceId1.Bytes()[0])\n}", "title": "" }, { "docid": "33dccd976336a025e119e9c80418eac2", "score": "0.4946781", "text": "func (_m *ChatI) AppendMessage(in *proto.Message) (*proto.MessageID, error) {\n\tret := _m.Called(in)\n\n\tvar r0 *proto.MessageID\n\tif rf, ok := ret.Get(0).(func(*proto.Message) *proto.MessageID); ok {\n\t\tr0 = rf(in)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*proto.MessageID)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*proto.Message) error); ok {\n\t\tr1 = rf(in)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "18f592a47e06de477f79172ca98d77ba", "score": "0.49410465", "text": "func (m_2 *MockWatchService_WatchClient) SendMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "0f21f8175ad5a381d405dcf1754283ef", "score": "0.4935895", "text": "func RecordHeartbeat(id string) {\n\tif e, ok := executorMap[id]; ok {\n\t\te.HeartbeatTime = time.Now()\n\t}\n}", "title": "" }, { "docid": "93eadddcc8b1a7388580e7afba16f3bd", "score": "0.49253297", "text": "func (_m *TextMessage) Send(from string, tech string, resource string, body string, vars map[string]string) error {\n\tret := _m.Called(from, tech, resource, body, vars)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, string, string, string, map[string]string) error); ok {\n\t\tr0 = rf(from, tech, resource, body, vars)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "13f5a59c0b3eb015085e7e5d3b582e75", "score": "0.4922056", "text": "func (m *MockMessagesClient) SetReceived(ctx context.Context, in *pbmessenger.UpdateStatusRequest, opts ...grpc.CallOption) (*empty.Empty, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"SetReceived\", varargs...)\n\tret0, _ := ret[0].(*empty.Empty)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "57784fc3370c4141218c3b51e49d70b0", "score": "0.49210888", "text": "func (m *MockOpenStorageWatch_WatchClient) SendMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SendMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "39100e098016dfe53d0fafdfa6f53275", "score": "0.49120206", "text": "func TestHeartbeat(t *testing.T) {\n\tt.Parallel()\n\tctx := pctx.TestContext(t)\n\tenv := realenv.NewRealEnv(ctx, t, dockertestenv.NewTestDBConfig(t))\n\tpeerPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort))\n\tc := env.PachClient\n\ttu.ActivateAuthClient(t, c, peerPort)\n\trootClient := tu.AuthenticateClient(t, c, auth.RootUser)\n\n\t// Confirm the localhost cluster is configured as expected\n\tclusters, err := rootClient.License.ListClusters(rootClient.Ctx(), &license.ListClustersRequest{})\n\trequire.NoError(t, err)\n\trequire.Equal(t, 1, len(clusters.Clusters))\n\trequire.Equal(t, false, clusters.Clusters[0].AuthEnabled)\n\n\t// Heartbeat using the correct shared secret, confirm the activation code is returned\n\tpachClient := tu.UnauthenticatedPachClient(t, c)\n\tresp, err := pachClient.License.Heartbeat(pachClient.Ctx(), &license.HeartbeatRequest{\n\t\tId: \"localhost\",\n\t\tSecret: \"localhost\",\n\t\tVersion: \"some weird version\",\n\t\tAuthEnabled: true,\n\t})\n\trequire.NoError(t, err)\n\trequire.Equal(t, tu.GetTestEnterpriseCode(t), resp.License.ActivationCode)\n\n\t// List clusters again, auth_enabled, version and last_heartbeat should be updated\n\tnewClusters, err := rootClient.License.ListClusters(rootClient.Ctx(), &license.ListClustersRequest{})\n\trequire.NoError(t, err)\n\trequire.Equal(t, 1, len(newClusters.Clusters))\n\trequire.Equal(t, true, newClusters.Clusters[0].AuthEnabled)\n\trequire.Equal(t, \"some weird version\", newClusters.Clusters[0].Version)\n\trequire.True(t, protoutil.MustTime(newClusters.Clusters[0].LastHeartbeat).After(protoutil.MustTime(clusters.Clusters[0].LastHeartbeat)))\n}", "title": "" }, { "docid": "1fbb8806c63aa95fc67801f99ae413c4", "score": "0.49116784", "text": "func (m_2 *MockTicketRedeemer_MonitorMaxFloatServer) RecvMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e8499f244a3e1519fa74371e1ffb7025", "score": "0.4903422", "text": "func (m *MockWorkflowServiceServer) RecordActivityTaskHeartbeatById(arg0 context.Context, arg1 *workflowservice.RecordActivityTaskHeartbeatByIdRequest) (*workflowservice.RecordActivityTaskHeartbeatByIdResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecordActivityTaskHeartbeatById\", arg0, arg1)\n\tret0, _ := ret[0].(*workflowservice.RecordActivityTaskHeartbeatByIdResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cda9b7b1f6127a70139aa96773021024", "score": "0.4895817", "text": "func (_m *MockDataReceiverService_PutEventServer) RecvMsg(m interface{}) error {\n\tret := _m.Called(m)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(interface{}) error); ok {\n\t\tr0 = rf(m)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f860e3cd11252300836c4447d62bfafc", "score": "0.4891008", "text": "func (m_2 *MockBackupService_DeleteIncrementalServer) SendMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "709ed807b890a9d899b33ca0de060d30", "score": "0.48806408", "text": "func (_m *MockMessageCodec) Send(message Message) error {\n\tret := _m.Called(message)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(Message) error); ok {\n\t\tr0 = rf(message)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f356ab381e458021f892d6a67c05cc63", "score": "0.48706263", "text": "func (_m *MockDefaultCodecRequirements) Send(message spi.Message) error {\n\tret := _m.Called(message)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(spi.Message) error); ok {\n\t\tr0 = rf(message)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "4cc3b0209ad29be384d2ab31f9f3168c", "score": "0.48665586", "text": "func setupMockAmbassadorServer(done chan struct{}, sendReady chan struct{}, grpcServer *grpc.Server) *MockTelemetryAmbassadorServer {\n\tambassadorService := NewMockTelemetryAmbassadorServer()\n\tpegomock.When(ambassadorService.AttachEnvoy(matchers.AnyPtrToTelemetryEdgeEnvoySummary(), matchers.AnyTelemetryEdgeTelemetryAmbassadorAttachEnvoyServer())).\n\t\tThen(func(params []pegomock.Param) pegomock.ReturnValues {\n\t\t\t<-sendReady\n\t\t\tresponse := params[1].(telemetry_edge.TelemetryAmbassador_AttachEnvoyServer)\n\t\t\tresponse.Send(&telemetry_edge.EnvoyInstruction{\n\t\t\t\tDetails: &telemetry_edge.EnvoyInstruction_Ready{},\n\t\t\t})\n\t\t\t<-done\n\t\t\treturn nil\n\t\t})\n\tpegomock.When(ambassadorService.KeepAlive(matchers.AnyContextContext(), matchers.AnyPtrToTelemetryEdgeKeepAliveRequest())).\n\t\tThenReturn(&telemetry_edge.KeepAliveResponse{}, nil)\n\n\ttelemetry_edge.RegisterTelemetryAmbassadorServer(grpcServer, ambassadorService)\n\treturn ambassadorService\n}", "title": "" }, { "docid": "1f900a1cecacf12d66773a184b938f9c", "score": "0.48650286", "text": "func (c *ChannelListenerMock) ExpectMessageArrival() {\n\tc.wg.Add(1)\n\tc.On(\"ProcessMessage\")\n}", "title": "" }, { "docid": "4d13e076f27104aad02a8a2930dd0d90", "score": "0.48628503", "text": "func (m_2 *MockBackupService_StreamFromClient) SendMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ba5f44c827f27e743ef8beb7cbc08c17", "score": "0.48616973", "text": "func (r *Raft) sendHeartbeat(to uint64) {\n\tmsg := pb.Message{\n\t\tMsgType: pb.MessageType_MsgHeartbeat,\n\t\tTo: to,\n\t\tFrom: r.id,\n\t\tTerm: r.Term,\n\t\tCommit: r.RaftLog.committed,\n\t}\n\tr.msgs = append(r.msgs, msg)\n}", "title": "" }, { "docid": "e0cff93b2ff15fc0b94dd4a5aca782a4", "score": "0.485924", "text": "func (myself *TestService) InjectSayHello(sayHello mockobject.SayHelloI) {\n\tmyself.sayHello = sayHello\n}", "title": "" }, { "docid": "e44144ef592e73112e9daf348d084f80", "score": "0.48492157", "text": "func (m *MockOpenStorageWatch_WatchServer) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "20be8c5c506a4ff28964ae60cd02f923", "score": "0.4832296", "text": "func (m_2 *MockBackupService_StreamToClient) SendMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2818f100551559b326ac353ac2736529", "score": "0.48274398", "text": "func (m *MockTextIndexer_SearchClient) SendMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SendMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9550c5206172639a9bddd90ecc55c890", "score": "0.482461", "text": "func (_m *Storage) EvictOlder(timestamp time.Time) error {\n\tret := _m.Called(timestamp)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(time.Time) error); ok {\n\t\tr0 = rf(timestamp)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "7791598b6421b305e7e062e48c44ad32", "score": "0.48226628", "text": "func (m *MockAgent) HandleMessage(arg0 context.Context, arg1 *choria.Message, arg2 protocol.Request, arg3 choria.ConnectorInfo, arg4 chan *AgentReply) {\n\tm.ctrl.Call(m, \"HandleMessage\", arg0, arg1, arg2, arg3, arg4)\n}", "title": "" }, { "docid": "e614aa937dd0b3d27d437917b355e2be", "score": "0.48050836", "text": "func (m *MockMessageHandler) Notify(arg0 []hosts.Repository) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Notify\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "90c9c1b4429e8d2211733156548e1da5", "score": "0.47912493", "text": "func (m *MockTextIndexer_SearchClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "c2d7880c3554b8fd20ce5be0c17b77d8", "score": "0.47822434", "text": "func (m *MockSessionStoreHelper) SendMessage(msg *dipper.Message) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SendMessage\", msg)\n}", "title": "" }, { "docid": "949ba964f3eb16d343ce0f7e7aaaa17b", "score": "0.47794735", "text": "func (m *MockClientInterface) Message(arg0, arg1 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Message\", arg0, arg1)\n}", "title": "" }, { "docid": "bc41b34f0766bc57f5b797f72652d601", "score": "0.47794166", "text": "func (m_2 *MockBackupService_StreamToServer) RecvMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b8187443626b7154265dde5a6d8575be", "score": "0.47783735", "text": "func (_m *PubsubClient) Publish(_a0 entity.Message) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(entity.Message) 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": "3704144a1addc2a9f90a3e9247da90a2", "score": "0.47673982", "text": "func (m *MockClientInterface) SendMessage(arg0 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SendMessage\", arg0)\n}", "title": "" }, { "docid": "94b917ea814031238ec4b455ce7b2ba2", "score": "0.47656894", "text": "func (m_2 *MockPushPull_PullServer) SendMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2e0ede9b5b5817d6967bbfa8c8fee9a4", "score": "0.47610468", "text": "func (_m *FrontendClient) RecordActivityTaskHeartbeatByID(ctx context.Context, request *shared.RecordActivityTaskHeartbeatByIDRequest, opts ...yarpc.CallOption) (*shared.RecordActivityTaskHeartbeatResponse, error) {\n\tret := _m.Called(ctx, request)\n\n\tvar r0 *shared.RecordActivityTaskHeartbeatResponse\n\tif rf, ok := ret.Get(0).(func(context.Context, *shared.RecordActivityTaskHeartbeatByIDRequest) *shared.RecordActivityTaskHeartbeatResponse); ok {\n\t\tr0 = rf(ctx, request)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*shared.RecordActivityTaskHeartbeatResponse)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, *shared.RecordActivityTaskHeartbeatByIDRequest) error); ok {\n\t\tr1 = rf(ctx, request)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "e038b10fcfbcb720f7a1c299c14c5125", "score": "0.47469208", "text": "func (r *Raft) sendHeartbeat(to uint64) {\n\t// Your Code Here (2A).\n\tp := r.Prs[to]\n\tif p == nil {\n\t\treturn\n\t}\n\tnxt := p.Next\n\tvar preIdx uint64\n\tif nxt > 0 {\n\t\tpreIdx = nxt - 1\n\t} else {\n\t\tpreIdx = 0\n\t}\n\tpreTerm, err := r.RaftLog.Term(preIdx)\n\tif err != nil {\n\t\tlog.Warnf(\"Fail to get Term of Log Index (%d), try Send snapshot, Error: %s\", preIdx, err.Error())\n\t\tpreIdx = r.RaftLog.LastIndex()\n\t\tpreTerm, _ = r.RaftLog.Term(preIdx)\n\t}\n\tcom := min(p.Match, r.RaftLog.committed)\n\tmsg := pb.Message{\n\t\tFrom: r.id,\n\t\tTo: to,\n\t\tTerm: r.Term,\n\t\tCommit: com,\n\t\tIndex: preIdx,\n\t\tLogTerm: preTerm,\n\t\tMsgType: pb.MessageType_MsgHeartbeat,\n\t}\n\tr.msgs = append(r.msgs, msg)\n}", "title": "" }, { "docid": "47b3eb1d0cec1d6323478e72bc4b165a", "score": "0.4744028", "text": "func TestWalMessage(t *testing.T) {\n\t// Setup mock\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\n\tmockManager := mocks.NewMockManagerInterface(mockCtrl)\n\tmockConn := mocks.NewMockConn(mockCtrl)\n\n\t// Setup channels\n\tprogChan := make(chan uint64, 10)\n\tstatsChan := make(chan stats.Stat, 1000)\n\n\tsh := shutdown.NewShutdownHandler()\n\treplicator := New(sh, statsChan, mockManager, 10)\n\tstoppedChan := replicator.GetStoppedChan()\n\n\t// Setup return\n\t// table public.customers: INSERT: id[integer]:1 first_name[text]:'Hello' last_name[text]:'World'\n\twalData, _ := base64.StdEncoding.DecodeString(\"dGFibGUgcHVibGljLmN1c3RvbWVyczogSU5TRVJUOiBpZFtpbnRlZ2VyXToxIGZpcnN0X25hbWVbdGV4dF06J0hlbGxvJyBsYXN0X25hbWVbdGV4dF06J1dvcmxkJw==\")\n\tbackendMessage := getXLogData(walData, uint64(22210928), uint64(0), int64(0))\n\tcd, _ := backendMessage.(*pgproto3.CopyData)\n\txld, _ := pglogrepl.ParseXLogData(cd.Data[1:])\n\n\texpected, _ := replication.XLogDataToWalMessage(xld)\n\n\tmockManager.EXPECT().GetConnWithStartLsn(gomock.Any(), uint64(0)).Return(mockConn, nil).MinTimes(2)\n\n\tserverWalEnd := uint64(111)\n\tmockConn.EXPECT().ReceiveMessage(gomock.Any()).Return(getPrimaryKeepaliveMessage(serverWalEnd), nil).Times(1)\n\tmockConn.EXPECT().ReceiveMessage(gomock.Any()).Return(backendMessage, nil).Do(\n\t\tfunc(_ interface{}) {\n\t\t\ttime.Sleep(time.Millisecond * 5)\n\t\t}).Times(1)\n\tmockConn.EXPECT().ReceiveMessage(gomock.Any()).Return(nil, nil).Do(\n\t\tfunc(_ interface{}) {\n\t\t\ttime.Sleep(time.Millisecond * 5)\n\t\t}).MinTimes(1)\n\n\t// Do test\n\tgo replicator.Start(progChan)\n\n\t// Wait for shutdown\n\ttime.Sleep(time.Millisecond * 5)\n\n\tselect {\n\tcase <-time.After(25 * time.Millisecond):\n\t\tassert.Fail(t, \"did not get output in time\")\n\tcase message := <-replicator.GetOutputChan():\n\t\tassert.Equal(t, expected, message)\n\t}\n\n\t// Verify stats\n\texpectedStats := []stats.Stat{stats.NewStatCount(\"replication\", \"received\", 1, time.Now().UnixNano())}\n\tstats.VerifyStats(t, statsChan, expectedStats)\n\n\t// Wait for shutdown\n\twaitForShutdown(t, mockManager, sh, stoppedChan)\n}", "title": "" }, { "docid": "8426791c9842eb124ff306f2d33673bd", "score": "0.47415343", "text": "func (m_2 *MockWatchService_WatchServer) RecvMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "4b5b59a682ff2d32c8beb20b0d27d2cc", "score": "0.47392693", "text": "func (mmSendBytes *mRPCControllerMockSendBytes) When(ctx context.Context, nodeID insolar.Reference, name string, msgBytes []byte) *RPCControllerMockSendBytesExpectation {\n\tif mmSendBytes.mock.funcSendBytes != nil {\n\t\tmmSendBytes.mock.t.Fatalf(\"RPCControllerMock.SendBytes mock is already set by Set\")\n\t}\n\n\texpectation := &RPCControllerMockSendBytesExpectation{\n\t\tmock: mmSendBytes.mock,\n\t\tparams: &RPCControllerMockSendBytesParams{ctx, nodeID, name, msgBytes},\n\t}\n\tmmSendBytes.expectations = append(mmSendBytes.expectations, expectation)\n\treturn expectation\n}", "title": "" }, { "docid": "a42644801e7db1583b348a01b44cf442", "score": "0.47380143", "text": "func (m_2 *MockBackupService_DeleteCommitLogServer) SendMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "910a925325b0d8f18f1847225e877be3", "score": "0.473783", "text": "func TestTxnHeartbeaterLoopRequests(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\ttestutils.RunTrueAndFalse(t, \"heartbeatObserved\", func(t *testing.T, heartbeatObserved bool) {\n\t\tctx := context.Background()\n\t\ttxn := makeTxnProto()\n\t\tth, _, mockGatekeeper := makeMockTxnHeartbeater(&txn)\n\t\tdefer th.stopper.Stop(ctx)\n\n\t\tvar count int\n\t\tvar lastTime hlc.Timestamp\n\t\tmockGatekeeper.MockSend(func(ba roachpb.BatchRequest) (*roachpb.BatchResponse, *roachpb.Error) {\n\t\t\trequire.Len(t, ba.Requests, 1)\n\t\t\trequire.IsType(t, &roachpb.HeartbeatTxnRequest{}, ba.Requests[0].GetInner())\n\n\t\t\thbReq := ba.Requests[0].GetInner().(*roachpb.HeartbeatTxnRequest)\n\t\t\trequire.Equal(t, &txn, ba.Txn)\n\t\t\trequire.Equal(t, roachpb.Key(txn.Key), hbReq.Key)\n\t\t\trequire.True(t, lastTime.Less(hbReq.Now))\n\n\t\t\tcount++\n\t\t\tlastTime = hbReq.Now\n\n\t\t\tbr := ba.CreateReply()\n\t\t\tbr.Txn = ba.Txn\n\t\t\treturn br, nil\n\t\t})\n\n\t\t// Kick off the heartbeat loop.\n\t\tkeyA := roachpb.Key(\"a\")\n\t\tvar ba roachpb.BatchRequest\n\t\tba.Header = roachpb.Header{Txn: txn.Clone()}\n\t\tba.Add(&roachpb.PutRequest{RequestHeader: roachpb.RequestHeader{Key: keyA}})\n\n\t\tbr, pErr := th.SendLocked(ctx, ba)\n\t\trequire.Nil(t, pErr)\n\t\trequire.NotNil(t, br)\n\n\t\t// Wait for 5 heartbeat requests.\n\t\ttestutils.SucceedsSoon(t, func() error {\n\t\t\tth.mu.Lock()\n\t\t\tdefer th.mu.Unlock()\n\t\t\trequire.True(t, th.mu.loopStarted)\n\t\t\trequire.True(t, th.heartbeatLoopRunningLocked())\n\t\t\tif count < 5 {\n\t\t\t\treturn errors.Errorf(\"waiting for more heartbeat requests, found %d\", count)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\t// Mark the coordinator's transaction record as COMMITTED while a heartbeat\n\t\t// is in-flight. This should cause the heartbeat loop to shut down.\n\t\tth.mu.Lock()\n\t\tmockGatekeeper.MockSend(func(ba roachpb.BatchRequest) (*roachpb.BatchResponse, *roachpb.Error) {\n\t\t\trequire.Len(t, ba.Requests, 1)\n\t\t\trequire.IsType(t, &roachpb.HeartbeatTxnRequest{}, ba.Requests[0].GetInner())\n\n\t\t\tbr := ba.CreateReply()\n\t\t\tbr.Txn = ba.Txn\n\t\t\tif heartbeatObserved {\n\t\t\t\t// Mimic a Heartbeat request that observed a committed record.\n\t\t\t\tbr.Txn.Status = roachpb.COMMITTED\n\t\t\t} else {\n\t\t\t\t// Mimic an EndTxn that raced with the heartbeat loop.\n\t\t\t\ttxn.Status = roachpb.COMMITTED\n\t\t\t}\n\t\t\treturn br, nil\n\t\t})\n\t\tth.mu.Unlock()\n\t\twaitForHeartbeatLoopToStop(t, &th)\n\n\t\t// Depending on how the committed transaction was observed, we may or\n\t\t// may not expect the heartbeater's final observed status to be set.\n\t\tif heartbeatObserved {\n\t\t\trequire.Equal(t, roachpb.COMMITTED, th.mu.finalObservedStatus)\n\t\t} else {\n\t\t\trequire.Equal(t, roachpb.PENDING, th.mu.finalObservedStatus)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "88202b9c7c9b92e388166c275bb35ff9", "score": "0.4737144", "text": "func (_m *Client) RecordActivityHeartbeatByID(ctx context.Context, namespace string, workflowID string, runID string, activityID string, details ...interface{}) error {\n\tvar _ca []interface{}\n\t_ca = append(_ca, ctx, namespace, workflowID, runID, activityID)\n\t_ca = append(_ca, details...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, ...interface{}) error); ok {\n\t\tr0 = rf(ctx, namespace, workflowID, runID, activityID, details...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "440afb1a72d8567a70c14a2bce2b677a", "score": "0.4731861", "text": "func (m *MockHolaServiceClient) SayHola(arg0 context.Context, arg1 *protobuf2.HolaRequest, arg2 ...grpc.CallOption) (*protobuf2.HolaReply, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"SayHola\", varargs...)\n\tret0, _ := ret[0].(*protobuf2.HolaReply)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c87789ed72de579fea937cd0a26491d9", "score": "0.47255388", "text": "func (m *MockCalculatorAPI_SumServer) SendMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SendMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7980c414a3341f1325a4164a34abe483", "score": "0.4724505", "text": "func (m *MockMessagesServer) SetReceived(arg0 context.Context, arg1 *pbmessenger.UpdateStatusRequest) (*empty.Empty, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetReceived\", arg0, arg1)\n\tret0, _ := ret[0].(*empty.Empty)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "54f614da38f0fbe9fce3a1f0e8fa2b88", "score": "0.47206616", "text": "func (_m *MockOperator_PullFileServer) SendMsg(_param0 interface{}) error {\n\tret := _m.ctrl.Call(_m, \"SendMsg\", _param0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "14e1a86dda4e3c3ddd2495655349c6a0", "score": "0.4720096", "text": "func (_m *MockAutoScalingAPI) RecordLifecycleActionHeartbeatRequest(_param0 *autoscaling.RecordLifecycleActionHeartbeatInput) (*request.Request, *autoscaling.RecordLifecycleActionHeartbeatOutput) {\n\tret := _m.ctrl.Call(_m, \"RecordLifecycleActionHeartbeatRequest\", _param0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*autoscaling.RecordLifecycleActionHeartbeatOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fcc9fcb3f7df40c61eb183c74eba8066", "score": "0.4719767", "text": "func (_m *RedisClient) Receive(topic string) (*types.MessageEnvelope, error) {\n\tret := _m.Called(topic)\n\n\tvar r0 *types.MessageEnvelope\n\tif rf, ok := ret.Get(0).(func(string) *types.MessageEnvelope); ok {\n\t\tr0 = rf(topic)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*types.MessageEnvelope)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(topic)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "9ed3b88a0af714f5ec212e388471f703", "score": "0.47176746", "text": "func (_m *AfterNower) Now() time.Time {\n\tret := _m.Called()\n\n\tvar r0 time.Time\n\tif rf, ok := ret.Get(0).(func() time.Time); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(time.Time)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "2cf0a2be9088e568f448dc68e70ad8da", "score": "0.47150737", "text": "func (_m *ChatI) UpdateMessage(in *proto.Message) (*proto.Result, error) {\n\tret := _m.Called(in)\n\n\tvar r0 *proto.Result\n\tif rf, ok := ret.Get(0).(func(*proto.Message) *proto.Result); ok {\n\t\tr0 = rf(in)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*proto.Result)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*proto.Message) error); ok {\n\t\tr1 = rf(in)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "a2e4993d03441a4e8beb7a5b79ee318e", "score": "0.47146988", "text": "func (m_2 *MockBackupService_StreamFromServer) RecvMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "4946e413f5cca4951904565148fd5421", "score": "0.4711768", "text": "func (m_2 *MockTicketRedeemer_MonitorMaxFloatClient) RecvMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e388c53af6a85c6e7979f4384a97eb3e", "score": "0.47067934", "text": "func (m *MockOptions) HeartbeatOptions() HeartbeatOptions {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"HeartbeatOptions\")\n\tret0, _ := ret[0].(HeartbeatOptions)\n\treturn ret0\n}", "title": "" }, { "docid": "40b000a6abf5a1ffaf6fdf2f3d54034e", "score": "0.4705566", "text": "func (_m *MockExecutor) Update(instance *ServiceInstance) <-chan StatusMessage {\n\tret := _m.Called(instance)\n\n\tvar r0 <-chan StatusMessage\n\tif rf, ok := ret.Get(0).(func(*ServiceInstance) <-chan StatusMessage); ok {\n\t\tr0 = rf(instance)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(<-chan StatusMessage)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "331f25887914d06f379e5ef9af57add1", "score": "0.47054458", "text": "func (r *Raft) handleHeartbeat(m pb.Message) {\n\t// Your Code Here (2A).\n\tresponse := pb.Message{\n\t\tFrom: r.id,\n\t\tTo: m.From,\n\t\tTerm: r.Term,\n\t\tReject: true,\n\t\tMsgType: pb.MessageType_MsgHeartbeatResponse,\n\t}\n\t// if the heartBeat is sent from stale leader, do nothing and response our term\n\tif r.Term == m.Term {\n\t\t// set the leader id if pass the term check\n\t\tr.Lead = m.From\n\t\tr.electionElapsed = 0\n\t\t// reset election timeout\n\t\tr.randElectionTimeout()\n\t\t// check and update committed\n\t\tlog.Debugf(\"node %d, originalCommitted:[%d]\", r.id, r.RaftLog.committed)\n\t\t// update committed only if leader's is greater than mine\n\t\taccept, lastIndex := r.RaftLog.followerTryAppendLog([]pb.Entry{}, m.Index, m.LogTerm)\n\t\t// should check whether it is keep-up with the leader\n\t\tif accept {\n\t\t\tif m.Commit > r.RaftLog.committed {\n\t\t\t\tr.RaftLog.followerUpdateCommitted(m.Commit, r.RaftLog.LastIndex())\n\t\t\t}\n\t\t\tresponse.Reject = false\n\t\t} else {\n\t\t\tresponse.Reject = true\n\t\t\tresponse.Index = lastIndex\n\t\t\tlog.Debugf(\"follower [%d] reject the heartBeat.\", r.id)\n\t\t}\n\t\tlog.Debugf(\"follower [%d] update committed, LeaderCommitted:[%d], leaderCommittedTerm:[%d],lastIdx:[%d], result:[%d]\",\n\t\t\tr.id, m.Commit, m.LogTerm, r.RaftLog.LastIndex(), r.RaftLog.committed)\n\t}\n\t// send response\n\tr.msgs = append(r.msgs, response)\n}", "title": "" }, { "docid": "da22f6f1b3e4c8c7916010815bd6e93f", "score": "0.47045332", "text": "func (_m *WrappableLoggerInterface) Notice(message string, context *logger.Context) error {\n\tret := _m.Called(message, context)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, *logger.Context) error); ok {\n\t\tr0 = rf(message, context)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "9503907e7da5cde1b010c94b2bb1af82", "score": "0.4699233", "text": "func (_m *Publisher) Publish(msg *domain.QueueMessage) error {\n\tret := _m.Called(msg)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*domain.QueueMessage) error); ok {\n\t\tr0 = rf(msg)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "1ff02159c355e5d58bf244a87448af69", "score": "0.46986184", "text": "func TestHandlePayloadMessageAckedWhenTaskAdded(t *testing.T) {\n\ttester := setup(t)\n\tdefer tester.ctrl.Finish()\n\n\tvar addedTask *apitask.Task\n\ttester.mockTaskEngine.EXPECT().AddTask(gomock.Any()).Do(func(task *apitask.Task) {\n\t\taddedTask = task\n\t}).Times(1)\n\n\tvar ackRequested *ecsacs.AckRequest\n\ttester.mockWsClient.EXPECT().MakeRequest(gomock.Any()).Do(func(ackRequest *ecsacs.AckRequest) {\n\t\tackRequested = ackRequest\n\t\ttester.cancel()\n\t}).Times(1)\n\n\tgo tester.payloadHandler.start()\n\n\t// Send a payload message\n\tpayloadMessage := &ecsacs.PayloadMessage{\n\t\tTasks: []*ecsacs.Task{\n\t\t\t{\n\t\t\t\tArn: aws.String(\"t1\"),\n\t\t\t},\n\t\t},\n\t\tMessageId: aws.String(payloadMessageId),\n\t}\n\terr := tester.payloadHandler.handleSingleMessage(payloadMessage)\n\tassert.NoError(t, err, \"Error handling payload message\")\n\n\t// Wait till we get an ack from the ackBuffer\n\tselect {\n\tcase <-tester.ctx.Done():\n\t}\n\t// Verify the message id acked\n\tassert.Equal(t, aws.StringValue(ackRequested.MessageId), payloadMessageId, \"received message is not expected\")\n\n\t// Verify if task added == expected task\n\texpectedTask := &apitask.Task{\n\t\tArn: \"t1\",\n\t\tResourcesMapUnsafe: make(map[string][]taskresource.TaskResource),\n\t}\n\tassert.Equal(t, addedTask, expectedTask, \"received task is not expected\")\n}", "title": "" }, { "docid": "7b44fd702f89cfe65fee370ba39a577e", "score": "0.46980822", "text": "func (m_2 *MockPushPull_PullClient) SendMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7b863ba935e99c9bff1d905b43785b07", "score": "0.46927774", "text": "func (m *MockProtocolHandlerInterface) Notify(n ConnectionManagerNotifee) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Notify\", n)\n}", "title": "" }, { "docid": "688c9d3901b9b40b8292b61acc8934d8", "score": "0.4692153", "text": "func (m *MockKOTSHandler) SendCustomApplicationMetrics(w http.ResponseWriter, r *http.Request) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SendCustomApplicationMetrics\", w, r)\n}", "title": "" }, { "docid": "2f58fad8542d90445b5540d6f3bc8cda", "score": "0.46915373", "text": "func (m_2 *MockE2TAdminService_ListRegisteredServiceModelsServer) SendMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "afe58d7c06b5e774946e2e51b34a9809", "score": "0.46901974", "text": "func (_m *EmailTokensQ) MarkSentWelcomeEmail(tid int64) error {\n\tret := _m.Called(tid)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(int64) error); ok {\n\t\tr0 = rf(tid)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "ba3736bbb183c283d38788dab64a0899", "score": "0.4686987", "text": "func (m_2 *MockBackupService_DeleteIncrementalClient) SendMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"SendMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "880458045c116f16594b8d679f54b282", "score": "0.46835527", "text": "func TestHandleMessage(t *testing.T) {\n\tclient := Client{}\n\ttype testData struct {\n\t\tmsg string\n\t\ttestCase string\n\t\texpectFollowCallback bool\n\t\texpectStreamUpdateCallback bool\n\t\texpectStreamOnlineCallback bool\n\t\texpectStreamOfflineCallback bool\n\t\texpectPointsRedemptionCallback bool\n\t\texpectCheerCallback bool\n\t\texpectRaidCallback bool\n\t\texpectSubscriptionCallback bool\n\t\texpectHypeTrainBeginCallback bool\n\t\texpectHypeTrainProgressCallback bool\n\t\texpectHypeTrainEndCallback bool\n\t}\n\n\tdata := []testData{\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"286244d9-c382-4a6e-81ed-5e80bcd2c94e\\\",\\\"event_type\\\":\\\"update\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"title\\\":\\\"foo\\\",\\\"languate\\\":\\\"en\\\",\\\"is_mature\\\":false,\\\"category_id\\\":12345,\\\"category_name\\\":\\\"Science & Technology\\\",\\\"broadcaster_user_id\\\":\\\"47073625\\\",\\\"broadcaster_user_name\\\":\\\"wwsean08\\\",\\\"broadcaster_user_login\\\":\\\"wwsean08\\\"},\\\"created\\\":\\\"2021-05-22T04:56:23.545683+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Stream Update Callback\",\n\t\t\texpectStreamUpdateCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"69db248a-b980-4de6-ad06-b528feb1294e\\\",\\\"event_type\\\":\\\"follow\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"user_name\\\":\\\"FiniteSingularity\\\",\\\"user_id\\\":\\\"\\\",\\\"user_login\\\":\\\"finitesingularity\\\",\\\"broadcaster_user_id\\\":\\\"47073625\\\",\\\"broadcaster_user_name\\\":\\\"wwsean08\\\",\\\"broadcaster_user_login\\\":\\\"wwsean08\\\"},\\\"created\\\":\\\"2021-05-22T05:16:21.506340+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Follow Callback\",\n\t\t\texpectFollowCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"ae567342-62c8-4b45-a41b-7da1472003b9\\\",\\\"event_type\\\":\\\"cheer\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"is_anonymous\\\":false,\\\"user_id\\\":\\\"536397236\\\",\\\"user_name\\\":\\\"FiniteSingularity\\\",\\\"user_login\\\":\\\"finitesingularity\\\",\\\"broadcaster_user_id\\\":\\\"47073625\\\",\\\"broadcaster_user_name\\\":\\\"wwsean08\\\",\\\"broadcaster_user_login\\\":\\\"wwsean08\\\",\\\"bits\\\":1000,\\\"message\\\":\\\"hello world\\\"},\\\"created\\\":\\\"2021-05-22T05:17:40.208431+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Cheer Callback\",\n\t\t\texpectCheerCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"3e62303f-55d3-478d-8f09-c83712e7c3b8\\\",\\\"event_type\\\":\\\"raid\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"from_broadcaster_user_name\\\":\\\"FiniteSingularity\\\",\\\"from_broadcaster_user_id\\\":\\\"536397236\\\",\\\"from_broadcaster_user_login\\\":\\\"finitesingularity\\\",\\\"to_broadcaster_user_id\\\":\\\"47073625\\\",\\\"to_broadcaster_user_login\\\":\\\"wwsean08\\\",\\\"to_broadcaster_user_name\\\":\\\"wwsean08\\\",\\\"viewers\\\":42},\\\"created\\\":\\\"2021-05-22T05:19:05.406987+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Raid Callback\",\n\t\t\texpectRaidCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":null,\\\"event_type\\\":\\\"subscribe\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"data\\\":{\\\"topic\\\":\\\"channel-subscribe-events-v1.47073625\\\",\\\"message\\\":{\\\"benefit_end_month\\\":0,\\\"user_name\\\":\\\"finitesingularity\\\",\\\"display_name\\\":\\\"FiniteSingularity\\\",\\\"channel_name\\\":\\\"wwsean08\\\",\\\"user_id\\\":\\\"536397236\\\",\\\"channel_id\\\":\\\"47073625\\\",\\\"time\\\":\\\"2021-05-22T05:20:06.015Z\\\",\\\"sub_message\\\":{\\\"message\\\":\\\"hello world\\\",\\\"emotes\\\":null},\\\"sub_plan\\\":\\\"1000\\\",\\\"sub_plan_name\\\":\\\"Channel Subscription (wwsean08)\\\",\\\"months\\\":0,\\\"cumulative_months\\\":42,\\\"context\\\":\\\"resub\\\",\\\"is_gift\\\":false,\\\"multi_month_duration\\\":0,\\\"streak_months\\\":42}},\\\"type\\\":\\\"MESSAGE\\\"},\\\"created\\\":\\\"2021-05-22T05:20:06.120452+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Subscription Callback\",\n\t\t\texpectSubscriptionCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"78e4825d-7496-44a5-b4f2-d71af9f040d8\\\",\\\"event_type\\\":\\\"stream-online\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"id\\\":\\\"9001\\\",\\\"broadcaster_user_id\\\":\\\"1337\\\",\\\"broadcaster_user_login\\\":\\\"cool_user\\\",\\\"broadcaster_user_name\\\":\\\"Cool_User\\\",\\\"type\\\":\\\"live\\\",\\\"started_at\\\":\\\"2020-10-11T10:11:12.123Z\\\"},\\\"created\\\":\\\"2021-05-22T20:36:07.969806+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Stream Online Callback\",\n\t\t\texpectStreamOnlineCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"097896c2-9de8-4840-bcdf-7bc5cada9c28\\\",\\\"event_type\\\":\\\"stream-offline\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"broadcaster_user_id\\\":\\\"1337\\\",\\\"broadcaster_user_login\\\":\\\"cool_user\\\",\\\"broadcaster_user_name\\\":\\\"Cool_User\\\"},\\\"created\\\":\\\"2021-05-22T20:36:07.969806+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Stream Offline Callback\",\n\t\t\texpectStreamOfflineCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"a4fc9436-74f6-438a-9cc0-5f3c9bce76cf\\\",\\\"event_type\\\":\\\"hype-train-begin\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"broadcaster_user_id\\\":\\\"1337\\\",\\\"broadcaster_user_login\\\":\\\"cool_user\\\",\\\"broadcaster_user_name\\\":\\\"Cool_User\\\",\\\"total\\\":137,\\\"progress\\\":137,\\\"goal\\\":500,\\\"top_contributions\\\":[{\\\"user_id\\\":\\\"123\\\",\\\"user_login\\\":\\\"pogchamp\\\",\\\"user_name\\\":\\\"PogChamp\\\",\\\"type\\\":\\\"bits\\\",\\\"total\\\":50},{\\\"user_id\\\":\\\"456\\\",\\\"user_login\\\":\\\"kappa\\\",\\\"user_name\\\":\\\"Kappa\\\",\\\"type\\\":\\\"subscription\\\",\\\"total\\\":45}],\\\"last_contribution\\\":{\\\"user_id\\\":\\\"123\\\",\\\"user_login\\\":\\\"pogchamp\\\",\\\"user_name\\\":\\\"PogChamp\\\",\\\"type\\\":\\\"bits\\\",\\\"total\\\":50},\\\"started_at\\\":\\\"2020-07-15T17:16:03.17106713Z\\\",\\\"expires_at\\\":\\\"2020-07-15T17:16:11.17106713Z\\\"},\\\"created\\\":\\\"2021-05-22T20:36:07.969806+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Hype Train Begin Callback\",\n\t\t\texpectHypeTrainBeginCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"25c54242-154e-44d0-8d52-8a91c783bca4\\\",\\\"event_type\\\":\\\"hype-train-progress\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"broadcaster_user_id\\\":\\\"1337\\\",\\\"broadcaster_user_login\\\":\\\"cool_user\\\",\\\"broadcaster_user_name\\\":\\\"Cool_User\\\",\\\"level\\\":2,\\\"total\\\":700,\\\"progress\\\":200,\\\"goal\\\":1000,\\\"top_contributions\\\":[{\\\"user_id\\\":\\\"123\\\",\\\"user_login\\\":\\\"pogchamp\\\",\\\"user_name\\\":\\\"PogChamp\\\",\\\"type\\\":\\\"bits\\\",\\\"total\\\":50},{\\\"user_id\\\":\\\"456\\\",\\\"user_login\\\":\\\"kappa\\\",\\\"user_name\\\":\\\"Kappa\\\",\\\"type\\\":\\\"subscription\\\",\\\"total\\\":45}],\\\"last_contribution\\\":{\\\"user_id\\\":\\\"123\\\",\\\"user_login\\\":\\\"pogchamp\\\",\\\"user_name\\\":\\\"PogChamp\\\",\\\"type\\\":\\\"bits\\\",\\\"total\\\":50},\\\"started_at\\\":\\\"2020-07-15T17:16:03.17106713Z\\\",\\\"expires_at\\\":\\\"2020-07-15T17:16:11.17106713Z\\\"},\\\"created\\\":\\\"2021-05-22T20:36:07.969806+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Hype Train Progress Callback\",\n\t\t\texpectHypeTrainProgressCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"f46bdbdc-4890-4199-9e7d-34f4ee9c2bdd\\\",\\\"event_type\\\":\\\"hype-train-end\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"broadcaster_user_id\\\":\\\"1337\\\",\\\"broadcaster_user_login\\\":\\\"cool_user\\\",\\\"broadcaster_user_name\\\":\\\"Cool_User\\\",\\\"level\\\":2,\\\"total\\\":137,\\\"top_contributions\\\":[{\\\"user_id\\\":\\\"123\\\",\\\"user_login\\\":\\\"pogchamp\\\",\\\"user_name\\\":\\\"PogChamp\\\",\\\"type\\\":\\\"bits\\\",\\\"total\\\":50},{\\\"user_id\\\":\\\"456\\\",\\\"user_login\\\":\\\"kappa\\\",\\\"user_name\\\":\\\"Kappa\\\",\\\"type\\\":\\\"subscription\\\",\\\"total\\\":45}],\\\"started_at\\\":\\\"2020-07-15T17:16:03.17106713Z\\\",\\\"ended_at\\\":\\\"2020-07-15T17:16:11.17106713Z\\\",\\\"cooldown_ends_at\\\":\\\"2020-07-15T18:16:11.17106713Z\\\"},\\\"created\\\":\\\"2021-05-22T20:36:07.969806+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Hype Train End Callback\",\n\t\t\texpectHypeTrainEndCallback: true,\n\t\t},\n\t\t{\n\t\t\tmsg: \"{\\\"id\\\":null,\\\"event_id\\\":\\\"4dc3e5c5-3e38-4d2d-bfe2-9c89c65a8c2a\\\",\\\"event_type\\\":\\\"point-redemption\\\",\\\"event_source\\\":\\\"TestCall\\\",\\\"event_data\\\":{\\\"broadcaster_user_id\\\":\\\"47073625\\\",\\\"broadcaster_user_name\\\":\\\"wwsean08\\\",\\\"broadcaster_user_login\\\":\\\"wwsean08\\\",\\\"id\\\":\\\"649995ea-b88b-446d-a011-0cc183588bd4\\\",\\\"user_name\\\":\\\"FiniteSingularity\\\",\\\"user_id\\\":1234,\\\"user_login\\\":\\\"finitesingularity\\\",\\\"user_input\\\":\\\"\\\",\\\"status\\\":\\\"unfilled\\\",\\\"redeemed_at\\\":\\\"2021-05-22T20:36:06.427Z\\\",\\\"reward\\\":{\\\"id\\\":\\\"3859c466-8cff-4480-9e9e-b7e9814b405d\\\",\\\"title\\\":\\\"Free tier 1 sub\\\",\\\"prompt\\\":\\\"Sean will gift you a tier one sub to his channel for one month\\\",\\\"cost\\\":20000}},\\\"created\\\":\\\"2021-05-22T20:36:07.969806+00:00\\\",\\\"origin\\\":\\\"test\\\"}\",\n\t\t\ttestCase: \"Expect Points Redemption Callback\",\n\t\t\texpectPointsRedemptionCallback: true,\n\t\t},\n\t}\n\n\tfor _, test := range data {\n\t\tfollowCallback := func(msg *FollowMsg) {\n\t\t\trequire.True(t, test.expectFollowCallback, test.testCase)\n\t\t}\n\t\tstreamUpdateCallback := func(msg *StreamUpdateMsg) {\n\t\t\trequire.True(t, test.expectStreamUpdateCallback, test.testCase)\n\t\t}\n\t\tcheerCallback := func(msg *CheerMsg) {\n\t\t\trequire.True(t, test.expectCheerCallback, test.testCase)\n\t\t}\n\t\traidCallback := func(msg *RaidMsg) {\n\t\t\trequire.True(t, test.expectRaidCallback, test.testCase)\n\t\t}\n\t\tsubCallback := func(msg *SubscriptionMsg) {\n\t\t\trequire.True(t, test.expectSubscriptionCallback, test.testCase)\n\t\t}\n\t\thypeTrainBegin := func(msg *HypeTrainBeginMsg) {\n\t\t\trequire.True(t, test.expectHypeTrainBeginCallback, test.testCase)\n\t\t}\n\t\thypeTrainProgress := func(msg *HypeTrainProgressMsg) {\n\t\t\trequire.True(t, test.expectHypeTrainProgressCallback, test.testCase)\n\t\t}\n\t\thypeTrainEnded := func(msg *HypeTrainEndedMsg) {\n\t\t\trequire.True(t, test.expectHypeTrainEndCallback, test.testCase)\n\t\t}\n\t\tstreamOnline := func(msg *StreamOnlineMsg) {\n\t\t\trequire.True(t, test.expectStreamOnlineCallback, test.testCase)\n\t\t}\n\t\tstreamOffline := func(msg *StreamOfflineMsg) {\n\t\t\trequire.True(t, test.expectStreamOfflineCallback, test.testCase)\n\t\t}\n\t\tpointsCallback := func(msg *PointsRedemptionMsg) {\n\t\t\trequire.True(t, test.expectPointsRedemptionCallback, test.testCase)\n\t\t}\n\t\tclient.SetFollowCallback(followCallback)\n\t\tclient.SetStreamUpdateCallback(streamUpdateCallback)\n\t\tclient.SetCheerCallback(cheerCallback)\n\t\tclient.SetRaidCallback(raidCallback)\n\t\tclient.SetSubscriptionCallback(subCallback)\n\t\tclient.SetHypeTrainBeginCallback(hypeTrainBegin)\n\t\tclient.SetHypeTrainProgressCallback(hypeTrainProgress)\n\t\tclient.SetHypeTrainEndedCallback(hypeTrainEnded)\n\t\tclient.SetStreamOnlineCallback(streamOnline)\n\t\tclient.SetStreamOfflineCallback(streamOffline)\n\t\tclient.SetPointsRedemptionCallback(pointsCallback)\n\n\t\tclient.handleMessage([]byte(test.msg))\n\t}\n}", "title": "" }, { "docid": "e3207667a05f1e54a510f2e04ac38837", "score": "0.468307", "text": "func (_m *Client) SendMessage(ctx context.Context, recipient crypto.PubKey, body []byte) (*usersclient.Message, error) {\n\tret := _m.Called(ctx, recipient, body)\n\n\tvar r0 *usersclient.Message\n\tif rf, ok := ret.Get(0).(func(context.Context, crypto.PubKey, []byte) *usersclient.Message); ok {\n\t\tr0 = rf(ctx, recipient, body)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*usersclient.Message)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, crypto.PubKey, []byte) error); ok {\n\t\tr1 = rf(ctx, recipient, body)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "571d774dbe37b4f3688ea8bb4c1d1081", "score": "0.46803287", "text": "func (_m *BrokerInterface) Publish(_a0 string, _a1 interface{}, _a2 amqp.Table) error {\n\tret := _m.Called(_a0, _a1, _a2)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, interface{}, amqp.Table) error); ok {\n\t\tr0 = rf(_a0, _a1, _a2)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" } ]
97b4835a6f24895c0141f57f37f54753
SerializeTo serializes a Puzzle into bytes.
[ { "docid": "8b45bd6d129f5e4e94a6cf5f789ffcab", "score": "0.75845796", "text": "func (p *Puzzle) SerializeTo(b []byte) error {\r\n\tp.Header.Contents = make([]byte, p.Len()-4)\r\n\tp.Header.Contents[0] = p.NoOfK\r\n\tp.Header.Contents[1] = p.Lifetime\r\n\tbinary.BigEndian.PutUint16(p.Header.Contents[2:4], p.Opaque)\r\n\tcopy(p.Header.Contents[4:], p.Random)\r\n\r\n\treturn p.Header.SerializeTo(b)\r\n}", "title": "" } ]
[ { "docid": "3f8b9ebf728b64a6a8a4d28e891991ae", "score": "0.78362846", "text": "func (p *Puzzle) Serialize() ([]byte, error) {\r\n\tb := make([]byte, p.Len())\r\n\tif err := p.SerializeTo(b); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn b, nil\r\n}", "title": "" }, { "docid": "b3cd05be0528680c0d20af443cac1e09", "score": "0.54687893", "text": "func (pg *ProblemGraph) Serialize() []byte {\n\tvar result bytes.Buffer\n\tencoder := gob.NewEncoder(&result)\n\n\terr := encoder.Encode(pg)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\treturn result.Bytes()\n}", "title": "" }, { "docid": "cb8ee25386ec0c35e02278e83d993857", "score": "0.5398909", "text": "func (im IPMask) ToBytes() []byte {\n\tif len(im) > net.IPv4len {\n\t\treturn im[:net.IPv4len]\n\t}\n\treturn im\n}", "title": "" }, { "docid": "f8e9ac2ee03ae124db23f68e0920f296", "score": "0.538296", "text": "func (p *Poll) EncodeToByte() []byte {\n\tb, _ := json.Marshal(p)\n\treturn b\n}", "title": "" }, { "docid": "41f71f373b13b51ce88ad212932e9e8d", "score": "0.5346716", "text": "func (pt MDTurbo) Serialize() ([PartitionBlkLen]uint8, error) {\n\treturn Serialize(pt)\n}", "title": "" }, { "docid": "04367435be75805a3dd02dac70c5e268", "score": "0.5305577", "text": "func (topicInfo TopicInfo) ToBytes() []byte {\n\tdata, err := protobuf.Marshal(topicInfo._ToProtobuf())\n\tif err != nil {\n\t\treturn make([]byte, 0)\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "c143c10fa59551c723eebd6bd21a7ab0", "score": "0.52281725", "text": "func (f *Fzp) ToYAML() ([]byte, error) {\n\tdata, err := yaml.Marshal(f)\n\treturn data, err\n}", "title": "" }, { "docid": "0542b44b71ee5d9ef523dcffe956b2b1", "score": "0.51738274", "text": "func (r Routes) ToBytes() []byte {\n\tbuf := uio.NewBigEndianBuffer(nil)\n\tfor _, route := range r {\n\t\troute.Marshal(buf)\n\t}\n\treturn buf.Data()\n}", "title": "" }, { "docid": "d3e517025ae00ff89852f2ab58bd96ae", "score": "0.5162722", "text": "func (p *Proof) ProofBytes() []byte {\n\tbuff := new(bytes.Buffer)\n\n\t// The solution we serialise depends on the size of the cuckoo graph. The\n\t// cycle is always of length 42, but each vertex takes up more bits on\n\t// larger graphs, nonceLengthBits is this number of bits.\n\tnonceLengthBits := uint(p.EdgeBits)\n\n\t// Make a slice just large enough to fit all of the POW bits.\n\tbitvecLengthBits := nonceLengthBits * uint(ProofSize)\n\tbitvec := make([]uint8, (bitvecLengthBits+7)/8)\n\n\tfor n, nonce := range p.Nonces {\n\t\t// Pack this nonce into the bit stream.\n\t\tfor bit := uint(0); bit < nonceLengthBits; bit++ {\n\t\t\t// If this bit is set, then write it to the correct position in the\n\t\t\t// stream.\n\t\t\tif nonce&(1<<bit) != 0 {\n\t\t\t\toffsetBits := uint(n)*nonceLengthBits + bit\n\t\t\t\tbitvec[offsetBits/8] |= 1 << (offsetBits % 8)\n\t\t\t}\n\t\t}\n\t}\n\n\tif _, err := buff.Write(bitvec); err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\treturn buff.Bytes()\n}", "title": "" }, { "docid": "880ed133d82a571caa1994decf146aab", "score": "0.5098555", "text": "func (op *optDNS) ToBytes() []byte {\n\tbuf := uio.NewBigEndianBuffer(nil)\n\tfor _, ns := range op.NameServers {\n\t\tbuf.WriteBytes(ns.To16())\n\t}\n\treturn buf.Data()\n}", "title": "" }, { "docid": "61a0be225214817e0780df44131b5894", "score": "0.5076523", "text": "func (ds *DepositToStake) Serialize() []byte {\n\treturn byteutil.Must(proto.Marshal(ds.Proto()))\n}", "title": "" }, { "docid": "f7f7cb85166078afc0ded92e977a8615", "score": "0.506668", "text": "func (m *PlannerAssignedToTaskBoardTaskFormat) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.Entity.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteObjectValue(\"orderHintsByAssignee\", m.GetOrderHintsByAssignee())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"unassignedOrderHint\", m.GetUnassignedOrderHint())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "024f2cce8695aeb1d3c0594c23507b66", "score": "0.50524867", "text": "func ToBytes(data Data) ([]byte, error) {\n\tbyteData, err := yaml.Marshal(data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not marshal config data: %w\", err)\n\t}\n\treturn byteData, nil\n}", "title": "" }, { "docid": "0c8fc3f65e7b0b287df2c322aa721fcb", "score": "0.4997329", "text": "func (mp *MerkleProof) ToBytes() ([]byte, error) {\r\n\tindex := bt.VarInt(mp.Index)\r\n\r\n\ttxOrID, err := hex.DecodeString(mp.TxOrID)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\ttxOrID = bt.ReverseBytes(txOrID)\r\n\r\n\ttarget, err := hex.DecodeString(mp.Target)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\ttarget = bt.ReverseBytes(target)\r\n\r\n\tnodeCount := len(mp.Nodes)\r\n\r\n\tnodes := []byte{}\r\n\r\n\tfor _, n := range mp.Nodes {\r\n\t\tif n == \"*\" {\r\n\t\t\tnodes = append(nodes, []byte{1}...)\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\tnodes = append(nodes, []byte{0}...)\r\n\t\tnb, err := hex.DecodeString(n)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t\tnodes = append(nodes, bt.ReverseBytes(nb)...)\r\n\r\n\t}\r\n\r\n\tvar flags uint8\r\n\r\n\tvar txLength []byte\r\n\tif len(mp.TxOrID) > 64 { // tx bytes instead of txid\r\n\t\t// set bit at index 0\r\n\t\tflags |= (1 << 0)\r\n\r\n\t\ttxLength = bt.VarInt(uint64(len(txOrID)))\r\n\t}\r\n\r\n\tif mp.TargetType == \"header\" {\r\n\t\t// set bit at index 1\r\n\t\tflags |= (1 << 1)\r\n\t} else if mp.TargetType == \"merkleRoot\" {\r\n\t\t// set bit at index 2\r\n\t\tflags |= (1 << 2)\r\n\t}\r\n\r\n\t// ignore proofType and compositeType for this version\r\n\r\n\tbytes := []byte{}\r\n\tbytes = append(bytes, flags)\r\n\tbytes = append(bytes, index...)\r\n\tbytes = append(bytes, txLength...)\r\n\tbytes = append(bytes, txOrID...)\r\n\tbytes = append(bytes, target...)\r\n\tbytes = append(bytes, byte(nodeCount))\r\n\tbytes = append(bytes, nodes...)\r\n\r\n\treturn bytes, nil\r\n}", "title": "" }, { "docid": "4a0f5b88783313e6bba4cdb2ab8e16bf", "score": "0.49931902", "text": "func (s Serializer) ToBytes(i any) []byte {\n\tret, err := s.ToBytesErr(i)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "d02b227d395ad8b85f6e7f0eaf9c8ea1", "score": "0.49859965", "text": "func (b *BitSet) WriteTo(ctx context.Context, w io.Writer) error {\n\tvar err error\n\n\t// Write length of the data to follow.\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tb.prune()\n\n\tlb := len(b.set)\n\tlb *= 2 * binary.Size(uint64(0))\n\terr = binary.Write(w, binary.BigEndian, uint32(lb))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor key, value := range b.set {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\t{\n\t\t\t\treturn nil\n\t\t\t}\n\t\tdefault:\n\t\t\terr = binary.Write(w, binary.BigEndian, key)\n\t\t\tif err != nil {\n\t\t\t\t//return int64(binary.Size(uint32(0))), err\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = binary.Write(w, binary.BigEndian, value)\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": "552bad29751920c9bac746a57724429a", "score": "0.49790263", "text": "func (g *Generic) SerializeTo(b []byte) error {\n\tlog.Println(\"DEPRECATED: MarshalTo instead\")\n\treturn g.MarshalTo(b)\n}", "title": "" }, { "docid": "a58cfca97d86b8a47b21e61c29ea7c6d", "score": "0.49773934", "text": "func (d *DNS) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {\n\tdsz := 0\n\tfor _, q := range d.Questions {\n\t\tdsz += len(q.Name) + 6\n\t}\n\tdsz += computeSize(d.Answers)\n\tdsz += computeSize(d.Authorities)\n\tdsz += computeSize(d.Additionals)\n\n\tbytes, err := b.PrependBytes(12 + dsz)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbinary.BigEndian.PutUint16(bytes, d.ID)\n\tbytes[2] = byte((b2i(d.QR) << 7) | (int(d.OpCode) << 3) | (b2i(d.AA) << 2) | (b2i(d.TC) << 1) | b2i(d.RD))\n\tbytes[3] = byte((b2i(d.RA) << 7) | (int(d.Z) << 4) | int(d.ResponseCode))\n\n\tif opts.FixLengths {\n\t\td.QDCount = uint16(len(d.Questions))\n\t\td.ANCount = uint16(len(d.Answers))\n\t\td.NSCount = uint16(len(d.Authorities))\n\t\td.ARCount = uint16(len(d.Additionals))\n\t}\n\tbinary.BigEndian.PutUint16(bytes[4:], d.QDCount)\n\tbinary.BigEndian.PutUint16(bytes[6:], d.ANCount)\n\tbinary.BigEndian.PutUint16(bytes[8:], d.NSCount)\n\tbinary.BigEndian.PutUint16(bytes[10:], d.ARCount)\n\n\toff := 12\n\tfor _, qd := range d.Questions {\n\t\tn := qd.encode(bytes, off)\n\t\toff += n\n\t}\n\n\tfor i := range d.Answers {\n\t\t// done this way so we can modify DNSResourceRecord to fix\n\t\t// lengths if requested\n\t\tqa := &d.Answers[i]\n\t\tn, err := qa.encode(bytes, off, opts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toff += n\n\t}\n\n\tfor i := range d.Authorities {\n\t\tqa := &d.Authorities[i]\n\t\tn, err := qa.encode(bytes, off, opts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toff += n\n\t}\n\tfor i := range d.Additionals {\n\t\tqa := &d.Additionals[i]\n\t\tn, err := qa.encode(bytes, off, opts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toff += n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6d1d7675b940c066f86e1de9321f2e73", "score": "0.4962915", "text": "func (t *SPOTuple) Serialize() []byte {\n\n\tout, err := proto.Marshal(t)\n\tif err != nil {\n\t\tlog.Println(\"tuple-serialize: protobuf encoding error: \", err)\n\t}\n\treturn out\n\n}", "title": "" }, { "docid": "22703a6525d4e342be5b7214004deae1", "score": "0.48888347", "text": "func (d *dataUsageCache) serializeTo(dst io.Writer) error {\n\t// Add version and compress.\n\t_, err := dst.Write([]byte{dataUsageCacheVerCurrent})\n\tif err != nil {\n\t\treturn err\n\t}\n\tenc, err := zstd.NewWriter(dst,\n\t\tzstd.WithEncoderLevel(zstd.SpeedFastest),\n\t\tzstd.WithWindowSize(1<<20),\n\t\tzstd.WithEncoderConcurrency(2))\n\tif err != nil {\n\t\treturn err\n\t}\n\tmEnc := msgp.NewWriter(enc)\n\terr = d.EncodeMsg(mEnc)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = mEnc.Flush()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = enc.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b275cab1f23be516d766e4edbe3e3f4", "score": "0.4878253", "text": "func (p *PublicKey) Serialize() []byte {\n\treturn p.pk().SerializeCompressed()\n}", "title": "" }, { "docid": "5babca5343dec0f64ba2ee7ba4dd49c8", "score": "0.48684955", "text": "func (m *BusinessScenarioPlanner) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.Entity.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteObjectValue(\"planConfiguration\", m.GetPlanConfiguration())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteObjectValue(\"taskConfiguration\", m.GetTaskConfiguration())\n if err != nil {\n return err\n }\n }\n if m.GetTasks() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetTasks()))\n for i, v := range m.GetTasks() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"tasks\", cast)\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "6bd01fc1218da9608d37c47570fed5db", "score": "0.48403212", "text": "func (p *Packet) ToByteArray(buffer []byte) []byte {\n\n\t// ATM this is not insanely valid as checksum calc needs to happen\n\t// but since were just swapping the IP src and dest the checksum is valid\n\tdest := []byte{buffer[12], buffer[13], buffer[14], buffer[15]}\n\tsrc := []byte{buffer[16], buffer[17], buffer[18], buffer[19]}\n\n\t// Swap Src and Dest\n\tbyteLocation := 12\n\tfor i := 0; i < len(dest); i++ {\n\t\tbuffer[byteLocation] = src[i]\n\t\tbuffer[byteLocation+4] = dest[i]\n\t\tbyteLocation++\n\t}\n\n\treturn buffer\n\n}", "title": "" }, { "docid": "8197a4b4921e3ca753654b8d055912ad", "score": "0.48326507", "text": "func (s *StringArray) SerializeTo(b []byte) error {\n\tvar offset = 4\n\tbinary.LittleEndian.PutUint32(b[:4], uint32(s.ArraySize))\n\n\tfor _, ss := range s.Strings {\n\t\tif err := ss.SerializeTo(b[offset:]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\toffset += ss.Len()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "60a461fdfd878d9c2f0baf3e71aba4f7", "score": "0.48307848", "text": "func (pb *PutBlock) Serialize() []byte {\n\treturn byteutil.Must(proto.Marshal(pb.Proto()))\n}", "title": "" }, { "docid": "d714349f5ede6f1a3a449111c27f0255", "score": "0.4824154", "text": "func (a *AttributeEndorsement) ToBytes() []byte {\n\tif bytes, err := json.Marshal(a); err != nil {\n\t\tlogger.Debug(\"Failed to json serialize: %s\", err)\n\t\treturn nil\n\t} else {\n\t\treturn bytes\n\t}\n}", "title": "" }, { "docid": "c63d2ce3ff20c74cf42e95f1f3ed7565", "score": "0.4821046", "text": "func (bm tsidbitmap) ToBytes() []byte {\n\t// Use little endian so layout is the same no matter what word size we're using.\n\tout := make([]byte, 8*len(bm))\n\tfor i, v := range bm {\n\t\tbinary.LittleEndian.PutUint64(out[i*8:], v)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "467b6fdff57772c0b8aa0a85d6f444ae", "score": "0.47860375", "text": "func (ti TypeItem) ToBytes() []byte {\n\treqBodyBytes := new(bytes.Buffer)\n\tjson.NewEncoder(reqBodyBytes).Encode(ti)\n\treturn reqBodyBytes.Bytes()\n}", "title": "" }, { "docid": "89c69f01c90aba1e5878110d5127cbc1", "score": "0.4785974", "text": "func (t *Trie) WriteToBytes(writer io.Writer) error {\n\treturn gob.NewEncoder(writer).Encode(t)\n}", "title": "" }, { "docid": "9ad90599d90b8fff93023bf863c99d30", "score": "0.47858968", "text": "func (s *String) SerializeTo(b []byte) error {\n\tif len(b) < s.Len() {\n\t\treturn errors.NewErrInvalidLength(s, \"bytes should be longer\")\n\t}\n\n\tbinary.LittleEndian.PutUint32(b[:4], uint32(s.Length))\n\tcopy(b[4:s.Len()], s.Value)\n\n\treturn nil\n}", "title": "" }, { "docid": "3a3c9ff0640c0e00731cc33d7a2ef97a", "score": "0.47741345", "text": "func (ba *FilterBitArray) ToBytes() []byte {\n\treturn *ba\n}", "title": "" }, { "docid": "d54def2de3535b8384050168b35fc589", "score": "0.4763823", "text": "func (p *PublicKey) Serialize() []byte {\n\treturn (*btcec.PublicKey)(p).SerializeCompressed()\n}", "title": "" }, { "docid": "94b8bebd55048388248abc7829813560", "score": "0.47605342", "text": "func (p *Proof) Bytes() []byte {\n\tbuff := new(bytes.Buffer)\n\n\t// Write size of cuckoo graph.\n\tif err := binary.Write(buff, binary.BigEndian, p.EdgeBits); err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tbuff.Write(p.ProofBytes())\n\n\treturn buff.Bytes()\n}", "title": "" }, { "docid": "1c315d37f72bf7bb3a5840caafa8cd0f", "score": "0.47484055", "text": "func (s *Set) WriteTo(w io.Writer) (int64, error) {\n\tbits, err := proto.Marshal(s.Encode())\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tnw, err := w.Write(bits)\n\treturn int64(nw), err\n}", "title": "" }, { "docid": "725eac5386627ec5e4af7e42dea68f22", "score": "0.4738753", "text": "func (rs *Restake) Serialize() []byte {\n\treturn byteutil.Must(proto.Marshal(rs.Proto()))\n}", "title": "" }, { "docid": "fa92f373864ecdbe918a9538e9220add", "score": "0.47220048", "text": "func (n ByteArray) Serialize() *bytes.Buffer {\n\tbuffer := bytes.NewBuffer([]byte{})\n\twriteByteArray([]byte(n), buffer)\n\treturn buffer\n}", "title": "" }, { "docid": "084debc201f1a6e7870b740bbbf8a774", "score": "0.47190434", "text": "func ToBytes(inter interface{}) []byte {\n\treqBodyBytes := new(bytes.Buffer)\n\tjson.NewEncoder(reqBodyBytes).Encode(inter)\n\tfmt.Println(reqBodyBytes.Bytes()) // this is the []byte\n\tfmt.Println(string(reqBodyBytes.Bytes())) // converted back to show it's your original object\n\treturn reqBodyBytes.Bytes()\n}", "title": "" }, { "docid": "16401634d579191980c3be14ff7d8b94", "score": "0.47183248", "text": "func (pub *PublicKey) ToBytes() (b []byte) {\n\t/* See Certicom SEC1 2.3.3, pg. 10 */\n\n\tx := pub.X.Bytes()\n\n\t/* Pad X to 32-bytes */\n\tpadded_x := append(bytes.Repeat([]byte{0x3f}, 32-len(x)), x...)\n\n\t/* Add prefix 0x02 or 0x03 depending on ylsb */\n\tif pub.Y.Bit(0) == 0 {\n\t\treturn append([]byte{0x02}, padded_x...)\n\t}\n\n\treturn append([]byte{0x03}, padded_x...)\n}", "title": "" }, { "docid": "bcc47a0bfa38cf6f7ce5682b53b0d152", "score": "0.47148016", "text": "func (f Fixed) WriteTo(w io.ByteWriter) error {\n\treturn writeVarint(w, f.fp)\n}", "title": "" }, { "docid": "f2d3aa78e2edf27d658639b6850887b0", "score": "0.47147286", "text": "func (puzzle Puzzle) String() string {\n\ts := \"\"\n\tfor _, row := range puzzle {\n\t\tfor _, x := range row {\n\t\t\tswitch x {\n\t\t\tcase X:\n\t\t\t\ts += \"X \"\n\t\t\tcase 0:\n\t\t\t\ts += \"0 \"\n\t\t\tcase 1:\n\t\t\t\ts += \"1 \"\n\t\t\tdefault: // invalid!\n\t\t\t\ts += \"? \"\n\t\t\t}\n\t\t}\n\t\ts += \"\\n\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "49c03f8b0b5175968ba7c5ae21e525e8", "score": "0.47129685", "text": "func ToJSONBytes(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "a39664605a51ad7f6cb794963e49769e", "score": "0.47119918", "text": "func (pf *PhotonFile) EncodeTo(writer io.Writer) error {\n\n\terr := error(nil)\n\tpreviewData := U16ToU8Slice(encodePreview(pf.PreviewImage))\n\tthumbnailData := U16ToU8Slice(encodePreview(pf.ThumbnailImage))\n\n\t/*\n\t\tpreviewData, err := ioutil.ReadFile(\"saved_preview_835x321.bin\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tthumbnailData, err := ioutil.ReadFile(\"saved_thumbnail_199x72.bin\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t*/\n\n\tvar layerDatas [][]byte\n\tfor i := 0; i < len(pf.Layers); i++ {\n\t\tlayerDatas = append(layerDatas, pf.Layers[i].RawData)\n\t}\n\n\t// Pre-calculate offsets so that we don't have to fixup the offset fields later.\n\tpos := 0\n\tpos += binary.Size(binCompatFileHeader{})\n\n\t// Preview offsets\n\tpreviewHeaderOffset := pos\n\tpos += binary.Size(binCompatPreviewHeader{})\n\tpreviewDataOffset := pos\n\tpos += len(previewData)\n\n\t// Thumbnail offsets\n\tthumbnailHeaderOffset := pos\n\tpos += binary.Size(binCompatPreviewHeader{})\n\tthumbnailDataOffset := pos\n\tpos += len(thumbnailData)\n\n\t// Layer headers offsets\n\tvar layerHeaderOffsets []int\n\tfor i := 0; i < len(pf.Layers); i++ {\n\t\tlayerHeaderOffsets = append(layerHeaderOffsets, pos)\n\t\tpos += binary.Size(binCompatLayerHeader{})\n\t}\n\n\t// Layer data offsets\n\tvar layerDataOffsets []int\n\tfor i := 0; i < len(pf.Layers); i++ {\n\t\tlayerDataOffsets = append(layerDataOffsets, pos)\n\t\tpos += len(layerDatas[i])\n\t}\n\n\t// Start forming and writing the file from here\n\theader := binCompatFileHeader{\n\t\tMagic1: 0x12FD0019,\n\t\tMagic2: 0x01,\n\t\tPlateX: pf.PlateX,\n\t\tPlateY: pf.PlateY,\n\t\tPlateZ: pf.PlateZ,\n\t\tLayerThickness: pf.LayerThickness,\n\t\tNormalExposureTime: pf.NormalExposureTime,\n\t\tBottomExposureTime: pf.BottomExposureTime,\n\t\tOffTime: pf.OffTime,\n\t\tBottomLayers: pf.BottomLayers,\n\t\tScreenHeight: pf.ScreenHeight,\n\t\tScreenWidth: pf.ScreenWidth,\n\t\tPreviewHeaderOffset: uint32(previewHeaderOffset),\n\t\tLayerHeadersOffset: uint32(layerHeaderOffsets[0]),\n\t\tTotalLayers: uint32(len(pf.Layers)),\n\t\tPreviewThumbnailHeaderOffset: uint32(thumbnailHeaderOffset),\n\t\tLightCuringType: pf.LightCuringType,\n\t}\n\n\tpreviewHeader := binCompatPreviewHeader{\n\t\tWidth:/*835, // */ uint32(pf.PreviewImage.Bounds().Max.X),\n\t\tHeight:/*321, //*/ uint32(pf.PreviewImage.Bounds().Max.Y),\n\t\tPreviewDataOffset: uint32(previewDataOffset),\n\t\tPreviewDataSize: uint32(len(previewData)),\n\t}\n\n\tthumbnailHeader := binCompatPreviewHeader{\n\t\tWidth:/*199, //*/ uint32(pf.ThumbnailImage.Bounds().Max.X),\n\t\tHeight:/*72, //*/ uint32(pf.ThumbnailImage.Bounds().Max.Y),\n\t\tPreviewDataOffset: uint32(thumbnailDataOffset),\n\t\tPreviewDataSize: uint32(len(thumbnailData)),\n\t}\n\n\tvar layerHeaders []binCompatLayerHeader\n\tfor idx, l := range pf.Layers {\n\t\tlayerHeaders = append(layerHeaders, binCompatLayerHeader{\n\t\t\tAbsoluteHeight: l.AbsoluteHeight,\n\t\t\tExposureTime: l.ExposureTime,\n\t\t\tPerLayerOffTime: l.PerLayerOffTime,\n\t\t\tImageDataOffset: uint32(layerDataOffsets[idx]),\n\t\t\tImageDataSize: uint32(len(layerDatas[idx])),\n\t\t})\n\t}\n\n\terr = binary.Write(writer, binary.LittleEndian, header)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(writer, binary.LittleEndian, previewHeader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(writer, binary.LittleEndian, previewData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(writer, binary.LittleEndian, thumbnailHeader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(writer, binary.LittleEndian, thumbnailData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = binary.Write(writer, binary.LittleEndian, layerHeaders)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, s := range layerDatas {\n\t\terr = binary.Write(writer, binary.LittleEndian, s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "63b33d41f002a9f06aa11f2ff6a7a137", "score": "0.47102907", "text": "func (space *Space) ToByte() []byte {\n\traw, _ := json.Marshal(space)\n\treturn raw\n}", "title": "" }, { "docid": "195b40038cc359e068e00a64a3b1413d", "score": "0.46998334", "text": "func (p *TOMLParser) ToBytes(value interface{}, options ...ReadWriteOption) ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\n\tenc := toml.NewEncoder(buf)\n\n\tcolourise := false\n\n\tfor _, o := range options {\n\t\tswitch o.Key {\n\t\tcase OptionIndent:\n\t\t\tif indent, ok := o.Value.(string); ok {\n\t\t\t\tenc.Indent = indent\n\t\t\t}\n\t\tcase OptionColourise:\n\t\t\tif value, ok := o.Value.(bool); ok {\n\t\t\t\tcolourise = value\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch d := value.(type) {\n\tcase SingleDocument:\n\t\tif err := enc.Encode(d.Document()); err != nil {\n\t\t\tif err.Error() == errStr {\n\t\t\t\tbuf.Write([]byte(fmt.Sprintf(\"%v\\n\", d.Document())))\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\tcase MultiDocument:\n\t\tfor _, dd := range d.Documents() {\n\t\t\tif err := enc.Encode(dd); err != nil {\n\t\t\t\tif err.Error() == errStr {\n\t\t\t\t\tbuf.Write([]byte(fmt.Sprintf(\"%v\\n\", dd)))\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tif err := enc.Encode(d); err != nil {\n\t\t\tif err.Error() == errStr {\n\t\t\t\tbuf.Write([]byte(fmt.Sprintf(\"%v\\n\", d)))\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif colourise {\n\t\tif err := ColouriseBuffer(buf, \"toml\"); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not colourise output: %w\", err)\n\t\t}\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "d2445f51f9ef2e0bc8ba97258623c94d", "score": "0.46949202", "text": "func ToWireFormat(data []byte, storage string) ([]byte, error) {\n\tprototypeType, found := storageToType[storage]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"unknown storage type: %v\", storage)\n\t}\n\n\tobj := reflect.New(prototypeType).Interface()\n\terr := yaml.Unmarshal(data, obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(obj)\n}", "title": "" }, { "docid": "11baae9a546aa7381320c2abff2cb3d6", "score": "0.46823582", "text": "func (st *AdapterConf) WriteTo(_os *codec.Buffer) error {\n\tvar err error\n\n\terr = _os.Write_string(st.Servant, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_string(st.Endpoint, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_string(st.Protocol, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(st.MaxConns, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(st.ThreadNum, 4)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(st.QueueCap, 5)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(st.QueueTimeout, 6)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f2d76719ae16005e14795bfed87b04e5", "score": "0.46819627", "text": "func (b *ShardedBloomFilter) WriteTo() ([][]byte, error) {\n\tbloomBytes := make([][]byte, shardNum)\n\tfor i, f := range b.blooms {\n\t\tbloomBuffer := &bytes.Buffer{}\n\t\t_, err := f.WriteTo(bloomBuffer)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbloomBytes[i] = bloomBuffer.Bytes()\n\t}\n\treturn bloomBytes, nil\n}", "title": "" }, { "docid": "3db6432059c38a9ae224112419e8166b", "score": "0.4674133", "text": "func (t *Typed) ToBytes(key string) ([]byte, error) {\n\tvar o interface{}\n\tif len(key) == 0 {\n\t\to = t\n\t} else {\n\t\texists := false\n\t\to, exists = t.GetIf(key)\n\t\tif exists == false {\n\t\t\treturn nil, KeyNotFound\n\t\t}\n\t}\n\tif o == nil {\n\t\treturn nil, nil\n\t}\n\tdata, err := json.Marshal(o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "6a4168c8a9b9edf5c17e60d7f8d503c1", "score": "0.4661678", "text": "func ToJSONBytes(i interface{}) ([]byte, error) {\n\treturn json.Marshal(i)\n}", "title": "" }, { "docid": "63fd4271d88692503213bc4ea53738a4", "score": "0.46606115", "text": "func (b Bytes) ToBytes() []byte {\n\treturn b\n}", "title": "" }, { "docid": "fef3e3c30ac2c9f8ebaf9e2b8075a0b7", "score": "0.46531138", "text": "func (self *bestFit) To(buff *bytes.Buffer) error {\n\n\terr := self.SmoothYs.To(buff)\n\tif (err != nil) {\n\t\treturn err\n\t}\n\n\terr = binary.Write(buff,binary.LittleEndian,&self.m)\n\tif err != nil {\n\t\treturn logError(err)\n\t}\n\n\terr = binary.Write(buff,binary.LittleEndian,&self.c)\n\tif err != nil {\n\t\treturn logError(err)\n\t}\n\n\treturn binary.Write(buff,binary.LittleEndian,&self.pv)\n}", "title": "" }, { "docid": "b2ef9762782e0f2677183ca90012fee2", "score": "0.46497062", "text": "func Serialize(o interface{}) ([]byte, error) {\n\tautil.TODO(\"CBOR-serialization\")\n\treturn nil, nil\n}", "title": "" }, { "docid": "72a07bd114611b4ee75dfe8d9dafe988", "score": "0.46474943", "text": "func (k *Key) ToBytes() []byte {\n\tbuf := &bytes.Buffer{}\n\tbuf.Write(encoding.Uint16ToBytes(k.DBIndex))\n\tbuf.WriteByte(k.MetaType)\n\tbuf.Write(k.Name)\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "d6c2dfa84b163f1e065e7aa225f5b142", "score": "0.4645077", "text": "func (b Bytes) Serialize() ([]byte, error) {\n\treturn b, nil\n}", "title": "" }, { "docid": "27cb540bf9cd2860fd129cf50500cb4f", "score": "0.4641704", "text": "func (queue *Queue) ToJSON() ([]byte, error) {\n\treturn queue.heap.ToJSON()\n}", "title": "" }, { "docid": "73f2cecd1894595d69255aa15e4be67c", "score": "0.4623006", "text": "func (ip6 *IPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {\n\tpayload := b.Bytes()\n\tif ip6.HopByHop != nil {\n\t\treturn fmt.Errorf(\"unable to serialize hopbyhop for now\")\n\t}\n\tbytes, err := b.PrependBytes(40)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbytes[0] = (ip6.Version << 4) | (ip6.TrafficClass >> 4)\n\tbytes[1] = (ip6.TrafficClass << 4) | uint8(ip6.FlowLabel>>16)\n\tbinary.BigEndian.PutUint16(bytes[2:], uint16(ip6.FlowLabel))\n\tif opts.FixLengths {\n\t\tip6.Length = uint16(len(payload))\n\t}\n\tbinary.BigEndian.PutUint16(bytes[4:], ip6.Length)\n\tbytes[6] = byte(ip6.NextHeader)\n\tbytes[7] = byte(ip6.HopLimit)\n\tif len(ip6.SrcIP) != 16 {\n\t\treturn fmt.Errorf(\"invalid src ip %v\", ip6.SrcIP)\n\t}\n\tif len(ip6.DstIP) != 16 {\n\t\treturn fmt.Errorf(\"invalid dst ip %v\", ip6.DstIP)\n\t}\n\tcopy(bytes[8:], ip6.SrcIP)\n\tcopy(bytes[24:], ip6.DstIP)\n\treturn nil\n}", "title": "" }, { "docid": "c1ad74a4bea74858f12cb8ca1f28cda1", "score": "0.4621782", "text": "func (e *Element) ToBytes(buf *bytes.Buffer) error {\n\tenc := gob.NewEncoder(buf)\n\tif err := enc.Encode(&e.name); err != nil {\n\t\treturn err\n\t}\n\tif err := enc.Encode(&e.text); err != nil {\n\t\treturn err\n\t}\n\tif err := e.attrs.ToBytes(buf); err != nil {\n\t\treturn err\n\t}\n\treturn e.elements.ToBytes(buf)\n}", "title": "" }, { "docid": "78f57870369546f36edd4e59bb56bcc3", "score": "0.4600146", "text": "func (chords Chords) ToBytes() (data []byte, dict map[byte]string) {\n\t// build the dictionaries\n\tuNames := strings.Split(chords.Uniques().String(), \",\")\n\treverseDict := make(map[string]byte, len(uNames))\n\tdict = make(map[byte]string, len(uNames))\n\tcurrentByte := byte(1)\n\tfor _, name := range uNames {\n\t\tdict[currentByte] = name\n\t\treverseDict[name] = currentByte\n\t\tcurrentByte++\n\t}\n\t// build the data\n\tfor _, name := range strings.Split(chords.String(), \",\") {\n\t\tdata = append(data, reverseDict[name])\n\t}\n\n\treturn data, dict\n}", "title": "" }, { "docid": "61646686946d6cf619bc12fb7ded7ceb", "score": "0.45980278", "text": "func (app *adapter) ToBytes(pk PrivateKey) []byte {\n\tkey := pk.Key()\n\treturn x509.MarshalPKCS1PrivateKey(&key)\n}", "title": "" }, { "docid": "6699bf27c4b783ee94d2e25d0f057b1e", "score": "0.4585715", "text": "func (bs endecBytes) WriteTo(w io.Writer) (int64, error) {\n\tn, err := w.Write(bs)\n\treturn int64(n), err\n}", "title": "" }, { "docid": "2b3eaae97816388b6ba7f29377e18516", "score": "0.45739093", "text": "func (dt Depth) ToBytes() int {\n\tsize := dt / 8\n\tif dt%8 != 0 {\n\t\tsize++\n\t}\n\treturn int(size)\n}", "title": "" }, { "docid": "e44f5f95c461f00bd2ced3e1fbaf59a7", "score": "0.4565964", "text": "func (c *Capabilities) ToBytes(buf *bytes.Buffer) error {\n\tenc := gob.NewEncoder(buf)\n\tif err := enc.Encode(&c.Node); err != nil {\n\t\treturn err\n\t}\n\tif err := enc.Encode(&c.Ver); err != nil {\n\t\treturn err\n\t}\n\treturn enc.Encode(&c.Features)\n}", "title": "" }, { "docid": "906b4609b94cc871538905f4d7557f84", "score": "0.45644277", "text": "func TrytesToBytes(trytes trinary.Trytes) ([]byte, error) {\n\tif err := ValidTrytesForBytes(trytes); err != nil {\n\t\treturn nil, err\n\t}\n\treturn MustTrytesToBytes(trytes), nil\n}", "title": "" }, { "docid": "1358a7f4d216c5a5f5f3e32d07e9caa8", "score": "0.45534503", "text": "func (t *Trip) ToJSON() string {\n\ttripJSON, err := json.Marshal(t)\n\tutil.FailOnError(err, \"Failed to convert Trip Struct to JSON\")\n\treturn string(tripJSON)\n}", "title": "" }, { "docid": "4b10afdff1b63beb13ff56b8cc7cb728", "score": "0.45445538", "text": "func (s Message) ToBytes() ([]byte, error) {\n\tj, e := json.Marshal(s)\n\treturn j, e\n}", "title": "" }, { "docid": "1528cda038bb75269658501fd74c2124", "score": "0.45438805", "text": "func (m MessageType) ToBytes() []byte {\n\treturn []byte{byte(m)}\n}", "title": "" }, { "docid": "9344fcb43c4eb9b90ef8d1f5acfc4901", "score": "0.4538841", "text": "func (g *GroupedAVP) Serialize() []byte {\n\tb := make([]byte, g.Len())\n\tvar n int\n\tfor _, a := range g.AVP {\n\t\ta.SerializeTo(b[n:])\n\t\tn += a.Len()\n\t}\n\treturn b\n}", "title": "" }, { "docid": "5530424c6fd28794bbf139095e30091a", "score": "0.45386323", "text": "func (m *Message) ToBytes() []byte {\n\tdata := make([]byte, 0, 0)\n\n\tdata = append(data, m.Header.ToBytes()...)\n\tdata = append(data, m.Question.ToBytes()...)\n\n\tfor _, answer := range m.Answers {\n\t\tdata = append(data, answer.ToBytes()...)\n\t}\n\n\tfor _, authority := range m.Authority {\n\t\tdata = append(data, authority.ToBytes()...)\n\t}\n\n\tfor _, additional := range m.Additional {\n\t\tdata = append(data, additional.ToBytes()...)\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "d4c547a01deab9cebac2692fa5486cb6", "score": "0.45355415", "text": "func (o Strings) ToBytes() []byte {\n\tbuf := uio.NewBigEndianBuffer(nil)\n\tfor _, uc := range o {\n\t\tbuf.Write8(uint8(len(uc)))\n\t\tbuf.WriteBytes([]byte(uc))\n\t}\n\treturn buf.Data()\n}", "title": "" }, { "docid": "70fccbaf954d54b3ad1241a01b6b5dd7", "score": "0.45346534", "text": "func toByteArray(data interface{}) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tenc := gob.NewEncoder(&buf)\n\terr := enc.Encode(data)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn buf.Bytes(), nil\n\t}\n}", "title": "" }, { "docid": "0fb6310b18840041d3483b2d8a552607", "score": "0.45344546", "text": "func (c *Config) DumpTo(out io.Writer, format string) (n int64, err error) {\n\tvar ok bool\n\tvar encoder Encoder\n\n\tformat = c.resolveFormat(format)\n\tif encoder, ok = c.encoders[format]; !ok {\n\t\terr = errors.New(\"not exists/register encoder for the format: \" + format)\n\t\treturn\n\t}\n\n\t// is empty\n\tif len(c.data) == 0 {\n\t\treturn\n\t}\n\n\t// encode data to string\n\tencoded, err := encoder(c.data)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// write content to out\n\tnum, _ := fmt.Fprintln(out, string(encoded))\n\n\treturn int64(num), nil\n}", "title": "" }, { "docid": "35eb799b7e26ce874cf199d48ce06f4f", "score": "0.4520823", "text": "func (t Task) Serialize(serializer Serializer) (map[string]interface{}, error) {\n\tvar err error\n\n\tdata := map[string]interface{}{\n\t\t\"id\": t.ID,\n\t\t\"name\": t.Name,\n\t\t\"status\": t.Status,\n\t\t\"published_at\": t.PublishedAt.Unix(),\n\t\t\"max_retries\": t.MaxRetries,\n\t\t\"ttl\": int(t.TTL.Seconds()),\n\t\t\"timeout\": int(t.Timeout.Seconds()),\n\t}\n\n\tif !t.ETA.IsZero() {\n\t\tdata[\"eta\"] = t.ETA.Unix()\n\t}\n\n\tif !t.ProcessedAt.IsZero() {\n\t\tdata[\"processed_at\"] = t.ProcessedAt.Unix()\n\t}\n\n\tif !t.StartedAt.IsZero() {\n\t\tdata[\"started_at\"] = t.StartedAt.Unix()\n\t}\n\n\tif t.Payload != nil {\n\t\tpayload, err := serializer.Dumps(t.Payload)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdata[\"payload\"] = string(payload)\n\t}\n\n\tif t.Result != nil {\n\t\tresult, err := serializer.Dumps(t.Result)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdata[\"result\"] = string(result)\n\t}\n\n\tif t.Error != nil {\n\t\trawErr, ok := t.Error.(error)\n\t\tif ok {\n\t\t\tdata[\"error\"], err = serializer.Dumps(rawErr.Error())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif t.ExecTime != 0 {\n\t\tdata[\"exec_time\"] = t.ExecTime\n\t}\n\n\tif len(t.RetryIntervals) > 0 {\n\t\tintervals := make([]string, len(t.RetryIntervals))\n\t\tfor i := range t.RetryIntervals {\n\t\t\tintervals[i] = fmt.Sprintf(\"%d\", int(t.RetryIntervals[i].Seconds()))\n\t\t}\n\n\t\tdata[\"retry_intervals\"] = strings.Join(intervals, \",\")\n\t}\n\n\treturn data, err\n}", "title": "" }, { "docid": "ed2e34d69d7cc50532f6ce4350b7bc55", "score": "0.45159316", "text": "func (p *BulletProof) Bytes() []byte {\n\tbuff := new(bytes.Buffer)\n\n\tfixed := GetB32(p.negTaux)\n\tif _, err := buff.Write(fixed[:]); err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tfixed = GetB32(p.negMu)\n\tif _, err := buff.Write(fixed[:]); err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tif _, err := buff.Write(SerializePoints(\n\t\t[]*Point{p.A, p.S, p.T1, p.T2})); err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tfixed = GetB32(p.tHat)\n\tif _, err := buff.Write(fixed[:]); err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tfor _, a := range p.a {\n\t\tfixed = GetB32(a)\n\t\tif _, err := buff.Write(fixed[:]); err != nil {\n\t\t\tlogrus.Fatal(err)\n\t\t}\n\t}\n\n\tfor _, b := range p.b {\n\t\tfixed = GetB32(b)\n\t\tif _, err := buff.Write(fixed[:]); err != nil {\n\t\t\tlogrus.Fatal(err)\n\t\t}\n\t}\n\n\t// Write as L1, R1, L2, R2, ...\n\tvar LRs []*Point\n\tfor i := 0; i < len(p.Ls); i++ {\n\t\tLRs = append(LRs, p.Ls[i])\n\t\tLRs = append(LRs, p.Rs[i])\n\t}\n\tif _, err := buff.Write(SerializePoints(LRs)); err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\treturn buff.Bytes()\n}", "title": "" }, { "docid": "7a6ccc978dfcb133f765062d45064c54", "score": "0.45144066", "text": "func ToYAML(v interface{}) ([]byte, error) {\n\treturn yaml.Marshal(v)\n}", "title": "" }, { "docid": "ab4ef6e06d8c62260ce9dfaf3558f752", "score": "0.45101845", "text": "func (sk *PrivKey) MarshalTo(dAtA []byte) (int, error) {\n\tbz := sk.Bytes()\n\tcopy(dAtA, bz)\n\treturn len(bz), nil\n}", "title": "" }, { "docid": "dd42842adccd21cb4742c70870331248", "score": "0.4497925", "text": "func (t *YAMLData) ToYAML() (*bytes.Buffer, error) {\n\td, err := yaml.Marshal(t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb := bytes.NewBuffer(d)\n\n\treturn b, nil\n}", "title": "" }, { "docid": "cae0341753a70b308b60805f9149c953", "score": "0.44951108", "text": "func (op *OptIAAddress) ToBytes() []byte {\n\tbuf := uio.NewBigEndianBuffer(nil)\n\tbuf.WriteBytes(op.IPv6Addr.To16())\n\tbuf.Write32(op.PreferredLifetime)\n\tbuf.Write32(op.ValidLifetime)\n\tbuf.WriteBytes(op.Options.ToBytes())\n\treturn buf.Data()\n}", "title": "" }, { "docid": "d2c3167876cc4901f6da4e22fa52c317", "score": "0.44837165", "text": "func (m *Planner) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.Entity.Serialize(writer)\n if err != nil {\n return err\n }\n if m.GetBuckets() != nil {\n cast := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.CollectionCast[i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable](m.GetBuckets())\n err = writer.WriteCollectionOfObjectValues(\"buckets\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetPlans() != nil {\n cast := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.CollectionCast[i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable](m.GetPlans())\n err = writer.WriteCollectionOfObjectValues(\"plans\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetTasks() != nil {\n cast := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.CollectionCast[i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable](m.GetTasks())\n err = writer.WriteCollectionOfObjectValues(\"tasks\", cast)\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "a3bf571c645b84ac9babf37415a3e0e6", "score": "0.44793323", "text": "func (v Version) ToBytes() []byte {\n\treturn []byte{\n\t\tv.Major,\n\t\tv.Minor,\n\t\tv.Patch,\n\t}\n}", "title": "" }, { "docid": "751dcc36ad50efcac9a4cfbd2848e47d", "score": "0.4471344", "text": "func (s *SOC) toBytes() []byte {\n\tbuf := bytes.NewBuffer(nil)\n\tbuf.Write(s.id)\n\tbuf.Write(s.signature)\n\tbuf.Write(s.chunk.Data())\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "ab62fca7a0776f3f0a021e7d1824078e", "score": "0.4467248", "text": "func (a I2PAddr) ToBytes() (d []byte, err error) {\n\tbuf := make([]byte, i2pB64enc.DecodedLen(len(a)))\n\t_, err = i2pB64enc.Decode(buf, []byte(a)) \n\tif err == nil {\n\t\td = buf\n\t}\n\treturn\n}", "title": "" }, { "docid": "8fe18c52f2016a2c7066aeffc94cace7", "score": "0.44623026", "text": "func (m *Matrix) ToBytes() []byte {\n\tb := cmp.Int64sToBytes(m.list...)\n\tb = append(b, cmp.Int16sToBytes(int16(m.focus.Min().X), int16(m.focus.Min().Y), int16(m.focus.Max().X), int16(m.focus.Max().Y))...)\n\tb = append(b, cmp.UInt64ToBytes(m.x)...)\n\tb = append(b, cmp.UInt64ToBytes(m.y)...)\n\treturn b\n}", "title": "" }, { "docid": "b480eb2db865d1ecfc6564bd5cff0994", "score": "0.44576094", "text": "func (i *IPv6Destination) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {\n\toptionLength := 0\n\tfor _, opt := range i.Options {\n\t\tl, err := opt.serializeTo(b, opts.FixLengths)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toptionLength += l\n\t}\n\tbytes, err := b.PrependBytes(2)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbytes[0] = uint8(i.NextHeader)\n\tif opts.FixLengths {\n\t\ti.HeaderLength = uint8((optionLength + 2) / 8)\n\t}\n\tbytes[1] = i.HeaderLength\n\treturn nil\n}", "title": "" }, { "docid": "a75b33a45a282223a16a59988640f7ee", "score": "0.44497785", "text": "func ToBytes(val interface{}) ([]byte, error) {\n\tswitch val.(type) {\n\tcase string:\n\t\treturn []byte(val.(string)), nil\n\tcase []byte:\n\t\tb := make([]byte, len(val.([]byte)))\n\t\tcopy(b, val.([]byte))\n\t\treturn b, nil\n\tdefault:\n\t\treturn json.Marshal(val)\n\t}\n}", "title": "" }, { "docid": "f62e901b4b9a17581691f43206a09484", "score": "0.44379267", "text": "func (t Tweet) Serialize() *[]byte {\n\tb, err := json.Marshal(t)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn &b\n}", "title": "" }, { "docid": "ae66dea6a07ff317414eef7bac155c54", "score": "0.44363463", "text": "func (op *OptDHCPv4Msg) ToBytes() []byte {\n\treturn op.Msg.ToBytes()\n}", "title": "" }, { "docid": "2148c12109e12674db80a0fd561358c2", "score": "0.4430335", "text": "func (b *Bytes) WriteTo(w io.Writer) (int64, error) {\n\tn, err := w.Write(b.Bytes())\n\treturn int64(n), err\n}", "title": "" }, { "docid": "329534b31710b100c2f150dcd457202a", "score": "0.44266552", "text": "func (JSONPresenter) Serialize(object interface{}) []byte {\n\tserial, err := json.Marshal(object)\n\n\tif err != nil {\n\t\tlog.Printf(\"failed to serialize: \\\"%s\\\"\", err)\n\t}\n\n\treturn serial\n}", "title": "" }, { "docid": "a0ab6d430a02011658f280f8bea3a2ce", "score": "0.44250238", "text": "func (b *EpsilonGreedy) Serialize() interface{} {\n\tdata := make(map[string]interface{})\n\tdata[\"strategy\"] = \"epsilon greedy\"\n\tdata[\"epsilon\"] = b.Epsilon\n\tdata[\"counts\"] = b.counts\n\tdata[\"values\"] = b.values\n\treturn data\n}", "title": "" }, { "docid": "26f9981245826a5e5bff83d5559a4c94", "score": "0.44207463", "text": "func WriteBytes(obj any) []byte {\n\tvar b bytes.Buffer\n\tenc := toml.NewEncoder(&b)\n\tenc.Encode(obj)\n\treturn b.Bytes()\n}", "title": "" }, { "docid": "107336b4218e82065ce0d062be06ef51", "score": "0.44202894", "text": "func (kwt KeyWithType) ToSerializable() SerializedKeyWithType {\n\treturn newSerializedKeyWithType(kwt.Type, kwt.Key.Bytes())\n}", "title": "" }, { "docid": "dae4e3a4f0ab7a73634553b4a3787bd9", "score": "0.4409605", "text": "func (bf *BloomFilter) ToBytes(binBuf *bytes.Buffer) error {\n\n\tbinary.Write(binBuf, binary.LittleEndian, bf.errorRate)\n\tbinary.Write(binBuf, binary.LittleEndian, uint64(bf.numSlices))\n\tbinary.Write(binBuf, binary.LittleEndian, uint64(bf.bitsPerSlice))\n\tbinary.Write(binBuf, binary.LittleEndian, uint64(bf.capacity))\n\tbinary.Write(binBuf, binary.LittleEndian, uint64(bf.count))\n\n\treturn bf.bitarray.ToBytes(binBuf)\n}", "title": "" }, { "docid": "4c9cd7c71cc31883fc069cde75c56679", "score": "0.44084397", "text": "func (h *HandShake) Serialize() []byte {\n\t// NOTE: Whenever we are sending a msg, it has to be in []byte type \n\tbuf := make([]byte, len(h.Pstr)+49)\n\tbuf[0] = byte(len(h.Pstr))\n\tcurr := 1\n\tcurr += copy(buf[curr:], h.Pstr)\n\tcurr += copy(buf[curr:], make([]byte, 8)) // 8 reserved bytes\n\tcurr += copy(buf[curr:], h.Info_hash[:])\n\tcurr += copy(buf[curr:], h.Peer_id[:])\n\treturn buf\n}", "title": "" }, { "docid": "c62f1f79a2ee32ae0538d69cae1a089a", "score": "0.44071907", "text": "func ToBytes(bits []bool) []byte {\n\tbs := make([]byte, (len(bits)+7)/8)\n\tfor i := 0; i < len(bits); i++ {\n\t\tif bits[i] {\n\t\t\tbs[i/8] |= (1 << 7) >> uint(i%8)\n\t\t}\n\t}\n\treturn bs\n}", "title": "" }, { "docid": "e748170d3d13088e4e021531a13a6979", "score": "0.43953657", "text": "func (e *Encoder) WriteTo(w io.Writer, data interface{}) error {\n\te.Reset(w)\n\treturn e.WriteObject(data)\n}", "title": "" }, { "docid": "045acf39b831e3c615e3fe36fa9934e1", "score": "0.4394001", "text": "func (d DUIDOpaque) ToBytes() []byte {\n\tbuf := uio.NewBigEndianBuffer(nil)\n\tbuf.Write16(uint16(d.Type))\n\tbuf.WriteData(d.Data)\n\treturn buf.Data()\n}", "title": "" }, { "docid": "d49d6abf363dd4199ab07a0ea40569a0", "score": "0.43905544", "text": "func (b *AnnealingEpsilonGreedy) Serialize() interface{} {\n\tdata := make(map[string]interface{})\n\tdata[\"strategy\"] = \"annealing epsilon greedy\"\n\tdata[\"epsilon\"] = b.Epsilon()\n\tdata[\"counts\"] = b.counts\n\tdata[\"values\"] = b.values\n\treturn data\n}", "title": "" }, { "docid": "7b8a566a6d601e1cd382fbd54b5691e8", "score": "0.43830305", "text": "func puzzle_to_board(puzzle Puzzle) (Board, error) {\n\t// The board to return\n\tvar board Board\n\n\t// allocate composed 2d array\n\trows := len(puzzle)\n\tcols := len(puzzle[0])\n\n\tif rows%2 != 0 || cols%2 != 0 {\n\t\treturn board, errors.New(fmt.Sprintf(\"rows[%v] or cols[%v] not a multiple of 2\", rows, cols))\n\t}\n\ta := make([][]Cell, rows)\n\te := make([]Cell, rows*cols)\n\tfor i := range a {\n\t\ta[i] = e[i*cols : (i+1)*cols]\n\t}\n\n\tfor y := 0; y < len(puzzle); y++ {\n\t\tfor x := 0; x < len(puzzle[y]); x++ {\n\t\t\t// put puzzle in board\n\t\t\tswitch puzzle[y][x] {\n\t\t\tcase X:\n\t\t\t\ta[y][x] = Cell{false, X}\n\t\t\tcase 0:\n\t\t\t\ta[y][x] = Cell{true, 0}\n\t\t\tcase 1:\n\t\t\t\ta[y][x] = Cell{true, 1}\n\t\t\tdefault: // invalid!\n\t\t\t\treturn board, errors.New(fmt.Sprintf(\"Cell [%v,%v] is not 0, 1 or X\", y, x))\n\t\t\t}\n\t\t}\n\t}\n\n\tboard.dim_y = len(puzzle)\n\tboard.dim_x = len(puzzle[0])\n\tboard.cells = a\n\treturn board, nil\n}", "title": "" }, { "docid": "9955cd54a599f58ff2269a62e4501209", "score": "0.43817148", "text": "func (ci CertIdentity) ToBytes() ([]byte, error) {\n\treturn proto.Marshal(ci.ToSerialized())\n}", "title": "" }, { "docid": "31d78f3a2e0263165f54fae5cf2131fc", "score": "0.4379817", "text": "func (query *Query) Serialize() []byte {\n bytes := make([]byte, 32, 32)\n\n bytes[0] = query.action\n bytes[1] = query.empty\n binary.BigEndian.PutUint32(bytes[2:6], query.replyIp)\n binary.BigEndian.PutUint16(bytes[6:8], query.replyPort)\n binary.BigEndian.PutUint64(bytes[8:16], query.key)\n binary.BigEndian.PutUint64(bytes[16:24], query.value)\n binary.BigEndian.PutUint32(bytes[24:28], query.timeToLive)\n binary.BigEndian.PutUint32(bytes[28:32], query.requestId)\n\n return bytes\n}", "title": "" } ]
d9c419b31adf3d2bef25e6d7f3ced89e
onlineStatus returns hosts Online field value
[ { "docid": "9dd26b77caa0a89a745f686d6919a9db", "score": "0.73163414", "text": "func (r *RemediationManager) OnlineStatus(host *bmh.BareMetalHost) bool {\n\treturn host.Spec.Online\n}", "title": "" } ]
[ { "docid": "840396fa972559b6d909e7255a097169", "score": "0.626426", "text": "func (o *StatsApplianceAllOfData) GetOnlineOk() (*bool, bool) {\n\tif o == nil || o.Online == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Online, true\n}", "title": "" }, { "docid": "5b566422379a64f29ac4b18af699e68f", "score": "0.6184018", "text": "func (o *StatsApplianceAllOfData) GetOnline() bool {\n\tif o == nil || o.Online == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Online\n}", "title": "" }, { "docid": "d308efe2a7905e8e35ea6cd9e73a804f", "score": "0.6099638", "text": "func GetOneHostStatus(key, field string) (int64, error) {\n stringCmd := client.HGet(key, field)\n if stringCmd.Err() != nil {\n return 0, errors.WithStack(stringCmd.Err())\n }\n return stringCmd.Int64()\n}", "title": "" }, { "docid": "79a8de850871b6c6c29571153b220f28", "score": "0.60406804", "text": "func IsOnlineStatus(cVR *apis.CStorVolumeReplica) bool {\n\tif string(cVR.Status.Phase) == string(apis.CVRStatusOnline) {\n\t\tklog.Infof(\"cVR Healthy status: %v\", string(cVR.ObjectMeta.UID))\n\t\treturn true\n\t}\n\tklog.Infof(\n\t\t\"cVR '%s': uid '%s': phase '%s': is_healthy_status: false\",\n\t\tstring(cVR.ObjectMeta.Name),\n\t\tstring(cVR.ObjectMeta.UID),\n\t\tcVR.Status.Phase,\n\t)\n\treturn false\n}", "title": "" }, { "docid": "ce83aeba88a4aa7bd0b0a59ccf28c9c4", "score": "0.5997922", "text": "func (p *Partition) Online() (ExtendedStatus, error) {\n\tstat := ExtendedStatus{}\n\tvar extendedStatus ole.VARIANT\n\tole.VariantInit(&extendedStatus)\n\tres, err := oleutil.CallMethod(p.handle, \"Online\", &extendedStatus)\n\tif err != nil {\n\t\treturn stat, fmt.Errorf(\"Online(): %w\", err)\n\t} else if val, ok := res.Value().(int32); val != 0 || !ok {\n\t\treturn stat, fmt.Errorf(\"error code returned during online: %d\", val)\n\t}\n\treturn stat, nil\n}", "title": "" }, { "docid": "ee40109bb6e10d00e9ba7e2196e7755e", "score": "0.59788316", "text": "func (s *AccountsService) GetOnlineStatus(ctx context.Context, accountIds ...int) (*OnlineStatus, *shared.Response, error) {\n\tu, err := internal.AddQueries(\"accounts/status\", &getOnlineStatusOptions{accountIds})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tvar result *OnlineStatus\n\tresp, err := s.client.Get(ctx, u, &result)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn result, resp, nil\n}", "title": "" }, { "docid": "f0d843c843fcebd1564a9c335f8d1923", "score": "0.5772667", "text": "func (h *Target) IsOnline(ctx context.Context) bool {\n\tif err := h.checkAlive(ctx); err != nil {\n\t\treturn !xnet.IsNetworkOrHostDown(err, false)\n\t}\n\treturn true\n}", "title": "" }, { "docid": "46bcdd582f6a2691fbb861eb5141ffe5", "score": "0.57505184", "text": "func GetStatus() string {\n\t/*\n\t TODO - Check Monitor is running\n\t TODO - Check Disk space\n\t*/\n\treturn \"All good\"\n}", "title": "" }, { "docid": "07194a028c79575cb02644a4e3a3ab47", "score": "0.5749777", "text": "func (r Probes) Status() NodeStatusType {\n\tresult := NodeStatusRunning\n\tfor _, probe := range r {\n\t\tif probe.Status == ProbeFailed {\n\t\t\tresult = NodeStatusDegraded\n\t\t\tbreak\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4711112bbd7a4fb4800f30a54e34eb65", "score": "0.57431203", "text": "func (s *Server) Status() *relayinterface.ServerStatus {\n\tusers := 0\n\tclientsInGames := 0\n\tfor e := s.clients.Front(); e != nil; e = e.Next() {\n\t\tc := e.Value.(*Client)\n\t\tif c.State() == CONNECTED && c.Permissions() != IRC {\n\t\t\tusers++\n\t\t\tif c.Game() != nil {\n\t\t\t\tclientsInGames++\n\t\t\t}\n\t\t}\n\t}\n\tgames := 0\n\topenGames := 0\n\tfor e := s.games.Front(); e != nil; e = e.Next() {\n\t\tg := e.Value.(*Game)\n\t\tgames++\n\t\tif g.State() == CONNECTABLE {\n\t\t\topenGames++\n\t\t}\n\t}\n\n\treturn &relayinterface.ServerStatus{\n\t\tNClients: users,\n\t\tNClientsInGames: clientsInGames,\n\t\tNGames: games,\n\t\tNOpenGames: openGames,\n\t\t}\n}", "title": "" }, { "docid": "aea5db29003cba23e6d7bb693dfd2888", "score": "0.5729001", "text": "func (m *website) Status() string {\n\treturn m.statusField\n}", "title": "" }, { "docid": "4f590f6f1a7b02b0a124532ab1bf72ac", "score": "0.57246494", "text": "func (m MockHost) Online() bool {\n\treturn true\n}", "title": "" }, { "docid": "1cb17f623a3f4a186c8d45dca3cbd036", "score": "0.5710325", "text": "func (m *WebCheck) Status() string {\n\treturn m.statusField\n}", "title": "" }, { "docid": "90d30ff9a1e50daa39a6467c30d3d481", "score": "0.5706543", "text": "func (c *OnvifClient) GetStatus() string {\n\t_, err := OnvifFunc(c.Client, \"GetSystemDateAndTime\", \"\")\n\tif err == nil {\n\t\treturn common.DEVSTOK\n\t}\n\treturn common.DEVSTDISCONN\n}", "title": "" }, { "docid": "327632a03d40ec910bbc7a0f04df1189", "score": "0.5665274", "text": "func (om *Sdk) Online() bool {\n\treq, err := om.newRequest(\"GET\", om.target, nil)\n\tif err != nil {\n\t\treturn false\n\t}\n\tresp, err := om.httpClient.Do(req)\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer resp.Body.Close()\n\n\treturn resp.StatusCode < 500\n}", "title": "" }, { "docid": "a1719f920b8d79582819393c45d80b28", "score": "0.566453", "text": "func (t *Tinzenite) PrintStatus() string {\n\tvar out string\n\tout += \"Online:\\n\"\n\taddresses, err := t.channel.FriendAddresses()\n\tif err != nil {\n\t\tout += \"channel.FriendAddresses failed!\"\n\t} else {\n\t\tvar count int\n\t\tfor _, address := range addresses {\n\t\t\tonline, err := t.channel.IsAddressOnline(address)\n\t\t\tvar insert string\n\t\t\tif err != nil {\n\t\t\t\tinsert = \"ERROR\"\n\t\t\t} else {\n\t\t\t\tinsert = fmt.Sprintf(\"%v\", online)\n\t\t\t}\n\t\t\tout += address[:16] + \" :: \" + insert + \"\\n\"\n\t\t\tcount++\n\t\t}\n\t\tout += \"Total friends: \" + fmt.Sprintf(\"%d\", count)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "c79731a153bb48f9bc4190f1c50ad589", "score": "0.5639042", "text": "func SetOnlineStatus() {\n\tgo func() {\n\t\tif ShouldExportMetrics {\n\t\t\tr, err := http.Get(\"http://clients3.google.com/generate_204\")\n\t\t\tif err == nil {\n\t\t\t\tr.Body.Close()\n\t\t\t\tisOnline = true\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "9f22edc630b9a89ee6c825d2a35ee732", "score": "0.56194407", "text": "func (s *Server) Status() ReportingStatus {\n\n\tstats := ReportingStatus{\n\t\tNode: fmt.Sprintf(\"%s-%s-%s\", platform(), env(), nodeName()),\n\t\tStatus: \"OK\",\n\t\tReported: time.Now().Unix(),\n\t\tStartupTime: s.Hub.startupTime.Unix(),\n\t\tSentMsgs: s.Hub.sentMsgs,\n\t}\n\n\tstats.Connections = connStatusList{}\n\tfor k := range s.Hub.connections {\n\t\tstats.Connections = append(stats.Connections, k.Status())\n\t}\n\tsort.Sort(stats.Connections)\n\n\treturn stats\n}", "title": "" }, { "docid": "849073278818cf13a5f617397d3f14ca", "score": "0.56162786", "text": "func (p *Peer) IsOnline() bool {\n\tp.mtx.Lock()\n\tdefer p.mtx.Unlock()\n\treturn p.online\n}", "title": "" }, { "docid": "1b1e4e3968b46cf03b22ee287b1f02ca", "score": "0.55944794", "text": "func (v *Ovms) Status() (api.ChargeStatus, error) {\n\tstatus := api.StatusA // disconnected\n\n\tres, err := v.chargeG()\n\tif res, ok := res.(ovmsChargeResponse); err == nil && ok {\n\t\tif res.ChargePortOpen > 0 {\n\t\t\tstatus = api.StatusB\n\t\t}\n\t\tif res.ChargeState == \"charging\" {\n\t\t\tstatus = api.StatusC\n\t\t}\n\t}\n\n\treturn status, err\n}", "title": "" }, { "docid": "4d92c7041bd18b74d3ecf552b4bab2d2", "score": "0.5581435", "text": "func (o *V0037Ping) GetStatus() int32 {\n\tif o == nil || o.Status == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "ed366168b2a54b7b89535f3b78709432", "score": "0.5555515", "text": "func (r *Router) IsOnline() bool {\n\tif !r.Status {\n\t\tnow := time.Now()\n\t\tif r.RecoveryTime.Before(now) {\n\t\t\tr.Status = true\n\t\t}\n\t}\n\treturn r.Status\n}", "title": "" }, { "docid": "56f3a9280aeb7cbc34069151c5594f49", "score": "0.5537304", "text": "func (a *conn) Status() (status messaging.ConnStatus) {\n\tswitch a.managedConn.Status() {\n\tcase nats.DISCONNECTED:\n\t\tstatus = messaging.DISCONNECTED\n\tcase nats.CONNECTED:\n\t\tstatus = messaging.CONNECTED\n\tcase nats.CLOSED:\n\t\tstatus = messaging.CLOSED\n\tcase nats.RECONNECTING:\n\t\tstatus = messaging.RECONNECTING\n\tcase nats.CONNECTING:\n\t\tstatus = messaging.CONNECTING\n\tdefault:\n\t\tlogger.Panic().Int(\"status\", int(a.managedConn.Status())).Msg(\"Unknown NATS connection status\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "6f4079766f49cbcc0d3dc48e126498f4", "score": "0.5535895", "text": "func (c Client) Status() Status {\n\tstatusCount := map[Status]int{}\n\tfor _, gameStatus := range c.GameStatuses {\n\t\tstatusCount[gameStatus.Status]++\n\t}\n\tgamesCount := len(c.GameStatuses)\n\tif statusCount[Ready] == gamesCount {\n\t\treturn Ready\n\t}\n\tif statusCount[Completed] == gamesCount {\n\t\treturn Completed\n\t}\n\tif statusCount[Failed] >= 1 {\n\t\treturn Failed\n\t}\n\treturn InProgress\n}", "title": "" }, { "docid": "96023e05cccc2bcaf87c7bcb3c68344a", "score": "0.5535558", "text": "func ShowOnlineUser() {\n\tfmt.Println(\"Current online users:\")\n\tfor id, user := range onlineUsers {\n\t\tif user.UserStatus == 0 {\n\t\t\tfmt.Println(\"User id:\\t\", id)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6a129785c6ee852324ea500a1c741504", "score": "0.5508968", "text": "func (s *Server) LocalStatus() (proto.Message, error) {\n\tif s.Handler.Holder == nil {\n\t\treturn nil, errors.New(\"Server.Holder is nil\")\n\t}\n\n\tns := internal.NodeStatus{\n\t\tHost: s.Handler.Handler.Host,\n\t\tState: pilosa.NodeStateUp,\n\t\tIndexes: pilosa.EncodeIndexes(s.Handler.Holder.Indexes()),\n\t}\n\n\t// Append Slice list per this Node's indexes\n\tfor _, index := range ns.Indexes {\n\t\tindex.Slices = s.Handler.Cluster.OwnsSlices(index.Name, index.MaxSlice, s.Handler.Host)\n\t}\n\n\treturn &ns, nil\n}", "title": "" }, { "docid": "09a4b10b48da657405df77fdf54e2c9d", "score": "0.5503113", "text": "func (k DefaultAgent) GetStatus(args *Args) (*Result, error) {\n\tk8s, err := k.kubeFunc()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnodes, err := k8s.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\tlogger.Error(\"could not get nodes from cluster\", \"error\", err)\n\t\treturn nil, err\n\t}\n\n\tfor _, node := range nodes.Items {\n\t\tfor _, condition := range node.Status.Conditions {\n\t\t\tif condition.Type == \"Ready\" {\n\t\t\t\tif condition.Status != \"True\" {\n\t\t\t\t\treturn &Result{\n\t\t\t\t\t\tData: false,\n\t\t\t\t\t\tType: StatusResult,\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &Result{\n\t\tData: true,\n\t\tType: StatusResult,\n\t}, nil\n}", "title": "" }, { "docid": "768c39f1fbe376feb31e0a14253fddd8", "score": "0.5492261", "text": "func (d *Daemon) IsOnline() bool {\n\treturn d.ws != nil && d.ws.IsOnline\n}", "title": "" }, { "docid": "302ff456060e48c151bff4cf819570ac", "score": "0.5489663", "text": "func (o CustomHostnameOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *CustomHostname) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "63bf0a2692ffec7416215ce1cf0d61ab", "score": "0.54811347", "text": "func (m *Monitor) Status() (string, error) {\n\t// Prepare the response.\n\tvar resp struct {\n\t\tReturn struct {\n\t\t\tStatus string `json:\"status\"`\n\t\t} `json:\"return\"`\n\t}\n\n\t// Query the status.\n\terr := m.run(\"query-status\", nil, &resp)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn resp.Return.Status, nil\n}", "title": "" }, { "docid": "39db1397a3e132d3a2a2173b0c69cdd4", "score": "0.5480713", "text": "func (hri *HealResultItem) GetOnlineCounts() (b, a int) {\n\tif hri == nil {\n\t\treturn\n\t}\n\tfor _, v := range hri.Before.Drives {\n\t\tif v.State == DriveStateOk {\n\t\t\tb++\n\t\t}\n\t}\n\tfor _, v := range hri.After.Drives {\n\t\tif v.State == DriveStateOk {\n\t\t\ta++\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e391eed80e4406e27ea25855272f08ba", "score": "0.547706", "text": "func HostPowerStatus(c *gin.Context) {\n\thost := c.Param(\"host\")\n\tif host == \"\" {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": fmt.Sprintf(\"invalid host: %s\", host)})\n\t\treturn\n\t}\n\n\tconn, err := discover.ScanAndConnect(host, viper.GetString(\"bmc_user\"), viper.GetString(\"bmc_pass\"))\n\tif err != nil {\n\t\tif err != errors.ErrVendorNotSupported {\n\t\t\tc.JSON(http.StatusPreconditionFailed, gin.H{\"message\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t}\n\tif bmc, ok := conn.(devices.Bmc); ok {\n\t\tdefer bmc.Close()\n\t\tstatus, err := bmc.PowerState()\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusExpectationFailed, gin.H{\"action\": \"ison\", \"status\": false, \"message\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tc.JSON(http.StatusOK, gin.H{\"action\": \"ison\", \"status\": status, \"message\": \"ok\"})\n\t\treturn\n\t}\n\n\tbmc, err := ipmi.New(viper.GetString(\"bmc_user\"), viper.GetString(\"bmc_pass\"), host)\n\tif err != nil {\n\t\tc.JSON(http.StatusPreconditionFailed, gin.H{\"message\": err.Error()})\n\t\treturn\n\t}\n\tstatus, err := bmc.IsOn()\n\tif err != nil {\n\t\tc.JSON(http.StatusExpectationFailed, gin.H{\"action\": \"ison\", \"status\": false, \"message\": err.Error()})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\"action\": \"ison\", \"status\": status, \"message\": \"ok\"})\n}", "title": "" }, { "docid": "a84a8d5d045df841408b2aa8e7055316", "score": "0.5459481", "text": "func (username *User) GetStatus() bool {\n return username.status\n}", "title": "" }, { "docid": "db4893a9420ab1ff78813d4112d0380d", "score": "0.54461515", "text": "func (o GetIpv6InternetBandwidthsBandwidthOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetIpv6InternetBandwidthsBandwidth) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b1aa0a3c2b2371b03735a1c4205f76aa", "score": "0.5443268", "text": "func (o GetIpsecServersServerOutput) OnlineClientCount() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetIpsecServersServer) int { return v.OnlineClientCount }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "3566248498efe40f7a6c61a243d6ad11", "score": "0.5441314", "text": "func (m *TenantStatusInformation) GetOnboardingStatus()(*TenantOnboardingStatus) {\n val, err := m.GetBackingStore().Get(\"onboardingStatus\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*TenantOnboardingStatus)\n }\n return nil\n}", "title": "" }, { "docid": "f47929166d5f4f808cd97196b192cffd", "score": "0.5440741", "text": "func (e *Eztv) Status() (polochon.ModuleStatus, error) {\n\tstatus := polochon.StatusOK\n\n\t// Get some torrents\n\ttorrents, err := eztv.GetTorrents(10, 1)\n\tif err != nil {\n\t\tstatus = polochon.StatusFail\n\t}\n\n\t// Check if there is any results\n\tif len(torrents) == 0 {\n\t\treturn polochon.StatusFail, polochon.ErrTorrentNotFound\n\t}\n\n\treturn status, err\n}", "title": "" }, { "docid": "0a78994a564fd7b7da2151a1d94d900d", "score": "0.543928", "text": "func (o GetPeerConnectionsConnectionOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetPeerConnectionsConnection) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "807ab363b9c8ba13cd05d600890b8f88", "score": "0.5428213", "text": "func (s *Swarm) GetStatus() (string, string, error) {\n\treturn s.provider.GetStatus()\n}", "title": "" }, { "docid": "3a41325e684dd38ae5599cfc6a8455bc", "score": "0.5416969", "text": "func (self *GenericBirdwatcher) NeighboursStatus() (*api.NeighboursStatusResponse, error) {\n\t// Query birdwatcher\n\tapiStatus, birdProtocols, err := self.fetchProtocolsShort()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse the neighbors short\n\tneighbours, err := parseNeighboursShort(birdProtocols, self.config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &api.NeighboursStatusResponse{\n\t\tApi: *apiStatus,\n\t\tNeighbours: neighbours,\n\t}\n\n\treturn response, nil // dereference for now\n}", "title": "" }, { "docid": "7e5a8ffe2da657505a271d857804161f", "score": "0.5415325", "text": "func (r *mockClient) LocalStatus(ctx context.Context) (*pb.NodeStatus, error) {\n\treturn r.agent.LocalStatus(), nil\n}", "title": "" }, { "docid": "232b8c02f01b25a843453ca53d33cdfc", "score": "0.5400085", "text": "func (api *API) computeGlobalPublicStatus() sdk.MonitoringStatus {\n\treturn sdk.MonitoringStatus{\n\t\tLines: []sdk.MonitoringStatusLine{\n\t\t\t{\n\t\t\t\tStatus: sdk.MonitoringStatusOK,\n\t\t\t\tComponent: \"Global/Maintenance\",\n\t\t\t\tValue: fmt.Sprintf(\"%v\", api.Maintenance),\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7287d32c5d76883db71276e373f1e1bb", "score": "0.5389883", "text": "func IsOnline(uid string) bool {\n\tnow := time.Now().Unix()\n\tnode := nodeInfo.userHashRing.Get(uid)\n\taddrMap, err := node.Extra.(*redis.Redis).Hgetall(userPrefix + uid)\n\tif err == nil {\n\t\treturn false\n\t}\n\tfor _, value := range addrMap {\n\t\told, _ := strconv.ParseInt(value, 10, 64)\n\t\tif now < old {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4b564934b2fa51f74fb87db79b922a8a", "score": "0.5389739", "text": "func (m *ConnManager)IsOnline(uniqueIdentification UniqueIdentification) (*Connection,bool) {\n\tv,b := m.Get(uniqueIdentification)\n\tif b {\n\t\tif c ,ok := v.(*Connection);ok{\n\t\t\treturn c,ok\n\t\t}\n\t}\n\treturn nil,false\n}", "title": "" }, { "docid": "0bd898890980ee30668ff3023ae291f0", "score": "0.53769016", "text": "func peerStatus(peer *ipnstate.PeerStatus) string {\n\tif !peer.Active {\n\t\tif peer.ExitNode {\n\t\t\treturn \"selected but offline\"\n\t\t}\n\t\tif !peer.Online {\n\t\t\treturn \"offline\"\n\t\t}\n\t}\n\n\tif peer.ExitNode {\n\t\treturn \"selected\"\n\t}\n\n\treturn \"-\"\n}", "title": "" }, { "docid": "f9f4e78bb6d7e6d523f1f2f7ce246ddc", "score": "0.5373777", "text": "func (o GetDesktopsDesktopOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetDesktopsDesktop) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b2cacf87967163e9cedb5d76d5615cd1", "score": "0.5364096", "text": "func (o NatIpOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *NatIp) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cf373a9f705b23eae95c13a69cc15550", "score": "0.53612024", "text": "func (o *VirtualizationVmwareDatastoreAllOf) GetStatus() string {\n\tif o == nil || o.Status == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Status\n}", "title": "" }, { "docid": "3d1b10f5462be37e6fad5b4ef9d6b709", "score": "0.53603417", "text": "func (this *RegisterController) CheckOnline() {\n\tdata := Resp{\"200\", \"客户端在线\"}\n\tthis.Data[\"json\"] = &data\n\tthis.ServeJSON()\n}", "title": "" }, { "docid": "702ed2560d6bf41a3732f52eaf42e524", "score": "0.53582615", "text": "func GetStatus() models.Status {\n\tif _stats == nil {\n\t\treturn models.Status{}\n\t}\n\n\tviewerCount := 0\n\tif IsStreamConnected() {\n\t\tviewerCount = len(_stats.Viewers)\n\t}\n\n\treturn models.Status{\n\t\tOnline: IsStreamConnected(),\n\t\tViewerCount: viewerCount,\n\t\tOverallMaxViewerCount: _stats.OverallMaxViewerCount,\n\t\tSessionMaxViewerCount: _stats.SessionMaxViewerCount,\n\t\tLastDisconnectTime: _stats.LastDisconnectTime,\n\t\tLastConnectTime: _stats.LastConnectTime,\n\t\tVersionNumber: config.VersionNumber,\n\t\tStreamTitle: data.GetStreamTitle(),\n\t}\n}", "title": "" }, { "docid": "b7c2d83bdd578ca3dbd68c05cf8b3a31", "score": "0.5354299", "text": "func (c *switchSocket) Status() (api.ChargeStatus, error) {\n\tres := api.StatusB\n\n\t// static mode\n\tif c.standbypower < 0 {\n\t\ton, err := c.enabled()\n\t\tif on {\n\t\t\tres = api.StatusC\n\t\t}\n\n\t\treturn res, err\n\t}\n\n\t// standby power mode\n\tpower, err := c.currentPower()\n\tif power > c.standbypower {\n\t\tres = api.StatusC\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "8a10f51c0cabded654b14ffbd8ca03ab", "score": "0.5354127", "text": "func (mcc *MobileConnect) Status() (api.ChargeStatus, error) {\n\tb, err := mcc.getValue(mcc.apiURL(mccAPIChargeState))\n\tif err != nil {\n\t\treturn api.StatusNone, err\n\t}\n\n\tchargeState, err := strconv.ParseInt(strings.Trim(string(b), \"\\n\"), 10, 8)\n\tif err != nil {\n\t\treturn api.StatusNone, err\n\t}\n\n\tswitch chargeState {\n\tcase 0: // Unplugged\n\t\treturn api.StatusA, nil\n\tcase 1, 3, 4, 6: // 1: Connecting, 3: Established, 4: Paused, 6: Finished\n\t\treturn api.StatusB, nil\n\tcase 2: // Error\n\t\treturn api.StatusF, nil\n\tcase 5: // Active\n\t\treturn api.StatusC, nil\n\tdefault:\n\t\treturn api.StatusNone, fmt.Errorf(\"properties unknown result: %d\", chargeState)\n\t}\n}", "title": "" }, { "docid": "d2d5386c6d88c995aa3e08cd94de6fed", "score": "0.534994", "text": "func (o GetNatIpsIpOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetNatIpsIp) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b20ba5065a7ee0981f78811ef3bd4887", "score": "0.5346084", "text": "func Status() string {\n\tif db == nil {\n\t\treturn fmt.Sprintf(\"Database: %s KO (no connection)\", dbDriver)\n\t}\n\n\tif err := db.Ping(); err != nil {\n\t\treturn fmt.Sprintf(\"Database: %s KO (%s)\", dbDriver, err)\n\t}\n\n\treturn fmt.Sprintf(\"Database: %s OK (%d conns)\", dbDriver, db.Stats().OpenConnections)\n}", "title": "" }, { "docid": "4e6d96a13a0a775bc4eb1080af125c50", "score": "0.5329566", "text": "func (o *StatsApplianceAllOfData) HasOnline() bool {\n\tif o != nil && o.Online != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fe735a1a41da816e0b3a9ae93bc23a37", "score": "0.5324451", "text": "func (b *BaseAPI) GetLiveStatus() bool {\n\treturn b.liveStatus\n}", "title": "" }, { "docid": "a3ded65bb7ba84a75006b219f5668096", "score": "0.5323846", "text": "func (o VpnTunnelOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *VpnTunnel) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8720a8e17e814f73ffeb11f8d7f2a252", "score": "0.53218967", "text": "func (o GetBgpPeersPeerOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetBgpPeersPeer) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "095407086d26e3eee9bcd5a562917743", "score": "0.53197175", "text": "func (v *Provider) Status() (api.ChargeStatus, error) {\n\tstatus := api.StatusA // disconnected\n\n\tres, err := v.statusG()\n\tif err == nil {\n\t\tswitch strings.ToLower(res.Services.Charging.Status) {\n\t\tcase \"connected\", \"readyforcharging\":\n\t\t\tstatus = api.StatusB\n\t\tcase \"charging\":\n\t\t\tstatus = api.StatusC\n\t\t}\n\t}\n\n\treturn status, err\n}", "title": "" }, { "docid": "d2ea8ce507951af7ae5b3012b7683591", "score": "0.53061926", "text": "func getStatus(w http.ResponseWriter, r *http.Request) {\n\twriteAccessHeaders(w)\n\tstress_test_map, err := listener.GetMap(\"stress_test:status\")\n\tif err != nil {\n\t\tfmt.Fprintln(w, model.GetResponse(2))\n\t\tlog.Printf(\"error getting status map: %v\", err)\n\t\treturn\n\t}\n\tif len(stress_test_map) == 0 {\n\t\tfmt.Fprintln(w, model.GetResponse(2))\n\t\tlog.Println(\"status map clear!!!\")\n\t\treturn\n\t}\n\tfor key, value := range stress_test_map {\n\t\tlog.Printf(\"server: %s status: %s\", key, value)\n\t\tif value != \"ready\" {\n\t\t\tfmt.Fprintln(w, model.GetResponse(1))\n\t\t\treturn\n\t\t}\n\t}\n\tfmt.Fprintln(w, model.GetResponse(0))\n}", "title": "" }, { "docid": "f24023b254cc49c24e5dd9b9b21034e1", "score": "0.53031695", "text": "func (o GetWorkspacePrivateEndpointConnectionConnectionOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetWorkspacePrivateEndpointConnectionConnection) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "efdc825267ffff1639c77915ead2ed90", "score": "0.5297301", "text": "func GetNodeStatus(IP, user, password string) (string, error) {\n\tURL := fmt.Sprintf(\"https://%v/redfish/v1/Systems/System.Embedded.1/\", IP)\n\tauth := user + \":\" + password\n\tencodedAuth := base64.StdEncoding.EncodeToString([]byte(auth))\n\tdata := map[string]string{}\n\tjson_data, _ := json.Marshal(data)\n\treq, err := http.NewRequest(\"GET\", URL, bytes.NewBuffer(json_data))\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Error creating http request: %v\", err)\n\t\tlog.Error(msg)\n\t\treturn \"\", errors.New(fmt.Sprintf(\"fail to get the node status, err: %v\", msg))\n\t}\n\treq.Header.Add(\"Authorization\", \"Basic \"+encodedAuth)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Accept\", \"*/*\")\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Error creating post request: %v\", err)\n\t\tlog.Error(msg)\n\t}\n\tlog.Infof(resp.Status)\n\tif resp.StatusCode != 200 {\n\t\tlog.Error(\"Unable to get current state of the node\")\n\t\treturn \"\", errors.New(fmt.Sprintf(\"fail to get the node status. Request failed with status: %v\", resp.StatusCode))\n\t}\n\tdefer resp.Body.Close()\n\tpower := new(State)\n\tjson.NewDecoder(resp.Body).Decode(power)\n\treturn power.PowerState, nil\n}", "title": "" }, { "docid": "c969b6197aabd1f2d5f99f9b6b6cab06", "score": "0.52949405", "text": "func onlineNodes() []Node {\n\tlock.RLock()\n\tdefer lock.RUnlock()\n\tn := make([]Node, 0)\n\tfor _, node := range nodes {\n\t\tif node.VisitsMissed == 0 {\n\t\t\tn = append(n, node)\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "118b821a646fa59fb7a9611e65e490af", "score": "0.5275092", "text": "func (u User) GetStatus() {\n\tfmt.Println(\"Is user active:\", u.Status)\n}", "title": "" }, { "docid": "0ff898bea1c463d1f9a5236cafad37d8", "score": "0.526529", "text": "func (host *BastionHost) GetStatus() genruntime.ConvertibleStatus {\n\treturn &host.Status\n}", "title": "" }, { "docid": "0006853b80cbee4168014fe106ef90bc", "score": "0.52642316", "text": "func (c *Client) GetHostsGseAgentStatus(supplyAccount string, hosts []Host) ([]HostAgentStatus, error) {\n\tif c == nil {\n\t\treturn nil, ErrServerNotInit\n\t}\n\n\tchunksHost := xslice.SplitToChunks(hosts, limit)\n\thostList, ok := chunksHost.([][]Host)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"GetHostsGseAgentStatus SplitToChunks failed\")\n\t}\n\n\tvar (\n\t\thostAgentStatus = make([]HostAgentStatus, 0)\n\t\tagentLock = &sync.RWMutex{}\n\t)\n\n\tcon := utils.NewRoutinePool(20)\n\tdefer con.Close()\n\n\tfor i := range hostList {\n\t\tcon.Add(1)\n\t\tgo func(hosts []Host) {\n\t\t\tdefer con.Done()\n\n\t\t\tif options.GetEditionInfo().IsInnerEdition() {\n\t\t\t\tresp, err := c.GetAgentStatusV1(&GetAgentStatusReq{\n\t\t\t\t\tBKSupplierAccount: supplyAccount,\n\t\t\t\t\tHosts: hosts,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tblog.Errorf(\"GetHostsGseAgentStatus %v failed, %s\", supplyAccount, err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfor _, agent := range resp.Data {\n\t\t\t\t\tagentLock.Lock()\n\t\t\t\t\thostAgentStatus = append(hostAgentStatus, HostAgentStatus{\n\t\t\t\t\t\tHost: Host{\n\t\t\t\t\t\t\tIP: agent.IP,\n\t\t\t\t\t\t\tBKCloudID: agent.BKCloudID,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tAlive: agent.BKAgentAlive,\n\t\t\t\t\t})\n\t\t\t\t\tagentLock.Unlock()\n\t\t\t\t}\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tagentIDs := make([]string, 0)\n\t\t\tfor i := range hosts {\n\t\t\t\tagentIDs = append(agentIDs, hosts[i].AgentID)\n\t\t\t}\n\n\t\t\tresp, err := c.GetAgentStatusV2(&GetAgentStatusReqV2{AgentIDList: agentIDs})\n\t\t\tif err != nil {\n\t\t\t\tblog.Errorf(\"GetHostsGseAgentStatus %v failed, %s\", supplyAccount, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, agent := range resp.Data {\n\t\t\t\tagentLock.Lock()\n\t\t\t\thostAgentStatus = append(hostAgentStatus, HostAgentStatus{\n\t\t\t\t\tHost: Host{\n\t\t\t\t\t\tAgentID: agent.BkAgentID,\n\t\t\t\t\t\tBKCloudID: agent.BKCloudID,\n\t\t\t\t\t},\n\t\t\t\t\tAlive: agent.BKAgentAlive,\n\t\t\t\t})\n\t\t\t\tagentLock.Unlock()\n\t\t\t}\n\n\t\t\treturn\n\t\t}(hostList[i])\n\t}\n\tcon.Wait()\n\n\treturn hostAgentStatus, nil\n}", "title": "" }, { "docid": "3ac74574a12514d86d7067cfe4373d94", "score": "0.5261856", "text": "func (nc *NodeConn) GetFullStatus() *NodeStatus {\n\tnc.mu.Lock()\n\tdefer nc.mu.Unlock()\n\n\tstatus := &NodeStatus{\n\t\tID: nc.Conn.GetID(),\n\t\tSessionEstablished: nc.sessionEstablished,\n\t\tMigratingShard: nc.shardMigrationShard,\n\t\tConnected: nc.connected,\n\t\tDisconnectedAt: nc.disconnectedAt,\n\t\tVersion: nc.version,\n\t}\n\n\tstatus.Shards = make([]int, len(nc.runningShards))\n\tcopy(status.Shards, nc.runningShards)\n\n\tif nc.shardMigrationMode == dshardorchestrator.ShardMigrationModeFrom {\n\t\tstatus.MigratingTo = nc.shardMigrationOtherNodeID\n\t} else if nc.shardMigrationMode == dshardorchestrator.ShardMigrationModeTo {\n\t\tstatus.MigratingFrom = nc.shardMigrationOtherNodeID\n\t}\n\n\treturn status\n}", "title": "" }, { "docid": "34a4993a22682f30939d6029aa1cd551", "score": "0.5253308", "text": "func HealthzStatus() int {\n\tmu.RLock()\n\tdefer mu.RUnlock()\n\treturn healthzStatus\n}", "title": "" }, { "docid": "815b978a2e6a514fb7e18e60f44c5858", "score": "0.5251658", "text": "func (b *BigIP) NodeStatus(name, state string) error {\n\tconfig := &Node{}\n\n\tswitch state {\n\tcase \"enable\":\n\t\t// config.State = \"unchecked\"\n\t\tconfig.Session = \"user-enabled\"\n\tcase \"disable\":\n\t\t// config.State = \"unchecked\"\n\t\tconfig.Session = \"user-disabled\"\n\t\t// case \"offline\":\n\t\t// \tconfig.State = \"user-down\"\n\t\t// \tconfig.Session = \"user-disabled\"\n\t}\n\n\treturn b.put(config, uriLtm, uriNode, name)\n}", "title": "" }, { "docid": "ae9cd465aa27bf74f6178d3fdf239080", "score": "0.5247456", "text": "func (n Node) Status() (NodeStatus, error) {\n\tdata, err := n.RawStatus()\n\tif err != nil {\n\t\treturn NodeStatus{}, err\n\t}\n\n\tvar output NodeStatus\n\terr = json.Unmarshal(data, &output)\n\treturn output, err\n}", "title": "" }, { "docid": "9b3345ef9c4de2a0eaae51e33da1b642", "score": "0.52460206", "text": "func (o VirtualPhysicalConnectionOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *VirtualPhysicalConnection) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c586bcdfb74b75d380ee10a9be57e2c5", "score": "0.52448875", "text": "func (o *GetOnlineStateV1OK) Code() int {\n\treturn 200\n}", "title": "" }, { "docid": "a50414356a28194aa1dca4195376c5d3", "score": "0.52431726", "text": "func (o GetNetworksVpcOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetNetworksVpc) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3f8f042ec6362caf4264dc6c1afd0b6b", "score": "0.5238434", "text": "func (s *SignalingService) PublishOnlineStatus(\n\tstatusChanges chan *signaling.OnlineStatus,\n) error {\n\tfor status := range statusChanges {\n\t\tif status == nil {\n\t\t\tcontinue\n\t\t}\n\t\tsubject := s.EventNamespace + \".\" + signaling.OnlineStatusChangeEvent\n\t\terr := s.Nats.Publish(subject, status)\n\t\tif err != nil {\n\t\t\ts.Logger.Error(err)\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed771c02d1a8aa5e4a678e8bdfc1a065", "score": "0.52337295", "text": "func (o GetIpv6GatewaysGatewayOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetIpv6GatewaysGateway) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fd18b6400cb16c2de8773169d9c3e720", "score": "0.52285177", "text": "func (f *ATRemote) Status() byte {\n\treturn f.buffer[atRemoteStatusOffset]\n}", "title": "" }, { "docid": "de600cf74bcc4be9b4425eefb82eae4d", "score": "0.52232236", "text": "func (o *StatsApplianceAllOfData) SetOnline(v bool) {\n\to.Online = &v\n}", "title": "" }, { "docid": "d2ce4d51a4ce8e0aaa7a5618aa808f1a", "score": "0.5218744", "text": "func GetStatus() string {\n\tfmt.Println(\"Status OK\")\n\treturn string(`{\"status\":\"OK\"}`)\n}", "title": "" }, { "docid": "a545c66c25208847eab00c742ed19ce7", "score": "0.52131665", "text": "func (o GetBgpNetworksNetworkOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetBgpNetworksNetwork) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9af47b4509afb00e471af70b7d2dade8", "score": "0.5212953", "text": "func Status(org, apiKeyTok string) {\n\t// Display the full resources\n\tvar output string\n\tcliutils.WiotpGet(cliutils.GetWiotpUrl(org), \"service-status\", apiKeyTok, []int{200}, &output)\n\tfmt.Println(output)\n}", "title": "" }, { "docid": "ab4686ebe8da17810d6b1637aa6a7863", "score": "0.5212842", "text": "func GetClientStatus(id string) string {\n\tif id == \"0\" {\n\t\treturn \"inactive\"\n\t}\n\treturn \"active\"\n\n}", "title": "" }, { "docid": "888f93d4846d7d0b8152edd9a63023a7", "score": "0.5212379", "text": "func (o GetSimpleOfficeSitesSiteOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSimpleOfficeSitesSite) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ec4ae8316a8a0aaf11ca5050befcf9a0", "score": "0.52116823", "text": "func (st *ServerStats) getServerStatus(client *mongo.Client) error {\n\tvar pstat = anly.ServerStatusDoc{}\n\tvar stat = anly.ServerStatusDoc{}\n\tvar iop int\n\tvar piop int\n\tvar r, w, c float64\n\tif st.verbose {\n\t\trstr := fmt.Sprintf(\"getServerStatus gets every %d seconds(s)\\n\", st.freq.serverStatus)\n\t\tst.channel <- rstr\n\t}\n\tst.channel <- \"[\" + st.mkey + \"] getServerStatus begins\"\n\tfor {\n\t\tserverStatus, _ := mdb.RunAdminCommand(client, \"serverStatus\")\n\t\tbuf, _ := bson.Marshal(serverStatus)\n\t\tbson.Unmarshal(buf, &stat)\n\t\tserverStatusDocs[st.uri] = append(serverStatusDocs[st.uri], stat)\n\t\tif len(serverStatusDocs[st.uri]) > 600 {\n\t\t\tvar err error\n\t\t\tvar data []byte\n\t\t\tif data, err = getServerStatusData(st.uri); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfilename := keyholeStatsDataFile + \"-\" + st.mkey + \".gz\"\n\t\t\tgox.OutputGzipped(data, filename)\n\t\t\t// also resets\n\t\t\tserverStatusDocs[st.uri] = []anly.ServerStatusDoc{}\n\t\t\treplSetStatusDocs[st.uri] = []anly.ReplSetStatusDoc{}\n\t\t}\n\n\t\tvar msg1, msg2 string\n\t\tstr := fmt.Sprintf(\"[%s] Memory - resident: %d, virtual: %d\",\n\t\t\tst.mkey, stat.Mem.Resident, stat.Mem.Virtual)\n\t\tiop = stat.Metrics.Document.Inserted + stat.Metrics.Document.Returned +\n\t\t\tstat.Metrics.Document.Updated + stat.Metrics.Document.Deleted\n\t\tiops := float64(iop-piop) / 60\n\t\tif len(serverStatusDocs[st.uri]) > 6 && len(serverStatusDocs[st.uri])%6 == 1 {\n\t\t\tpstat = serverStatusDocs[st.uri][len(serverStatusDocs[st.uri])-7]\n\t\t\tif stat.Host == pstat.Host {\n\t\t\t\tstr += fmt.Sprintf(\", page faults: %d, iops: %.1f\",\n\t\t\t\t\t(stat.ExtraInfo.PageFaults - pstat.ExtraInfo.PageFaults), iops)\n\t\t\t\tmsg1 = fmt.Sprintf(\"[%s] CRUD+ - insert: %d, find: %d, update: %d, delete: %d, getmore: %d, command: %d\",\n\t\t\t\t\tst.mkey, stat.OpCounters.Insert-pstat.OpCounters.Insert,\n\t\t\t\t\tstat.OpCounters.Query-pstat.OpCounters.Query,\n\t\t\t\t\tstat.OpCounters.Update-pstat.OpCounters.Update,\n\t\t\t\t\tstat.OpCounters.Delete-pstat.OpCounters.Delete,\n\t\t\t\t\tstat.OpCounters.Getmore-pstat.OpCounters.Getmore,\n\t\t\t\t\tstat.OpCounters.Command-pstat.OpCounters.Command)\n\t\t\t\tr = 0\n\t\t\t\tif stat.OpLatencies.Reads.Ops > 0 {\n\t\t\t\t\tr = float64(stat.OpLatencies.Reads.Latency) / float64(stat.OpLatencies.Reads.Ops) / 1000\n\t\t\t\t}\n\t\t\t\tw = 0\n\t\t\t\tif stat.OpLatencies.Writes.Ops > 0 {\n\t\t\t\t\tw = float64(stat.OpLatencies.Writes.Latency) / float64(stat.OpLatencies.Writes.Ops) / 1000\n\t\t\t\t}\n\t\t\t\tc = 0\n\t\t\t\tif stat.OpLatencies.Commands.Ops > 0 {\n\t\t\t\t\tc = float64(stat.OpLatencies.Commands.Latency) / float64(stat.OpLatencies.Commands.Ops) / 1000\n\t\t\t\t}\n\t\t\t\tmsg2 = fmt.Sprintf(\"[%s] Latency- read: %.1f, write: %.1f, command: %.1f (ms)\",\n\t\t\t\t\tst.mkey, r, w, c)\n\t\t\t} else {\n\t\t\t\tstr += \"\"\n\t\t\t}\n\t\t} else {\n\t\t\tstr += \"\"\n\t\t}\n\t\tif len(serverStatusDocs[st.uri])%6 == 1 {\n\t\t\tst.channel <- str\n\t\t\tif msg1 != \"\" {\n\t\t\t\tst.channel <- msg1\n\t\t\t}\n\t\t\tif msg2 != \"\" {\n\t\t\t\tst.channel <- msg2\n\t\t\t}\n\t\t}\n\t\tpiop = iop\n\t\ttime.Sleep(time.Duration(st.freq.serverStatus) * time.Second)\n\t}\n}", "title": "" }, { "docid": "dcc977a1b95391b6ce334262db1f382b", "score": "0.52097857", "text": "func CurrentStatus(session *mgo.Session) (*Status, error) {\n\tstatus := &Status{}\n\terr := session.Run(\"replSetGetStatus\", status)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot get replica set status: %v\", err)\n\t}\n\n\tfor index, member := range status.Members {\n\t\tstatus.Members[index].Address = formatIPv6AddressWithBrackets(member.Address)\n\t}\n\treturn status, nil\n}", "title": "" }, { "docid": "5b233fd70325a099f5af1a5cb27c121c", "score": "0.5209695", "text": "func GetStatus(param ops.GetStatusParams) middleware.Responder {\n\tstatus := CheckConnection()\n\tresp := models.StatusResponse{Host: &configuration.Receiver.Host, Reachable: &status}\n\treturn ops.NewGetStatusOK().WithPayload(&resp)\n}", "title": "" }, { "docid": "91a1a32042c9740bf493d9e3d9a99eb2", "score": "0.52054805", "text": "func (wb *Versicharge) Status() (api.ChargeStatus, error) {\n\tb, err := wb.conn.ReadHoldingRegisters(versiRegChargeStatus, 1)\n\tif err != nil {\n\t\treturn api.StatusNone, err\n\t}\n\n\treturn api.ChargeStatusString(string(b))\n}", "title": "" }, { "docid": "b29e61b8493d8cd164e4baa34aad101d", "score": "0.52010715", "text": "func (c *client) Status() (int, error) {\n\tstatusCode, _, err := c.Do(\"/v3\", \"GET\", nil)\n\treturn statusCode, err\n}", "title": "" }, { "docid": "02859f536294ac098d1ebcc81cd95030", "score": "0.5196776", "text": "func (r *server) LocalStatus(ctx context.Context, req *pb.LocalStatusRequest) (resp *pb.LocalStatusResponse, err error) {\n\tresp = &pb.LocalStatusResponse{}\n\n\tresp.Status = r.agent.recentLocalStatus()\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "a145a4dc4d0afc97601153df0d414095", "score": "0.5195804", "text": "func (o GetHanaBackupClientsResultOutput) Status() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GetHanaBackupClientsResult) *string { return v.Status }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e0848152e686d369859b80cb8a7fe2ef", "score": "0.5194367", "text": "func (o ServerlessInstanceOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ServerlessInstance) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "959a88297a52ec2608a93bec10db168d", "score": "0.5193081", "text": "func (o GetTrafficMirrorSessionsSessionOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetTrafficMirrorSessionsSession) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6c1be4e484d51b7856a2a3a6badc626c", "score": "0.518204", "text": "func (o HanaBackupClientOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *HanaBackupClient) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "bffc3c8dc3edf5661d06fcd823604a02", "score": "0.51725465", "text": "func (o *Source) GetAvailabilityStatus() string {\n\tif o == nil || o.AvailabilityStatus == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.AvailabilityStatus\n}", "title": "" }, { "docid": "347e4f24d17a5562d41adb4053aceb42", "score": "0.51670057", "text": "func (c *diskCache) IsOnline() bool {\n\tc.onlineMutex.RLock()\n\tdefer c.onlineMutex.RUnlock()\n\treturn c.online\n}", "title": "" }, { "docid": "e60a47bb0e9b10a0f2112ca44d0ad6fd", "score": "0.5159519", "text": "func NewGetOnlineStateV1OK() *GetOnlineStateV1OK {\n\treturn &GetOnlineStateV1OK{}\n}", "title": "" }, { "docid": "6dd7eb1c9774f26e32fbfcd12e1dc561", "score": "0.5155805", "text": "func workerStatus() (active, total int) {\n\tworkCond.Lock()\n\ttotal = len(workStatus)\n\tactive = total - workCond.Value\n\tworkCond.Unlock()\n\treturn\n}", "title": "" }, { "docid": "09b6c547759d822ad731a03a7394b4e9", "score": "0.51557606", "text": "func (o PrivateLinkConnectionStateOutput) Status() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PrivateLinkConnectionState) *string { return v.Status }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "854324c01fb54bb23d7a7efec4e1803c", "score": "0.5151209", "text": "func (o GetPublicIpAddressPoolsPoolOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetPublicIpAddressPoolsPool) string { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7233d5148d24bc2f7a0c0290a94360aa", "score": "0.51448107", "text": "func (o GatewayVcoRouteOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *GatewayVcoRoute) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "00dd10693ec1ddb9c4fc518c0b7f8bf8", "score": "0.5135048", "text": "func (b *Board) GetStatus(x, y int) (int, error) {\n\tif int(x) > b.width-1 || int(y) > b.height-1 {\n\t\treturn 0, ErrOutOfBoard\n\t}\n\tif b.fields[x][y].mine {\n\t\treturn StatusMine, nil\n\t}\n\treturn b.getNeighbourMCount(int(x), int(y)), nil\n}", "title": "" } ]
0f925104380025ecc957fc1428784d04
watt seconds for aux4
[ { "docid": "9cdb19c5afe0af6c545cece7fd933f41", "score": "0.5205178", "text": "func wattSec6(dataframe []byte) (float64, error) {\n\treturn readAsFloat(dataframe, 52, 56, 1, true)\n}", "title": "" } ]
[ { "docid": "15dda7312cdeb93680f07f7d7f172bf5", "score": "0.58103514", "text": "func wattSec4(dataframe []byte) (float64, error) {\n\treturn readAsFloat(dataframe, 44, 48, 1, true)\n}", "title": "" }, { "docid": "b873a2c71b1b9a0c24259a4ae45a5b95", "score": "0.5514472", "text": "func monotime() int64", "title": "" }, { "docid": "5d803e4435365769617dcea6d4908f4a", "score": "0.5471703", "text": "func usleep2(dt int32)", "title": "" }, { "docid": "861bc78503a51816c235d8882ad56d34", "score": "0.54694086", "text": "func tracerouteDuration(scamper1 *parser.Scamper1) uint32 {\n\td := uint32(scamper1.CycleStop.StopTime - scamper1.CycleStart.StartTime)\n\ttotDuration += uint64(d)\n\tif d < minDuration {\n\t\tminDuration = d\n\t}\n\tif d > maxDuration {\n\t\tmaxDuration = d\n\t}\n\treturn d\n}", "title": "" }, { "docid": "cbd5e32ea40d4648d8553fe13629a696", "score": "0.54451793", "text": "func wattSec1(dataframe []byte) (float64, error) {\n\treturn readAsFloat(dataframe, 5, 10, 1, true)\n}", "title": "" }, { "docid": "6faeab680f741ae524c54e2b883e9eab", "score": "0.54061294", "text": "func sinceTracelbStart(scamper1 *parser.Scamper1, t int64) int64 {\n\tif t == 0 {\n\t\treturn 0\n\t}\n\treturn (t - (scamper1.Tracelb.Start.Sec*1000000 + scamper1.Tracelb.Start.Usec)) / 1000\n}", "title": "" }, { "docid": "4249b08fbf1201ab0274010b1a3b5294", "score": "0.53618133", "text": "func wattSec2(dataframe []byte) (float64, error) {\n\treturn readAsFloat(dataframe, 10, 15, 1, true)\n}", "title": "" }, { "docid": "76eede264620d3fcd3a2f40a90808c96", "score": "0.53181267", "text": "func wattSec3(dataframe []byte) (float64, error) {\n\treturn readAsFloat(dataframe, 40, 44, 1, true)\n}", "title": "" }, { "docid": "4bf9b576f2bb6da999473cfddc016267", "score": "0.5215329", "text": "func uptime(startTime *time.Time) string {\n\t// Seconds duration since app start\n\tduration := time.Since(*startTime)\n\n\tsec := int(duration.Seconds()) % 60\n\tmin := int(duration.Minutes()) % 60\n\thour := int(duration.Hours()) % 24\n\tday := int(duration.Hours()/24) % 7\n\tmonth := int(duration.Hours()/24/7/4) % 12\n\tyear := int(duration.Hours() / 24 / 365)\n\n\treturn fmt.Sprintf(\"P%dY%dM%dDT%dH%dM%dS\", year, month, day, hour, min, sec)\n}", "title": "" }, { "docid": "e59a5195c3fee6397d73f167dd70eba3", "score": "0.5204579", "text": "func Ts() int64 {\n\treturn time.Now().Unix()\n}", "title": "" }, { "docid": "281727ffa0ef27ba4e59080b61379ad3", "score": "0.51908123", "text": "func (*A_VT) Duration() {}", "title": "" }, { "docid": "7b8eab6d1d50770f5225a4a77715b8a0", "score": "0.5178221", "text": "func SleepTiming(step string) int {\n\treturn int(([]rune(strings.ToUpper(step))[0] - 64))\n}", "title": "" }, { "docid": "520db317865e606921f45be7267cb3a4", "score": "0.5177937", "text": "func wattSec5(dataframe []byte) (float64, error) {\n\treturn readAsFloat(dataframe, 48, 52, 1, true)\n}", "title": "" }, { "docid": "896151a6d0af7df176ef1f64a1a7ed88", "score": "0.5177215", "text": "func formTimestamp(b *Bluno, resp []byte, start uint8) time.Time {\n\tts := time.Millisecond * time.Duration(binary.LittleEndian.Uint32(resp[start:start+4]))\n\tdelta := time.Duration(int64(b.HandshakedAt.Sub(b.HandShakeInit)) / 2)\n\treturn b.HandShakeInit.Add(delta).Add(ts)\n}", "title": "" }, { "docid": "d0d199553ad3bc213447c0e8cd632bba", "score": "0.5174338", "text": "func TimeRun() time.Duration {\n d := time.Since(appTime)\n d -= d % time.Second\n return d\n}", "title": "" }, { "docid": "e00763904dfb41f0797cfb35b6faa3f5", "score": "0.51713556", "text": "func PreparationTime (time int) int {\n return 2*time\n}", "title": "" }, { "docid": "7883f541945e75bb941a813a7e6b408c", "score": "0.5103626", "text": "func wattSec7(dataframe []byte) (float64, error) {\n\treturn readAsFloat(dataframe, 56, 60, 1, true)\n}", "title": "" }, { "docid": "141a1dc9dd749e45b1cda70bff1cc30d", "score": "0.5055455", "text": "func (mw *ModelWatcher) timeframe() int {\n\ttimeframe := strings.ReplaceAll(mw.RatingRuleInstance.Timeframe, \"s\", \"\")\n\tduration, err := strconv.Atoi(timeframe)\n\tif err != nil {\n\t\tmw.Logger.Error(err, \"Unrecognized format for `timeframe`, using default (60s).\")\n\t\tduration = 60\n\t}\n\treturn duration\n}", "title": "" }, { "docid": "35e6618af81613ee3d13baaa7a5ae416", "score": "0.5053661", "text": "func getDelay(departure *time.Time) int {\n\treturn int(departure.Sub(time.Now().UTC()).Minutes())\n}", "title": "" }, { "docid": "34c944728f1bb639d6be9e31a802f1e3", "score": "0.5022537", "text": "func (self *Timer) TimeCap() int{\n return self.Object.Get(\"timeCap\").Int()\n}", "title": "" }, { "docid": "7ab5c3fd7adfdc1cd20d6db193eac23d", "score": "0.50099343", "text": "func snotime() uint64 {\n\treturn internal.Snotime()\n}", "title": "" }, { "docid": "11d41c383bc6a01052442af0480522b7", "score": "0.5007226", "text": "func (c *Cache) TTU() time.Duration { return c.ttu }", "title": "" }, { "docid": "9b7f55df181518d5f3a79504319aaea0", "score": "0.49803612", "text": "func (s *Tps2000) SetupTime(sampleIntervalSec float64, xPosSec float64, mode instr.SampleMode, sampleCount int) error {\n\tif sampleCount > s.maxSampleCount {\n\t\treturn fmt.Errorf(\"samplecount of %d is larger than max %d\", sampleCount, s.maxSampleCount)\n\t}\n\ts.sampleCount = sampleCount\n\t// The scope allways store 2500 samples for a full 10 divisions or 250 s/div\n\t// Samples pr sec is then\n\tnr := fmt.Sprintf(\"%0.3e\", sampleIntervalSec*250)\n\t// Make sure it is in the 1-2.5-5 sequence\n\tif nr[0:4] != \"1.00\" && nr[0:4] != \"2.50\" && nr[0:4] != \"5.00\" {\n\t\treturn fmt.Errorf(\"time pr div must be 1/2.5/5\")\n\t}\n\tif mode == instr.MinMax {\n\t} else if mode == instr.Average {\n\t\t_ = s.Write(\"ACQ:MOD AVE\")\n\t} else if mode == instr.Sample {\n\t\t_ = s.Write(\"ACQ:MOD SAM\")\n\t} else {\n\t\t_ = s.Write(\"ACQ:MOD PEAK\")\n\t}\n\terr := s.Write(\"HOR:MAI:SCA \" + nr)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_ = s.Write(\"HOR:MAI:POS %0.3g\", xPosSec)\n\treturn nil\n}", "title": "" }, { "docid": "a455a6e33ddbea5b1eda6077a09a219a", "score": "0.4969249", "text": "func (dscptr *SpDscptr) TimeDscptr(bitn *bitter.Bitn) {\n\tdscptr.Name = \"Time Descriptor\"\n\tdscptr.TAISeconds = bitn.AsUInt64(48)\n\tdscptr.TAINano = bitn.AsUInt64(32)\n\tdscptr.UTCOffset = bitn.AsUInt64(16)\n}", "title": "" }, { "docid": "e800b3ad3fd522ed8307020637707e5a", "score": "0.49609882", "text": "func weightedTime(material MaterialKind, kinetic float64) float64 {\n\tif kinetic < physK[0] {\n\t\treturn 0\n\t}\n\n\tmat := materials[material]\n\timax := len(physK) - 1\n\tif kinetic >= physK[imax] {\n\t\t// constant loss model\n\t\ta := mat.amax\n\t\tb := mat.bmax\n\t\te0 := physK[imax] + muon.Mass\n\t\te1 := kinetic + muon.Mass\n\t\treturn mat.t[imax] + muon.Mass/a*math.Log((e1/e0)*(a+b*e0)/(a+b*e1))\n\t}\n\n\treturn linearInterpolate(physK[:], mat.t[:], kinetic)\n}", "title": "" }, { "docid": "baef17373e849db7e54377d0cfc9c58b", "score": "0.4957749", "text": "func (NilRate) UpdateTs(int64, int64) {}", "title": "" }, { "docid": "7c786389300a5b1ba5cdcc2b7df9ef8f", "score": "0.49388495", "text": "func now() time.Duration {\n\tvar now int64\n\tsyscall.Syscall(queryPerformanceCounterProc.Addr(), 1, uintptr(unsafe.Pointer(&now)), 0, 0)\n\treturn time.Duration(now) * time.Second / (time.Duration(qpcFrequency) * time.Nanosecond)\n}", "title": "" }, { "docid": "e7c900c8e8dc8fc9cfc69840b6c1ead4", "score": "0.4922814", "text": "func (self *Timer) Seconds() int{\n return self.Object.Get(\"seconds\").Int()\n}", "title": "" }, { "docid": "091ba3622bbe2f1e48f3506187bd794d", "score": "0.49171397", "text": "func (self Timer)tickSecs()(float64){\n return float64(self.Ticks)/SECOND_IN_NS\n}", "title": "" }, { "docid": "0aa602f0cbcf8167199b97eb341c7b80", "score": "0.4906692", "text": "func (o GoogleCloudRunV2ProbeOutput) PeriodSeconds() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudRunV2Probe) *int { return v.PeriodSeconds }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "f114f57e31000dc3c711923590507204", "score": "0.4901818", "text": "func getReconnectDuration(start, now time.Time) time.Duration {\n\tduration := now.Sub(start)\n\tswitch {\n\tcase duration < 10*time.Minute:\n\t\treturn 30 * time.Second\n\tcase duration < 24*time.Hour:\n\t\treturn 5 * time.Minute\n\tcase duration < 168*time.Hour:\n\t\treturn 30 * time.Minute\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "48b5b8c1a57c48a0454eb1307ae454b3", "score": "0.49002728", "text": "func uptime(uptime int) string {\n\tvar result string\n\n\tdays := uptime / 24 / 60 / 60\n\thours := (uptime - days*86400) / 3600\n\tminutes := (uptime - days*86400 - hours*3600) / 60\n\tseconds := uptime - days*86400 - hours*3600 - minutes*60\n\n\tresult = strconv.Itoa(seconds) + \"s\"\n\n\tif minutes > 0 {\n\t\tresult = strconv.Itoa(minutes) + \"m \" + result\n\t}\n\tif hours > 0 {\n\t\tresult = strconv.Itoa(hours) + \"h \" + result\n\t}\n\tif days > 0 {\n\t\tresult = strconv.Itoa(days) + \"d \" + result\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "955befeb79cc56f02a74c7fdb7ca3cdb", "score": "0.4893252", "text": "func timer(w http.ResponseWriter, r *http.Request) {\n\tpage := getTime()\n\tfmt.Fprint(w, page)\n}", "title": "" }, { "docid": "9c38dfe1ae85936562a21e85c02e4ddd", "score": "0.4888933", "text": "func (self *Timer) Ms() int{\n return self.Object.Get(\"ms\").Int()\n}", "title": "" }, { "docid": "67b0556c024baa64ee4f7c9e21d12fef", "score": "0.48565006", "text": "func calculateWatchTimeout(deployment *unstructured.Unstructured, buffer int32) *int64 {\n\tapplicationContainer, _ := findContainer(deployment)\n\tif applicationContainer.LivenessProbe == nil {\n\t\t// Return default if liveness probe was initialized but all values left at defaults, plus buffer.\n\t\treturn int64Ref(33 + buffer)\n\t}\n\t// Default settings as defined in k8s.io/api/core/v1/types.go\n\tinitialDelay := applicationContainer.LivenessProbe.InitialDelaySeconds // Default is 0.\n\ttimeout := setIfZeroInt32(applicationContainer.LivenessProbe.TimeoutSeconds, 1)\n\tperiod := setIfZeroInt32(applicationContainer.LivenessProbe.PeriodSeconds, 10)\n\tfailureThreshold := setIfZeroInt32(applicationContainer.LivenessProbe.FailureThreshold, 3)\n\treturn int64Ref(buffer + initialDelay + failureThreshold*(period+timeout))\n}", "title": "" }, { "docid": "0e2824e860c405f39bc76c5a620daaa1", "score": "0.4850411", "text": "func RemainingOvenTime (time int) int {\n return OvenTime - time\n}", "title": "" }, { "docid": "d2044766a70072207c6b95e32b18703e", "score": "0.48487625", "text": "func (this *Counter) PerSec() int64 {\n this.mutex.Lock()\n defer this.mutex.Unlock()\n\n return this.perSec\n}", "title": "" }, { "docid": "92d67812e071aabb492a092a8fe64804", "score": "0.48393553", "text": "func (*C_PhilosophersNotes) Duration() {}", "title": "" }, { "docid": "699ce8ba54ac7f9125eab7602650af91", "score": "0.483799", "text": "func (self *Timer) SECOND() int{\n return self.Object.Get(\"SECOND\").Int()\n}", "title": "" }, { "docid": "afbed1e788dcd2d16b707aa9d73ecdd9", "score": "0.48365268", "text": "func (cmd *TimeSignal) length() int {\n\tlength := 1 // time_specified_flag\n\tif cmd.timeSpecifiedFlag() {\n\t\tlength += 6 // reserved\n\t\tlength += 33 // pts_time\n\t} else {\n\t\tlength += 7 // reserved\n\t}\n\treturn length / 8\n}", "title": "" }, { "docid": "4174688ebc6965d6e71cee2b1ba9b02b", "score": "0.4830659", "text": "func main() {\n currentTime, lastTime, err := getCPUTimes()\n if err != nil {\n fmt.Println(\"fail\") \n }\n fmt.Println(currentTime)\n fmt.Println(lastTime)\n}", "title": "" }, { "docid": "c0fc7f73ddfa65dabe9090ea3954925e", "score": "0.4829818", "text": "func getNTPSeconds(t time.Time) (int64, int64) {\n // convert time to total # of secs since 1970\n // add NTP epoch offsets as total #secs between 1900-1970\n secs := t.Unix() + int64(getNTPOffset())\n fracs := t.Nanosecond()\n return secs, int64(fracs)\n}", "title": "" }, { "docid": "5b8840a2a24ca356509149a8e60a7bb9", "score": "0.48015153", "text": "func (this *base) accrueTime(copy *base) {\n\tthis.inDocs += copy.inDocs\n\tthis.outDocs += copy.outDocs\n\tthis.phaseSwitches += copy.phaseSwitches\n\tthis.execTime += copy.execTime\n\tthis.chanTime += copy.chanTime\n\tthis.servTime += copy.servTime\n}", "title": "" }, { "docid": "53a5bca4ab203fdba1d52f867fc61945", "score": "0.4798055", "text": "func sec_to_time(d uint64) string {\n\thours := d / 3600 // integer value\n\tminutes := (d - hours*3600) / 60 // integer value\n\tseconds := d - hours*3600 - minutes*60\n\n\treturn fmt.Sprintf(\"%02d:%02d:%02d\", hours, minutes, seconds)\n}", "title": "" }, { "docid": "93fc6dc85e4313f707455392b913f4d8", "score": "0.4796758", "text": "func printRunTime(start, finish int64) {\n\tms := finish - start\n\tns := ms * int64(time.Millisecond)\n\tsecs := float64(ns) / float64(time.Second)\n\tfmt.Printf(\"Stats\\t%.2f seconds\\n\", secs)\n}", "title": "" }, { "docid": "741c16c056e33bfefafa39bd4706aa5a", "score": "0.47933212", "text": "func update() {\n\t//update prev at 59 second\n\tprev = cc\n}", "title": "" }, { "docid": "15727fdb70aa09f005b956b843999161", "score": "0.479114", "text": "func main() {\nfor {\n\tv := time.Now().Format(time.RFC850)\n\tthen, err := time.Parse(time.RFC850, v)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tduration := time.Since(then)\n\tfmt.Println(duration.Seconds())\n}\n/*\n\tv = time.Now().Format(time.RFC850)\n\tthen, err = time.Parse(time.RFC850, v)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tduration = time.Since(then)\n\tfmt.Println(duration.Seconds())\n\n\tv = time.Now().Format(time.RFC850)\n\tthen, err = time.Parse(time.RFC850, v)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tduration = time.Since(then)\n\tfmt.Println(duration.Seconds())\n\n\tv = time.Now().Format(time.RFC850)\n\tthen, err = time.Parse(time.RFC850, v)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tduration = time.Since(then)\n\tfmt.Println(duration.Seconds())\n*/\n}", "title": "" }, { "docid": "4bad0ace167276b5cf81f97c15d2928b", "score": "0.47901443", "text": "func timeallowed() time.Duration {\n\tswitch {\n\tcase testing.Short():\n\t\treturn time.Second / 10\n\tcase *long:\n\t\treturn 30 * time.Second\n\tcase *stress:\n\t\treturn 2 * time.Minute\n\tdefault:\n\t\treturn time.Second\n\t}\n}", "title": "" }, { "docid": "ccd3a84cb1706ffb112e22b17e827c96", "score": "0.47877076", "text": "func timestamp(hours, minutes, seconds, millis string) time.Duration {\n\treturn durationFrom(hours)*time.Hour +\n\t\tdurationFrom(minutes)*time.Minute +\n\t\tdurationFrom(seconds)*time.Second +\n\t\tdurationFrom(millis)*time.Millisecond\n}", "title": "" }, { "docid": "0a0b216d3ece83cd731fbbef706858f9", "score": "0.47860906", "text": "func InWords(t time.Time) string {\n\n\tnow := time.Now()\n\td := now.Sub(t)\n\tif d >= time.Second && d <= (time.Second*4) {\n\t\treturn fmt.Sprintf(lssthnd, 5, \"seconds\")\n\t} else if d >= (time.Second*5) && d < (time.Second*10) {\n\t\treturn fmt.Sprintf(lssthnd, 10, \"seconds\")\n\t} else if d >= (time.Second*10) && d < (time.Second*20) {\n\t\treturn fmt.Sprintf(lssthnd, 20, \"seconds\")\n\t} else if d >= (time.Second*20) && d < (time.Second*40) {\n\t\treturn \"half a minute\"\n\t} else if d >= (time.Second*40) && d < (time.Second*60) {\n\t\treturn fmt.Sprintf(lssthns, \"minute\")\n\t} else if d >= (time.Second*60) && d < time.Minute+(time.Second*30) {\n\t\treturn \"1 minute\"\n\t} else if d >= time.Minute+(time.Second*30) && d < (time.Minute*44)+(time.Second*30) {\n\t\treturn fmt.Sprintf(\"%d minutes\", (d / time.Minute))\n\t} else if d >= (time.Minute*44)+(time.Second*30) && d < (time.Minute*89)+(time.Second*30) {\n\t\treturn fmt.Sprintf(aboutnd, d/time.Hour, \"hour\")\n\t} else if d >= (time.Minute*89)+(time.Second*30) && d < (time.Hour*29)+(time.Minute*59)+(time.Second*30) {\n\t\treturn fmt.Sprintf(aboutnd, (d / time.Hour), \"hours\")\n\t} else if d >= (time.Hour*23)+(time.Minute*59)+(time.Second*30) && d < (time.Hour*41)+(time.Minute*59)+(time.Second*30) {\n\t\treturn \"1 day\"\n\t} else if d >= (time.Hour*41)+(time.Minute*59)+(time.Second*30) && d < (day*29)+(time.Hour*23)+(time.Minute*59)+(time.Second*30) {\n\t\treturn fmt.Sprintf(\"%d days\", d/(time.Hour*24))\n\t} else if d >= (day*29)+(time.Hour*23)+(time.Minute*59)+(time.Second*30) && d < (day*59)+(time.Hour*23)+(time.Minute*59)+(time.Second*30) {\n\t\treturn fmt.Sprintf(aboutnd, 1, \"month\")\n\t} else if d >= (day*59)+(time.Hour*23)+(time.Minute*59)+(time.Second*30) && d < (year) {\n\t\treturn fmt.Sprintf(aboutnd, d/month+1, \"months\")\n\t} else if d >= year && d < year+(3*month) {\n\t\treturn fmt.Sprintf(aboutnd, 1, \"year\")\n\t} else if d >= year+(3*month) && d < year+(9*month) {\n\t\treturn \"over 1 year\"\n\t} else if d >= year+(9*month) && d < (year*2) {\n\t\treturn \"almost 2 years\"\n\t} else {\n\t\treturn fmt.Sprintf(aboutnd, d/year, \"years\")\n\t}\n\n}", "title": "" }, { "docid": "37bfdc1723105ce2b9ae4de9e2edbd6b", "score": "0.47813436", "text": "func latency(t1, t2 metav1.Time) string {\n\treturn fmt.Sprintf(\"%.0f sec\", t2.Time.Sub(t1.Time).Seconds())\n}", "title": "" }, { "docid": "ccceefec0ddef58a487d4521a4d11b04", "score": "0.47794533", "text": "func (o GoogleCloudRunV2ProbePtrOutput) PeriodSeconds() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudRunV2Probe) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PeriodSeconds\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "c8d5d690b7b45a49ee554413459d9f38", "score": "0.47754276", "text": "func NowSecond() int {\n\treturn time.Now().Second()\n}", "title": "" }, { "docid": "5df7889356fb322450144816df8015f7", "score": "0.47731626", "text": "func calculateDuration(t time.Duration) string {\n\tstartTime = time.Now()\n\ttotalTime := int(startTime.Unix()) - appTime //int(t) / int(time.Second)\n\n\tremainderSeconds := totalTime % 60 // final seconds\n\tminutes := totalTime / 60\n\tremainderMinutes := minutes % 60 // final minutes\n\thours := minutes / 60\n\tremainderHours := hours % 24 // final hours\n\tdays := hours / 24\n\tremainderDays := days % 7 // final days\n\tmonths := days / 28\n\tremainderMonths := months % 12 // final months\n\tyears := months / 12 // final years\n\n\ts := \"P\" + strconv.Itoa(years) + \"Y\" + strconv.Itoa(remainderMonths) + \"M\" + strconv.Itoa(remainderDays) + \"D\" + strconv.Itoa(remainderHours) + \"H\" + strconv.Itoa(remainderMinutes) + \"M\" + strconv.Itoa(remainderSeconds) + \"S\"\n\treturn s\n}", "title": "" }, { "docid": "6cdf8c702ba57a45729ca052f1ee05e5", "score": "0.47613418", "text": "func CounterNow() uint { return TimeToCounter(timeNow(), DefaultPeriod) }", "title": "" }, { "docid": "c6d7307ec74323cae14a74597a517b8e", "score": "0.47589314", "text": "func (c *Counter) plusSec() {\n\tif c.ss == 59 {\n\t\tc.plusMin()\n\t\tc.ss = 0\n\t}\n\tc.ss++\n}", "title": "" }, { "docid": "fea590175458f00c84c856f8e3ebba9b", "score": "0.47477695", "text": "func (this *Counter) calcPerSec() {\n this.mutex.Lock()\n defer this.mutex.Unlock()\n\n this.perSec = this.total\n if this.perSec > this.maxPerSec {\n this.maxPerSec = this.perSec\n }\n \n this.total = 0\n\n time.AfterFunc(1 * time.Second, this.calcPerSec)\n}", "title": "" }, { "docid": "a7ecb1ca968c611b24c57d63ad2cbe86", "score": "0.4746672", "text": "func (self *Timer) SetSECONDA(member int) {\n self.Object.Set(\"SECOND\", member)\n}", "title": "" }, { "docid": "eda6a9b7909f5fbc6ad0f45abf8ad3c3", "score": "0.4739864", "text": "func Utime(path string, buf *Utimbuf) (err error) {\n\tvar _p0 *byte\n\t_p0, err = BytePtrFromString(path)\n\tif err != nil {\n\t\treturn\n\t}\n\t_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUtime)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0)\n\tif e1 != 0 {\n\t\terr = e1\n\t}\n\treturn\n}", "title": "" }, { "docid": "360e1ce2a6ffacaf43f031c8478ebab0", "score": "0.47358528", "text": "func uptime() time.Duration {\n\treturn time.Since(startTime)\n}", "title": "" }, { "docid": "fcfd69d8b1bc2394e74c3d9c7f527a4f", "score": "0.47289574", "text": "func timeStr(d time.Duration, precision int, short bool) string {\n\ttimes := map[int]timeEntry{\n\t\t1: {\"s\", \"second\"},\n\t\t60: {\"m\", \"minute\"},\n\t\t3600: {\"h\", \"hour\"},\n\t\t86400: {\"d\", \"day\"},\n\t\t604800: {\"w\", \"week\"},\n\t\tint(2.628e6): {\"mo\", \"month\"},\n\t\tint(3.154e7): {\"yr\", \"year\"},\n\t}\n\t// Sort keys to ensure proper order\n\tkeys := make([]int, 0)\n\tfor k := range times {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Sort(sort.Reverse(sort.IntSlice(keys)))\n\tseconds := int(d.Seconds())\n\tif seconds < 1 {\n\t\treturn \"just now\"\n\t}\n\tvar ret string\n\tvar tmp int\n\tfor _, k := range keys {\n\t\tif tmp >= precision {\n\t\t\tbreak\n\t\t}\n\t\tq := seconds / k\n\t\tr := seconds % k\n\t\t// We have <1 of this unit\n\t\tif q == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif short {\n\t\t\tret += fmt.Sprintf(\"%d%s\", q, times[k].short)\n\t\t} else {\n\t\t\tif q == 1 {\n\t\t\t\t// We have one, don't add s\n\t\t\t\tret += fmt.Sprintf(\"%d %s, \", q, times[k].long)\n\t\t\t} else {\n\t\t\t\t// More than one or zero, add s at the end\n\t\t\t\tret += fmt.Sprintf(\"%d %ss, \", q, times[k].long)\n\t\t\t}\n\t\t}\n\t\tseconds = r\n\t\ttmp++\n\t}\n\treturn strings.TrimSuffix(ret, \", \")\n}", "title": "" }, { "docid": "78dc0b1ff9dbba9ed909518b2bf66415", "score": "0.4727602", "text": "func conversionSleep(bits int) {\n\ttime.Sleep((94 << uint(bits-9)) * time.Millisecond)\n}", "title": "" }, { "docid": "8c3fb7191d2e6a77a9c9d578a1a0e015", "score": "0.47186077", "text": "func sleepDuration(scale float64) time.Duration {\n\treturn time.Duration(float64(time.Second) * scale)\n}", "title": "" }, { "docid": "1f006a02cead58a120a909231012c96a", "score": "0.47168994", "text": "func ctimeFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:23136:13: */\n\t_ = NotUsed\n\t_ = NotUsed2\n\ttimeFunc(tls, context, 0, uintptr(0))\n}", "title": "" }, { "docid": "a4699e7e25729e47eb440ce8a8eb92d4", "score": "0.47088268", "text": "func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {\n\t_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAdjtime)), 2, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0, 0, 0, 0)\n\tif e1 != 0 {\n\t\terr = e1\n\t}\n\treturn\n}", "title": "" }, { "docid": "6d77d9c26a717a43495ed890593b1154", "score": "0.47061107", "text": "func BitSeconds(amount uint64) string {\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(DigitFormat(amount * 8)) //in bit\n\tbuffer.WriteString(\"it/s\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "7112fdac3c1d2e16c762363397305827", "score": "0.47013557", "text": "func sleepTicks(d timeUnit) {\n\tcurrentTime += d\n\tfor d != 0 {\n\t\tsleepWDT(WDT_PERIOD_16MS)\n\t\td -= 1\n\t}\n}", "title": "" }, { "docid": "ec47cf57fa6a2fcc5b1e346cd765528f", "score": "0.4695117", "text": "func TsMs() int64 {\n\treturn time.Now().UnixNano() / int64(time.Millisecond)\n}", "title": "" }, { "docid": "903c06700e64b6e31156106963588126", "score": "0.46907684", "text": "func TimeToCounter(t time.Time, p time.Duration) uint { return uint(t.Unix()) / uint(p.Seconds()) }", "title": "" }, { "docid": "88ecdacffce611cb8a014091321ff96e", "score": "0.46879295", "text": "func (s *server) time(w http.ResponseWriter, _ *http.Request) {\n\tw.Write([]byte(time.Now().Format(time.RFC3339Nano)))\n}", "title": "" }, { "docid": "8632835df643a0239a9ff3668c879032", "score": "0.46877864", "text": "func (writer *Writer) Dwell(time float64) error {\r\n\tif math.IsNaN(time) || math.IsInf(time, 0) || time <= 0 {\r\n\t\treturn errors.New(\"Invalid time\")\r\n\t}\r\n\t_, err := fmt.Fprintf(writer.Stream, \"G4 P%f\\n\", time)\r\n\twriter.Time += time\r\n\treturn err\r\n}", "title": "" }, { "docid": "f93481dc8567178040e05e31f8516cd2", "score": "0.46751118", "text": "func main() {\n\thora := 0\n\tfor hora < 24 {\n\t\tfmt.Printf(\"%.2d:00\\n\", hora)\n\t\thora++\n\t}\n\n}", "title": "" }, { "docid": "ad9d92dc1e354eb121189d09f0d4d084", "score": "0.46750146", "text": "func jwkThreshold(config *Config) time.Duration {\n\tvar duration time.Duration\n\tif config.ServerAPI != nil {\n\t\tduration = config.ServerAPI.PollInterval\n\t} else {\n\t\tduration = config.WorkloadAPI.PollInterval\n\t}\n\tif duration*ThresholdMultiplicator < ThresholdMinTime {\n\t\tduration = ThresholdMinTime\n\t}\n\treturn duration\n}", "title": "" }, { "docid": "f31c4cf5ad0170fe9a6fa98a9c20f8ac", "score": "0.46675622", "text": "func (s *StopWatch) GetDetlaSec() int64 {\n\treturn (GetEpochMillis() - s.start) / 1000\n}", "title": "" }, { "docid": "ab04ff4d22f0fe426df9ea734a788bfc", "score": "0.46610966", "text": "func sessionDuration(app, provider string) int64 {\n\ta := viper.GetInt64(fmt.Sprintf(\"apps.%s.duration\", app))\n\tp := viper.GetInt64(fmt.Sprintf(\"providers.%s.duration\", provider))\n\n\tif a != 0 {\n\t\treturn a\n\t}\n\n\tif p != 0 {\n\t\treturn p\n\t}\n\n\treturn 3600\n}", "title": "" }, { "docid": "4aa59e46f8d42900464bec6fa255da7b", "score": "0.46500584", "text": "func (v *Twc3) ChargingTime() (time.Duration, error) {\n\tres, err := v.vitalsG()\n\treturn time.Duration(res.SessionS) * time.Second, err\n}", "title": "" }, { "docid": "13554e8db6b1f530d192684f51b7bc1c", "score": "0.46484178", "text": "func S(n int64) time.Duration {\n\treturn time.Duration(n) * time.Second\n}", "title": "" }, { "docid": "add512531576df6599ce23aee1a03e32", "score": "0.4644606", "text": "func dSince(t mono.Time) int {\n\treturn dFromDuration(t.Sub(t0))\n}", "title": "" }, { "docid": "bf3ff5e26c5891a5cb7ef527795353c4", "score": "0.46396306", "text": "func getTime() string {\n\tif PAUSE {\n\t\treturn \"00:00:00\"\n\t}\n\ttimer := int(time.Now().Sub(CLOCK).Seconds())\n\tminutes := timer/60\n\tseconds := timer%60\n\thours := minutes/60\n\tminutes = minutes%60\n\thzero := \"\"\n\tmzero := \"\"\n\tszero := \"\"\n\tif hours < 10 {\n\t\thzero = \"0\"\n\t}\n\tif seconds < 10 {\n\t\tszero = \"0\"\n\t}\n\tif minutes < 10 {\n\t\tmzero = \"0\"\n\t}\n\treturn hzero + strconv.Itoa(hours) + \":\" + mzero + strconv.Itoa(minutes) + \":\" + szero + strconv.Itoa(seconds)\n}", "title": "" }, { "docid": "0876763dcd30c89f85a4830cf7f009d3", "score": "0.46390015", "text": "func DurationInWords(d time.Duration) string {\n\tif d >= time.Second && d <= (time.Second*4) {\n\t\treturn fmt.Sprintf(lssthnd, 5, \"seconds\")\n\t} else if d >= (time.Second*5) && d < (time.Second*10) {\n\t\treturn fmt.Sprintf(lssthnd, 10, \"seconds\")\n\t} else if d >= (time.Second*10) && d < (time.Second*20) {\n\t\treturn fmt.Sprintf(lssthnd, 20, \"seconds\")\n\t} else if d >= (time.Second*20) && d < (time.Second*40) {\n\t\treturn \"half a minute\"\n\t} else if d >= (time.Second*40) && d < (time.Second*60) {\n\t\treturn fmt.Sprintf(lssthns, \"minute\")\n\t} else if d >= (time.Second*60) && d < time.Minute+(time.Second*30) {\n\t\treturn \"1 minute\"\n\t} else if d >= time.Minute+(time.Second*30) && d < (time.Minute*44)+(time.Second*30) {\n\t\treturn fmt.Sprintf(\"%d minutes\", (d / time.Minute))\n\t} else if d >= (time.Minute*44)+(time.Second*30) && d < (time.Minute*89)+(time.Second*30) {\n\t\treturn fmt.Sprintf(aboutnd, d/time.Hour, \"hour\")\n\t} else if d >= (time.Minute*89)+(time.Second*30) && d < (time.Hour*29)+(time.Minute*59)+(time.Second*30) {\n\t\treturn fmt.Sprintf(aboutnd, (d / time.Hour), \"hours\")\n\t} else if d >= (time.Hour*23)+(time.Minute*59)+(time.Second*30) && d < (time.Hour*41)+(time.Minute*59)+(time.Second*30) {\n\t\treturn \"1 day\"\n\t} else if d >= (time.Hour*41)+(time.Minute*59)+(time.Second*30) && d < (day*29)+(time.Hour*23)+(time.Minute*59)+(time.Second*30) {\n\t\treturn fmt.Sprintf(\"%d days\", d/(time.Hour*24))\n\t} else if d >= (day*29)+(time.Hour*23)+(time.Minute*59)+(time.Second*30) && d < (day*59)+(time.Hour*23)+(time.Minute*59)+(time.Second*30) {\n\t\treturn fmt.Sprintf(aboutnd, 1, \"month\")\n\t} else if d >= (day*59)+(time.Hour*23)+(time.Minute*59)+(time.Second*30) && d < (year) {\n\t\treturn fmt.Sprintf(aboutnd, d/month+1, \"months\")\n\t} else if d >= year && d < year+(3*month) {\n\t\treturn fmt.Sprintf(aboutnd, 1, \"year\")\n\t} else if d >= year+(3*month) && d < year+(9*month) {\n\t\treturn \"over 1 year\"\n\t} else if d >= year+(9*month) && d < (year*2) {\n\t\treturn \"almost 2 years\"\n\t} else {\n\t\treturn fmt.Sprintf(aboutnd, d/year, \"years\")\n\t}\n\n}", "title": "" }, { "docid": "23b5f70763413c1c2c7c703310539139", "score": "0.46338892", "text": "func timeInWords(h int32, m int32) string {\n // Write your code here\n\tvar time string = \"\"\n\thour := make(map[string]string)\n\tminute := make(map[string]string)\n\thour[\"1\"] = \"one\"\n\thour[\"2\"] = \"two\"\n\thour[\"3\"] = \"three\"\n\thour[\"4\"] = \"four\"\n\thour[\"5\"] = \"five\"\n\thour[\"6\"] = \"six\"\n\thour[\"7\"] = \"seven\"\n\thour[\"8\"] = \"eight\"\n\thour[\"9\"] = \"nine\"\n\thour[\"10\"] = \"ten\"\n\thour[\"11\"] = \"eleven\"\n\thour[\"12\"] = \"twelve\"\n\n\tminute[\"1\"]\t = \"one minute\"\n\tminute[\"2\"]\t = \"two minutes\"\n\tminute[\"3\"]\t = \"three minutes\"\n\tminute[\"4\"]\t = \"four minutes\"\n\tminute[\"5\"]\t = \"five minutes\"\n\tminute[\"6\"]\t = \"six minutes\"\n\tminute[\"7\"]\t = \"seven minutes\"\n\tminute[\"8\"]\t = \"eight minutes\"\n\tminute[\"9\"]\t = \"nine minutes\"\n\tminute[\"10\"] = \"ten minutes\"\n\tminute[\"11\"] = \"eleven minutes\"\n\tminute[\"12\"] = \"twelve minutes\"\n\tminute[\"13\"] = \"thirteen minutes\"\n\tminute[\"14\"] = \"fourteen minutes\"\n\tminute[\"15\"] = \"quarter\"\n\tminute[\"16\"] = \"sixteen minutes\"\n\tminute[\"17\"] = \"seventeen minutes\"\n\tminute[\"18\"] = \"eighteen minutes\"\n\tminute[\"19\"] = \"nineteen minutes\"\n\tminute[\"20\"] = \"twenty minutes\"\n\tminute[\"21\"] = \"twenty one minutes\"\n\tminute[\"22\"] = \"twenty two minutes\"\n\tminute[\"23\"] = \"twenty three minutes\"\n\tminute[\"24\"] = \"twenty four minutes\"\n\tminute[\"25\"] = \"twenty five minutes\"\n\tminute[\"26\"] = \"twenty six minutes\"\n\tminute[\"27\"] = \"twenty seven minutes\"\n\tminute[\"28\"] = \"twenty eight minutes\"\n\tminute[\"29\"] = \"twenty nine minutes\"\n\tminute[\"30\"] = \"half\"\n\tminute[\"31\"] = \"thirty one minutes\"\n\tminute[\"32\"] = \"thirty two minutes\"\n\tminute[\"33\"] = \"thirty three minutes\"\n\tminute[\"34\"] = \"thirty four minutes\"\n\tminute[\"35\"] = \"thirty five minutes\"\n\tminute[\"36\"] = \"thirty six minutes\"\n\tminute[\"37\"] = \"thirty seven minutes\"\n\tminute[\"38\"] = \"thirty eight minutes\"\n\tminute[\"39\"] = \"thirty nine minutes\"\n\tminute[\"40\"] = \"forty minutes\"\n\tminute[\"41\"] = \"forty one minutes\"\n\tminute[\"42\"] = \"forty two minutes\"\n\tminute[\"43\"] = \"forty three minutes\"\n\tminute[\"44\"] = \"forty four minutes\"\n\tminute[\"45\"] = \"forty five minutes\"\n\tminute[\"46\"] = \"forty six minutes\"\n\tminute[\"47\"] = \"forty seven minutes\"\n\tminute[\"48\"] = \"forty eight minutes\"\n\tminute[\"49\"] = \"forty nine minutes\"\n\tminute[\"50\"] = \"fifty minutes\"\n\tminute[\"51\"] = \"fifty one minutes\"\n\tminute[\"52\"] = \"fifty two minutes\"\n\tminute[\"53\"] = \"fifty three minutes\"\n\tminute[\"54\"] = \"fifty four minutes\"\n\tminute[\"55\"] = \"fifty five minutes\"\n\tminute[\"56\"] = \"fifty six minutes\"\n\tminute[\"57\"] = \"fifty seven minutes\"\n\tminute[\"58\"] = \"fifty eight minutes\"\n\tminute[\"59\"] = \"fifty nine minutes\"\n\n\thKey := strconv.FormatInt(int64(h), 10)\n\tmKey := strconv.FormatInt(int64(m), 10)\n\tif m == 0 {\n\t\ttime = hour[hKey] + \" o' clock\"\n\t}\n\tif 1 <= m && m <= 30 {\n\t\ttime = minute[mKey] + \" past \" + hour[hKey] \n\t}\n\tif 30 < m {\n\t\tnextHour := h+1\n\t\tif nextHour > 12 {\n\t\t\tnextHour = 1\n\t\t}\n\n\t\thourKey := strconv.FormatInt(int64(nextHour), 10)\n\t\tminuteKey := strconv.FormatInt(int64(60-m), 10)\n\t\ttime = minute[minuteKey] + \" to \" + hour[hourKey] \n\t}\n\n\treturn time\n}", "title": "" }, { "docid": "b3caf3f50d9acb9b48e6bbcbd2b4832f", "score": "0.46338508", "text": "func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:22946:13: */\n\tbp := tls.Alloc(172)\n\tdefer tls.Free(172)\n\n\t// var x DateTime at bp+24, 48\n\n\tif isDate(tls, context, argc, argv, bp+24 /* &x */) == 0 {\n\t\t// var zBuf [100]int8 at bp+72, 100\n\n\t\tcomputeHMS(tls, bp+24 /* &x */)\n\t\tXsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+439 /* \"%02d:%02d:%02d\" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs)))\n\t\tXsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1))\n\t}\n}", "title": "" }, { "docid": "dcc5eb5237dd8e15b23a0dea4cc52b2f", "score": "0.46320802", "text": "func (c *volcano) rumble() {\n\tdefer c.mu.Done()\n\tdefer func() {\n\t\tclose(c.noiseCh)\n\t}()\n\n\tsecTick := time.NewTicker(1 * time.Second)\n\tminTick := time.NewTicker(1 * time.Minute)\n\thourTick := time.NewTicker(1 * time.Hour)\n\n\tsecM := \"rumble\"\n\tminM := \"RUMBLE\"\n\thourM := \"LAVAOVERFLOW\"\n\n\tstart := time.Now()\n\n\ti := 0\n\tfor {\n\n\t\tif time.Since(start) > c.stopTime {\n\t\t\tc.doneCh <- struct{}{}\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase m := <-c.secCh:\n\t\t\tsecM = m\n\t\tcase m := <-c.minCh:\n\t\t\tminM = m\n\t\tcase m := <-c.hourCh:\n\t\t\thourM = m\n\t\tdefault:\n\t\t}\n\n\t\tselect {\n\t\tcase err := <-c.errorCh:\n\t\t\tlog.Println(err)\n\t\t\treturn\n\n\t\tcase <-secTick.C:\n\t\t\tselect {\n\t\t\tcase m := <-c.secCh:\n\t\t\t\tsecM = m\n\t\t\tdefault:\n\t\t\t}\n\t\t\ti++\n\t\t\tif i%60 != 0 {\n\t\t\t\tc.noiseCh <- formatPrintNoise(i, secM)\n\t\t\t}\n\n\t\tcase <-minTick.C:\n\t\t\tselect {\n\t\t\tcase m := <-c.minCh:\n\t\t\t\tminM = m\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\tif i%3600 != 0 {\n\t\t\t\tc.noiseCh <- formatPrintNoise(i, minM)\n\t\t\t}\n\n\t\tcase <-hourTick.C:\n\t\t\tselect {\n\t\t\tcase m := <-c.hourCh:\n\t\t\t\thourM = m\n\t\t\tdefault:\n\t\t\t}\n\t\t\tc.noiseCh <- formatPrintNoise(i, hourM)\n\t\t\ti = 0\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4141cb7ed559bffcc6ca40e7a25e7011", "score": "0.46312958", "text": "func optionsLeaseTime(d time.Duration) []byte {\n\tleaseBytes := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(leaseBytes, uint32(d/time.Second))\n\treturn leaseBytes\n}", "title": "" }, { "docid": "639e87bb12ec82c4a305f04705d930b6", "score": "0.46310213", "text": "func getSleepTime(attempt int, retryTime time.Duration) time.Duration {\n\tn := (math.Pow(2, float64(attempt)))\n\trand.Seed(time.Now().Unix())\n\trnd := time.Duration(rand.Intn(4)+1) * time.Millisecond\n\treturn (time.Duration(n) * retryTime) - rnd\n}", "title": "" }, { "docid": "88102c78b862a0555c3f792d7ec168f7", "score": "0.46304253", "text": "func (logger *Logger) getSecondsUntillInterval() int {\r\n\t//interval in seconds = 60 * interval\r\n\tintervalInSecs := float64(60 * logger.Interval)\r\n\r\n\t//get the current time\r\n\tnow := time.Now()\r\n\r\n\t//get the number of seconds that have elapsed in this hour\r\n\tnSecs := float64((now.Minute() * 60) + now.Second())\r\n\t//number of seconds to the next quarter-hour mark\r\n\tdelta := math.Ceil(nSecs/intervalInSecs)*intervalInSecs - nSecs\r\n\treturn int(delta)\r\n}", "title": "" }, { "docid": "ca017c7446d51ae288ad4923f6b49d20", "score": "0.46280482", "text": "func (m *resendMap) rtt() time.Duration {\n\tconst averageDuration = time.Second * 5\n\tvar (\n\t\ttotal, records time.Duration\n\t\tnow = time.Now()\n\t)\n\tfor t, rtt := range m.delays {\n\t\tif now.Sub(t) > averageDuration {\n\t\t\tdelete(m.delays, t)\n\t\t\tcontinue\n\t\t}\n\t\ttotal += rtt\n\t\trecords++\n\t}\n\tif records == 0 {\n\t\t// No records yet, generally should not happen. Just return a reasonable amount of time.\n\t\treturn time.Millisecond * 50\n\t}\n\treturn total / records\n}", "title": "" }, { "docid": "c5d165731abfb5b529c9f91458a2b1b9", "score": "0.46272016", "text": "func truncateToSeconds(d time.Duration) int {\n\td = d.Truncate(1 * time.Second)\n\n\t// Handle the case where someone requested a ridiculously short increment -\n\t// increments must be larger than a second.\n\tif d < 1*time.Second {\n\t\treturn 0\n\t}\n\n\treturn int(d.Seconds())\n}", "title": "" }, { "docid": "6cd15ce8aebab8dbeaa528ea89418ea1", "score": "0.46267474", "text": "func (d *Discovery) increaseUptimeSeconds() {\n\tdefer d.wg.Done()\n\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tUptimeSeconds.Increase(1)\n\t\tcase <-d.ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "868d70971faf2cf560f0fb0e5b503454", "score": "0.4616109", "text": "func TS() int64 {\n\treturn time.Now().UnixNano() / int64(time.Millisecond)\n}", "title": "" }, { "docid": "8794d0b800b85acb1c444447927a6ce3", "score": "0.46135938", "text": "func now() uint64 {\n\treturn uint64(time.Now().UnixNano() / 1e6)\n}", "title": "" }, { "docid": "d828b04ceed5af73e6b36efa7f8792b4", "score": "0.46106097", "text": "func (s *Tps2000) GetTime() (sampleIntervalSec float64, xPosSec float64) {\n\tsampleIntervalSec, _ = s.PollFloat(\"HOR:MAI:SCA?\")\n\txPosSec, _ = s.PollFloat(\"HOR:MAI:POS?\")\n\treturn sampleIntervalSec, xPosSec\n}", "title": "" }, { "docid": "8b595431aed2a05c4f52da6ffcdd8925", "score": "0.4608465", "text": "func ipv4TimestampTime(clock tcpip.Clock) uint32 {\n\t// Per RFC 791 page 21:\n\t// The Timestamp is a right-justified, 32-bit timestamp in\n\t// milliseconds since midnight UT.\n\tnow := clock.Now().UTC()\n\tmidnight := now.Truncate(24 * time.Hour)\n\treturn uint32(now.Sub(midnight).Milliseconds())\n}", "title": "" }, { "docid": "45252b50b5970f5d67847a19c57ebd3a", "score": "0.45991892", "text": "func calculateTimeval(event, t0, t1, tUptime float64) (float64, float64) {\n\tbootTimeval := round((t0+t1)/2 - tUptime)\n\t// |error| should be close to 0 so is not rounded.\n\terror := (t1 - t0) / 2\n\treturn bootTimeval + event, error\n}", "title": "" }, { "docid": "7d089a22991e237a3430d4d741c40f26", "score": "0.45926636", "text": "func timeTrack(start time.Time, n int, name string) {\n\tloopNS := time.Since(start).Nanoseconds() / int64(n)\n\tfmt.Printf(\"%s: %d\\n\", name, loopNS)\n}", "title": "" }, { "docid": "dd51edec6e601822fb86c47683aa28ea", "score": "0.45890054", "text": "func timeSince(t time.Time) string {\n\n\tDecisecond := 100 * time.Millisecond\n\tDay := 24 * time.Hour\n\n\tts := time.Since(t)\n\tsign := time.Duration(1)\n\n\tts += Decisecond / 2\n\td := sign * (ts / Day)\n\tts = ts % Day\n\th := ts / time.Hour\n\tts = ts % time.Hour\n\tm := ts / time.Minute\n\tts = ts % time.Minute\n\ts := ts / time.Second\n\tts = ts % time.Second\n\tf := ts / Decisecond\n\ty := d / 365\n\treturn fmt.Sprintf(\"P%dY%dD%dH%dM%d.%dS\", y, d, h, m, s, f)\n}", "title": "" }, { "docid": "4e45175018e3215d1e23aa85d5b1ff08", "score": "0.4588293", "text": "func delayForSeconds(delay float64) {\n\tdelayInMilliseconds := int(delay * 1000.0)\n\ttime.Sleep(time.Duration(delayInMilliseconds) * time.Millisecond)\n}", "title": "" }, { "docid": "8bec1a6b05da16abdf0c80900f43cb5f", "score": "0.45861778", "text": "func (o TimeOfDayOutput) Seconds() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v TimeOfDay) *int { return v.Seconds }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "f6a6312724cb68fad19c88b151a4779e", "score": "0.4573723", "text": "func micros(d time.Duration) int {\n\treturn int(d.Seconds() * 1000000)\n}", "title": "" }, { "docid": "f31b4aeb64ad083cd9644bda421faf1b", "score": "0.45724866", "text": "func firmwareTimestampBootTime(ctx context.Context, h *firmware.Helper) (float64, error) {\n\tb, err := h.Reporter.CatFile(ctx, \"/tmp/firmware-boot-time\")\n\tfor err != nil {\n\t\treturn 0, errors.Wrap(err, \"failed to read firmware-boot-time file\")\n\t}\n\tl := strings.Split(string(b), \"\\n\")[0]\n\treturn strconv.ParseFloat(l, 64)\n}", "title": "" } ]
32f9a7c498429885e8ad24af9e8ab78e
GetMetrics returns the metrics from all metrics
[ { "docid": "53d4224602ee011d0dc051ead9262057", "score": "0.750088", "text": "func (m *MetricsCollector) GetMetrics() map[string]interface{} {\n\tm.Mu.Lock() // Acquire the lock before accessing shared resources\n\tdefer m.Mu.Unlock() // Release the lock after the function returns\n\n\tdataMap := make(map[string]interface{})\n\tresData := make(map[string]([]map[string]map[string]string))\n\tfor _, metric := range m.Metrics {\n\t\tmonitorMetrics := metric.GetMetrics()\n\t\tres := getResourceConsumption(monitorMetrics)\n\t\tif _, ok := resData[metric.GetMetricsName()]; !ok {\n\t\t\tresData[metric.GetMetricsName()] = make([]map[string]map[string]string, 0)\n\t\t}\n\t\tresData[metric.GetMetricsName()] = append(resData[metric.GetMetricsName()], res)\n\t}\n\n\tfor metricsName, metrics := range resData {\n\t\tdataMap[metricsName] = metrics\n\t}\n\n\tfor _, metric := range m.OneTimeMetrics {\n\t\toneTimeMetricsMap := make(map[string]interface{})\n\t\tmonitorMetrics := metric.GetMetrics()\n\t\tfor key, value := range monitorMetrics {\n\t\t\toneTimeMetricsMap[key] = value\n\t\t}\n\t\tdataMap[metric.GetMetricsName()] = oneTimeMetricsMap\n\t}\n\treturn dataMap\n}", "title": "" } ]
[ { "docid": "7b40c79867011c9dc201bfaf050c60b7", "score": "0.774444", "text": "func GetMetrics() *Metrics {\n\treturn gm\n}", "title": "" }, { "docid": "06648c361129910f396f618c1afe7e71", "score": "0.7585518", "text": "func (service *Service) GetMetrics(apiKey string, deviceID string) ([]Metric, error) {\n\t// TODO: This should maybe take a date range as well\n\n\tsensorDataList, err := service.danaltoClient.GetDeviceData(apiKey, deviceID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO: Think about pointer behaviour here\n\t// var metrics []Metric\n\t// metrics := []*Metric{}\n\tmetrics := []Metric{}\n\tfor _, sensorData := range sensorDataList {\n\t\tmetrics = append(metrics, Metric{\n\t\t\tTimestamp: sensorData.Timestamp,\n\t\t\tTemperature: sensorData.Payload.Temperature,\n\t\t\tHumidity: sensorData.Payload.Humidity,\n\t\t})\n\t}\n\n\treturn metrics, nil\n}", "title": "" }, { "docid": "ba0d72f0f4c0888a1f7bbf7a534bec52", "score": "0.74236023", "text": "func (am *Snapshot) GetMetrics() map[string]Metric {\n\treturn am.data\n}", "title": "" }, { "docid": "8cb5e06da3c04d11bc01efe96db1bfed", "score": "0.7394093", "text": "func (context ExporterContext) GetMetrics() []string {\n\tmetrics := make([]string, 0)\n\tfor _, rule := range Context.Rules {\n\t\tfor _, metric := range rule.Metrics {\n\t\t\tif !contains(metrics, metric) {\n\t\t\t\tmetrics = append(metrics, metric)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn metrics\n}", "title": "" }, { "docid": "66a08c816e70e07956a3775f82e847bb", "score": "0.7338589", "text": "func (web *web) GetMetrics(c *gin.Context) {\n\tif web.metrics == nil {\n\t\tc.String(http.StatusNotFound, \"Metrics not enabled)\")\n\t\treturn\n\t}\n\n\tlists := make([]map[string]string, 0, len(web.conf.Lists))\n\tfor _, list := range web.conf.Lists {\n\t\tlistEntry := make(map[string]string)\n\t\tlistEntry[\"short\"] = list.ShortName()\n\t\tlistEntry[\"name\"] = list.CanonicalName()\n\t\tlists = append(lists, listEntry)\n\t}\n\n\tmetrics := web.metrics.GetAll()\n\n\tif filterStrings := c.Query(\"metrics\"); len(filterStrings) > 0 {\n\t\tkeepMetrics := strings.Split(filterStrings, \",\")\n\t\tfor k := range metrics {\n\t\t\tif !util.StringIn(k, keepMetrics) {\n\t\t\t\tdelete(metrics, k)\n\t\t\t}\n\t\t}\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"metrics\": metrics,\n\t\t\"lists\": lists,\n\t})\n}", "title": "" }, { "docid": "bd290360827746da1e4f8f5ea07e510b", "score": "0.7335033", "text": "func (r *DefaultRegistry) GetMetrics() map[string]Metric {\n\tr.Lock()\n\tdefer r.Unlock()\n\treturn r.metrics\n}", "title": "" }, { "docid": "0d48609d76f83baeb7e5f7e726f858e4", "score": "0.7325778", "text": "func GetMetrics() *CollectedMetrics {\n\treturn metrics\n}", "title": "" }, { "docid": "4cb4345ce3556ca53041cb64989ed842", "score": "0.7211485", "text": "func GetMetrics(c *gin.Context) {\n\tstorages := common.Storages{\n\t\tSplitStorage: util.GetSplitStorage(c.Get(common.SplitStorage)),\n\t\tEventStorage: util.GetEventStorage(c.Get(common.EventStorage)),\n\t\tImpressionStorage: util.GetImpressionStorage(c.Get(common.ImpressionStorage)),\n\t\tLocalTelemetryStorage: util.GetTelemetryStorage(c.Get(common.LocalMetricStorage)),\n\t\tSegmentStorage: util.GetSegmentStorage(c.Get(common.SegmentStorage)),\n\t}\n\n\tif util.AreValidStorages(storages) {\n\t\tstats := web.GetMetrics(storages)\n\t\tc.JSON(http.StatusOK, stats)\n\t\treturn\n\t}\n\tlog.Instance.Error(\"GetMetrics: Could not fetch storages\")\n\tc.String(http.StatusInternalServerError, \"%s\", \"Could not fetch storages\")\n}", "title": "" }, { "docid": "c9e6d163292f18b868e8fc0935aa4ddb", "score": "0.7176304", "text": "func (o *CIAppPipelineEventStep) GetMetrics() []string {\n\tif o == nil || o.Metrics.Get() == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.Metrics.Get()\n}", "title": "" }, { "docid": "daa03c7164b03474427f97d283a0a90a", "score": "0.7007754", "text": "func (c *Client) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {\n\treq = typeutil.Clone(req)\n\tcommonpbutil.UpdateMsgBase(\n\t\treq.GetBase(),\n\t\tcommonpbutil.FillMsgBaseFromClient(paramtable.GetNodeID(), commonpbutil.WithTargetID(c.grpcClient.GetNodeID())),\n\t)\n\treturn wrapGrpcCall(ctx, c, func(client datapb.DataCoordClient) (*milvuspb.GetMetricsResponse, error) {\n\t\treturn client.GetMetrics(ctx, req)\n\t})\n}", "title": "" }, { "docid": "2367bb42608a624a60628b3def37e72f", "score": "0.69949406", "text": "func GetMetrics(ctx context.Context, db gorp.SqlExecutor, key string, appID int64, metricName string) ([]json.RawMessage, error) {\n\tmetricsRequest := sdk.MetricRequest{\n\t\tProjectKey: key,\n\t\tApplicationID: appID,\n\t\tKey: metricName,\n\t}\n\n\tsrvs, err := services.LoadAllByType(ctx, db, sdk.TypeElasticsearch)\n\tif err != nil {\n\t\treturn nil, sdk.WrapError(err, \"Unable to get elasticsearch service\")\n\t}\n\n\tvar esMetrics []elastic.SearchHit\n\tif _, _, err := services.NewClient(db, srvs).DoJSONRequest(context.Background(), \"GET\", \"/metrics\", metricsRequest, &esMetrics); err != nil {\n\t\treturn nil, sdk.WrapError(err, \"Unable to get metrics\")\n\t}\n\n\tevents := make([]json.RawMessage, len(esMetrics))\n\tfor i := range esMetrics {\n\t\tevents[len(esMetrics)-1-i] = esMetrics[i].Source\n\t}\n\treturn events, nil\n}", "title": "" }, { "docid": "619b1455e5e527921dcddd3b4174cba9", "score": "0.69930243", "text": "func GetMetrics(db storage.Storage) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\thost := c.Request.Header.Get(\"TraceHost\")\n\t\tresults, ok := db.GetResults(host)\n\t\tif !ok {\n\t\t\tc.JSON(http.StatusOK, gin.H{\"status\": \"data not in store\"})\n\n\t\t\treturn\n\t\t}\n\t\tvar metrics []*Metric\n\t\tfor _, result := range results {\n\t\t\tlastHop := result.Hops[len(result.Hops)-1]\n\t\t\tmetrics = append(metrics, &Metric{\n\t\t\t\tDate: result.Time.UTC().Format(\"2006-01-02T15:04:05.999Z\"),\n\t\t\t\tValue: lastHop.Duration.Milliseconds(),\n\t\t\t})\n\t\t}\n\t\tc.JSON(http.StatusOK, metrics)\n\t}\n}", "title": "" }, { "docid": "ca49d16aad61779e666bfc822d34a099", "score": "0.69927144", "text": "func GetMetrics(w rest.ResponseWriter, _ *rest.Request) {\n\tnm := make(map[string]*model.Metrics)\n\tfor _, m := range clientMetrics {\n\t\tif m != nil {\n\t\t\tnm[m.Address] = m\n\t\t}\n\t}\n\tw.WriteJson(nm)\n}", "title": "" }, { "docid": "49da2a960c689df2f54aa8ab93fdd666", "score": "0.6982164", "text": "func (c *Client) getMetrics() Metrics {\n\tif c.Metrics != nil {\n\t\treturn c.Metrics\n\t}\n\n\treturn noopMetrics\n}", "title": "" }, { "docid": "63a55099eab20466770726459ae93823", "score": "0.6973566", "text": "func (client BaseClient) GetMetrics(ctx context.Context, body []MetricsPostBodySchema) (result ListMetricsResultsItem, err error) {\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: body,\n\t\t\tConstraints: []validation.Constraint{{Target: \"body\", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"insights.BaseClient\", \"GetMetrics\", err.Error())\n\t}\n\n\treq, err := client.GetMetricsPreparer(ctx, body)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"insights.BaseClient\", \"GetMetrics\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetMetricsSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"insights.BaseClient\", \"GetMetrics\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetMetricsResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"insights.BaseClient\", \"GetMetrics\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a81d49d1f0d4ac7643c31eb6c1a5a147", "score": "0.69299406", "text": "func (err Metrics) GetMetrics() pdata.Metrics {\n\treturn err.failed\n}", "title": "" }, { "docid": "61a68ec829537a5bbbffc63140bb6fef", "score": "0.68753946", "text": "func (o *Metric) GetMetrics() string {\n\tif o == nil || o.Metrics == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Metrics\n}", "title": "" }, { "docid": "8e1eb068209aa1dfa883017c485b5f74", "score": "0.6840407", "text": "func (NilMultiMetric) Metrics() map[string]Metric { return map[string]Metric{} }", "title": "" }, { "docid": "57d6bda05df3d5b78f2f9121b7f1ee3b", "score": "0.68279606", "text": "func (o *MetricsListResponse) GetMetrics() []string {\n\tif o == nil || o.Metrics == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn o.Metrics\n}", "title": "" }, { "docid": "a43c1b8d665c21ba7452bfc19edca1ce", "score": "0.68187886", "text": "func GetMetrics() ([]*prometheus_proto.MetricFamily, error) {\n\n\tfamilies, err := prometheus.DefaultGatherer.Gather()\n\tif err != nil {\n\t\treturn []*prometheus_proto.MetricFamily{},\n\t\t\tfmt.Errorf(\"err gathering from registry: %v\\n\", err)\n\t}\n\t// timeStamp in milliseconds\n\ttimeStamp := time.Now().UnixNano() / int64(time.Millisecond)\n\tfor _, metric_family := range families {\n\t\tfor _, sample := range metric_family.Metric {\n\t\t\tsample.TimestampMs = &timeStamp\n\t\t}\n\t}\n\treturn families, nil\n}", "title": "" }, { "docid": "a1680c5e91cc3afb09a90cf52b12a546", "score": "0.67620856", "text": "func getMetrics(clientSet *kubernetes.Clientset, pods *PodMetricsList) error {\n\tdata, err := clientSet.RESTClient().Get().AbsPath(\"apis/metrics.k8s.io/v1beta1/pods\").DoRaw(context.TODO())\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.Unmarshal(data, &pods)\n\treturn err\n}", "title": "" }, { "docid": "a1680c5e91cc3afb09a90cf52b12a546", "score": "0.67620856", "text": "func getMetrics(clientSet *kubernetes.Clientset, pods *PodMetricsList) error {\n\tdata, err := clientSet.RESTClient().Get().AbsPath(\"apis/metrics.k8s.io/v1beta1/pods\").DoRaw(context.TODO())\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.Unmarshal(data, &pods)\n\treturn err\n}", "title": "" }, { "docid": "5a6652f7dd3f1f326dbcf302282e8675", "score": "0.6710543", "text": "func (k *Stub) GetMetrics() (BrokerMetrics, []error) {\n\tbm := BrokerMetrics{}\n\tfor i := 0; i < 10; i++ {\n\t\tbm[1000+i] = &Broker{\n\t\t\tID: 1000 + i,\n\t\t\tHost: fmt.Sprintf(\"host%d\", i),\n\t\t\tInstanceType: \"stub\",\n\t\t\tNetTX: 100.00 + float64(i),\n\t\t}\n\t}\n\n\treturn bm, nil\n}", "title": "" }, { "docid": "3db87ab7a0cb94b088493e864d2fe77a", "score": "0.66837674", "text": "func (mm *StandardMultiMetric) Metrics() map[string]Metric {\n\treturn mm.metrics\n}", "title": "" }, { "docid": "f0984f08b35e6c9a974aaf923cfc4415", "score": "0.6676246", "text": "func (h *ddHandler) GetMetrics() (kafkametrics.BrokerMetrics, []error) {\n\tvar errors []error\n\tvar mergedBrokerList []*kafkametrics.Broker\n\n\tstart := time.Now().Add(-time.Duration(h.metricsWindow) * time.Second).Unix()\n\n\t// Get network metrics for tx and rx.\n\tvar lastLen int\n\tfor i, query := range []string{h.netTXQuery, h.netRXQuery} {\n\t\tseries, err := h.c.QueryMetrics(start, time.Now().Unix(), query)\n\t\tif err != nil {\n\t\t\treturn nil, []error{&kafkametrics.APIError{\n\t\t\t\tRequest: \"metrics query\",\n\t\t\t\tMessage: h.scrubbedErrorText(err),\n\t\t\t}}\n\t\t}\n\n\t\tif len(series) == 0 {\n\t\t\treturn nil, []error{&kafkametrics.NoResults{\n\t\t\t\tMessage: fmt.Sprintf(\"No data returned with query %s\", query),\n\t\t\t}}\n\t\t}\n\n\t\t// Get a []*kafkametrics.Broker from the series. Brokers with missing\n\t\t// points are excluded from blist.\n\t\tblist, errs := brokersFromSeries(series, i)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\n\t\t// We received a different number of series.\n\t\tif i > 0 && len(blist) != lastLen {\n\t\t\treturn nil, []error{&kafkametrics.NoResults{\n\t\t\t\tMessage: \"Failed to fetch complete metrics for brokers\",\n\t\t\t}}\n\t\t}\n\n\t\tlastLen = len(blist)\n\n\t\t// Merge the results into the mergedBrokerList.\n\t\tmergedBrokerList = mergeBrokerLists(mergedBrokerList, blist)\n\t}\n\n\t// The []*kafkametrics.Broker only contains hostnames and the network tx\n\t// metric. Fetch the rest of the required metadata and construct a\n\t// kafkametrics.BrokerMetrics.\n\tbm, errs := h.brokerMetricsFromList(mergedBrokerList)\n\tif errs != nil {\n\t\terrors = append(errors, errs...)\n\t}\n\n\treturn bm, errors\n}", "title": "" }, { "docid": "14b866e9e939aaf0e973ab2654e5720b", "score": "0.65145177", "text": "func (s *Service) GetMetrics() MapMetricsOptions {\n\tif s.Metrics == nil {\n\t\ts.Metrics = make(MapMetricsOptions)\n\t}\n\n\treturn s.Metrics\n}", "title": "" }, { "docid": "21c82c331f30549ec5220c3bf15ef05c", "score": "0.65128094", "text": "func (re *ApiConfig) GetMetrics(resolution float64) (metrics.Metrics, error) {\n\n\tif len(re.UseMetrics) > 0 {\n\t\tgots := metrics.GetMetrics(re.UseMetrics)\n\t\tif gots == nil {\n\t\t\treturn nil, fmt.Errorf(\"Could not find %s in the metric registry\", re.UseMetrics)\n\t\t}\n\t\treturn gots, nil\n\t}\n\n\treader, err := metrics.NewWriterMetrics(re.ApiMetricOptions.Driver)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif re.ApiMetricOptions.Options == nil {\n\t\tre.ApiMetricOptions.Options = options.New()\n\t}\n\tre.ApiMetricOptions.Options.Set(\"dsn\", re.ApiMetricOptions.DSN)\n\tre.ApiMetricOptions.Options.Set(\"resolution\", resolution)\n\n\t// need to match caches\n\t// use the defined cacher object\n\tif len(re.ApiMetricOptions.UseCache) == 0 {\n\t\treturn nil, writers.ErrCacheOptionRequired\n\t}\n\n\t// find the proper cache to use\n\tres := uint32(resolution)\n\tproper_name := fmt.Sprintf(\"%s:%d\", re.ApiMetricOptions.UseCache, res)\n\tc, err := metrics.GetCacherSingleton(proper_name, metrics.CacheNeededName(re.ApiMetricOptions.Driver))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tre.ApiMetricOptions.Options.Set(\"cache\", c)\n\n\terr = reader.Config(&re.ApiMetricOptions.Options)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn reader, nil\n}", "title": "" }, { "docid": "f412a318c1843580697267e2f3e1ebbb", "score": "0.649413", "text": "func (db *DB) GetMetrics(query GetMetricsOpts) (metrics []PlainMetric, err error) {\n\tvar dbResult *gorm.DB\n\n\ttype Result struct {\n\t\tTags json.RawMessage\n\t\tPlainMetric\n\t}\n\n\tvar results []Result\n\n\t// build the where clause from the options\n\tvar whereClause string\n\ti := 1\n\tvals := make([]interface{}, 0)\n\n\tif query.Tag != \"\" {\n\t\twhereClause = whereClause + fmt.Sprintf(\"t.text=$%d AND \", i)\n\t\ti++\n\t\tvals = append(vals, query.Tag)\n\t}\n\tif query.Key != \"\" {\n\t\twhereClause = whereClause + fmt.Sprintf(\"m.key=$%d AND \", i)\n\t\ti++\n\t\tvals = append(vals, query.Key)\n\t}\n\tif query.MinTimestamp != 0 {\n\t\twhereClause = whereClause + fmt.Sprintf(\"m.timestamp>=$%d AND \", i)\n\t\ti++\n\t\tvals = append(vals, query.MinTimestamp)\n\t}\n\tif query.MaxTimestamp != 0 {\n\t\twhereClause = whereClause + fmt.Sprintf(\"m.timestamp<$%d AND \", i)\n\t\ti++\n\t\tvals = append(vals, query.MaxTimestamp)\n\t}\n\tif whereClause != \"\" {\n\t\twhereClause = \"WHERE \" + strings.Trim(whereClause, \"AND \")\n\t}\n\n\t// Run the query\n\n\t// In production, we'd need a reasonable paging strategy\n\t// For now, we'll just set a fairly high upper limit so we don't crash the database\n\tdbResult = db.\n\t\tRaw(`SELECT m.*, COALESCE(jsonb_agg(\n t.text\n ) FILTER (WHERE t IS NOT NULL), '[]') AS tags\n FROM metrics as m\n LEFT JOIN metric_tags as mt on m.id = mt.metric_id\n LEFT JOIN tags as t on mt.tag_id = t.id `+\n\t\t\twhereClause+\n\t\t\t` GROUP BY m.id ORDER BY m.timestamp asc LIMIT 100000`, vals).Scan(&results)\n\n\tif err = dbResult.Error; err != nil {\n\t\treturn\n\t}\n\n\t// Convert the results to the proper type\n\tmetrics = make([]PlainMetric, len(results))\n\n\tfor i, v := range results {\n\t\tmetrics[i] = PlainMetric{\n\t\t\tKey: v.Key,\n\t\t\tValue: v.Value,\n\t\t\tTimestamp: v.Timestamp,\n\t\t}\n\t\tjson.Unmarshal(v.Tags, &metrics[i].Tags)\n\t}\n\treturn\n}", "title": "" }, { "docid": "946ca8c1a97ae25916c1318367ec8aef", "score": "0.64754695", "text": "func (_class VMMetricsClass) GetAll(sessionID SessionRef) (_retval []VMMetricsRef, _err error) {\n\t_method := \"VM_metrics.get_all\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertVMMetricsRefSetToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "60f0efc63b6c08d58907f99db7643932", "score": "0.6458999", "text": "func (a *MetricsApiService) GetMetrics(ctx _context.Context, entityId string, metric string, interval int32, start int64, end int64) (MetricResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue MetricResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/metrics\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tlocalVarQueryParams.Add(\"entity_id\", parameterToString(entityId, \"\"))\n\tlocalVarQueryParams.Add(\"metric\", parameterToString(metric, \"\"))\n\tlocalVarQueryParams.Add(\"interval\", parameterToString(interval, \"\"))\n\tlocalVarQueryParams.Add(\"start\", parameterToString(start, \"\"))\n\tlocalVarQueryParams.Add(\"end\", parameterToString(end, \"\"))\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\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 MetricResponse\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\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": "a366b9d0833d58b651b0f75b6938244c", "score": "0.6453891", "text": "func (mm *MultiMetricSnapshot) Metrics() map[string]Metric {\n\treturn mm.m.Metrics()\n}", "title": "" }, { "docid": "54b99096abe71b96748662b86fcaa68b", "score": "0.6450077", "text": "func (s *MetricsService) GetAll(rsID, locale string, segmentable bool, expansion []string) (*[]Metric, error) {\n\tvar params = map[string]string{}\n\tparams[\"rsid\"] = rsID\n\tif locale != \"\" {\n\t\tparams[\"locale\"] = locale\n\t}\n\tparams[\"segmentable\"] = strconv.FormatBool(segmentable)\n\tif len(expansion) > 0 {\n\t\tparams[\"expansion\"] = strings.Join(expansion[:], \",\")\n\t}\n\n\tvar data []Metric\n\terr := s.client.get(\"/metrics\", params, nil, &data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &data, err\n}", "title": "" }, { "docid": "71f922f1011ebae6e7df62fac70e1cb6", "score": "0.6431173", "text": "func (c *Collecter) Metrics() []prometheus.Collector { return c.metrics.List() }", "title": "" }, { "docid": "98683a8640828a1e0d139785b5193fe1", "score": "0.64175355", "text": "func getMetrics(metricsURL string) (string, error) {\n\tresp, err := http.Get(metricsURL)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(body), nil\n}", "title": "" }, { "docid": "eb674074e95d834d996e34aa2bd6c916", "score": "0.64105594", "text": "func GetAppMetrics() response.CacheResponse {\n\tusr, _ := user.Current()\n\tconfigPath := usr.HomeDir\n\n\tfile, err := os.Open(configPath + AppMetricsLogFilePath)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to open appMetrics log file: %s\", err.Error())\n\t}\n\tdefer file.Close()\n\n\tvar entries []ReadAppMetrics\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tvar entry ReadAppMetrics\n\t\tline := scanner.Text()\n\t\terr := json.Unmarshal([]byte(line), &entry)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tentries = append(entries, entry)\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tres := response.NewResponseFromValue(entries)\n\treturn res\n}", "title": "" }, { "docid": "dc63f7834583248775d386a4a7009e00", "score": "0.6406325", "text": "func GetMetricsAsMap() map[string]*structures.Metric {\n\tif handler != nil {\n\t\t(*handler)()\n\t}\n\n\tm := make(map[string]*structures.Metric, len(Metrics))\n\tfor _, metric := range Metrics {\n\t\tmetric.Get()\n\t\tm[metric.Name] = metric\n\t}\n\treturn m\n}", "title": "" }, { "docid": "4abf1d91366f4ae5f02dd16ce8291e29", "score": "0.6370382", "text": "func (_class PIFMetricsClass) GetAll(sessionID SessionRef) (_retval []PIFMetricsRef, _err error) {\n\tif IsMock {\n\t\treturn _class.GetAllMock(sessionID)\n\t}\t\n\t_method := \"PIF_metrics.get_all\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertPIFMetricsRefSetToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "877debb008628a73d3af3c28cc8ec50c", "score": "0.63660836", "text": "func (s *kafkaScaler) GetMetrics(ctx context.Context, metricName string, metricSelector labels.Selector) ([]external_metrics.ExternalMetricValue, error) {\n\tpartitions, err := s.getPartitions()\n\tif err != nil {\n\t\treturn []external_metrics.ExternalMetricValue{}, err\n\t}\n\n\toffsets, err := s.getOffsets(partitions)\n\tif err != nil {\n\t\treturn []external_metrics.ExternalMetricValue{}, err\n\t}\n\n\ttotalLag := int64(0)\n\tfor _, partition := range partitions {\n\t\tlag := s.getLagForPartition(partition, offsets)\n\t\ttotalLag += lag\n\t}\n\n\tlog.Debugf(\"Kafka scaler: Providing metrics based on totalLag %v, partitions %v, threshold %v\", totalLag, len(partitions), s.metadata.lagThreshold)\n\n\t// don't scale out beyond the number of partitions\n\tif (totalLag / s.metadata.lagThreshold) > int64(len(partitions)) {\n\t\ttotalLag = int64(len(partitions)) * s.metadata.lagThreshold\n\t}\n\n\tmetric := external_metrics.ExternalMetricValue{\n\t\tMetricName: metricName,\n\t\tValue: *resource.NewQuantity(int64(totalLag), resource.DecimalSI),\n\t\tTimestamp: metav1.Now(),\n\t}\n\n\treturn append([]external_metrics.ExternalMetricValue{}, metric), nil\n}", "title": "" }, { "docid": "dcebef74a5202851bbb0e83aa31efb9a", "score": "0.6365676", "text": "func (client ResourceOperationsClient) GetQuotaMetrics(resourceGroupName string, resourceName string) (result QuotaMetricInfoListResult, err error) {\n\treq, err := client.GetQuotaMetricsPreparer(resourceGroupName, resourceName)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"iothub.ResourceOperationsClient\", \"GetQuotaMetrics\", nil, \"Failure preparing request\")\n\t}\n\n\tresp, err := client.GetQuotaMetricsSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\treturn result, autorest.NewErrorWithError(err, \"iothub.ResourceOperationsClient\", \"GetQuotaMetrics\", resp, \"Failure sending request\")\n\t}\n\n\tresult, err = client.GetQuotaMetricsResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"iothub.ResourceOperationsClient\", \"GetQuotaMetrics\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "35c8109fd8fc59b88c7a37836157fdcf", "score": "0.62772745", "text": "func (q *Query) Metrics() []*QueryMetric {\n return q.metrics\n}", "title": "" }, { "docid": "890b253cecd637b4e0cd35452be5593b", "score": "0.62108815", "text": "func (context ExporterContext) GetMapOfMetrics() map[string]bool {\n\tmapOfWhiteListedMetrics := make(map[string]bool)\n\n\tfor _, rule := range Context.Rules {\n\t\tfor _, metric := range rule.Metrics {\n\t\t\tmapOfWhiteListedMetrics[metric] = true\n\t\t}\n\t}\n\n\treturn mapOfWhiteListedMetrics\n}", "title": "" }, { "docid": "0126474f27ccce0f15bacab2e4ff0b01", "score": "0.6183272", "text": "func (m Plugin) FetchMetrics() (map[string]float64, error) {\n\tresp, err := http.Get(fmt.Sprintf(\"http://%s/stats/app\", m.Target))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\ts := struct {\n\t\tUptime float64 `json:\"uptime\"`\n\t\tStartAt float64 `json:\"start_at\"`\n\t\tServiceUnavailableAt float64 `json:\"su_at\"`\n\t\tWorkers float64 `json:\"workers\"`\n\t\tQueueSize float64 `json:\"queue_size\"`\n\t\tRetryQueueSize float64 `json:\"retry_queue_size\"`\n\t\tWorkersQueueSize float64 `json:\"workers_queue_size\"`\n\t\tCommandQueueSize float64 `json:\"cmdq_queue_size\"`\n\t\tRetryCount float64 `json:\"retry_count\"`\n\t\tRequestCount float64 `json:\"req_count\"`\n\t\tSentCount float64 `json:\"sent_count\"`\n\t\tErrCount float64 `json:\"err_count\"`\n\t\tCertificateExpireUntil float64 `json:\"certificate_expire_until\"`\n\t}{}\n\n\tif err := json.NewDecoder(resp.Body).Decode(&s); err != nil {\n\t\treturn nil, err\n\t}\n\tret := make(map[string]float64, 13)\n\tret[\"uptime\"] = s.Uptime\n\tret[\"workers\"] = s.Workers\n\tret[\"queue_size\"] = s.QueueSize\n\tret[\"retry_queue_size\"] = s.RetryQueueSize\n\tret[\"workers_queue_size\"] = s.WorkersQueueSize\n\tret[\"cmdq_queue_size\"] = s.CommandQueueSize\n\tret[\"retry_count\"] = s.RetryCount\n\tret[\"req_count\"] = s.RequestCount\n\tret[\"sent_count\"] = s.SentCount\n\tret[\"err_count\"] = s.ErrCount\n\tret[\"certificate_expire_until\"] = s.CertificateExpireUntil\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "da511774a7dc8ae5ec3b9bc1a21d6fbc", "score": "0.61800194", "text": "func (b *BaseMetricSet) Metrics() *monitoring.Registry {\n\treturn b.metrics\n}", "title": "" }, { "docid": "22067df534df7b77fa0c7c72225fdf57", "score": "0.61741704", "text": "func (r *Registry) DumpMetrics() ([]*models.Metric, error) {\n\tresult := []*models.Metric{}\n\tcurrentMetrics, err := r.inner.Gather()\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\tfor _, val := range currentMetrics {\n\t\tmetricName := val.GetName()\n\t\tmetricType := val.GetType()\n\n\t\tfor _, metricLabel := range val.Metric {\n\t\t\tlabels := map[string]string{}\n\t\t\tfor _, label := range metricLabel.GetLabel() {\n\t\t\t\tlabels[label.GetName()] = label.GetValue()\n\t\t\t}\n\n\t\t\tvar value float64\n\t\t\tswitch metricType {\n\t\t\tcase dto.MetricType_COUNTER:\n\t\t\t\tvalue = metricLabel.Counter.GetValue()\n\t\t\tcase dto.MetricType_GAUGE:\n\t\t\t\tvalue = metricLabel.GetGauge().GetValue()\n\t\t\tcase dto.MetricType_UNTYPED:\n\t\t\t\tvalue = metricLabel.GetUntyped().GetValue()\n\t\t\tcase dto.MetricType_SUMMARY:\n\t\t\t\tvalue = metricLabel.GetSummary().GetSampleSum()\n\t\t\tcase dto.MetricType_HISTOGRAM:\n\t\t\t\tvalue = metricLabel.GetHistogram().GetSampleSum()\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tmetric := &models.Metric{\n\t\t\t\tName: metricName,\n\t\t\t\tLabels: labels,\n\t\t\t\tValue: value,\n\t\t\t}\n\t\t\tresult = append(result, metric)\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "b404ccef0251671bcbf924e3fb84968b", "score": "0.61730057", "text": "func (rd ResourceDef) GetMetricDefs() []config.RextMetricDef {\n\treturn rd.metrics\n}", "title": "" }, { "docid": "b187525b9ff03351bc9acac96dbae157", "score": "0.61632895", "text": "func ExampleMetrics() {\n\trecorder := prometheus.NewRecorder(prometheus.Config{}).RegisterOn(nil)\n\n\tconfig := metrics.NewConfig(recorder)\n\tconfig.IdentifierProvider = func(req *http.Request) string {\n\t\treturn req.URL.Host+\" -> \"+req.URL.Path\n\t}\n\n\t// we recommend to use MiddlewareStack to simplify managing all wanted middleware\n\t// caution middleware order matter\n\tstack := httpware.TripperwareStack(\n\t\ttripperware.Metrics(config),\n\t)\n\n\t// create http client using the tripperwareStack as RoundTripper\n\tclient := http.Client{\n\t\tTransport: stack,\n\t}\n\n\t_, _ = client.Get(\"fake-address.foo\")\n\n\t//Output:\n}", "title": "" }, { "docid": "f16b03c8f61fb35e13c40fff8692e966", "score": "0.61627203", "text": "func (s *RestServer) getRuleMetricsHandler(r *http.Request) (interface{}, error) {\n\tlog.Infof(\"Got GET request RuleMetrics/%s\", mux.Vars(r)[\"Meta.Name\"])\n\treturn nil, nil\n}", "title": "" }, { "docid": "494f7019685b54a9db277b3dc93c5d3a", "score": "0.6148392", "text": "func (kc *Keycloak) Gather() ([]*metric, error) {\n\tkc.logger.Debug(\"keycloak metrics gathering \")\n\tsvc, err := kc.serviceRepoBuilder.UseDefaultSAToken().Build()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"keycloak gather failed to create svcruder using default service account token\")\n\t}\n\tkcServices, err := svc.List(func(attrs mobile.Attributer) bool {\n\t\treturn attrs.GetName() == kc.ServiceName\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"keycloak gather failed to list existing services\")\n\t}\n\tif len(kcServices) == 0 {\n\t\treturn nil, &noServiceProvisionedErr{Message: \" no keycloak service present in namespace \"}\n\t}\n\tkcService := kcServices[0] //TODO deal with more than one\n\thost := kcService.Host\n\tusername := kcService.Params[\"admin_username\"]\n\tpass := kcService.Params[\"admin_password\"]\n\trealm := kcService.Params[\"realm\"]\n\ttoken, err := kc.getToken(host, username, pass, realm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcs, err := kc.getClientStats(host, token, realm)\n\tif err != nil {\n\t\tkc.logger.Error(\"keycloak: failed to get client stats \", err)\n\t}\n\tevents, err := kc.getRealmEvents(host, token, realm)\n\tif err != nil {\n\t\tkc.logger.Error(\"keycloak: failed to get realm events \", err)\n\t}\n\tvar kcMetrics = []*metric{}\n\tif len(cs) > 0 {\n\t\tclientMetrics := processClientStats(cs)\n\t\tkcMetrics = append(kcMetrics, clientMetrics...)\n\t}\n\tif len(events) > 0 {\n\t\teventMetrics := processRealmEvents(events)\n\t\tkcMetrics = append(kcMetrics, eventMetrics...)\n\t}\n\treturn kcMetrics, nil\n}", "title": "" }, { "docid": "7edac1f6ad84ad557b35f0cdcdd74cf3", "score": "0.6133887", "text": "func ExampleMetrics() {\n\trecorder := prometheus.NewRecorder(prometheus.Config{}).RegisterOn(nil)\n\n\t// we recommend to use MiddlewareStack to simplify managing all wanted middleware\n\t// caution middleware order matter\n\tstack := httpware.TripperwareStack(\n\t\ttripperware.Metrics(recorder, metrics.WithIdentifierProvider(func(req *http.Request) string {\n\t\t\treturn req.URL.Host + \" -> \" + req.URL.Path\n\t\t})),\n\t)\n\n\t// create http client using the tripperwareStack as RoundTripper\n\tclient := http.Client{\n\t\tTransport: stack,\n\t}\n\n\t_, _ = client.Get(\"fake-address.foo\")\n\n\t//Output:\n}", "title": "" }, { "docid": "fffdcfcf744e8178fa41f9fe98c6d358", "score": "0.6102171", "text": "func (o MonitorTagRuleOutput) Metrics() MonitorTagRuleMetricArrayOutput {\n\treturn o.ApplyT(func(v *MonitorTagRule) MonitorTagRuleMetricArrayOutput { return v.Metrics }).(MonitorTagRuleMetricArrayOutput)\n}", "title": "" }, { "docid": "a052a6c020e0ef1834bc562d8753c464", "score": "0.60982317", "text": "func NewMetrics() Metrics {\n\tm := &metricsData{}\n\tm.Init()\n\treturn m\n}", "title": "" }, { "docid": "064dce4c70a3156496f007daeb80a96c", "score": "0.6046242", "text": "func (a *MetricsApiService) ListMetrics(ctx _context.Context) apiListMetricsRequest {\n\treturn apiListMetricsRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "fec4d11573fb5c5d534cb90ea54d1dc1", "score": "0.6044247", "text": "func (c *Client) Metrics(ctx context.Context, req *wpb.MetricsRequest) (*wpb.MetricsResponse, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "1997753a7b9579ed8547e8fd1bb867df", "score": "0.60426927", "text": "func (o *AzureSupportingService) GetMonitoredMetrics() []AzureMonitoredMetric {\n\tif o == nil || o.MonitoredMetrics == nil {\n\t\tvar ret []AzureMonitoredMetric\n\t\treturn ret\n\t}\n\treturn *o.MonitoredMetrics\n}", "title": "" }, { "docid": "d637f2dcc18726bb9714013323a3530f", "score": "0.6042585", "text": "func (svc *Service) getAllMetricsFromControl(catalogId, categoryName, controlId string) (metrics []*assessment.Metric, err error) {\n\tvar subControlMetrics []*assessment.Metric\n\n\tcontrol, err := svc.getControl(catalogId, categoryName, controlId)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"could not get control for control id {%s}: %w\", controlId, err)\n\t\treturn\n\t}\n\n\t// Add metric of control to the metrics list\n\tmetrics = append(metrics, control.Metrics...)\n\n\t// Add sub-control metrics to the metric list if exist\n\tif len(control.Controls) != 0 {\n\t\t// Get the metrics from the next sub-control\n\t\tsubControlMetrics, err = svc.getMetricsFromSubcontrols(control)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"error getting metrics from sub-controls: %w\", err)\n\t\t\treturn\n\t\t}\n\n\t\tmetrics = append(metrics, subControlMetrics...)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3c2239ed79c58af6913186241c87ede7", "score": "0.60286546", "text": "func (h *Handler) GetSensorMetrics(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\n\tvars := mux.Vars(r)\n\tapiKey := vars[\"apiKey\"]\n\tdeviceId := vars[\"deviceId\"]\n\n\t//i, err := strconv.ParseUint(id, 10, 64)\n\t//if err != nil {\n\t//\tsendErrorResponse(w, \"Unable to parse UInt from ID\", err)\n\t//\treturn\n\t//}\n\n\tmetrics, err := h.Service.GetMetrics(apiKey, deviceId)\n\tif err != nil {\n\t\tsendErrorResponse(w, \"Error Retrieving Sensor Metrics for Client ID\", err)\n\t\treturn\n\t}\n\t\n\tif err := json.NewEncoder(w).Encode(metrics); err != nil {\n\t\tpanic(err)\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "f63ea24a0527315cd2cdbff81c24a5d4", "score": "0.6013277", "text": "func getFilteredMetrics(rawMetrics map[string]metricType, allowlist []string, allowlistEnabled bool, blocklist []string, blocklistEnabled bool) map[string]metricType {\n\tfilteredMetrics := filterAllowedMetrics(rawMetrics, allowlist, allowlistEnabled)\n\tfilterBlockedMetrics(filteredMetrics, blocklist, blocklistEnabled)\n\n\treturn filteredMetrics\n}", "title": "" }, { "docid": "acebccbdd0163da74c4386c4d377a292", "score": "0.6006421", "text": "func (p StepFunctionsPlugin) FetchMetrics() (map[string]float64, error) {\n\tstats := make(map[string]float64)\n\n\tfor _, met := range stepFunctionsMetricsGroup {\n\t\tv, err := getLastPointFromCloudWatch(p.CloudWatch, p.StateMachineArn, met)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%s: %s\", met, err)\n\t\t} else if v != nil {\n\t\t\tstats = mergeStatsFromDatapoint(stats, v, met)\n\t\t}\n\t}\n\treturn stats, nil\n}", "title": "" }, { "docid": "4d00482ce81c5a61e9962448aed633bb", "score": "0.60035443", "text": "func (s *RestServer) getMsmsintmsMetricsHandler(r *http.Request) (interface{}, error) {\n\tlog.Infof(\"Got GET request MsmsintmsMetrics/%s\", mux.Vars(r)[\"Meta.Name\"])\n\treturn nil, nil\n}", "title": "" }, { "docid": "fda4b8314e83e8ee9ff362c7c47056b1", "score": "0.6000701", "text": "func (e EndpointsTelemetryV1Client) Metrics(ctx context.Context, in *MetricsQueryList) (*MetricsQueryResponse, error) {\n\tresp, err := e.MetricsEndpoint(ctx, in)\n\tif err != nil {\n\t\treturn &MetricsQueryResponse{}, err\n\t}\n\treturn resp.(*MetricsQueryResponse), nil\n}", "title": "" }, { "docid": "bbe52bd2bec3f102a07e0f079776c318", "score": "0.59872866", "text": "func (c MultiApache2Plugin) FetchMetrics() (map[string]interface{}, error) {\n\tchannel := make(chan *Metrics4Channel, len(c.PortList))\n\tfor _, port := range c.PortList {\n\t\tgo fetchMetrics4Port(c.Protocol, c.Host, port, c.Path, c.Header, channel)\n\t}\n\n\tstats := make(map[string]interface{})\n\tfor i := 0; i < cap(channel); i++ {\n\t\tstat := <-channel\n\t\taccStatKey := fmt.Sprintf(\"apache2.access.%d.disconnect\", stat.Port)\n\t\tstats[accStatKey] = float64(0)\n\t\tif stat.Err != nil {\n\t\t\tstats[accStatKey] = float64(1)\n\t\t\tcontinue\n\t\t}\n\t\tfor key, val := range stat.Stat {\n\t\t\tstats[fmt.Sprintf(\"apache2.%s\", strings.Replace(key, \"*\", strconv.Itoa(stat.Port), 1))] = val\n\t\t}\n\t}\n\treturn stats, nil\n}", "title": "" }, { "docid": "79b7bc78fafea8abef0590b5b97882ac", "score": "0.5985872", "text": "func (c *Client) Metrics() (string, error) {\n\turl := fmt.Sprintf(\"%s/metrics\", c.baseURL)\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar sb strings.Builder\n\tif _, err := io.Copy(&sb, res.Body); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"request failed with status code %d\", res.StatusCode)\n\t}\n\treturn sb.String(), nil\n}", "title": "" }, { "docid": "7d54d687e54b2a7cf428a354a945fee0", "score": "0.5981971", "text": "func (c *FloatingIPCollector) Metrics() []*prometheus.Desc {\n\treturn []*prometheus.Desc{\n\t\tc.Active,\n\t}\n}", "title": "" }, { "docid": "1b51feb567bb4287c0172d8db542d694", "score": "0.5979785", "text": "func (dc *DataCollector) SyncMetrics(obj interface{}) {\n\tvar md pmetric.Metrics\n\n\tswitch o := obj.(type) {\n\tcase *corev1.Pod:\n\t\tmd = pod.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *corev1.Node:\n\t\tmd = node.GetMetrics(dc.settings, dc.metricsBuilderConfig, o, dc.nodeConditionsToReport, dc.allocatableTypesToReport)\n\tcase *corev1.Namespace:\n\t\tmd = namespace.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *corev1.ReplicationController:\n\t\tmd = replicationcontroller.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *corev1.ResourceQuota:\n\t\tmd = resourcequota.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *appsv1.Deployment:\n\t\tmd = deployment.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *appsv1.ReplicaSet:\n\t\tmd = replicaset.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *appsv1.DaemonSet:\n\t\tmd = demonset.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *appsv1.StatefulSet:\n\t\tmd = statefulset.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *batchv1.Job:\n\t\tmd = jobs.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *batchv1.CronJob:\n\t\tmd = cronjob.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *batchv1beta1.CronJob:\n\t\tmd = cronjob.GetMetricsBeta(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *autoscalingv2.HorizontalPodAutoscaler:\n\t\tmd = hpa.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *autoscalingv2beta2.HorizontalPodAutoscaler:\n\t\tmd = hpa.GetMetricsBeta(dc.settings, dc.metricsBuilderConfig, o)\n\tcase *quotav1.ClusterResourceQuota:\n\t\tmd = clusterresourcequota.GetMetrics(dc.settings, dc.metricsBuilderConfig, o)\n\tdefault:\n\t\treturn\n\t}\n\n\tif md.DataPointCount() == 0 {\n\t\treturn\n\t}\n\n\tdc.UpdateMetricsStore(obj, md)\n}", "title": "" }, { "docid": "170f2b30c567b2ee5e61674583bd490e", "score": "0.5945267", "text": "func (c *EC2) DefaultMetrics() []Metric {\n\treturn []Metric{\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"CPUUtilization\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Percent\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"DiskReadOps\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Count\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"DiskWriteOps\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Count\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"DiskReadBytes\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Bytes\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"DiskWriteBytes\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Bytes\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"NetworkIn\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Bytes\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"NetworkOut\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Bytes\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"NetworkPacketsIn\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Count\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"NetworkPacketsOut\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Count\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"EBSReadOps\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Count\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"EBSWriteOps\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Count\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"EBSReadBytes\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Bytes\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tAWSMetric{\n\t\t\t\tName: \"EBSWriteBytes\",\n\t\t\t\tStats: []string{metricStatAverage},\n\t\t\t\tUnits: \"Bytes\",\n\t\t\t},\n\t\t\tCirconusMetric{\n\t\t\t\tName: \"\", // NOTE: AWSMetric.Name will be used if blank\n\t\t\t\tType: \"gauge\", // (gauge|counter|histogram|text)\n\t\t\t\tTags: circonus.Tags{}, // NOTE: units:strings.ToLower(AWSMetric.Units) is added automatically\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4b9be322d9c31358ee90e5fc986335b6", "score": "0.5932826", "text": "func (ms InstrumentationLibraryMetrics) Metrics() MetricSlice {\n\treturn newMetricSlice(&ms.orig.Metrics)\n}", "title": "" }, { "docid": "17d13e85688de8faa48481b783223314", "score": "0.59301287", "text": "func (r *MetaResult) Metrics() MetricsResult {\n\tvar metrics MetricsResult = make([]string, 0, len(*r))\n\tfor k := range *r {\n\t\tmetrics = append(metrics, k)\n\t}\n\treturn metrics\n}", "title": "" }, { "docid": "77c10266336688ea308e0cd8124dc6f7", "score": "0.5913615", "text": "func (a *API) FetchMetrics() (*[]Metric, error) {\n\tresult, err := a.Get(config.MetricPrefix)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar metrics []Metric\n\tif err := json.Unmarshal(result, &metrics); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &metrics, nil\n}", "title": "" }, { "docid": "db38c72ec9c5ca3f0d58dbd2b71cb3c3", "score": "0.5905948", "text": "func (c Apache2Plugin) FetchMetrics() (map[string]interface{}, error) {\n\tdata, err := getApache2Metrics(c.Host, c.Port, c.Path, c.Header)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstat := make(map[string]interface{})\n\terrStat := parseApache2Status(data, &stat)\n\tif errStat != nil {\n\t\treturn nil, errStat\n\t}\n\terrScore := parseApache2Scoreboard(data, &stat)\n\tif errScore != nil {\n\t\treturn nil, errScore\n\t}\n\n\treturn stat, nil\n}", "title": "" }, { "docid": "eb2e709028218079d3877dd87c729f54", "score": "0.590388", "text": "func (p ALBPlugin) FetchMetrics() (map[string]interface{}, error) {\n\tstat := make(map[string]interface{})\n\tif p.Lbname != \"\" {\n\t\tld := []*cloudwatch.Dimension{\n\t\t\t{\n\t\t\t\tName: aws.String(\"LoadBalancer\"),\n\t\t\t\tValue: aws.String(p.Lbname),\n\t\t\t},\n\t\t}\n\t\tfor _, met := range []string{\n\t\t\t\"ProcessedBytes\",\n\t\t\t\"NewConnectionCount\", \"RejectedConnectionCount\", \"ActiveConnectionCount\", \"TargetConnectionErrorCount\",\n\t\t\t\"RequestCount\",\n\t\t\t\"HTTPCode_ELB_5XX_Count\", \"HTTPCode_ELB_4XX_Count\",\n\t\t\t\"HTTPCode_Target_2XX_Count\", \"HTTPCode_Target_3XX_Count\", \"HTTPCode_Target_4XX_Count\", \"HTTPCode_Target_5XX_Count\",\n\t\t} {\n\t\t\tv, err := p.getLastPoint(ld, met, stSum)\n\t\t\tif err == nil {\n\t\t\t\tstat[met] = v\n\t\t\t}\n\t\t}\n\t\tfor _, met := range []string{\"TargetResponseTime\"} {\n\t\t\tv, err := p.getLastPoint(ld, met, stAve)\n\t\t\tif err == nil {\n\t\t\t\tstat[met] = v\n\t\t\t}\n\t\t}\n\n\t\ttgr := regexp.MustCompile(\"targetgroup/(.+?)/.+\")\n\n\t\tfor _, tgname := range p.Tgnames {\n\t\t\tgroup := tgr.FindStringSubmatch(tgname)\n\t\t\ttgMetricName := \"\"\n\t\t\tif len(group) >= 2 {\n\t\t\t\ttgMetricName = group[1]\n\t\t\t} else {\n\t\t\t\ttgMetricName = strings.Replace(tgname, \"/\", \"_\", 0)\n\t\t\t}\n\t\t\ttd := []*cloudwatch.Dimension{\n\t\t\t\t{\n\t\t\t\t\tName: aws.String(\"LoadBalancer\"),\n\t\t\t\t\tValue: aws.String(p.Lbname),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: aws.String(\"TargetGroup\"),\n\t\t\t\t\tValue: aws.String(tgname),\n\t\t\t\t},\n\t\t\t}\n\t\t\tfor _, met := range []string{\n\t\t\t\t\"HTTPCode_Target_2XX_Count\", \"HTTPCode_Target_3XX_Count\", \"HTTPCode_Target_4XX_Count\", \"HTTPCode_Target_5XX_Count\",\n\t\t\t} {\n\t\t\t\tv, err := p.getLastPoint(td, met, stSum)\n\t\t\t\tif err == nil {\n\t\t\t\t\tstat[\"alb.httpcode_count_per_group.\" + tgMetricName + \".\" + met] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, met := range []string{\n\t\t\t\t\"RequestCountPerTarget\",\n\t\t\t} {\n\t\t\t\tv, err := p.getLastPoint(td, met, stSum)\n\t\t\t\tif err == nil {\n\t\t\t\t\tstat[\"alb.request_per_group.\" + tgMetricName + \".\" + met] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, met := range []string{\"HealthyHostCount\", \"UnHealthyHostCount\",} {\n\t\t\t\tv, err := p.getLastPoint(td, met, stAve)\n\t\t\t\tif err == nil {\n\t\t\t\t\tstat[\"alb.host_count.\" + tgMetricName + \".\" + met] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, met := range []string{\"TargetResponseTime\",} {\n\t\t\t\tv, err := p.getLastPoint(td, met, stAve)\n\t\t\t\tif err == nil {\n\t\t\t\t\tstat[\"alb.response_per_group.\" + tgMetricName + \".\" + met] = v\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn stat, nil\n}", "title": "" }, { "docid": "d5c29933fd7e2d667f9675478fc1e476", "score": "0.59029377", "text": "func (q QgPlugin) FetchMetrics() (map[string]interface{}, error) {\n\tdb, err := q.DB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc, err := qg.NewClient2(db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\n\tstats, err := c.Stats()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstat := q.aggregateStats(stats)\n\n\treturn map[string]interface{}{\n\t\t\"count_total\": uint64(stat.Count),\n\t\t\"count_working\": uint64(stat.CountWorking),\n\t\t\"count_errored\": uint64(stat.CountErrored),\n\t\t\"highest_error_count\": uint64(stat.HighestErrorCount),\n\t}, nil\n}", "title": "" }, { "docid": "650bc2bae8b273c328088af9c9043fe0", "score": "0.5901611", "text": "func getPodMetrics(clientSet *kubernetes.Clientset) {\n\terr := getMetrics(clientSet, &podsObj)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\t//print the information\n\tfor i, pod := range podsObj.Items {\n\t\tfmt.Printf(\"\\nPod Name: %s, Pod Namespace: %s\\n\", pod.Metadata.Name, pod.Metadata.Namespace)\n\t\tfor j, container := range podsObj.Items[i].Containers {\n\t\t\tfmt.Printf(\"%d) Container Name: %s, CPU Usage: %s, Memory Usage: %s\\n\", j+1, container.Name, container.Usage.CPU, container.Usage.Memory)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "5d06338862fe127671465cc4ee33fa08", "score": "0.58928394", "text": "func metrics(w http.ResponseWriter, req *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tif len(CurrentModule.LastMetrics) == 0 {\n\t\tjson.NewEncoder(w).Encode(\"{}\")\n\t\treturn\n\t}\n\n\tparams := mux.Vars(req)\n\tvar listMetrics []Metric // List of metrics to return\n\n\t// Get the timestamp from parameter\n\ttimestampParam, ok := params[\"timestamp\"]\n\n\t// If there is no timestamp\n\tif !ok {\n\t\te := JSONError{Message: \"Internal Server Error\"}\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\terr2 := json.NewEncoder(w).Encode(e)\n\t\tlog.Panic(\"No timestamp provided\", err2)\n\t}\n\n\t// TODO choose timestamp template\n\ttimestamp, err := time.Parse(time.RFC3339, timestampParam)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tlistMetrics = getMetricsFromTimestamp(timestamp)\n\n\t// Return logs as a JSON object\n\tjsonError := json.NewEncoder(w).Encode(listMetrics)\n\tif jsonError != nil {\n\t\te := JSONError{Message: \"Internal Server Error\"}\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\terr2 := json.NewEncoder(w).Encode(e)\n\t\tlog.Panic(err, err2)\n\t}\n}", "title": "" }, { "docid": "7db20bb4ff9307510d49af7dfb81ac1a", "score": "0.58864486", "text": "func (c *InfluxdbClient) ReadMetrics(database string, query string) ([]models.Row, error) {\n\tq := client.Query{\n\t\tCommand: query,\n\t\tDatabase: database,\n\t}\n\n\tresp, err := c.client.Query(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.Error() != nil {\n\t\tlog.Fatalln(\"Error: \", resp.Error())\n\t}\n\n\treturn resp.Results[0].Series, nil\n}", "title": "" }, { "docid": "613eb71e5f1799019905ea53d8b35280", "score": "0.5872171", "text": "func GetMetrics(path string) (*csi.NodeGetVolumeStatsResponse, error) {\n\tif path == \"\" {\n\t\treturn nil, fmt.Errorf(\"getMetrics No path given\")\n\t}\n\tavailable, capacity, usage, inodes, inodesFree, inodesUsed, err := fs.FsInfo(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetrics := &k8svol.Metrics{Time: metav1.Now()}\n\tmetrics.Available = resource.NewQuantity(available, resource.BinarySI)\n\tmetrics.Capacity = resource.NewQuantity(capacity, resource.BinarySI)\n\tmetrics.Used = resource.NewQuantity(usage, resource.BinarySI)\n\tmetrics.Inodes = resource.NewQuantity(inodes, resource.BinarySI)\n\tmetrics.InodesFree = resource.NewQuantity(inodesFree, resource.BinarySI)\n\tmetrics.InodesUsed = resource.NewQuantity(inodesUsed, resource.BinarySI)\n\n\tmetricAvailable, ok := (*(metrics.Available)).AsInt64()\n\tif !ok {\n\t\tlog.Errorf(\"failed to fetch available bytes for target: %s\", path)\n\t\treturn nil, status.Error(codes.Unknown, \"failed to fetch available bytes\")\n\t}\n\tmetricCapacity, ok := (*(metrics.Capacity)).AsInt64()\n\tif !ok {\n\t\tlog.Errorf(\"failed to fetch capacity bytes for target: %s\", path)\n\t\treturn nil, status.Error(codes.Unknown, \"failed to fetch capacity bytes\")\n\t}\n\tmetricUsed, ok := (*(metrics.Used)).AsInt64()\n\tif !ok {\n\t\tlog.Errorf(\"failed to fetch used bytes for target %s\", path)\n\t\treturn nil, status.Error(codes.Unknown, \"failed to fetch used bytes\")\n\t}\n\tmetricInodes, ok := (*(metrics.Inodes)).AsInt64()\n\tif !ok {\n\t\tlog.Errorf(\"failed to fetch available inodes for target %s\", path)\n\t\treturn nil, status.Error(codes.Unknown, \"failed to fetch available inodes\")\n\t}\n\tmetricInodesFree, ok := (*(metrics.InodesFree)).AsInt64()\n\tif !ok {\n\t\tlog.Errorf(\"failed to fetch free inodes for target: %s\", path)\n\t\treturn nil, status.Error(codes.Unknown, \"failed to fetch free inodes\")\n\t}\n\tmetricInodesUsed, ok := (*(metrics.InodesUsed)).AsInt64()\n\tif !ok {\n\t\tlog.Errorf(\"failed to fetch used inodes for target: %s\", path)\n\t\treturn nil, status.Error(codes.Unknown, \"failed to fetch used inodes\")\n\t}\n\n\treturn &csi.NodeGetVolumeStatsResponse{\n\t\tUsage: []*csi.VolumeUsage{\n\t\t\t{\n\t\t\t\tAvailable: metricAvailable,\n\t\t\t\tTotal: metricCapacity,\n\t\t\t\tUsed: metricUsed,\n\t\t\t\tUnit: csi.VolumeUsage_BYTES,\n\t\t\t},\n\t\t\t{\n\t\t\t\tAvailable: metricInodesFree,\n\t\t\t\tTotal: metricInodes,\n\t\t\t\tUsed: metricInodesUsed,\n\t\t\t\tUnit: csi.VolumeUsage_INODES,\n\t\t\t},\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "18d7858ac7b521e232bfe452c6acb339", "score": "0.5862137", "text": "func (client *XenClient) VIFMetricsGetAll() (result []string, err error) {\n\tobj, err := client.APICall(\"VIF_metrics.get_all\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresult = make([]string, len(obj.([]interface{})))\n\tfor i, value := range obj.([]interface{}) {\n\t\tresult[i] = value.(string)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d6babf5b9e5feb144af35f3381e8774b", "score": "0.58620363", "text": "func AllMetricsNames() []string {\n\treturn metricsNames\n}", "title": "" }, { "docid": "b05b86758c3c2bc8d6ec4feef1d6ab4f", "score": "0.5858492", "text": "func NewMetrics() *Metrics {\n\tengines := make(map[string]MetricsEngine)\n\thandle := &mhandler{}\n\treturn &Metrics{handler: handle, mh: MetricsHandler{handler: handle}, engines: engines}\n}", "title": "" }, { "docid": "0ee2096e50a4b0e02b854aed22502e9a", "score": "0.5853977", "text": "func RegisterMetrics() {\n\tregisterMetricsOnce.Do(func() {\n\t\tlegacyregistry.MustRegister(SyncProxyRulesLatency)\n\t\tlegacyregistry.MustRegister(SyncFullProxyRulesLatency)\n\t\tlegacyregistry.MustRegister(SyncPartialProxyRulesLatency)\n\t\tlegacyregistry.MustRegister(SyncProxyRulesLastTimestamp)\n\t\tlegacyregistry.MustRegister(NetworkProgrammingLatency)\n\t\tlegacyregistry.MustRegister(EndpointChangesPending)\n\t\tlegacyregistry.MustRegister(EndpointChangesTotal)\n\t\tlegacyregistry.MustRegister(ServiceChangesPending)\n\t\tlegacyregistry.MustRegister(ServiceChangesTotal)\n\t\tlegacyregistry.MustRegister(IptablesRulesTotal)\n\t\tlegacyregistry.MustRegister(IptablesRulesLastSync)\n\t\tlegacyregistry.MustRegister(IptablesRestoreFailuresTotal)\n\t\tlegacyregistry.MustRegister(IptablesPartialRestoreFailuresTotal)\n\t\tlegacyregistry.MustRegister(SyncProxyRulesLastQueuedTimestamp)\n\t\tlegacyregistry.MustRegister(SyncProxyRulesNoLocalEndpointsTotal)\n\t\tlegacyregistry.MustRegister(ProxyHealthzTotal)\n\t\tlegacyregistry.MustRegister(ProxyLivezTotal)\n\n\t})\n}", "title": "" }, { "docid": "750c1281d34fca2addb74d3145a96a73", "score": "0.5851997", "text": "func Metrics(args *common.Parameters) {\n\t//Setup variables used in the code.\n\tvar historyInterval time.Duration\n\thistoryInterval = 0\n\tvar query string\n\tvar result model.Value\n\tvar err error\n\n\t//Start and end time + the prometheus address used for querying\n\trange5Min := common.TimeRange(args, historyInterval)\n\n\tquery = `max(kube_resourcequota_created) by (namespace,resourcequota)`\n\tresult, err = common.MetricCollect(args, query, range5Min)\n\n\tif err != nil {\n\t\targs.WarnLogger.Println(\"metric=resourceQuotas query=\" + query + \" message=\" + err.Error())\n\t\tfmt.Println(\"[WARNING] metric=resourceQuotas query=\" + query + \" message=\" + err.Error())\n\t\treturn\n\t}\n\tvar rsltIndex = result.(model.Matrix)\n\tfor i := 0; i < rsltIndex.Len(); i++ {\n\n\t\tnamespaceName := string(result.(model.Matrix)[i].Metric[\"namespace\"])\n\t\tif _, ok := resourceQuotas[namespaceName]; !ok {\n\t\t\tresourceQuotas[namespaceName] = &namespace{rqs: map[string]*resourceQuota{}}\n\t\t}\n\n\t\tunixTimeInt := int64(rsltIndex[i].Values[len(rsltIndex[i].Values)-1].Value)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"ERROR: Unable to parse unix time into int\")\n\t\t}\n\t\tresourceQuotas[namespaceName].rqs[string(rsltIndex[i].Metric[\"resourcequota\"])] =\n\t\t\t&resourceQuota{\n\t\t\t\tresources: \"\",\n\t\t\t\tcpuLimit: -1, cpuRequest: -1, memLimit: -1, memRequest: -1, podsLimit: -1,\n\t\t\t\tcreateTime: time.Unix(unixTimeInt, 0),\n\t\t\t}\n\t}\n\n\tquery = `max(kube_resourcequota) by (resourcequota, resource, namespace, type)`\n\tresult, err = common.MetricCollect(args, query, range5Min)\n\tif err != nil {\n\t\targs.WarnLogger.Println(\"metric=resourceQuotaLimits query=\" + query + \" message=\" + err.Error())\n\t\tfmt.Println(\"[WARNING] metric=resourceQuotaLimits query=\" + query + \" message=\" + err.Error())\n\t} else {\n\t\tgetExistingQuotas(result)\n\t}\n\n\twriteAttributes(args)\n\twriteConfig(args)\n\n\tvar metricField []model.LabelName\n\tmetricField = append(metricField, \"namespace\")\n\tmetricField = append(metricField, \"resourcequota\")\n\n\tquery = `sum(kube_resourcequota{type=\"used\", resource=\"limits.cpu\"}) by (resourcequota,namespace) * 1000`\n\tcommon.GetWorkload(\"cpu_limits\", \"CpuLimits\", query, metricField, args, entityKind)\n\n\tquery = `sum(kube_resourcequota{type=\"used\", resource=~\"cpu|requests\\\\.cpu\"}) by (resourcequota,namespace) * 1000`\n\tcommon.GetWorkload(\"cpu_requests\", \"CpuRequests\", query, metricField, args, entityKind)\n\n\tquery = `sum(kube_resourcequota{type=\"used\", resource=\"limits.memory\"}) by (resourcequota,namespace)`\n\tcommon.GetWorkload(\"mem_limits\", \"MemLimits\", query, metricField, args, entityKind)\n\n\tquery = `sum(kube_resourcequota{type=\"used\", resource=~\"memory|requests\\\\.memory\"}) by (resourcequota,namespace) / (1024 * 1024)`\n\tcommon.GetWorkload(\"mem_requests\", \"MemRequests\", query, metricField, args, entityKind)\n\n\tquery = `sum(kube_resourcequota{type=\"used\", resource=~\"pods|count\\\\/pods\"}) by (resourcequota,namespace)`\n\tcommon.GetWorkload(\"pods\", \"PodsLimits\", query, metricField, args, entityKind)\n\n}", "title": "" }, { "docid": "ee72a91c6b01c1c4e9b3e7ba8b7b739a", "score": "0.5822295", "text": "func (p JSONPlugin) FetchMetrics() (map[string]float64, error) {\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: p.InsecureSkipVerify},\n\t}\n\tclient := &http.Client{Transport: tr}\n\tresponse, err := client.Get(p.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer response.Body.Close()\n\tbytes, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar content interface{}\n\tif err := json.Unmarshal(bytes, &content); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p.traverseMap(content, []string{p.Prefix})\n}", "title": "" }, { "docid": "d3ccb6ff566fc8b3178c90c286145f07", "score": "0.58141977", "text": "func (c *SSHKeyCollector) Metrics() []*prometheus.Desc {\n\treturn []*prometheus.Desc{\n\t\tc.Key,\n\t}\n}", "title": "" }, { "docid": "25de8a320921a4477b0e22eec7141c87", "score": "0.58021975", "text": "func (e EndpointsTelemetryV1Server) Metrics(ctx context.Context, in MetricsQueryList) (MetricsQueryResponse, error) {\n\tresp, err := e.MetricsEndpoint(ctx, in)\n\tif err != nil {\n\t\treturn MetricsQueryResponse{}, err\n\t}\n\treturn *resp.(*MetricsQueryResponse), nil\n}", "title": "" }, { "docid": "d7c6b64ba2a28c8d310bd89bd8251f6d", "score": "0.5796765", "text": "func GetMetric(mfs []*dto.MetricFamily, name string, idx int) *dto.Metric {\n\tfor _, mf := range mfs {\n\t\tif *mf.Name == name {\n\t\t\tif len(mf.Metric) < idx {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn mf.Metric[idx]\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0c2735a07a5442368f6e84f3742056b1", "score": "0.57965696", "text": "func AddMetrics() map[string]PrometheusMetric {\n\n\tAPIMetrics := make(map[string]PrometheusMetric)\n\n\t// Space\n\tAPIMetrics[\"Space\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"space\", \"usage\"),\n\t\t\t\"Total number of contentful spaces created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"space\", \"limit\"),\n\t\t\t\"Limit for the number of spaces\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Space membership\n\tAPIMetrics[\"Space membership\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"spaceMembership\", \"usage\"),\n\t\t\t\"Total number of contentful space memberships created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"spaceMembership\", \"limit\"),\n\t\t\t\"Limit for the number of space members\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Entries\n\tAPIMetrics[\"Entry\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"entry\", \"usage\"),\n\t\t\t\"Total number of contentful entries created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"entry\", \"limit\"),\n\t\t\t\"Limit for the number of entries\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Assets\n\tAPIMetrics[\"Asset\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"asset\", \"usage\"),\n\t\t\t\"Total number of contentful assets created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"asset\", \"limit\"),\n\t\t\t\"Limit for the number of assets\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Records\n\tAPIMetrics[\"Record\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"record\", \"usage\"),\n\t\t\t\"Total number of contentful records created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"record\", \"limit\"),\n\t\t\t\"Limit for the number of records\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\t// Roles\n\tAPIMetrics[\"Role\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"role\", \"usage\"),\n\t\t\t\"Total number of contentful roles created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"role\", \"limit\"),\n\t\t\t\"Limit for the number of roles\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Locales\n\tAPIMetrics[\"Locale\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"locale\", \"usage\"),\n\t\t\t\"Total number of contentful locales created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"locale\", \"limit\"),\n\t\t\t\"Limit for the number of locales\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Content types\n\tAPIMetrics[\"Content type\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"contentType\", \"usage\"),\n\t\t\t\"Total number of contentful content types created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"contentType\", \"limit\"),\n\t\t\t\"Limit for the number of content types\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\t// API Key\n\tAPIMetrics[\"Api key\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"apiKey\", \"usage\"),\n\t\t\t\"Total number of contentful api keys created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"apiKey\", \"limit\"),\n\t\t\t\"Limit for the number of api keys\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// API Key\n\tAPIMetrics[\"Environment\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"environment\", \"usage\"),\n\t\t\t\"Total number of contentful environments created\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"environment\", \"limit\"),\n\t\t\t\"Limit for the number of environments\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Content delivery api request\n\tAPIMetrics[\"Content delivery api request\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"deliveryApiRequests\", \"usage\"),\n\t\t\t\"Total number of contentful content delivery API requests\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"deliveryApiRequests\", \"limit\"),\n\t\t\t\"Limit for the number of contentful content delivery API requests\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Asset bandwidth\n\tAPIMetrics[\"Asset bandwidth\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"assetBandwidth\", \"usage\"),\n\t\t\t\"Total asset bandwidth usage\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"assetBandwidth\", \"limit\"),\n\t\t\t\"Limit for the asset bandwidth\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Content management api request\n\tAPIMetrics[\"Content management api request\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"managementApiRequests\", \"usage\"),\n\t\t\t\"Total management api requests\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"managementApiRequests\", \"limit\"),\n\t\t\t\"Limit for management api requests\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// Content preview api request\n\tAPIMetrics[\"Content preview api request\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"previewApiRequests\", \"usage\"),\n\t\t\t\"Total preview api requests\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"previewApiRequests\", \"limit\"),\n\t\t\t\"Limit for preview api requests\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\t// GraphQL api request\n\tAPIMetrics[\"Graphql content delivery api request\"] = PrometheusMetric{\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"graphQlApiRequests\", \"usage\"),\n\t\t\t\"Total graphql api requests\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t\tprometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(\"contentful\", \"graphQlApiRequests\", \"limit\"),\n\t\t\t\"Limit for graphql api requests\",\n\t\t\t[]string{\"spaceId\", \"environment\"}, nil,\n\t\t),\n\t}\n\n\treturn APIMetrics\n}", "title": "" }, { "docid": "0a7c1d49804197aefce3ef531b5c927f", "score": "0.5776603", "text": "func (s *RestServer) getMsmsintmiscMetricsHandler(r *http.Request) (interface{}, error) {\n\tlog.Infof(\"Got GET request MsmsintmiscMetrics/%s\", mux.Vars(r)[\"Meta.Name\"])\n\treturn nil, nil\n}", "title": "" }, { "docid": "56bf0b652d6b4e65004de0bcb6713edd", "score": "0.57680947", "text": "func (pm *PowerMetrics) GetAll() []Metric {\n\tvalues := make([]Metric, (pm.power)*(pm.bufferLen)+1)\n\tvar index = 0\n\tif pm.CurrentValue != nil {\n\t\tvalues[0] = pm.CurrentValue\n\t\tindex = 1\n\t}\n\n\tarr := make([]Metric, pm.power)\n\tvar arrIdx = len(arr) - 1\n\tfor idx := 0; idx < pm.bufferLen; idx++ {\n\t\tr := pm.powerBuffer[idx]\n\t\tr.Do(func(val interface{}) {\n\t\t\tif val != nil {\n\t\t\t\tarr[arrIdx] = val.(Metric)\n\t\t\t\tarrIdx--\n\t\t\t}\n\t\t})\n\n\t\tfor i := arrIdx + 1; i < len(arr); i++ {\n\t\t\tvalues[index] = arr[i]\n\t\t\tindex++\n\t\t}\n\t\tarrIdx = len(arr) - 1\n\t}\n\treturn values[:index]\n}", "title": "" }, { "docid": "639b5e5203a51c2073e74dd49fbe52e9", "score": "0.5766986", "text": "func (r ArpPlugin) FetchMetrics() (map[string]float64, error) {\n file, err := os.Open(r.Target)\n if err != nil {\n return nil, err\n }\n defer file.Close()\n\n return r.Parse(file)\n}", "title": "" }, { "docid": "35ad806589e1bc4b001271fd461cd2de", "score": "0.5759015", "text": "func (r *reporter) GetMetric(name string, tags map[string]string) interface{} {\n\tkey := EncodeKey(name, tags)\n\treturn r.registry.Get(key)\n}", "title": "" }, { "docid": "b953f01081f54d930e7e629cdec1c249", "score": "0.57519263", "text": "func Metrics() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tif c.Request.URL.Path == metricsPath {\n\t\t\tc.Next()\n\t\t\treturn\n\t\t}\n\t\tstop := createTimer()\n\t\tendpoint := c.FullPath()\n\t\tc.Next()\n\n\t\tstatus := strconv.Itoa(c.Writer.Status())\n\t\tmethod := c.Request.Method\n\t\tlatency := stop()\n\t\trequestsTotal.WithLabelValues(endpoint, method, status).Inc()\n\t\trequestsLatency.WithLabelValues(endpoint, method, status).Observe(latency)\n\t}\n}", "title": "" }, { "docid": "7ce7fb5b07210c740f4bcf7c9e5915b3", "score": "0.5740126", "text": "func GetMetrics(contextName string) (*metrics.Clientset, error) {\n\n\t// Try to get it from the cache\n\texistingClientset := versionedClientsets[contextName]\n\tif existingClientset != nil {\n\t\treturn existingClientset, nil\n\t}\n\n\t// Check if the contextName exists in the list of possible contextNames\n\tif _, ok := contextNames[contextName]; !ok {\n\t\treturn nil, &NotFoundError{contextName}\n\t}\n\n\t// Update the configuration\n\terr := UseContext(contextName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Try to build an empty config, that should default to in cluster mode\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", contextConfigurationFileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set High QPS and Burst because we may query intensively when doing the report\n\tconfig.QPS = 1e6\n\tconfig.Burst = 1e6\n\n\t// Try to connect with the update config\n\tversioned, err := metrics.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Keep the client set\n\tversionedClientsets[contextName] = versioned\n\n\treturn versioned, nil\n}", "title": "" }, { "docid": "deddcb0cbef491f8bc76c77ee8e97f58", "score": "0.5737212", "text": "func (c *Config) getURLMetrics(ctx echo.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "86e9de390554fa4641f440a5673d6589", "score": "0.57314026", "text": "func (r *StandardCollectry) Get(name string) interface{} {\n\tr.mutex.RLock()\n\tdefer r.mutex.RUnlock()\n\treturn r.metrics[name]\n}", "title": "" }, { "docid": "255997e1878bc34433883ac6d14c136c", "score": "0.57302594", "text": "func (ic *influxdbCollector) CollectMetrics(mts []plugin.Metric) ([]plugin.Metric, error) {\n\tres := []plugin.Metric{}\n\tif len(mts) == 0 {\n\t\treturn nil, errors.New(\"No metrics requested\")\n\t}\n\tif ic.urlDiagnostic == nil || ic.urlStatistic == nil {\n\t\tic.init(mts[0].Config)\n\t}\n\n\tmetrics, err := ic.getMetrics()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// return only requested metrics\n\tts := time.Now()\n\tfor _, req := range mts {\n\t\tfor _, metric := range metrics {\n\t\t\tif reflect.DeepEqual(req.Namespace.Strings(), metric.Namespace.Strings()) {\n\t\t\t\t// merge any new tags\n\t\t\t\tfor k, v := range metric.Tags {\n\t\t\t\t\treq.Tags[k] = v\n\t\t\t\t}\n\t\t\t\treq.Data = metric.Data\n\t\t\t\treq.Timestamp = ts\n\t\t\t\tres = append(res, req)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "1cd33821febe1cc1b0f087c130452fd0", "score": "0.5725944", "text": "func CollectMetrics(ns string) ([]CollectMetric, error) {\n\tvar res []CollectMetric\n\tvar data RespCollect\n\n\t// remove \"collect.\" from NS\n\tns = strings.TrimPrefix(ns, \"collect.\")\n\n\turi := fmt.Sprintf(CollectURI, ns)\n\turl := fmt.Sprintf(\"%s%s\", RegistryAddr, uri)\n\tresp, err := requests.Get(url)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\tif resp.Status == 200 {\n\t\terr := json.Unmarshal(resp.Body, &data)\n\t\tif err != nil {\n\t\t\treturn res, err\n\t\t}\n\t\treturn data.Data, nil\n\t}\n\treturn res, fmt.Errorf(\"get collect %s failed: status:%d\", ns, resp.Status)\n}", "title": "" }, { "docid": "a9a4bbab3467cf81df2402404173487f", "score": "0.5724357", "text": "func (r *Reporter) getVmMetrics(ctx context.Context, slot rrd.Slot) error {\n\tlog.Debug().Msg(\"collecting networking metrics\")\n\tvmd := stubs.NewVMModuleStub(r.cl)\n\n\tctx, cancel := context.WithTimeout(ctx, 1*time.Minute)\n\tdefer cancel()\n\tmetrics, err := vmd.Metrics(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor vm, consumption := range metrics {\n\t\tnu := r.computeNU(consumption)\n\t\tlog.Debug().Str(\"vm\", vm).Uint64(\"computed\", uint64(nu)).Msgf(\"consumption: %+v\", consumption)\n\t\tif err := slot.Counter(vm, float64(nu)); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to store metrics for '%s'\", vm)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0b8251f13efddc6afc6f02fa10819a0f", "score": "0.5723185", "text": "func NewMetrics() Metrics {\n\n\treturn Metrics{\n\t\tTotalPushCount: prometheus.NewDesc(\n\t\t\tnamespace+\"total_push_count\",\n\t\t\t\"Number of push count\",\n\t\t\tnil, nil,\n\t\t),\n\t\tIosSuccess: prometheus.NewDesc(\n\t\t\tnamespace+\"ios_success\",\n\t\t\t\"Number of iOS success count\",\n\t\t\tnil, nil,\n\t\t),\n\t\tIosError: prometheus.NewDesc(\n\t\t\tnamespace+\"ios_error\",\n\t\t\t\"Number of iOS fail count\",\n\t\t\tnil, nil,\n\t\t),\n\t\tAndroidSuccess: prometheus.NewDesc(\n\t\t\tnamespace+\"android_success\",\n\t\t\t\"Number of android success count\",\n\t\t\tnil, nil,\n\t\t),\n\t\tAndroidError: prometheus.NewDesc(\n\t\t\tnamespace+\"android_fail\",\n\t\t\t\"Number of android fail count\",\n\t\t\tnil, nil,\n\t\t),\n\t\tQueueUsage: prometheus.NewDesc(\n\t\t\tnamespace+\"queue_usage\",\n\t\t\t\"Length of internal queue\",\n\t\t\tnil, nil,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4e1865f5629a818644e76dfe957bda2e", "score": "0.57213175", "text": "func (s *RestServer) getMsmsintprp2MetricsHandler(r *http.Request) (interface{}, error) {\n\tlog.Infof(\"Got GET request Msmsintprp2Metrics/%s\", mux.Vars(r)[\"Meta.Name\"])\n\treturn nil, nil\n}", "title": "" }, { "docid": "f86f499a4967b16a163ca2d4a3374a96", "score": "0.5718018", "text": "func (r IPVSCpustatPlugin) FetchMetrics() (map[string]float64, error) {\n file, err := os.Open(\"/proc/net/ip_vs_stats_percpu\")\n if err != nil {\n return nil, err\n }\n defer file.Close()\n\n return r.Parse(file)\n}", "title": "" }, { "docid": "a6e0068c539d4d5241843939bc9722a3", "score": "0.571376", "text": "func (a *API) SearchMetrics(searchCriteria *SearchQueryType, filterCriteria *SearchFilterType) (*[]Metric, error) {\n\tq := url.Values{}\n\n\tif searchCriteria != nil && *searchCriteria != \"\" {\n\t\tq.Set(\"search\", string(*searchCriteria))\n\t}\n\n\tif filterCriteria != nil && len(*filterCriteria) > 0 {\n\t\tfor filter, criteria := range *filterCriteria {\n\t\t\tfor _, val := range criteria {\n\t\t\t\tq.Add(filter, val)\n\t\t\t}\n\t\t}\n\t}\n\n\tif q.Encode() == \"\" {\n\t\treturn a.FetchMetrics()\n\t}\n\n\treqURL := url.URL{\n\t\tPath: config.MetricPrefix,\n\t\tRawQuery: q.Encode(),\n\t}\n\n\tresult, err := a.Get(reqURL.String())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[ERROR] API call error %+v\", err)\n\t}\n\n\tvar metrics []Metric\n\tif err := json.Unmarshal(result, &metrics); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &metrics, nil\n}", "title": "" } ]
93c594ab8e37acfceb6cb27925c80a00
Implements adds an interface to the object being built
[ { "docid": "40dbb1363f05b8276a9a5ed0c47264ab", "score": "0.7365499", "text": "func (b *ObjectTypeBuilder) Implements(name string) {\n\tb.implements = append(b.implements, name)\n}", "title": "" } ]
[ { "docid": "5ff09ee09adf11c26dc46585e88f454d", "score": "0.64438695", "text": "func (file *File) AddInterface(name string, description string) (*Interface, error) {\n\treturn nil, fmt.Errorf(\"Function not implemented\")\n}", "title": "" }, { "docid": "2e20add156784fa0ebb6ccfe00973238", "score": "0.641752", "text": "func (c *content) addInterface(pkg pkg, name string, i *ast.InterfaceType) {\n\tin := Interface{Methods: map[string]Func{}}\n\tif i.Methods != nil {\n\t\tfor _, m := range i.Methods.List {\n\t\t\tif len(m.Names) > 0 {\n\t\t\t\tn := m.Names[0].Name\n\t\t\t\tf := pkg.buildFunc(m.Type.(*ast.FuncType))\n\t\t\t\tin.Methods[n] = f\n\t\t\t} else {\n\t\t\t\tn := pkg.getText(m.Type.Pos(), m.Type.End())\n\t\t\t\tin.EmbeddedInterfaces = append(in.EmbeddedInterfaces, n)\n\t\t\t}\n\t\t}\n\t}\n\tc.Interfaces[name] = in\n}", "title": "" }, { "docid": "c7f9e7e46140ffdbae7aaaa0141cc0d1", "score": "0.6408671", "text": "func (this *assertion) Implements(expected interface{}) {\n\tthis.t.Helper()\n\tthis.so(this.actual, should.Implement, expected)\n}", "title": "" }, { "docid": "27eff2c414b05ae1cf7ffc81980859c0", "score": "0.6174753", "text": "func (s *System) AddByInterface(i ecs.Identifier) {\n\to, _ := i.(Able)\n\ts.Add(o.GetBasicEntity(), o.GetSpaceComponent(), o.GetControlComponent())\n}", "title": "" }, { "docid": "cc154dfee7e1ce64990c4dd3fb76876a", "score": "0.61503184", "text": "func Implements(o, i interface{}) bool {\n\tot := reflect.ValueOf(o).Type()\n\tbs := reflect.TypeOf(i).Elem()\n\treturn ot.Implements(bs)\n}", "title": "" }, { "docid": "b87765800a607c4d30b0ecde682a6c44", "score": "0.61294276", "text": "func (assert *FluentAssertion) Implements(interfaceObject interface{}, msgAndArgs ...interface{}) *FluentAssertion {\n\tinterfaceType := reflect.TypeOf(interfaceObject).Elem()\n\n\tif assert.actual == nil {\n\t\tFail(assert, fmt.Sprintf(\"Cannot check if nil implements %v\", interfaceType), msgAndArgs...)\n\t\treturn assert\n\t}\n\tif !reflect.TypeOf(assert.actual).Implements(interfaceType) {\n\t\tFail(assert, fmt.Sprintf(\"%T must implement %v\", assert.actual, interfaceType), msgAndArgs...)\n\t\treturn assert\n\t}\n\treturn assert\n}", "title": "" }, { "docid": "69acddae939989c93dcf299e7b01cadf", "score": "0.6044479", "text": "func (v *View) Implements(usePlugin bool) bool {\n\tif usePlugin && !PreActionCall(\"Implements\", v) {\n\t\treturn false\n\t}\n\n\tif v.Buf.FileType() == \"go\" {\n\t\timplements := getImplements(v)\n\t\tautocomplete.OpenNoPrompt(func(v *View) (messages Messages) {\n\t\t\tmessages = Messages{}\n\t\t\tfor _, from := range implements.AssignableFrom {\n\t\t\t\tmessages = append(messages, Message{MessageToDisplay: fmt.Sprintf(\"%s %s\", from.Name, from.Kind), Value2: []byte(from.Pos)})\n\t\t\t}\n\t\t\treturn messages\n\t\t}, func(message Message) {\n\t\t\tv.Buf.Save()\n\t\t\tv.Open(strings.Split(string(message.Value2), \":\")[0])\n\t\t\tx, _ := strconv.Atoi(strings.Split(string(message.Value2), \":\")[2])\n\t\t\ty, _ := strconv.Atoi(strings.Split(string(message.Value2), \":\")[1])\n\t\t\tv.Buf.Cursor.X = x - 1\n\t\t\tv.Buf.Cursor.Y = y - 1\n\t\t\tv.Relocate()\n\t\t\tcursorLocations.AddLocation(CursorLocation{X: v.Buf.Cursor.X, Y: v.Buf.Cursor.Y, Path: v.Buf.Path})\n\t\t}, nil, v)\n\t}\n\tif usePlugin {\n\t\treturn PostActionCall(\"Implements\", v)\n\t}\n\treturn true\n}", "title": "" }, { "docid": "f8e688f1c1d51b37b10c00988a98fdab", "score": "0.6025949", "text": "func (r *Implements) AddImplements(impl *Implements) *Implements {\n\tfor k, v := range impl.implements {\n\t\tif _, exists := r.implements[k]; exists == false {\n\t\t\tr.implements[k] = v\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "9cdbb8eeb9af80748afb4607aa75c643", "score": "0.6020981", "text": "func (c *Client) Implements(ctx context.Context, pos string, opt *ClientOptions) {\n\tloc := &serialpb.Location{Pos: pos}\n\tif opt != nil {\n\t\tloc.Options = &serialpb.Options{\n\t\t\tScope: opt.Scope,\n\t\t}\n\t}\n\timpl, err := c.grpcc.GetImplements(ctx, loc)\n\tif err != nil {\n\t\tlog.Fatalf(\"could not get Implements: %v\", err)\n\t}\n\tlog.Debugf(\"impl: %T => %+v\\n\", impl, impl)\n}", "title": "" }, { "docid": "928f70877a1f0b853a9d1c27c982665d", "score": "0.59866035", "text": "func (self *PluginManager) AddI(args ...interface{}) *Plugin{\n return &Plugin{self.Object.Call(\"add\", args)}\n}", "title": "" }, { "docid": "86974f51890362934f4626d1010462ca", "score": "0.5984603", "text": "func (s *BaseDart2Listener) EnterInterfaces(ctx *InterfacesContext) {}", "title": "" }, { "docid": "0d0cb4cf493f7692ee268aceb82b449a", "score": "0.59739214", "text": "func (this *RangerAppClassDesc) Set_implements_interfaces( value []string) {\n this.implements_interfaces = value \n}", "title": "" }, { "docid": "355bfd66e1687452df8e118b32b1364c", "score": "0.5904438", "text": "func NewImplements() *Implements {\n\tret := Implements{make(map[string]AbstractModule), nil}\n\treturn &ret\n}", "title": "" }, { "docid": "fff4a119bb1208b652f200bdbab55e13", "score": "0.5880394", "text": "func (r *Implements) AddImplement(name string, impl AbstractModule) *Implements {\n\tr.implements[name] = impl\n\treturn r\n}", "title": "" }, { "docid": "a78cb70b249953f73f4f4bb38a4ed452", "score": "0.5845064", "text": "func (suite *SlugTestSuite) TestImplements() {\n\tslug := new(Slug)\n\tassert.Implements(suite.T(), (*web_responders.LazyLoader)(nil), slug)\n\tassert.Implements(suite.T(), (*web_responders.ResponseValueCreator)(nil), slug)\n\tassert.Implements(suite.T(), (*auth.Authorizer)(nil), slug)\n\tassert.Implements(suite.T(), (*web_responders.RelatedLinker)(nil), slug)\n\tassert.Implements(suite.T(), (*web_responders.Locationer)(nil), slug)\n\t//\tassert.Implements(suite.T(), (*datastore.SelfConverter)(nil), slug)\n}", "title": "" }, { "docid": "197649dcf0cfa8e2f7fa4862c90ade15", "score": "0.57987946", "text": "func (o OnValue) Implements(iface reflect.Type) bool {\n\tt := reflect.TypeOf(o.value)\n\treturn o.Compare(t, \"implements\", iface).Test(t.Implements(iface))\n}", "title": "" }, { "docid": "a34949bdc33dc104caa6242f7f24da7c", "score": "0.57494366", "text": "func (p *lowerInterfacesPass) defineInterfaceImplementsFunc(fn llvm.Value, itf *interfaceInfo) {\n\t// Create the function and function signature.\n\tfn.Param(0).SetName(\"actualType\")\n\tfn.SetLinkage(llvm.InternalLinkage)\n\tfn.SetUnnamedAddr(true)\n\tAddStandardAttributes(fn, p.config)\n\n\t// Start the if/else chain at the entry block.\n\tentry := p.ctx.AddBasicBlock(fn, \"entry\")\n\tthenBlock := p.ctx.AddBasicBlock(fn, \"then\")\n\tp.builder.SetInsertPointAtEnd(entry)\n\n\tif p.dibuilder != nil {\n\t\tdifile := p.getDIFile(\"<Go interface assert>\")\n\t\tdiFuncType := p.dibuilder.CreateSubroutineType(llvm.DISubroutineType{\n\t\t\tFile: difile,\n\t\t})\n\t\tdifunc := p.dibuilder.CreateFunction(difile, llvm.DIFunction{\n\t\t\tName: \"(Go interface assert)\",\n\t\t\tFile: difile,\n\t\t\tLine: 0,\n\t\t\tType: diFuncType,\n\t\t\tLocalToUnit: true,\n\t\t\tIsDefinition: true,\n\t\t\tScopeLine: 0,\n\t\t\tFlags: llvm.FlagPrototyped,\n\t\t\tOptimized: true,\n\t\t})\n\t\tfn.SetSubprogram(difunc)\n\t\tp.builder.SetCurrentDebugLocation(0, 0, difunc, llvm.Metadata{})\n\t}\n\n\t// Iterate over all possible types. Each iteration creates a new branch\n\t// either to the 'then' block (success) or the .next block, for the next\n\t// check.\n\tactualType := fn.Param(0)\n\tfor _, typ := range itf.types {\n\t\tnextBlock := p.ctx.AddBasicBlock(fn, typ.name+\".next\")\n\t\tcmp := p.builder.CreateICmp(llvm.IntEQ, actualType, llvm.ConstPtrToInt(typ.typecode, p.uintptrType), typ.name+\".icmp\")\n\t\tp.builder.CreateCondBr(cmp, thenBlock, nextBlock)\n\t\tp.builder.SetInsertPointAtEnd(nextBlock)\n\t}\n\n\t// The builder is now inserting at the last *.next block. Once we reach\n\t// this point, all types have been checked so the type assert will have\n\t// failed.\n\tp.builder.CreateRet(llvm.ConstInt(p.ctx.Int1Type(), 0, false))\n\n\t// Fill 'then' block (type assert was successful).\n\tp.builder.SetInsertPointAtEnd(thenBlock)\n\tp.builder.CreateRet(llvm.ConstInt(p.ctx.Int1Type(), 1, false))\n}", "title": "" }, { "docid": "843096367208a622a4425bba241e7d7f", "score": "0.568366", "text": "func (self *StateManager) AddI(args ...interface{}) {\n self.Object.Call(\"add\", args)\n}", "title": "" }, { "docid": "0351c435cdb59a58645628a8526fadea", "score": "0.56706834", "text": "func Example_implementing() {}", "title": "" }, { "docid": "a0a8d08849a4718fff41d4d6e81a8b6b", "score": "0.5629561", "text": "func (this *RangerAppClassDesc) Get_implements_interfaces() []string {\n return this.implements_interfaces\n}", "title": "" }, { "docid": "1248135493e5ce62a772920b411c5d9f", "score": "0.5529886", "text": "func (ifs Interfaces) Add(ifName string) {\n\tifs[ifName] = struct{}{}\n}", "title": "" }, { "docid": "d648deaa774215829edc55a9b23169d5", "score": "0.54770464", "text": "func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) {}", "title": "" }, { "docid": "7f0ac8863c3f4a2d50d3e390eb10109b", "score": "0.5424599", "text": "func (p *lowerInterfacesPass) addInterface(methodsString string) {\n\tif _, ok := p.interfaces[methodsString]; ok {\n\t\treturn\n\t}\n\tt := &interfaceInfo{\n\t\tname: methodsString,\n\t\tsignatures: make(map[string]*signatureInfo),\n\t}\n\tp.interfaces[methodsString] = t\n\tfor _, method := range strings.Split(methodsString, \"; \") {\n\t\tsignature := p.getSignature(method)\n\t\tsignature.interfaces = append(signature.interfaces, t)\n\t\tt.signatures[method] = signature\n\t}\n}", "title": "" }, { "docid": "423a584a67d07043b08fea9036653871", "score": "0.541621", "text": "func TestInterface(t *testing.T) {\n\tt.Parallel()\n\tassert.Implements(t, (*resource.Task)(nil), new(owner.Owner))\n}", "title": "" }, { "docid": "4a0024a151c82ea1bb74a744e976e27c", "score": "0.5382652", "text": "func Implements(expectedValue interface{}) *implementsMatcher {\n\tm := new(implementsMatcher)\n\tm.expectedValue = expectedValue\n\treturn m\n}", "title": "" }, { "docid": "54c575fe2ba40eec0acca9ed060e873b", "score": "0.5378292", "text": "func (self *Utils) ExtendI(args ...interface{}) interface{}{\n return self.Object.Call(\"extend\", args)\n}", "title": "" }, { "docid": "b05147d6d63d4ff7439fdd275ad1041b", "score": "0.53727245", "text": "func TestInterfaceIsImplemented(t *testing.T) {\n\tvar client KinesisClient\n\tauth := &Auth{\n\t\tAccessKey: \"BAD_ACCESS_KEY\",\n\t\tSecretKey: \"BAD_SECRET_KEY\",\n\t}\n\n\tclient = New(auth, USEast1)\n\tif client == nil {\n\t\tt.Error(\"Client is nil\")\n\t}\n}", "title": "" }, { "docid": "07e19c91219b86244ecd34316c4b7259", "score": "0.5337687", "text": "func implements() { //nolint:deadcode,unused\n\tvar t pipe\n\n\t// The pipe type is a cell.\n\t_ = cell.I(&t)\n\n\t// The pipe type is a conduit.\n\t_ = conduit.I(&t)\n}", "title": "" }, { "docid": "377f953d6e6c0eb2135d4e2a48317e14", "score": "0.533311", "text": "func InterfacesModule(c *dig.Container) {\n\t// DAO\n\tc.Provide(dao.NewUserDao)\n\tc.Provide(dao.NewTodoDao)\n\n\t// Repository\n\tc.Provide(repository.NewUserDaoRepository)\n\tc.Provide(repository.NewTodoDaoRepository)\n\n\t// Controller\n\tc.Provide(controller.NewUsersController)\n\tc.Provide(controller.NewTodosController)\n}", "title": "" }, { "docid": "399f7e044849c100d94d56676ed934cf", "score": "0.52974045", "text": "func myInterface() {\n\tvar a abser\n\tf := myFloat2(-math.Sqrt2)\n\tv := vertex2{3, 4}\n\n\ta = f // a MyFloat implements abser\n\ta = &v // a *Vertex implements abser\n\n\t// In the following line, v is a vertex (not *vertex)\n\t// and does NOT implement abser.\n\t//a = v\n\n\tfmt.Println(a.abs())\n}", "title": "" }, { "docid": "5e8b3dccc66d8fc63b6245a3d9338391", "score": "0.52869815", "text": "func (r *Implements) HasImplement(name string) bool {\n\t_, exists := r.implements[name]\n\treturn exists\n}", "title": "" }, { "docid": "6e1a13f14aee006885d8860d6b4714f8", "score": "0.5257622", "text": "func (self *Physics) EnableI(args ...interface{}) {\n self.Object.Call(\"enable\", args)\n}", "title": "" }, { "docid": "2096ddaf9b32477f9e560cee0703ac8d", "score": "0.5228091", "text": "func interfaceEncode(enc *gob.Encoder, p Pythagoras) {\n\t// The encode will fail unless the concrete type has been\n\t// registered. We registered it in the calling function.\n\n\t// Pass pointer to interface so Encode sees (and hence sends) a value of\n\t// interface type. If we passed p directly it would see the concrete type instead.\n\t// See the blog post, \"The Laws of Reflection\" for background.\n\terr := enc.Encode(&p)\n\tif err != nil {\n\t\tlog.Fatal(\"encode:\", err)\n\t}\n}", "title": "" }, { "docid": "2af31e4ac19b3a306fd2f366f669b0d0", "score": "0.5171731", "text": "func Implements(x, y reflect.Type) bool {\n\tif _, ok := x.(runtime.ScriggoType); ok {\n\t\treturn y.NumMethod() == 0\n\t}\n\tif _, ok := y.(runtime.ScriggoType); ok {\n\t\treturn true\n\t}\n\t// If y has unexported methods, and x is not an interface type, it is not possible to check\n\t// if x implements y using the x.NumMethod and x.Method methods, because they do not return\n\t// the unexported methods of x. Therefore, the x.Implements method is used instead.\n\treturn x.Implements(y)\n}", "title": "" }, { "docid": "a21ad48957a753ab6c0bd6ff835cd35f", "score": "0.5142148", "text": "func (self *ImageCollection) AddImageI(args ...interface{}) {\n self.Object.Call(\"addImage\", args)\n}", "title": "" }, { "docid": "1f5fb02193456e1a9b90fa6f9520b9ac", "score": "0.5128347", "text": "func (self *Utils) MixinI(args ...interface{}) interface{}{\n return self.Object.Call(\"mixin\", args)\n}", "title": "" }, { "docid": "fe79d9de008ed634be73a6f51c026c61", "score": "0.5115073", "text": "func (i InterfaceImplementer) WithInterface(iface *InterfaceImplementation) InterfaceImplementer {\n\tresult := i.copy()\n\tresult.interfaces[iface.Name()] = iface\n\n\treturn result\n}", "title": "" }, { "docid": "462f07e117fb53b9afa06a2568fd84ae", "score": "0.5112667", "text": "func interfaceEncode(enc *gob.Encoder, p tgdb.TGAttribute) tgdb.TGError {\n\t// The encode will fail unless the concrete type has been\n\t// registered. We registered it in the calling function.\n\n\t// Pass pointer to interface so Encode sees (and hence sends) a value of\n\t// interface type. If we passed p directly it would see the concrete type instead.\n\t// See the blog post, \"The Laws of Reflection\" for background.\n\terr := enc.Encode(&p)\n\tif err != nil {\n\t\tlog.Fatal(\"encode:\", err)\n\t\terrMsg := \"Unable to encode interface\"\n\t\treturn GetErrorByType(TGErrorIOException, \"TGErrorIOException\", errMsg, \"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9514a97694a63aced32b21af51a90074", "score": "0.5092376", "text": "func (r *RType) Implements(typ reflect.Type) bool {\n\tif r == nil {\n\t\treturn false\n\t}\n\tn := typ.NumMethod()\n\tfor i := 0; i < n; i++ {\n\t\tm0 := typ.Method(i)\n\t\tm1, ok := r.Methods[m0.Name]\n\t\tif !ok || len(m1.In) != m0.Type.NumIn() || len(m1.Out) != m0.Type.NumOut() {\n\t\t\treturn false\n\t\t}\n\t\tin := m0.Type.NumIn()\n\t\tfor j := 0; j < in; j++ {\n\t\t\tif !m1.In[j].TypeEqual(m0.Type.In(j)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tout := m0.Type.NumOut()\n\t\tfor j := 0; j < out; j++ {\n\t\t\tif !m1.Out[j].TypeEqual(m0.Type.Out(j)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5afadbca5afef501a7479ce71518469b", "score": "0.50866985", "text": "func (self *Utils) MixinPrototypeI(args ...interface{}) {\n self.Object.Call(\"mixinPrototype\", args)\n}", "title": "" }, { "docid": "1543bab5971fea3668652c2ef17ca67b", "score": "0.5068729", "text": "func (space *Space) Implement() {\n\timplemented := make(map[*Group]struct{})\n\n\tvar implementExpr func(expr *Expr)\n\timplementGroup := func(group *Group) {\n\t\t_, found := implemented[group]\n\t\tif found {\n\t\t\treturn\n\t\t}\n\t\timplemented[group] = struct{}{}\n\t\tfor _, expr := range group.Exprs {\n\t\t\timplementExpr(expr)\n\t\t}\n\t}\n\timplementExpr = func(expr *Expr) {\n\t\tfor _, input := range expr.Inputs {\n\t\t\timplementGroup(input)\n\t\t}\n\t\tfor _, rule := range space.def.ImplementationRules() {\n\t\t\tnewExprs := rule.Apply(expr)\n\t\t\tfor _, newExpr := range newExprs {\n\t\t\t\tspace.insertEquivalent(newExpr, expr)\n\t\t\t}\n\t\t}\n\t}\n\timplementGroup(space.root)\n}", "title": "" }, { "docid": "940e54d0e8593aa6cf41f4f446aaec1f", "score": "0.50527084", "text": "func (x *fastReflection_TestModuleA) Interface() protoreflect.ProtoMessage {\n\treturn (*TestModuleA)(x)\n}", "title": "" }, { "docid": "3b6d25509b937bcecebb0f1fadb43850", "score": "0.5050339", "text": "func (x *fastReflection_Entry) Interface() protoreflect.ProtoMessage {\n\treturn (*Entry)(x)\n}", "title": "" }, { "docid": "12f056f690257b99e1ba11f1d8d8e2dd", "score": "0.50482416", "text": "func (self *Loader) PackI(args ...interface{}) *Loader{\n return &Loader{self.Object.Call(\"pack\", args)}\n}", "title": "" }, { "docid": "f28e31d370ce6cc50a7fba060f70c4b4", "score": "0.50138956", "text": "func (a Module) RegisterInterfaces(registry types.InterfaceRegistry) {\n\tgroup.RegisterTypes(registry)\n}", "title": "" }, { "docid": "522cf461f66e3419356e6f0727f45844", "score": "0.49771652", "text": "func (cuo *CategoryUpdateOne) AddImplement(i ...*Implement) *CategoryUpdateOne {\n\tids := make([]int, len(i))\n\tfor j := range i {\n\t\tids[j] = i[j].ID\n\t}\n\treturn cuo.AddImplementIDs(ids...)\n}", "title": "" }, { "docid": "14c813d189058897e48b46f4d95ce886", "score": "0.49696067", "text": "func (dsl *PutDSL) Interface(val *interfaces.Interfaces_Interface) vppclient.PutDSL {\n\tdsl.parent.txn.Put(intf.InterfaceKey(val.Name), val)\n\treturn dsl\n}", "title": "" }, { "docid": "7c77a35158cb6baafcb84f56c7a337f5", "score": "0.49671122", "text": "func (cu *CategoryUpdate) AddImplement(i ...*Implement) *CategoryUpdate {\n\tids := make([]int, len(i))\n\tfor j := range i {\n\t\tids[j] = i[j].ID\n\t}\n\treturn cu.AddImplementIDs(ids...)\n}", "title": "" }, { "docid": "e650797b5b471970ba7d2d5a05cc98c9", "score": "0.4956862", "text": "func newInterfaceNode(name string, node *ProviderNode, iface interface{}) (_ *InterfaceNode, err error) {\n\tif iface == nil {\n\t\treturn nil, errors.Errorf(\"nil interface\") // todo: improve message\n\t}\n\n\ttyp := reflect.TypeOf(iface)\n\n\tif typ.Kind() != reflect.Ptr {\n\t\treturn nil, errors.Errorf(\"As() argument must be a pointer to interface, like new(http.Handler), got %s\", typ.Kind())\n\t}\n\n\ttyp = typ.Elem()\n\n\tif typ.Kind() != reflect.Interface {\n\t\treturn nil, errors.Errorf(\"As() argument must be a pointer to interface, like new(http.Handler), got %s\", typ.Kind()) // todo: improve message\n\t}\n\n\tif !node.ResultType().Implements(typ) {\n\t\treturn nil, errors.Errorf(\"%s interface not implemented\", typ.String())\n\t}\n\n\treturn &InterfaceNode{\n\t\tkey: Key{\n\t\t\tType: typ,\n\t\t\tName: name,\n\t\t},\n\t\tnode: node,\n\t}, nil\n}", "title": "" }, { "docid": "803a4f75d46eec32816d4cf8a4ee2497", "score": "0.4944144", "text": "func concreteImplementsIntf(a, b types.Type) bool {\n\taIsIntf, bIsIntf := IsInterface(a), IsInterface(b)\n\n\t// Make sure exactly one is an interface type.\n\tif aIsIntf == bIsIntf {\n\t\treturn false\n\t}\n\n\t// Rearrange if needed so \"a\" is the concrete type.\n\tif aIsIntf {\n\t\ta, b = b, a\n\t}\n\n\treturn types.AssignableTo(a, b)\n}", "title": "" }, { "docid": "9f25d1850e6c2a59a9c4cd4e679eb0e9", "score": "0.49435985", "text": "func (t *ObjectType) HasInterface(name string) bool {\n\tfor _, it := range t.interfaces {\n\t\tif it.name == name {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3b0128d21c32878ba2f6cada4173dc41", "score": "0.49294534", "text": "func (ctx *Context) PushInterface(v interface{}) error {\n\treturn ctx.pushValue(reflect.ValueOf(v))\n}", "title": "" }, { "docid": "96e5fa02838f68c88d22dcf3bb53e9ad", "score": "0.49192488", "text": "func (self *FrameData) AddFrameI(args ...interface{}) *Frame{\n return &Frame{self.Object.Call(\"addFrame\", args)}\n}", "title": "" }, { "docid": "a43419e632100b07400008cedfe44b2d", "score": "0.4905652", "text": "func InterfaceExample(pp PersonProvider) {\n\tpp.SayHello()\n}", "title": "" }, { "docid": "b0c3fbda68ef5622a9b91d1682776d24", "score": "0.49014282", "text": "func (e *ExampleInterfaceImpl) Do() {\n\tfmt.Println(\"Hello example\")\n}", "title": "" }, { "docid": "0ce47c9b368eec61604124a1919f75d9", "score": "0.48856714", "text": "func (c *Container) processProviderInterface(provider internalProvider, as interface{}) {\n\t// create interface from provider\n\tiface := newProviderInterface(provider, as)\n\tkey := iface.Key()\n\tif c.graph.Exists(key) {\n\t\tstub := newProviderStub(key, \"have several implementations\")\n\t\tc.graph.Replace(key, stub)\n\t} else {\n\t\t// add interface node\n\t\tc.graph.Add(key, iface)\n\t}\n\t// create group\n\tgroup := newProviderGroup(key)\n\tgroupKey := group.Key()\n\t// check exists\n\tif c.graph.Exists(groupKey) {\n\t\t// if exists use existing group\n\t\tnode := c.graph.Get(groupKey)\n\t\tgroup = node.Value.(*providerGroup)\n\t} else {\n\t\t// else add new group to graph\n\t\tc.graph.Add(groupKey, group)\n\t}\n\t// add provider reference into group\n\tproviderKey := provider.Key()\n\tgroup.Add(providerKey)\n}", "title": "" }, { "docid": "784a0e0c86906eeb7ab92a2fbb119b3a", "score": "0.48743287", "text": "func (self *DisplayObjectContainer) AddChildI(args ...interface{}) *DisplayObject{\n return &DisplayObject{self.Object.Call(\"addChild\", args)}\n}", "title": "" }, { "docid": "afd4c85bc64436f8e1de70d33a4f0206", "score": "0.48523673", "text": "func (self *Text) AddChildI(args ...interface{}) *DisplayObject{\n return &DisplayObject{self.Object.Call(\"addChild\", args)}\n}", "title": "" }, { "docid": "14c88ce8b44aa0cda4d253035bdd979a", "score": "0.4850452", "text": "func MakeInterfaceImplementer() InterfaceImplementer {\n\treturn InterfaceImplementer{}\n}", "title": "" }, { "docid": "99540574aa84a6016a70bf362b9a0db1", "score": "0.4843854", "text": "func implements() { //nolint:deadcode,unused\n\tvar t env\n\n\t// The env type is a cell.\n\t_ = cell.I(&t)\n\n\t// The env type is a scope.\n\t_ = scope.I(&t)\n}", "title": "" }, { "docid": "e24165ad8eb15e8feb9b73700a408511", "score": "0.48346287", "text": "func (a *Arith) AddImpl(args *Args, result *AdditionResult) error {\n\tlog.Println(\"Performing addition with args: \", *args)\n\tsum := args.A + args.B\n\tresult.Sum = sum\n\treturn nil\n}", "title": "" }, { "docid": "02f4f93d7d522dd0ac7a575c1ba65c4e", "score": "0.48331767", "text": "func (AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) {\n\tauthz.RegisterInterfaces(registry)\n}", "title": "" }, { "docid": "d271a44b08ac15ca246fabada16468de", "score": "0.48281837", "text": "func (x *fastReflection_SimpleExample) Interface() protoreflect.ProtoMessage {\n\treturn (*SimpleExample)(x)\n}", "title": "" }, { "docid": "38463ef2578a6fea63040fd2371f8828", "score": "0.48255807", "text": "func (t *Stp_Mstp_MstInstance) AppendInterface(v *Stp_Mstp_MstInstance_Interface) error {\n\tkey := *v.Name\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Interface == nil {\n\t\tt.Interface = make(map[string]*Stp_Mstp_MstInstance_Interface)\n\t}\n\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Interface %v\", key)\n\t}\n\n\tt.Interface[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "8c66fe70f60c427dd1a04e4ca8737873", "score": "0.48233452", "text": "func (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {\n\ttypes.RegisterInterfaces(registry)\n}", "title": "" }, { "docid": "3ee1cb68f86c0d089bd7418d67a3bc5a", "score": "0.4818343", "text": "func (x *fastReflection_Credits) Interface() protoreflect.ProtoMessage {\n\treturn (*Credits)(x)\n}", "title": "" }, { "docid": "148b4df51f776bce04510609dda7f47d", "score": "0.48159835", "text": "func (AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) {\n\tgroup.RegisterInterfaces(registry)\n}", "title": "" }, { "docid": "d25d34d579ff1b2460fe00396307c244", "score": "0.48129237", "text": "func (objectType *ObjectType) WithInterface(iface *InterfaceImplementation) *ObjectType {\n\t// Create a copy of objectType to preserve immutability\n\tresult := objectType.copy()\n\tresult.InterfaceImplementer = result.InterfaceImplementer.WithInterface(iface)\n\treturn result\n}", "title": "" }, { "docid": "c6282f4a60c42f061be0f0b262200a22", "score": "0.4805223", "text": "func (r *Implements) Clone() *Implements {\n\tret := NewImplements()\n\tret.AddImplements(r)\n\tfor _, nonamed := range r.anonymousModule {\n\t\tret.anonymousModule = append(ret.anonymousModule, nonamed)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "d93b95d79d88b4b6f384f169c015a0b1", "score": "0.47983018", "text": "func (t *Stp) AppendInterface(v *Stp_Interface) error {\n\tkey := *v.Name\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Interface == nil {\n\t\tt.Interface = make(map[string]*Stp_Interface)\n\t}\n\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Interface %v\", key)\n\t}\n\n\tt.Interface[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "f9248145b4e07740bc003d5fdbacfcb3", "score": "0.47931316", "text": "func (p *Group) ImplementedInterface() spi.InterfaceSpec {\n\treturn group.InterfaceSpec\n\n}", "title": "" }, { "docid": "f6be82d96b9dbf51dcf8d39298bd4717", "score": "0.47896612", "text": "func TestIfInterface(t *testing.T) {\n\tf := Foo{123}\n\tt.Logf(\"f: %+v\", f)\n\tassert.True(t, isIdentifiable(f))\n\tassert.Equal(t, 123, f.GetId())\n\n\tb := Bar{ 123 }\n\tt.Logf(\"b: %+v\", b)\n\tassert.False(t, isIdentifiable(b))\n}", "title": "" }, { "docid": "4b70abbf6b06db06dd4112843a5b0683", "score": "0.4786408", "text": "func (this *RangerFlowParser) Set_definedInterfaces( value map[string]bool) {\n this.definedInterfaces = value \n}", "title": "" }, { "docid": "ab2e35b54b68b1adc1e2e64807835c52", "score": "0.4784792", "text": "func Example_interface() {\n\tvar network bytes.Buffer // Stand-in for the network.\n\n\t// We must register the concrete type for the encoder and decoder (which would\n\t// normally be on a separate machine from the encoder). On each end, this tells the\n\t// engine which concrete type is being sent that implements the interface.\n\tgob.Register(Point{})\n\n\t// Create an encoder and send some values.\n\tenc := gob.NewEncoder(&network)\n\tfor i := 1; i <= 3; i++ {\n\t\tinterfaceEncode(enc, Point{3 * i, 4 * i})\n\t}\n\n\t// Create a decoder and receive some values.\n\tdec := gob.NewDecoder(&network)\n\tfor i := 1; i <= 3; i++ {\n\t\tresult := interfaceDecode(dec)\n\t\tfmt.Println(result.Hypotenuse())\n\t}\n\n\t// Output:\n\t// 5\n\t// 10\n\t// 15\n}", "title": "" }, { "docid": "e010afa133c9968d8e1d9af1776868bd", "score": "0.4777675", "text": "func wowinterfaceURL(name string) (AddonMeta, error) {\n\treturn AddonMeta{}, fmt.Errorf(\"wowinterface not implemented\")\n}", "title": "" }, { "docid": "334513823beaf5557df336ee6d8d9e16", "score": "0.4770324", "text": "func (self *PluginManager) Add(plugin interface{}, parameter interface{}) *Plugin{\n return &Plugin{self.Object.Call(\"add\", plugin, parameter)}\n}", "title": "" }, { "docid": "aee38b9f0cc599791e15837f088532d2", "score": "0.47702295", "text": "func (t *Lacp) AppendInterface(v *Lacp_Interface) error {\n\tkey := *v.Name\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Interface == nil {\n\t\tt.Interface = make(map[string]*Lacp_Interface)\n\t}\n\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Interface %v\", key)\n\t}\n\n\tt.Interface[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "97bf3e78d792ba00dd0f291d1bdfe19f", "score": "0.47593558", "text": "func (t *NetworkInstance_Protocol_Isis) AppendInterface(v *NetworkInstance_Protocol_Isis_Interface) error {\n\tkey := *v.InterfaceId\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Interface == nil {\n\t\tt.Interface = make(map[string]*NetworkInstance_Protocol_Isis_Interface)\n\t}\n\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Interface %v\", key)\n\t}\n\n\tt.Interface[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "7a09eeedd28730a7f415270bbae2c231", "score": "0.47589803", "text": "func (self *PluginManager) RenderI(args ...interface{}) {\n self.Object.Call(\"render\", args)\n}", "title": "" }, { "docid": "77d42e4f1241a1d818f4660ffc771217", "score": "0.47498965", "text": "func (r *Implements) AddBind(bindF func(binder *Binder)) *Implements {\n\tr.anonymousModule = append(r.anonymousModule, BindFunc(bindF))\n\treturn r\n}", "title": "" }, { "docid": "2974f7fadef89ec652876abc9fbd5837", "score": "0.47447544", "text": "func (this *RangerAppClassDesc) Set_is_interface( value bool) {\n this.is_interface = value \n}", "title": "" }, { "docid": "38df5c7d79a3f74b4c6d09ea62ce4de3", "score": "0.47424525", "text": "func (self *Scope) AddProtocolImpl(implementations ...Any) *Scope {\n\tself.Lock()\n\tdefer self.Unlock()\n\n\tfor _, imp := range implementations {\n\t\tswitch t := imp.(type) {\n\t\tcase BoolProtocol:\n\t\t\tself.bool.AddImpl(t)\n\t\tcase EqProtocol:\n\t\t\tself.eq.AddImpl(t)\n\t\tcase LtProtocol:\n\t\t\tself.lt.AddImpl(t)\n\t\tcase AddProtocol:\n\t\t\tself.add.AddImpl(t)\n\t\tcase SubProtocol:\n\t\t\tself.sub.AddImpl(t)\n\t\tcase MulProtocol:\n\t\t\tself.mul.AddImpl(t)\n\t\tcase DivProtocol:\n\t\t\tself.div.AddImpl(t)\n\t\tcase MembershipProtocol:\n\t\t\tself.membership.AddImpl(t)\n\t\tcase AssociativeProtocol:\n\t\t\tself.associative.AddImpl(t)\n\t\tcase RegexProtocol:\n\t\t\tself.regex.AddImpl(t)\n\t\tdefault:\n\t\t\tDebug(t)\n\t\t\tpanic(\"Unsupported interface\")\n\t\t}\n\t}\n\n\treturn self\n}", "title": "" }, { "docid": "8ed1ad9688e0d54e7a58a8e32c924c47", "score": "0.47418928", "text": "func (this *RangerAppClassDesc) Get_is_interface() bool {\n return this.is_interface\n}", "title": "" }, { "docid": "bb95378a30ded0721f0dca134149477e", "score": "0.4728692", "text": "func (this *RangerAppWriterContext) Set_definedInterfaces( value map[string]*RangerAppClassDesc) {\n this.definedInterfaces = value \n}", "title": "" }, { "docid": "f12561060698ecab01c9e0314b85dc33", "score": "0.47283477", "text": "func (x *fastReflection_Header) Interface() protoreflect.ProtoMessage {\n\treturn (*Header)(x)\n}", "title": "" }, { "docid": "7dba031483612ee6ac3ff38a6544bd34", "score": "0.4727492", "text": "func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) {\n\ttypes.RegisterInterfaces(registry)\n}", "title": "" }, { "docid": "0b579401fda297d295dea4fa5aa377f8", "score": "0.4725166", "text": "func (els *elements) addHTML(h HTML) {\n\tpanic(\"unimplemented\")\n}", "title": "" }, { "docid": "c24e40cd328b8599067040ac6825c750", "score": "0.4716784", "text": "func (t *Acl) AppendInterface(v *Acl_Interface) error {\n\tkey := *v.Id\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Interface == nil {\n\t\tt.Interface = make(map[string]*Acl_Interface)\n\t}\n\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Interface %v\", key)\n\t}\n\n\tt.Interface[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "7fcf2b3c9239f23d747bc1e2842fea43", "score": "0.47147608", "text": "func (p *Parser) parseImplementsInterfaces() []*NamedType {\n\ttypes := make([]*NamedType, 4)[:0]\n\tif p.token.Value == \"implements\" {\n\t\tp.advance()\n\t\ttypes = append(types, p.parseNamedType())\n\t\tfor !p.peek(TOKEN_BRACE_L) {\n\t\t\ttypes = append(types, p.parseNamedType())\n\t\t}\n\t}\n\treturn types\n}", "title": "" }, { "docid": "e95279d74501b59cfefb3631564ba6dc", "score": "0.47135693", "text": "func interfaceFunction(h human) {\n\tswitch h.(type) {\n\tcase secretAgent:\n\t\tfmt.Printf(\"I'm a human (secret agent), here are my credentials: %v\\n\", h)\n\t\tfmt.Printf(\"\\tand let me prove it: %v\\n\", h.(secretAgent).ltk)\n\tcase person:\n\t\tfmt.Printf(\"I'm a human (normal person), here are my credentials: %v\\n\", h)\n\t\tfmt.Printf(\"\\tand let me prove it: %v\\n\", h.(person).first)\n\t}\n}", "title": "" }, { "docid": "58ba64fa14d4fde45db5ce50e69d46f3", "score": "0.4699123", "text": "func (t *NetworkInstance_Protocol_Igmp) AppendInterface(v *NetworkInstance_Protocol_Igmp_Interface) error {\n\tkey := *v.InterfaceId\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Interface == nil {\n\t\tt.Interface = make(map[string]*NetworkInstance_Protocol_Igmp_Interface)\n\t}\n\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Interface %v\", key)\n\t}\n\n\tt.Interface[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "c78a8a12b989ea23cb9e09eabbbf05a2", "score": "0.46980837", "text": "func (t *Mpls) AppendInterface(v *Mpls_Interface) error {\n\tkey := *v.InterfaceId\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Interface == nil {\n\t\tt.Interface = make(map[string]*Mpls_Interface)\n\t}\n\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Interface %v\", key)\n\t}\n\n\tt.Interface[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "5e7802e3c5c31ac53a78904772fc42e4", "score": "0.46978167", "text": "func (x *fastReflection_MsgPut) Interface() protoreflect.ProtoMessage {\n\treturn (*MsgPut)(x)\n}", "title": "" }, { "docid": "6a3053cde65295216433ea8a4d8de804", "score": "0.4697732", "text": "func Interfaces() {\n\tvar writer io.Writer\n\n\t_ = (io.Writer)(writer) //@ unnecessary conversion\n\t_ = (*io.Writer)(&writer) //@ unnecessary conversion\n}", "title": "" }, { "docid": "df86d2ea4dc1090f0e224cb5b96a6f10", "score": "0.46952564", "text": "func (o *Object3D) Add(obj interface{}) *Object3D {\n\tif v, ok := obj.(JSObject); ok {\n\t\to.p.Call(\"add\", v.JSObject())\n\t} else {\n\t\to.p.Call(\"add\", obj)\n\t}\n\treturn o\n}", "title": "" }, { "docid": "04fd92cfc016254cd2a87787d32c2cf5", "score": "0.4693702", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area) AppendInterface(v *NetworkInstance_Protocol_Ospfv2_Area_Interface) error {\n\tkey := *v.Id\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Interface == nil {\n\t\tt.Interface = make(map[string]*NetworkInstance_Protocol_Ospfv2_Area_Interface)\n\t}\n\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Interface %v\", key)\n\t}\n\n\tt.Interface[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "fc5ee84741757b9eb7211276bea388c4", "score": "0.4686659", "text": "func test_interface(x interface{}) {}", "title": "" }, { "docid": "087eff5da9bff64e6166a77f5d30338a", "score": "0.46692052", "text": "func (s *Spec) add(o types.Object) {\n if ExportedOnly && !o.Exported() {\n return\n }\n\n switch o.(type) {\n\n case *types.Func:\n s.Funcs = append(s.Funcs, o.Name())\n\n case *types.Const:\n s.Consts = append(s.Consts, o.Name())\n\n case *types.Var:\n s.Vars = append(s.Vars, o.Name())\n\n case *types.TypeName:\n s.Types = append(s.Types, o.Name())\n\n default:\n return\n }\n s.Objects[o.Name()] = o\n\n s.sorted = false\n}", "title": "" }, { "docid": "a42dda86e876eb12f5a97a36572cea1a", "score": "0.46646124", "text": "func (t *Device) AppendInterface(v *Interface) error {\n\tkey := *v.Name\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Interface == nil {\n\t\tt.Interface = make(map[string]*Interface)\n\t}\n\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Interface %v\", key)\n\t}\n\n\tt.Interface[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "d07c60a3b613f86a500703e45136baf6", "score": "0.4657363", "text": "func (interactor AddObjectInteractorImpl) Add(objectName string, instance *interface{}) (*entity.Object, error) {\n\tinsertInstance := interactor.Factory.CreateWithDateTime(instance)\n\treturn interactor.Gateway.Insert(objectName, insertInstance)\n}", "title": "" } ]
11b44f091c614355f33ae0292564d203
CalcDelegationCompoundRewards is a free data retrieval call binding the contract method 0x9864183d. Solidity: function calcDelegationCompoundRewards(address delegator, uint256 toStakerID, uint256 _fromEpoch, uint256 maxEpochs) view returns(uint256, uint256, uint256)
[ { "docid": "27d650dc55bcfb0941b6b51b25dd0005", "score": "0.8807857", "text": "func (_SfcV2Contract *SfcV2ContractCallerSession) CalcDelegationCompoundRewards(delegator common.Address, toStakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV2Contract.Contract.CalcDelegationCompoundRewards(&_SfcV2Contract.CallOpts, delegator, toStakerID, _fromEpoch, maxEpochs)\n}", "title": "" } ]
[ { "docid": "5db5ca4c702cffac7e38e154541e2a9b", "score": "0.8829305", "text": "func (_SfcV2Contract *SfcV2ContractSession) CalcDelegationCompoundRewards(delegator common.Address, toStakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV2Contract.Contract.CalcDelegationCompoundRewards(&_SfcV2Contract.CallOpts, delegator, toStakerID, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "b405bd1296755973bc246aa0e6b999fb", "score": "0.87772834", "text": "func (_SfcV2Contract *SfcV2ContractCaller) CalcDelegationCompoundRewards(opts *bind.CallOpts, delegator common.Address, toStakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV2Contract.contract.Call(opts, &out, \"calcDelegationCompoundRewards\", delegator, toStakerID, _fromEpoch, maxEpochs)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), *new(*big.Int), *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\tout1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\tout2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\n\treturn out0, out1, out2, err\n\n}", "title": "" }, { "docid": "8c92a10a70270367ebb75f2e3478eef3", "score": "0.7798088", "text": "func (_SfcV2Contract *SfcV2ContractSession) ClaimDelegationCompoundRewards(maxEpochs *big.Int, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.ClaimDelegationCompoundRewards(&_SfcV2Contract.TransactOpts, maxEpochs, toStakerID)\n}", "title": "" }, { "docid": "89bdfbc0d4365ae3e911e3235ca4e706", "score": "0.77632475", "text": "func (_SfcV2Contract *SfcV2ContractTransactorSession) ClaimDelegationCompoundRewards(maxEpochs *big.Int, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.ClaimDelegationCompoundRewards(&_SfcV2Contract.TransactOpts, maxEpochs, toStakerID)\n}", "title": "" }, { "docid": "da31174b6f81d8bb64685e0028aa9112", "score": "0.77415615", "text": "func (_SfcV1Contract *SfcV1ContractCaller) CalcDelegationRewards(opts *bind.CallOpts, delegator common.Address, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV1Contract.contract.Call(opts, &out, \"calcDelegationRewards\", delegator, _fromEpoch, maxEpochs)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), *new(*big.Int), *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\tout1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\tout2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\n\treturn out0, out1, out2, err\n\n}", "title": "" }, { "docid": "8756d7e01640e4a917b5ecf84f9c3b27", "score": "0.77019066", "text": "func (_SfcV2Contract *SfcV2ContractCaller) CalcDelegationRewards(opts *bind.CallOpts, delegator common.Address, toStakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV2Contract.contract.Call(opts, &out, \"calcDelegationRewards\", delegator, toStakerID, _fromEpoch, maxEpochs)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), *new(*big.Int), *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\tout1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\tout2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\n\treturn out0, out1, out2, err\n\n}", "title": "" }, { "docid": "6b251743f6ee948180a8495a2be38aa8", "score": "0.7613761", "text": "func (_SfcV2Contract *SfcV2ContractTransactor) ClaimDelegationCompoundRewards(opts *bind.TransactOpts, maxEpochs *big.Int, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.contract.Transact(opts, \"claimDelegationCompoundRewards\", maxEpochs, toStakerID)\n}", "title": "" }, { "docid": "8a68557839851cab168942f7dd4b1f60", "score": "0.7584734", "text": "func (_SfcV2Contract *SfcV2ContractSession) CalcDelegationRewards(delegator common.Address, toStakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV2Contract.Contract.CalcDelegationRewards(&_SfcV2Contract.CallOpts, delegator, toStakerID, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "130ca090d9d82f62bea1e38200c3658e", "score": "0.7571983", "text": "func (_SfcV2Contract *SfcV2ContractCallerSession) CalcDelegationRewards(delegator common.Address, toStakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV2Contract.Contract.CalcDelegationRewards(&_SfcV2Contract.CallOpts, delegator, toStakerID, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "ba827db806ebd6d772b49bbb6f143080", "score": "0.75243044", "text": "func (_SfcV1Contract *SfcV1ContractSession) CalcDelegationRewards(delegator common.Address, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcDelegationRewards(&_SfcV1Contract.CallOpts, delegator, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "f3f7f27fd38d86e063d34ca2e6671813", "score": "0.7512804", "text": "func (_SfcV1Contract *SfcV1ContractCallerSession) CalcDelegationRewards(delegator common.Address, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcDelegationRewards(&_SfcV1Contract.CallOpts, delegator, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "01a9494004c7ba491e90d5fed0aedadd", "score": "0.7391764", "text": "func (_SfcV2Contract *SfcV2ContractCallerSession) CalcValidatorCompoundRewards(stakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV2Contract.Contract.CalcValidatorCompoundRewards(&_SfcV2Contract.CallOpts, stakerID, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "67930d485e9406c612d97953bab388b6", "score": "0.7340281", "text": "func (_SfcV2Contract *SfcV2ContractSession) CalcValidatorCompoundRewards(stakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV2Contract.Contract.CalcValidatorCompoundRewards(&_SfcV2Contract.CallOpts, stakerID, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "397c01f588dd5d7760740e69c3650352", "score": "0.73182255", "text": "func (_SfcV2Contract *SfcV2ContractCaller) CalcValidatorCompoundRewards(opts *bind.CallOpts, stakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV2Contract.contract.Call(opts, &out, \"calcValidatorCompoundRewards\", stakerID, _fromEpoch, maxEpochs)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), *new(*big.Int), *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\tout1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\tout2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\n\treturn out0, out1, out2, err\n\n}", "title": "" }, { "docid": "99fc9e463389ad41a4cf3acf71a440e5", "score": "0.6861737", "text": "func (ftm *FtmBridge) DelegationRewards(addr string, staker hexutil.Uint64) (types.PendingRewards, error) {\n\t// instantiate the contract and display its name\n\tcontract, err := contracts.NewSfcContract(ftm.sfcConfig.SFCContract, ftm.eth)\n\tif err != nil {\n\t\tftm.log.Criticalf(\"failed to instantiate SFC contract: %s\", err.Error())\n\t\treturn types.PendingRewards{}, err\n\t}\n\n\t// get the value from the contract\n\tepoch, err := contract.CurrentSealedEpoch(nil)\n\tif err != nil {\n\t\tftm.log.Errorf(\"failed to get the current sealed epoch: %s\", err.Error())\n\t\treturn types.PendingRewards{}, err\n\t}\n\n\t// do we have the sealed epoch?\n\tif epoch == nil {\n\t\tftm.log.Errorf(\"no epoch information available\")\n\t\treturn types.PendingRewards{}, nil\n\t}\n\n\t// get the rewards amount\n\tftm.log.Debugf(\"loading delegation rewards for %s → %d between epochs [0, %d]\", addr, uint64(staker), epoch.Uint64())\n\tamount, fromEpoch, toEpoch, err := contract.CalcDelegationRewards(ftm.DefaultCallOpts(), common.HexToAddress(addr), new(big.Int).SetUint64(uint64(staker)), big.NewInt(0), epoch)\n\tif err != nil {\n\t\tftm.log.Debugf(\"no rewards for %s → %d; %s\", addr, uint64(staker), err.Error())\n\t\treturn types.PendingRewards{\n\t\t\tStaker: staker,\n\t\t\tAmount: hexutil.Big{},\n\t\t\tFromEpoch: hexutil.Uint64(0),\n\t\t\tToEpoch: hexutil.Uint64(epoch.Uint64()),\n\t\t}, nil\n\t}\n\n\t// return the data\n\treturn types.PendingRewards{\n\t\tStaker: staker,\n\t\tAmount: hexutil.Big(*amount),\n\t\tFromEpoch: hexutil.Uint64(fromEpoch.Uint64()),\n\t\tToEpoch: hexutil.Uint64(toEpoch.Uint64()),\n\t}, nil\n}", "title": "" }, { "docid": "742dbf776b83e3980fb41fcb9929609b", "score": "0.67161095", "text": "func GetDelegationRewards(rootDir, node, chainID, delegatorAddr, validatorAddr string) string {\n\t//convert the delegator string address to sdk form\n\tDelAddr, err := sdk.AccAddressFromBech32(delegatorAddr)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t//convert the validator string address to sdk form\n\tValAddr, err := sdk.ValAddressFromBech32(validatorAddr)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t//to be fixed, the trust-node was set true to passby the verifier function, need improvement\n\tcliCtx := newCLIContext(rootDir, node, chainID).\n\t\tWithCodec(cdc).\n\t\tWithAccountDecoder(cdc).WithTrustNode(true)\n\tif err := cliCtx.EnsureAccountExistsFromAddr(DelAddr); err != nil {\n\t\treturn err.Error()\n\t}\n\n\t//query the delegation rewards\n\tresp, err := cliCtx.QueryWithData(\"custom/distr/delegation_rewards\", cdc.MustMarshalJSON(distr.NewQueryDelegationRewardsParams(DelAddr, ValAddr)))\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\tvar result sdk.DecCoins\n\tcdc.MustUnmarshalJSON(resp, &result)\n\n\tresbyte, err := cdc.MarshalJSON(result)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\treturn string(resbyte)\n}", "title": "" }, { "docid": "1b4e9f3345c2daae54cdf97188046d86", "score": "0.6703454", "text": "func (_SfcV1Contract *SfcV1ContractCaller) CalcDelegationEpochReward(opts *bind.CallOpts, stakerID *big.Int, epoch *big.Int, delegationAmount *big.Int, commission *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV1Contract.contract.Call(opts, &out, \"_calcDelegationEpochReward\", stakerID, epoch, delegationAmount, commission)\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": "5af5d01bb15323f76974ee9052577a2d", "score": "0.6658126", "text": "func (_SfcV2Contract *SfcV2ContractTransactorSession) ClaimValidatorCompoundRewards(maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.ClaimValidatorCompoundRewards(&_SfcV2Contract.TransactOpts, maxEpochs)\n}", "title": "" }, { "docid": "cb64f648c2fd705e72a075b02d63b685", "score": "0.6592529", "text": "func (_SfcV2Contract *SfcV2ContractSession) ClaimValidatorCompoundRewards(maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.ClaimValidatorCompoundRewards(&_SfcV2Contract.TransactOpts, maxEpochs)\n}", "title": "" }, { "docid": "3c5849357dd577a9e07b80b0ee51ed27", "score": "0.65901583", "text": "func GetDelegtorRewardsShares(rootDir, node, chainID, delegatorAddr string) string {\n\t//convert the delegator string address to sdk form\n\tDelAddr, err := sdk.AccAddressFromBech32(delegatorAddr)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t//to be fixed, the trust-node was set true to passby the verifier function, need improvement\n\tcliCtx := newCLIContext(rootDir, node, chainID).\n\t\tWithCodec(cdc).\n\t\tWithAccountDecoder(cdc).WithTrustNode(true)\n\tif err := cliCtx.EnsureAccountExistsFromAddr(DelAddr); err != nil {\n\t\treturn err.Error()\n\t}\n\n\t//get all the validators with delegation of the specific delegator\n\tValAddrs, err := cliCtx.QueryWithData(\"custom/distr/delegator_validators\", cdc.MustMarshalJSON(distr.NewQueryDelegatorParams(DelAddr)))\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\tvar validators []sdk.ValAddress\n\tif err := cdc.UnmarshalJSON(ValAddrs, &validators); err != nil {\n\t\treturn err.Error()\n\t}\n\n\tvar delrews []Delrewards\n\t//query the delegation rewards\n\tfor _, valAddr := range validators {\n\t\trewards, err := cliCtx.QueryWithData(\"custom/distr/delegation_rewards\", cdc.MustMarshalJSON(distr.NewQueryDelegationRewardsParams(DelAddr, valAddr)))\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\t\tvar rewardsresult sdk.DecCoins\n\t\tcdc.MustUnmarshalJSON(rewards, &rewardsresult)\n\n\t\t// make a query to get the existing delegation shares\n\t\tkey := staking.GetDelegationKey(DelAddr, valAddr)\n\t\tres, err := cliCtx.QueryStore(key, storeStake)\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\n\t\t// parse out the delegation\n\t\tdelegation, err := types.UnmarshalDelegation(cdc, res)\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\n\t\t//create the unbond message\n\t\tsharesAmount := delegation.Shares\n\n\t\tdelrew := Delrewards{\n\t\t\trewardsresult,\n\t\t\tsharesAmount,\n\t\t\tvalAddr,\n\t\t}\n\n\t\tdelrews = append(delrews, delrew)\n\n\t}\n\trespbyte, err := cdc.MarshalJSON(delrews)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\treturn string(respbyte)\n\n}", "title": "" }, { "docid": "01fe41d01e1049cb73de65d8f4238c9e", "score": "0.65261996", "text": "func (_SfcV2Contract *SfcV2ContractSession) ClaimDelegationRewards(maxEpochs *big.Int, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.ClaimDelegationRewards(&_SfcV2Contract.TransactOpts, maxEpochs, toStakerID)\n}", "title": "" }, { "docid": "9e012689e40e57a3fb02ef309bc28c4c", "score": "0.6525276", "text": "func (_SfcV2Contract *SfcV2ContractTransactor) ClaimValidatorCompoundRewards(opts *bind.TransactOpts, maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.contract.Transact(opts, \"claimValidatorCompoundRewards\", maxEpochs)\n}", "title": "" }, { "docid": "3a71b9c6f225fdb2379d8494957f57eb", "score": "0.65005094", "text": "func (_SfcV2Contract *SfcV2ContractTransactorSession) ClaimDelegationRewards(maxEpochs *big.Int, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.ClaimDelegationRewards(&_SfcV2Contract.TransactOpts, maxEpochs, toStakerID)\n}", "title": "" }, { "docid": "379de792c2511ed19ed90ce940488e4a", "score": "0.64902604", "text": "func (_SfcV1Contract *SfcV1ContractSession) ClaimDelegationRewards(maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV1Contract.Contract.ClaimDelegationRewards(&_SfcV1Contract.TransactOpts, maxEpochs)\n}", "title": "" }, { "docid": "b858772798ddcde61ab6714f95524b9c", "score": "0.64861983", "text": "func (_SfcV1Contract *SfcV1ContractTransactorSession) ClaimDelegationRewards(maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV1Contract.Contract.ClaimDelegationRewards(&_SfcV1Contract.TransactOpts, maxEpochs)\n}", "title": "" }, { "docid": "327bf9a82202b179a7f5313ca0e92634", "score": "0.64848846", "text": "func (_SfcV1Contract *SfcV1ContractTransactor) ClaimDelegationRewards(opts *bind.TransactOpts, maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV1Contract.contract.Transact(opts, \"claimDelegationRewards\", maxEpochs)\n}", "title": "" }, { "docid": "7fabbb0965a08dca0187e1a2689b28d0", "score": "0.6472324", "text": "func (_SfcV2Contract *SfcV2ContractTransactor) ClaimDelegationRewards(opts *bind.TransactOpts, maxEpochs *big.Int, toStakerID *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.contract.Transact(opts, \"claimDelegationRewards\", maxEpochs, toStakerID)\n}", "title": "" }, { "docid": "74887e3a25ea317d3cebf9e6890f745e", "score": "0.640695", "text": "func accumulateRewards(config *params.ChainConfig, state *state.StateDB, header *types.Header, db *trie.Database, genesis *types.Header) {\n\t// Select the correct block reward based on chain progression\n\tblockReward := frontierBlockReward\n\tif config.IsByzantium(header.Number) {\n\t\tblockReward = byzantiumBlockReward\n\t}\n\tif config.IsConstantinople(header.Number) {\n\t\tblockReward = constantinopleBlockReward\n\t}\n\t// retrieve the total vote weight of header's validator\n\tvoteCount := GetTotalVote(state, header.Validator)\n\tif voteCount.Cmp(common.BigInt0) <= 0 {\n\t\tstate.AddBalance(header.Coinbase, blockReward.BigIntPtr())\n\t\treturn\n\t}\n\t// get ratio of reward between validator and its delegator\n\trewardRatioNumerator := GetRewardRatioNumeratorLastEpoch(state, header.Validator)\n\tsharedReward := blockReward.MultUint64(rewardRatioNumerator).DivUint64(RewardRatioDenominator)\n\tassignedReward := common.BigInt0\n\n\t// Loop over the delegators to add delegator rewards\n\tpreEpochSnapshotDelegateTrieRoot := getPreEpochSnapshotDelegateTrieRoot(state, genesis)\n\tdelegateTrie, err := getPreEpochSnapshotDelegateTrie(db, preEpochSnapshotDelegateTrieRoot)\n\tif err != nil {\n\t\tlog.Error(\"couldn't get snapshot delegate trie, error:\", err)\n\t\treturn\n\t}\n\n\tdelegatorIterator := trie.NewIterator(delegateTrie.PrefixIterator(header.Validator.Bytes()))\n\tfor delegatorIterator.Next() {\n\t\tdelegator := common.BytesToAddress(delegatorIterator.Value)\n\t\t// get the votes of delegator to vote for delegate\n\t\tdelegatorVote := GetVoteLastEpoch(state, delegator)\n\t\t// calculate reward of each delegator due to it's vote(stake) percent\n\t\tdelegatorReward := delegatorVote.Mult(sharedReward).Div(voteCount)\n\t\tstate.AddBalance(delegator, delegatorReward.BigIntPtr())\n\t\tassignedReward = assignedReward.Add(delegatorReward)\n\t}\n\t// accumulate the rest rewards for the validator\n\tvalidatorReward := blockReward.Sub(assignedReward)\n\tstate.AddBalance(header.Coinbase, validatorReward.BigIntPtr())\n}", "title": "" }, { "docid": "c1ed9d953a9fe1a649a23533f3379de4", "score": "0.63096285", "text": "func (_SfcV1Contract *SfcV1ContractSession) CalcDelegationEpochReward(stakerID *big.Int, epoch *big.Int, delegationAmount *big.Int, commission *big.Int) (*big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcDelegationEpochReward(&_SfcV1Contract.CallOpts, stakerID, epoch, delegationAmount, commission)\n}", "title": "" }, { "docid": "2402b08784a49412bfe438d85c25a1c0", "score": "0.6303093", "text": "func (_SfcV1Contract *SfcV1ContractCallerSession) CalcDelegationEpochReward(stakerID *big.Int, epoch *big.Int, delegationAmount *big.Int, commission *big.Int) (*big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcDelegationEpochReward(&_SfcV1Contract.CallOpts, stakerID, epoch, delegationAmount, commission)\n}", "title": "" }, { "docid": "3049b0b8be20a352861a492b4bdb10f9", "score": "0.6120083", "text": "func (_SfcV1Contract *SfcV1ContractCaller) CalcValidatorRewards(opts *bind.CallOpts, stakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV1Contract.contract.Call(opts, &out, \"calcValidatorRewards\", stakerID, _fromEpoch, maxEpochs)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), *new(*big.Int), *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\tout1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\tout2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\n\treturn out0, out1, out2, err\n\n}", "title": "" }, { "docid": "64d5b4c0e0dedff70566788f6f61b14d", "score": "0.60730267", "text": "func (_SfcV2Contract *SfcV2ContractCaller) CalcValidatorRewards(opts *bind.CallOpts, stakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV2Contract.contract.Call(opts, &out, \"calcValidatorRewards\", stakerID, _fromEpoch, maxEpochs)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), *new(*big.Int), *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\tout1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\tout2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\n\treturn out0, out1, out2, err\n\n}", "title": "" }, { "docid": "209bcd4835644ddb039d62502631abcb", "score": "0.59860075", "text": "func (v VaultData) CalcNodeRewards(nodeUnits cosmos.Uint) cosmos.Uint {\n\treturn common.GetShare(nodeUnits, v.TotalBondUnits, v.BondRewardRune)\n}", "title": "" }, { "docid": "a46721da14359c2a9478326f8c112063", "score": "0.5916765", "text": "func (_SfcV1Contract *SfcV1ContractSession) CalcValidatorRewards(stakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcValidatorRewards(&_SfcV1Contract.CallOpts, stakerID, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "326035d8cf66855539aaa7fcb791ef20", "score": "0.5893131", "text": "func (_SfcV1Contract *SfcV1ContractCallerSession) CalcValidatorRewards(stakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcValidatorRewards(&_SfcV1Contract.CallOpts, stakerID, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "c309cd93014202e74daf9524bf0ded34", "score": "0.5876663", "text": "func (_SfcV2Contract *SfcV2ContractSession) CalcValidatorRewards(stakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV2Contract.Contract.CalcValidatorRewards(&_SfcV2Contract.CallOpts, stakerID, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "67e0a61b5a984feed0efb4ed20d84d7c", "score": "0.5869569", "text": "func (_SfcV2Contract *SfcV2ContractCallerSession) CalcValidatorRewards(stakerID *big.Int, _fromEpoch *big.Int, maxEpochs *big.Int) (*big.Int, *big.Int, *big.Int, error) {\n\treturn _SfcV2Contract.Contract.CalcValidatorRewards(&_SfcV2Contract.CallOpts, stakerID, _fromEpoch, maxEpochs)\n}", "title": "" }, { "docid": "b66c4de032f479bddd0628579ec7b580", "score": "0.58628803", "text": "func (s *Store) GetDelegatorClaimedRewards(addr common.Address) *big.Int {\n\tamount, err := s.table.DelegatorOldRewards.Get(addr.Bytes())\n\tif err != nil {\n\t\ts.Log.Crit(\"Failed to erase key-value\", \"err\", err)\n\t}\n\tif amount == nil {\n\t\treturn big.NewInt(0)\n\t}\n\treturn new(big.Int).SetBytes(amount)\n}", "title": "" }, { "docid": "ae5b362d6c3548e851d3ee5c63125986", "score": "0.5605682", "text": "func (s *Store) GetStakerDelegatorsClaimedRewards(stakerID idx.StakerID) *big.Int {\n\tamount, err := s.table.StakerDelegatorsOldRewards.Get(stakerID.Bytes())\n\tif err != nil {\n\t\ts.Log.Crit(\"Failed to erase key-value\", \"err\", err)\n\t}\n\tif amount == nil {\n\t\treturn big.NewInt(0)\n\t}\n\treturn new(big.Int).SetBytes(amount)\n}", "title": "" }, { "docid": "5dd638ddd7fc9362f67e12ad36e07e4a", "score": "0.55562055", "text": "func (_Dosstaking *DosstakingCaller) Delegators(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (struct {\n\tDelegatedNode common.Address\n\tDelegatedAmount *big.Int\n\tAccumulatedRewards *big.Int\n\tAccumulatedRewardIndex *big.Int\n\tPendingWithdraw *big.Int\n}, error) {\n\tret := new(struct {\n\t\tDelegatedNode common.Address\n\t\tDelegatedAmount *big.Int\n\t\tAccumulatedRewards *big.Int\n\t\tAccumulatedRewardIndex *big.Int\n\t\tPendingWithdraw *big.Int\n\t})\n\tout := ret\n\terr := _Dosstaking.contract.Call(opts, out, \"delegators\", arg0, arg1)\n\treturn *ret, err\n}", "title": "" }, { "docid": "e501779e1096ad1d523c37ece729b8d9", "score": "0.55171597", "text": "func (_Dosstaking *DosstakingCallerSession) Delegators(arg0 common.Address, arg1 common.Address) (struct {\n\tDelegatedNode common.Address\n\tDelegatedAmount *big.Int\n\tAccumulatedRewards *big.Int\n\tAccumulatedRewardIndex *big.Int\n\tPendingWithdraw *big.Int\n}, error) {\n\treturn _Dosstaking.Contract.Delegators(&_Dosstaking.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "88eb82b4d1b29d5cacf28b1955b01d02", "score": "0.5480503", "text": "func WithdrawDelegationReward(rootDir, node, chainID, delegatorName, password, delegatorAddr, validatorAddr, feeStr, broadcastMode string) string {\n\t//build procedure\n\t//get the Keybase\n\tviper.Set(cli.HomeFlag, rootDir)\n\tkb, err1 := keys.NewKeyBaseFromHomeFlag()\n\tif err1 != nil {\n\t\tfmt.Println(err1)\n\t}\n\n\t//delegatorName generated from keyspace locally\n\tif delegatorName == \"\" {\n\t\tfmt.Println(\"no delegatorName input!\")\n\t}\n\tinfo, err := kb.Get(delegatorName)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\t//checkout with rule of own deligation\n\tDelegatorAddr, err := sdk.AccAddressFromBech32(delegatorAddr)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\tif !bytes.Equal(info.GetPubKey().Address(), DelegatorAddr) {\n\t\treturn fmt.Sprintf(\"Must use own delegator address\")\n\t}\n\n\t////to be fixed, the trust-node was set true to passby the verifier function, need improvement\n\tcliCtx := newCLIContext(rootDir, node, chainID).\n\t\tWithCodec(cdc).\n\t\tWithAccountDecoder(cdc).WithTrustNode(true).WithBroadcastMode(broadcastMode)\n\tif err := cliCtx.EnsureAccountExistsFromAddr(DelegatorAddr); err != nil {\n\t\treturn err.Error()\n\t}\n\n\t//validator to address type []byte\n\tValidatorAddr, err := sdk.ValAddressFromBech32(validatorAddr)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t//generate messages betweeb delegator and validator\n\tmsgs := []sdk.Msg{distritypes.NewMsgWithdrawDelegatorReward(DelegatorAddr, ValidatorAddr)}\n\n\t//build-->sign-->broadcast\n\t//sign the stake message\n\t//init the txbldr\n\ttxBldr := authtxb.NewTxBuilderFromCLI().WithTxEncoder(utils.GetTxEncoder(cdc)).WithFees(feeStr).WithChainID(chainID)\n\n\t//accNum added to txBldr\n\taccNum, err := cliCtx.GetAccountNumber(DelegatorAddr)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\ttxBldr = txBldr.WithAccountNumber(accNum)\n\n\t//accSequence added\n\taccSeq, err := cliCtx.GetAccountSequence(DelegatorAddr)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\ttxBldr = txBldr.WithSequence(accSeq)\n\n\t// build and sign the transaction\n\ttxBytes, err := txBldr.BuildAndSign(delegatorName, password, msgs)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\t// broadcast to a Tendermint node\n\tresb, err := cliCtx.BroadcastTx(txBytes)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\tresbyte, err := cdc.MarshalJSON(resb)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\treturn string(resbyte)\n\n}", "title": "" }, { "docid": "1f4197bfdea6da84d3ae64cb2e5b8e42", "score": "0.5447527", "text": "func (_Dosstaking *DosstakingSession) Delegators(arg0 common.Address, arg1 common.Address) (struct {\n\tDelegatedNode common.Address\n\tDelegatedAmount *big.Int\n\tAccumulatedRewards *big.Int\n\tAccumulatedRewardIndex *big.Int\n\tPendingWithdraw *big.Int\n}, error) {\n\treturn _Dosstaking.Contract.Delegators(&_Dosstaking.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "28473f3f075301439e9e6df432d7dbb6", "score": "0.5395923", "text": "func (s *PublicStakingService) GetAvailableRedelegationBalance(\n\tctx context.Context, address string,\n) (*big.Int, error) {\n\tif !isBeaconShard(s.hmy) {\n\t\treturn nil, ErrNotBeaconShard\n\t}\n\n\tcurrEpoch := s.hmy.BlockChain.CurrentHeader().Epoch()\n\n\tdelegatorAddr := internal_common.ParseAddr(address)\n\t_, delegations := s.hmy.GetDelegationsByDelegator(delegatorAddr)\n\n\tredelegationTotal := big.NewInt(0)\n\tfor _, d := range delegations {\n\t\tfor _, u := range d.Undelegations {\n\t\t\tif u.Epoch.Cmp(currEpoch) < 1 { // Undelegation.Epoch < currentEpoch\n\t\t\t\tredelegationTotal.Add(redelegationTotal, u.Amount)\n\t\t\t}\n\t\t}\n\t}\n\treturn redelegationTotal, nil\n}", "title": "" }, { "docid": "6cb38d328da35871a37607f88deb7174", "score": "0.5369418", "text": "func (_Dosstaking *DosstakingCaller) GetDelegatorRewardTokensRT(opts *bind.CallOpts, _delegator common.Address, _nodeAddr common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Dosstaking.contract.Call(opts, out, \"getDelegatorRewardTokensRT\", _delegator, _nodeAddr)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f8028fb255cca2e9f9ffbadf45520626", "score": "0.5349605", "text": "func (_SfcV1Contract *SfcV1ContractCaller) CalcValidatorEpochReward(opts *bind.CallOpts, stakerID *big.Int, epoch *big.Int, commission *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV1Contract.contract.Call(opts, &out, \"_calcValidatorEpochReward\", stakerID, epoch, commission)\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": "01db4229671b1eee28606edb4a8fa8a0", "score": "0.5335852", "text": "func (l *LedgerAPI) Delegators(hash types.Address) ([]*APIAccountBalance, error) {\n\tabs := make([]*APIAccountBalance, 0)\n\n\terr := l.ledger.GetAccountMetas(func(am *types.AccountMeta) error {\n\t\tt := am.Token(config.ChainToken())\n\t\tif t != nil {\n\t\t\tif t.Representative == hash {\n\t\t\t\tab := &APIAccountBalance{am.Address, am.VoteWeight()}\n\t\t\t\tabs = append(abs, ab)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn abs, nil\n}", "title": "" }, { "docid": "b906637a719fd8c72bbf8725bdc74172", "score": "0.5326154", "text": "func (_SfcV2Contract *SfcV2ContractCaller) GetDelegationRewardRatio(opts *bind.CallOpts, delegator common.Address, toStakerID *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV2Contract.contract.Call(opts, &out, \"getDelegationRewardRatio\", delegator, toStakerID)\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": "ddba6d5a70e1708625e172a13886be42", "score": "0.5291066", "text": "func (_SfcV2Contract *SfcV2ContractTransactor) ClaimValidatorRewards(opts *bind.TransactOpts, maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.contract.Transact(opts, \"claimValidatorRewards\", maxEpochs)\n}", "title": "" }, { "docid": "7725bef57d9a537c506d3ff2f497eab3", "score": "0.5290398", "text": "func QueryRewards(f *cli.Fixtures, delAddr sdk.AccAddress, flags ...string) distribution.QueryDelegatorTotalRewardsResponse {\n\tcmd := fmt.Sprintf(\"%s query distribution rewards %s %s\", f.SimcliBinary, delAddr, f.Flags())\n\tres, errStr := tests.ExecuteT(f.T, cmd, \"\")\n\trequire.Empty(f.T, errStr)\n\n\tvar rewards distribution.QueryDelegatorTotalRewardsResponse\n\terr := f.Cdc.UnmarshalJSON([]byte(res), &rewards)\n\trequire.NoError(f.T, err)\n\treturn rewards\n}", "title": "" }, { "docid": "4f3ad0b5710eb73f752202ed63c8bd8e", "score": "0.5286065", "text": "func (_SfcV1Contract *SfcV1ContractTransactor) ClaimValidatorRewards(opts *bind.TransactOpts, maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV1Contract.contract.Transact(opts, \"claimValidatorRewards\", maxEpochs)\n}", "title": "" }, { "docid": "006a400ab233d242a52788223d2bd294", "score": "0.5260345", "text": "func (_SfcV1Contract *SfcV1ContractCaller) CalcRawValidatorEpochReward(opts *bind.CallOpts, stakerID *big.Int, epoch *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV1Contract.contract.Call(opts, &out, \"_calcRawValidatorEpochReward\", stakerID, epoch)\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": "dc4c57d23fa8fd90f404fe517f5bc39e", "score": "0.52546513", "text": "func (_SfcV2Contract *SfcV2ContractSession) GetDelegationRewardRatio(delegator common.Address, toStakerID *big.Int) (*big.Int, error) {\n\treturn _SfcV2Contract.Contract.GetDelegationRewardRatio(&_SfcV2Contract.CallOpts, delegator, toStakerID)\n}", "title": "" }, { "docid": "10f544208966e1a82e332bddcc59f7ee", "score": "0.5250611", "text": "func GetCmdQueryDelegatorRewards(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"rewards [delegator] [<validator>]\",\n\t\tArgs: cobra.RangeArgs(1, 2),\n\t\tShort: \"Query all kudistribution delegator rewards or rewards from a particular validator\",\n\t\tLong: strings.TrimSpace(\n\t\t\tfmt.Sprintf(`Query all rewards earned by a delegator, optionally restrict to rewards from a single validator.\n\nExample:\n$ %s query kudistribution rewards jack\n$ %s query kudistribution rewards jack validatorName\n`,\n\t\t\t\tversion.ClientName, version.ClientName,\n\t\t\t),\n\t\t),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\t// query for rewards from a particular delegation\n\t\t\tif len(args) == 2 {\n\t\t\t\tresp, _, err := common.QueryDelegationRewards(cliCtx, queryRoute, args[0], args[1])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tvar result chainTypes.DecCoins\n\t\t\t\tif err = cdc.UnmarshalJSON(resp, &result); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to unmarshal response: %w\", err)\n\t\t\t\t}\n\n\t\t\t\treturn cliCtx.PrintOutput(result)\n\t\t\t}\n\n\t\t\tdelegatorAddr, err := chainTypes.NewAccountIDFromStr(args[0])\n\n\t\t\t//delegatorAddr, err := sdk.AccAddressFromBech32(args[0])\n\t\t\tfmt.Println(delegatorAddr, err)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t//acc := chainTypes.NewAccountIDFromAccAdd(delegatorAddr)\n\t\t\tparams := types.NewQueryDelegatorParams(delegatorAddr)\n\t\t\tbz, err := cdc.MarshalJSON(params)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to marshal params: %w\", err)\n\t\t\t}\n\n\t\t\t// query for delegator total rewards\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s\", queryRoute, types.QueryDelegatorTotalRewards)\n\t\t\tres, _, err := cliCtx.QueryWithData(route, bz)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar result types.QueryDelegatorTotalRewardsResponse\n\t\t\tif err = cdc.UnmarshalJSON(res, &result); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to unmarshal response: %w\", err)\n\t\t\t}\n\n\t\t\treturn cliCtx.PrintOutput(result)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "19fcbe2857690f430d371bb9d2bb0087", "score": "0.5244501", "text": "func (s *Store) IncDelegatorClaimedRewards(addr common.Address, diff *big.Int) {\n\tamount := s.GetDelegatorClaimedRewards(addr)\n\tamount.Add(amount, diff)\n\ts.SetDelegatorClaimedRewards(addr, amount)\n}", "title": "" }, { "docid": "d02ea541f27c42f80f8fa82a4d9b5050", "score": "0.5220736", "text": "func (_SfcV2Contract *SfcV2ContractTransactorSession) ClaimValidatorRewards(maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.ClaimValidatorRewards(&_SfcV2Contract.TransactOpts, maxEpochs)\n}", "title": "" }, { "docid": "6d1a60a9bccd3cc0372e7738e94ed21c", "score": "0.52028215", "text": "func (_SfcV2Contract *SfcV2ContractSession) ClaimValidatorRewards(maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.ClaimValidatorRewards(&_SfcV2Contract.TransactOpts, maxEpochs)\n}", "title": "" }, { "docid": "3391a2504d969115a21b7dcb454436e6", "score": "0.51913965", "text": "func (_SfcV1Contract *SfcV1ContractTransactorSession) ClaimValidatorRewards(maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV1Contract.Contract.ClaimValidatorRewards(&_SfcV1Contract.TransactOpts, maxEpochs)\n}", "title": "" }, { "docid": "f7808457bf460cdf3c3f87b6da5f4ea3", "score": "0.51798236", "text": "func (_SfcV2Contract *SfcV2ContractCallerSession) GetDelegationRewardRatio(delegator common.Address, toStakerID *big.Int) (*big.Int, error) {\n\treturn _SfcV2Contract.Contract.GetDelegationRewardRatio(&_SfcV2Contract.CallOpts, delegator, toStakerID)\n}", "title": "" }, { "docid": "dd9f2a188621915db54017696156e6db", "score": "0.517283", "text": "func (_SfcV1Contract *SfcV1ContractSession) ClaimValidatorRewards(maxEpochs *big.Int) (*types.Transaction, error) {\n\treturn _SfcV1Contract.Contract.ClaimValidatorRewards(&_SfcV1Contract.TransactOpts, maxEpochs)\n}", "title": "" }, { "docid": "ccbdd01f10370d29bcfd2b2c3e60951b", "score": "0.5151848", "text": "func (_Dosstaking *DosstakingTransactor) DelegatorClaimReward(opts *bind.TransactOpts, _nodeAddr common.Address) (*types.Transaction, error) {\n\treturn _Dosstaking.contract.Transact(opts, \"delegatorClaimReward\", _nodeAddr)\n}", "title": "" }, { "docid": "f8c519a212aadf50add40537926ef51b", "score": "0.51313233", "text": "func TaxRewardsForEpoch(ctx sdk.Context, k Keeper, epoch sdk.Int) sdk.Dec {\n\ttaxRewards := sdk.NewDecCoins(k.PeekTaxProceeds(ctx, epoch))\n\n\ttaxRewardInMicroSDR := sdk.ZeroDec()\n\tfor _, coinReward := range taxRewards {\n\t\tif coinReward.Denom != assets.MicroSDRDenom {\n\t\t\tswappedReward, err := k.mk.GetSwapDecCoin(ctx, coinReward, assets.MicroSDRDenom)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttaxRewardInMicroSDR = taxRewardInMicroSDR.Add(swappedReward.Amount)\n\t\t} else {\n\t\t\ttaxRewardInMicroSDR = taxRewardInMicroSDR.Add(coinReward.Amount)\n\t\t}\n\t}\n\n\treturn taxRewardInMicroSDR\n}", "title": "" }, { "docid": "e5aa0fe3b9ea8c63b1bbcc3bb67b212c", "score": "0.51159203", "text": "func (v *Validator) Rewards(address string, cursor string, maxTime string, minTime string) (*Validators, error) {\n\tparams := make(map[string]string)\n\tif len(cursor) > 0 {\n\t\tparams[\"cursor\"] = cursor\n\t}\n\tparams[\"max_time\"] = maxTime\n\tparams[\"min_time\"] = minTime\n\n\tresp, err := v.c.Request(http.MethodGet, fmt.Sprintf(\"/validators/%s/rewards\", address), new(bytes.Buffer), params)\n\tif err != nil {\n\t\treturn &Validators{}, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar validators *Validators\n\terr = json.NewDecoder(resp.Body).Decode(&validators)\n\tif err != nil {\n\t\treturn &Validators{}, err\n\t}\n\treturn validators, nil\n}", "title": "" }, { "docid": "5fd51ae8f63a88520c5629846907f0f3", "score": "0.5102734", "text": "func (_Dosstaking *DosstakingSession) DelegatorClaimReward(_nodeAddr common.Address) (*types.Transaction, error) {\n\treturn _Dosstaking.Contract.DelegatorClaimReward(&_Dosstaking.TransactOpts, _nodeAddr)\n}", "title": "" }, { "docid": "8c863999d76099a8ad04681a86eaf2ab", "score": "0.5101796", "text": "func (_Dosstaking *DosstakingSession) GetDelegatorRewardTokensRT(_delegator common.Address, _nodeAddr common.Address) (*big.Int, error) {\n\treturn _Dosstaking.Contract.GetDelegatorRewardTokensRT(&_Dosstaking.CallOpts, _delegator, _nodeAddr)\n}", "title": "" }, { "docid": "abcefa6f6722f07bc8b428246cc881eb", "score": "0.50976706", "text": "func TestClaimAccessReward(t *testing.T) {\n\t// get the current accumulated byte access balance for the listings used\n\tlistingHash1 := test.GenBytes32(\"LookAtMyJunk\")\n\tlistingHash2 := test.GenBytes32(\"LookAtMyJunkToo\")\n\t// note the supply of those listings\n\t_, supply1, _ := deployed.ListingContract.GetListing(nil, listingHash1)\n\t_, supply2, _ := deployed.ListingContract.GetListing(nil, listingHash2)\n\t// note the current datatrust banked eth token amount, at this point it should only be the maker split(s) from the outstanding bytes accessed\n\tdataBal, _ := deployed.EtherTokenContract.BalanceOf(nil, deployed.DatatrustAddress)\n\t// claim the listing for 1\n\t_, clErr := deployed.ListingContract.ClaimAccessReward(test.GetTxOpts(context.AuthUser2, nil,\n\t\tbig.NewInt(test.ONE_GWEI*2), 250000), listingHash1)\n\ttest.IfNotNil(t, clErr, \"Error claiming access\")\n\tcontext.Blockchain.Commit()\n\n\t// Compute Listing Reward per listing\n\tcostPerByte, _ := deployed.ParameterizerContract.GetCostPerByte(nil)\n\tmakerPayment, _ := deployed.ParameterizerContract.GetMakerPayment(nil)\n\tamount := big.NewInt(1024 * 512)\n\t// (costPerByte * amount * makerPayment) / 100\n\taccessPayment := big.NewInt(1)\n\taccessPayment = accessPayment.Mul(accessPayment, costPerByte).Mul(accessPayment, amount).Mul(accessPayment, makerPayment).Div(accessPayment, big.NewInt(100))\n\n\t// supply should have increased\n\t_, supply1Now, _ := deployed.ListingContract.GetListing(nil, listingHash1)\n\tif supply1Now.Cmp(supply1) != 1 {\n\t\tt.Errorf(\"expected %v to be > %v\", supply1Now, supply1)\n\t}\n\t// Here is actual payment. Should match theoretical payment above\n\tsupply1ActualPayment := supply1Now.Sub(supply1Now, supply1)\n\tif supply1ActualPayment.Cmp(accessPayment) != 0 {\n\t\tt.Errorf(\"Expected %v to be %v\", supply1ActualPayment, accessPayment)\n\t}\n\n\t// access bal should be cleared\n\taccessBal1, _ := deployed.DatatrustContract.GetAccessRewardEarned(nil, listingHash1)\n\tif accessBal1.Cmp(big.NewInt(0)) != 0 {\n\t\tt.Errorf(\"Expected %v to be 0\", accessBal1)\n\t}\n\n\t// datatrust bank should be lower\n\tdataBalNow, _ := deployed.EtherTokenContract.BalanceOf(nil, deployed.DatatrustAddress)\n\tif dataBalNow.Cmp(dataBal) != -1 {\n\t\tt.Errorf(\"Expected %v to be < %v\", dataBalNow, dataBal)\n\t}\n\n\t// NOTE if cost_per_byte is too low there is a scenario here where the 2nd listing's\n\t// maker_fee is too low for support. Which is _not_ erroneous, but worth noting...\n\n\t// claim the other listing access\n\t_, clErr2 := deployed.ListingContract.ClaimAccessReward(test.GetTxOpts(context.AuthUser1, nil,\n\t\tbig.NewInt(test.ONE_GWEI*2), 250000), listingHash2)\n\ttest.IfNotNil(t, clErr2, \"Error claiming access\")\n\tcontext.Blockchain.Commit()\n\n\t// supply should have increased\n\t_, supply2Now, _ := deployed.ListingContract.GetListing(nil, listingHash2)\n\tif supply2Now.Cmp(supply2) != 1 {\n\t\tt.Errorf(\"Expected %v to be > %v\", supply2Now, supply2)\n\t}\n\t// Here is actual payment. Should match theoretical payment above\n\tsupply2ActualPayment := supply2Now.Sub(supply2Now, supply2)\n\tif supply2ActualPayment.Cmp(accessPayment) != 0 {\n\t\tt.Errorf(\"Expected %v to be %v\", supply2ActualPayment, accessPayment)\n\t}\n\n\t// access bal should be cleared\n\taccessBal2, _ := deployed.DatatrustContract.GetAccessRewardEarned(nil, listingHash2)\n\tif accessBal2.Cmp(big.NewInt(0)) != 0 {\n\t\tt.Errorf(\"Expected %v to be 0\", accessBal2)\n\t}\n\n\t// datatrust bank should be empty now. NOTE this will not always be the case #dusting TODO\n\tdataBalAgain, _ := deployed.EtherTokenContract.BalanceOf(nil, deployed.DatatrustAddress)\n\tif dataBalAgain.Cmp(big.NewInt(0)) != 0 {\n\t\tt.Errorf(\"Expected %v to be 0\", dataBalAgain)\n\t}\n}", "title": "" }, { "docid": "c55602cd048a49a1104c29ed9442e104", "score": "0.50970066", "text": "func (s *Store) IncStakerDelegatorsClaimedRewards(stakerID idx.StakerID, diff *big.Int) {\n\tamount := s.GetStakerDelegatorsClaimedRewards(stakerID)\n\tamount.Add(amount, diff)\n\ts.SetStakerDelegatorsClaimedRewards(stakerID, amount)\n}", "title": "" }, { "docid": "f04ca46fc02e543a766d036918fca255", "score": "0.5096501", "text": "func (_Dosstaking *DosstakingCallerSession) GetDelegatorRewardTokensRT(_delegator common.Address, _nodeAddr common.Address) (*big.Int, error) {\n\treturn _Dosstaking.Contract.GetDelegatorRewardTokensRT(&_Dosstaking.CallOpts, _delegator, _nodeAddr)\n}", "title": "" }, { "docid": "050f3da0e4dfb5ef1d3f367b1b7f0db0", "score": "0.50928086", "text": "func (_Dosstaking *DosstakingTransactorSession) DelegatorClaimReward(_nodeAddr common.Address) (*types.Transaction, error) {\n\treturn _Dosstaking.Contract.DelegatorClaimReward(&_Dosstaking.TransactOpts, _nodeAddr)\n}", "title": "" }, { "docid": "f835bdc7e505d7d1502518b633c0eab5", "score": "0.5068683", "text": "func (_SfcV2Contract *SfcV2ContractCaller) Delegations(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (struct {\n\tCreatedEpoch *big.Int\n\tCreatedTime *big.Int\n\tDeactivatedEpoch *big.Int\n\tDeactivatedTime *big.Int\n\tAmount *big.Int\n\tPaidUntilEpoch *big.Int\n\tToStakerID *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _SfcV2Contract.contract.Call(opts, &out, \"delegations\", arg0, arg1)\n\n\toutstruct := new(struct {\n\t\tCreatedEpoch *big.Int\n\t\tCreatedTime *big.Int\n\t\tDeactivatedEpoch *big.Int\n\t\tDeactivatedTime *big.Int\n\t\tAmount *big.Int\n\t\tPaidUntilEpoch *big.Int\n\t\tToStakerID *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.CreatedEpoch = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\toutstruct.CreatedTime = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\toutstruct.DeactivatedEpoch = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\toutstruct.DeactivatedTime = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\toutstruct.Amount = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int)\n\toutstruct.PaidUntilEpoch = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int)\n\toutstruct.ToStakerID = *abi.ConvertType(out[6], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "7fe9d2e8348984359554ccd4da9619db", "score": "0.5034131", "text": "func (_SfcV1Contract *SfcV1ContractCaller) Delegations(opts *bind.CallOpts, arg0 common.Address) (struct {\n\tCreatedEpoch *big.Int\n\tCreatedTime *big.Int\n\tDeactivatedEpoch *big.Int\n\tDeactivatedTime *big.Int\n\tAmount *big.Int\n\tPaidUntilEpoch *big.Int\n\tToStakerID *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _SfcV1Contract.contract.Call(opts, &out, \"delegations\", arg0)\n\n\toutstruct := new(struct {\n\t\tCreatedEpoch *big.Int\n\t\tCreatedTime *big.Int\n\t\tDeactivatedEpoch *big.Int\n\t\tDeactivatedTime *big.Int\n\t\tAmount *big.Int\n\t\tPaidUntilEpoch *big.Int\n\t\tToStakerID *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.CreatedEpoch = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\toutstruct.CreatedTime = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\toutstruct.DeactivatedEpoch = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\toutstruct.DeactivatedTime = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\toutstruct.Amount = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int)\n\toutstruct.PaidUntilEpoch = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int)\n\toutstruct.ToStakerID = *abi.ConvertType(out[6], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "aa50d6bcbc359d605a97ee4b5d7a0dc3", "score": "0.5004848", "text": "func (p *Protocol) NumDelegatesForEpochReward(\n\tctx context.Context,\n\tsm protocol.StateManager,\n) (uint64, error) {\n\ta := admin{}\n\tif _, err := p.state(ctx, sm, _adminKey, &a); err != nil {\n\t\treturn 0, err\n\t}\n\treturn a.numDelegatesForEpochReward, nil\n}", "title": "" }, { "docid": "e5a2e6574611b4193662a6de0f8304cf", "score": "0.49697208", "text": "func (_SfcV1Contract *SfcV1ContractCallerSession) CalcRawValidatorEpochReward(stakerID *big.Int, epoch *big.Int) (*big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcRawValidatorEpochReward(&_SfcV1Contract.CallOpts, stakerID, epoch)\n}", "title": "" }, { "docid": "abb4db760db8f06705cc4dc7c762fdb9", "score": "0.49632427", "text": "func (v *Validator) RewardsSum(address string,) (*ValidatorRewardsSum, error) {\n\tresp, err := v.c.Request(http.MethodGet, fmt.Sprintf(\"/validators/%s/rewards/sum\", address), new(bytes.Buffer), nil)\n\tif err != nil {\n\t\treturn &ValidatorRewardsSum{}, err\n\t}\n\tdefer resp.Body.Close()\n\t\n\tvar validatorRewardsSum *ValidatorRewardsSum\n\terr = json.NewDecoder(resp.Body).Decode(&validatorRewardsSum)\n\tif err != nil {\n\t\treturn &ValidatorRewardsSum{}, err\n\t}\n\treturn validatorRewardsSum, nil\n}", "title": "" }, { "docid": "57e3cf31918124abb83e2ba29c6baf87", "score": "0.4961154", "text": "func (c *command) calculateYield(ctx context.Context) error {\n\tspec, err := c.eth2Client.(eth2client.SpecProvider).Spec(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttmp, exists := spec[\"BASE_REWARD_FACTOR\"]\n\tif !exists {\n\t\treturn errors.New(\"spec missing BASE_REWARD_FACTOR\")\n\t}\n\tbaseReward, isType := tmp.(uint64)\n\tif !isType {\n\t\treturn errors.New(\"BASE_REWARD_FACTOR of incorrect type\")\n\t}\n\tif c.debug {\n\t\tfmt.Printf(\"Base reward: %v\\n\", baseReward)\n\t}\n\tc.results.BaseReward = decimal.New(int64(baseReward), 0)\n\n\tnumerator := decimal.New(32, 0).Mul(weiPerGwei).Mul(c.results.BaseReward)\n\tif c.debug {\n\t\tfmt.Printf(\"Numerator: %v\\n\", numerator)\n\t}\n\tactiveValidatorsBalanceInGwei := c.results.ActiveValidatorBalance.Div(weiPerGwei)\n\tdenominator := decimal.NewFromBigInt(new(big.Int).Sqrt(activeValidatorsBalanceInGwei.BigInt()), 0)\n\tif c.debug {\n\t\tfmt.Printf(\"Denominator: %v\\n\", denominator)\n\t}\n\tc.results.ValidatorRewardsPerEpoch = numerator.Div(denominator).RoundDown(0).Mul(weiPerGwei)\n\tif c.debug {\n\t\tfmt.Printf(\"Validator rewards per epoch: %v\\n\", c.results.ValidatorRewardsPerEpoch)\n\t}\n\tc.results.ValidatorRewardsPerYear = c.results.ValidatorRewardsPerEpoch.Mul(epochsPerYear)\n\tif c.debug {\n\t\tfmt.Printf(\"Validator rewards per year: %v\\n\", c.results.ValidatorRewardsPerYear)\n\t}\n\t// Expected validator rewards assume that there is no proposal and no sync committee participation,\n\t// but that head/source/target are correct and timely: this gives 54/64 of the reward.\n\t// These values are obtained from https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/beacon-chain.md#incentivization-weights\n\tc.results.ExpectedValidatorRewardsPerEpoch = c.results.ValidatorRewardsPerEpoch.Mul(decimal.New(54, 0)).Div(decimal.New(64, 0)).Div(weiPerGwei).RoundDown(0).Mul(weiPerGwei)\n\tif c.debug {\n\t\tfmt.Printf(\"Expected validator rewards per epoch: %v\\n\", c.results.ExpectedValidatorRewardsPerEpoch)\n\t}\n\n\tc.results.MaxIssuancePerEpoch = c.results.ValidatorRewardsPerEpoch.Mul(c.results.ActiveValidators)\n\tif c.debug {\n\t\tfmt.Printf(\"Chain rewards per epoch: %v\\n\", c.results.MaxIssuancePerEpoch)\n\t}\n\tc.results.MaxIssuancePerYear = c.results.MaxIssuancePerEpoch.Mul(epochsPerYear)\n\tif c.debug {\n\t\tfmt.Printf(\"Chain rewards per year: %v\\n\", c.results.MaxIssuancePerYear)\n\t}\n\n\tc.results.Yield = c.results.ValidatorRewardsPerYear.Div(weiPerGwei).Div(weiPerGwei).Div(decimal.New(32, 0))\n\tif c.debug {\n\t\tfmt.Printf(\"Yield: %v\\n\", c.results.Yield)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d4c893eaf936a598207d6612892b0acb", "score": "0.49607456", "text": "func (_SfcV2Contract *SfcV2ContractSession) PrepareToWithdrawDelegationPartial(wrID *big.Int, toStakerID *big.Int, amount *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.PrepareToWithdrawDelegationPartial(&_SfcV2Contract.TransactOpts, wrID, toStakerID, amount)\n}", "title": "" }, { "docid": "107179b73f5d3c95bcbc751c0af2d062", "score": "0.4960625", "text": "func (_SfcV1Contract *SfcV1ContractCallerSession) CalcValidatorEpochReward(stakerID *big.Int, epoch *big.Int, commission *big.Int) (*big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcValidatorEpochReward(&_SfcV1Contract.CallOpts, stakerID, epoch, commission)\n}", "title": "" }, { "docid": "53009735e0d1f3d9961a8e8ed93ff621", "score": "0.4958806", "text": "func (e *Engine) accumulateRewards(chain consensus.ChainHeaderReader, state *state.StateDB, header *types.Header) {\n\tblockReward := chain.Config().GetBlockReward(header.Number)\n\tif blockReward.Cmp(big.NewInt(0)) > 0 {\n\t\tcoinbase := header.Coinbase\n\t\tif (coinbase == common.Address{}) {\n\t\t\tcoinbase = e.signer\n\t\t}\n\t\trewardAccount, _ := chain.Config().GetRewardAccount(header.Number, coinbase)\n\t\tlog.Trace(\"QBFT: accumulate rewards to\", \"rewardAccount\", rewardAccount, \"blockReward\", blockReward)\n\n\t\tstate.AddBalance(rewardAccount, &blockReward)\n\t}\n}", "title": "" }, { "docid": "a57bd79111fbd3e45adddfb77bcbb66d", "score": "0.4954748", "text": "func (_L1BondingManager *L1BondingManagerCaller) GetDelegator(opts *bind.CallOpts, _delegator common.Address) (struct {\n\tBondedAmount *big.Int\n\tFees *big.Int\n\tDelegateAddress common.Address\n\tDelegatedAmount *big.Int\n\tStartRound *big.Int\n\tLastClaimRound *big.Int\n\tNextUnbondingLockId *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _L1BondingManager.contract.Call(opts, &out, \"getDelegator\", _delegator)\n\n\toutstruct := new(struct {\n\t\tBondedAmount *big.Int\n\t\tFees *big.Int\n\t\tDelegateAddress common.Address\n\t\tDelegatedAmount *big.Int\n\t\tStartRound *big.Int\n\t\tLastClaimRound *big.Int\n\t\tNextUnbondingLockId *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.BondedAmount = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\toutstruct.Fees = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\toutstruct.DelegateAddress = *abi.ConvertType(out[2], new(common.Address)).(*common.Address)\n\toutstruct.DelegatedAmount = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\toutstruct.StartRound = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int)\n\toutstruct.LastClaimRound = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int)\n\toutstruct.NextUnbondingLockId = *abi.ConvertType(out[6], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "58930598e48edc707aecfaba77af6e08", "score": "0.49538502", "text": "func (_SfcV2Contract *SfcV2ContractCaller) TotalBurntLockupRewards(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _SfcV2Contract.contract.Call(opts, &out, \"totalBurntLockupRewards\")\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": "0b3f4aec9b728f720b3a548350d6f9ac", "score": "0.4941204", "text": "func (_SfcV2Contract *SfcV2ContractTransactorSession) PrepareToWithdrawDelegationPartial(wrID *big.Int, toStakerID *big.Int, amount *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.Contract.PrepareToWithdrawDelegationPartial(&_SfcV2Contract.TransactOpts, wrID, toStakerID, amount)\n}", "title": "" }, { "docid": "00d447c0de34caf1a76872772038bddf", "score": "0.49372345", "text": "func AccumulateRewards(stateTree *StateTree, header *BlockHeader) {\n\tsubsidy := calcBlockSubsidy(header.Height)\n\tlogrus.Debugf(\"current height of the blockchain %d, reward: %d\", header.Height, subsidy)\n\tstateTree.AddBalance(header.Coinbase, subsidy)\n}", "title": "" }, { "docid": "4c2121cb67de6c70b66410c0b7acc9fe", "score": "0.4930942", "text": "func (_SfcV2Contract *SfcV2ContractCallerSession) TotalBurntLockupRewards() (*big.Int, error) {\n\treturn _SfcV2Contract.Contract.TotalBurntLockupRewards(&_SfcV2Contract.CallOpts)\n}", "title": "" }, { "docid": "fab25dac28ed91f8c5b21cf5435c92e5", "score": "0.49136502", "text": "func (_SfcV1Contract *SfcV1ContractSession) CalcRawValidatorEpochReward(stakerID *big.Int, epoch *big.Int) (*big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcRawValidatorEpochReward(&_SfcV1Contract.CallOpts, stakerID, epoch)\n}", "title": "" }, { "docid": "38e1e13321a023fcf9c5865f08a12a5a", "score": "0.48869634", "text": "func (_SfcV1Contract *SfcV1ContractSession) CalcValidatorEpochReward(stakerID *big.Int, epoch *big.Int, commission *big.Int) (*big.Int, error) {\n\treturn _SfcV1Contract.Contract.CalcValidatorEpochReward(&_SfcV1Contract.CallOpts, stakerID, epoch, commission)\n}", "title": "" }, { "docid": "cc821ebb3fb6690b1bcae0a50c0e2b59", "score": "0.4881456", "text": "func (_SfcV2Contract *SfcV2ContractFilterer) FilterClaimedDelegationReward(opts *bind.FilterOpts, from []common.Address, stakerID []*big.Int) (*SfcV2ContractClaimedDelegationRewardIterator, error) {\n\n\tvar fromRule []interface{}\n\tfor _, fromItem := range from {\n\t\tfromRule = append(fromRule, fromItem)\n\t}\n\tvar stakerIDRule []interface{}\n\tfor _, stakerIDItem := range stakerID {\n\t\tstakerIDRule = append(stakerIDRule, stakerIDItem)\n\t}\n\n\tlogs, sub, err := _SfcV2Contract.contract.FilterLogs(opts, \"ClaimedDelegationReward\", fromRule, stakerIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &SfcV2ContractClaimedDelegationRewardIterator{contract: _SfcV2Contract.contract, event: \"ClaimedDelegationReward\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "5d8957e139922346d4984cb1739f6826", "score": "0.4836837", "text": "func (_SfcV1Contract *SfcV1ContractFilterer) FilterClaimedDelegationReward(opts *bind.FilterOpts, from []common.Address, stakerID []*big.Int) (*SfcV1ContractClaimedDelegationRewardIterator, error) {\n\n\tvar fromRule []interface{}\n\tfor _, fromItem := range from {\n\t\tfromRule = append(fromRule, fromItem)\n\t}\n\tvar stakerIDRule []interface{}\n\tfor _, stakerIDItem := range stakerID {\n\t\tstakerIDRule = append(stakerIDRule, stakerIDItem)\n\t}\n\n\tlogs, sub, err := _SfcV1Contract.contract.FilterLogs(opts, \"ClaimedDelegationReward\", fromRule, stakerIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &SfcV1ContractClaimedDelegationRewardIterator{contract: _SfcV1Contract.contract, event: \"ClaimedDelegationReward\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "b7b34faa1d59ed641044c64dd03f0bb0", "score": "0.4829479", "text": "func (_SfcV2Contract *SfcV2ContractFilterer) FilterPreparedToWithdrawDelegation(opts *bind.FilterOpts, delegator []common.Address, stakerID []*big.Int) (*SfcV2ContractPreparedToWithdrawDelegationIterator, error) {\n\n\tvar delegatorRule []interface{}\n\tfor _, delegatorItem := range delegator {\n\t\tdelegatorRule = append(delegatorRule, delegatorItem)\n\t}\n\tvar stakerIDRule []interface{}\n\tfor _, stakerIDItem := range stakerID {\n\t\tstakerIDRule = append(stakerIDRule, stakerIDItem)\n\t}\n\n\tlogs, sub, err := _SfcV2Contract.contract.FilterLogs(opts, \"PreparedToWithdrawDelegation\", delegatorRule, stakerIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &SfcV2ContractPreparedToWithdrawDelegationIterator{contract: _SfcV2Contract.contract, event: \"PreparedToWithdrawDelegation\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "c3f86bbf3dce3477159d635dcae092c2", "score": "0.4826723", "text": "func (_SfcV2Contract *SfcV2ContractCallerSession) Delegations(arg0 common.Address, arg1 *big.Int) (struct {\n\tCreatedEpoch *big.Int\n\tCreatedTime *big.Int\n\tDeactivatedEpoch *big.Int\n\tDeactivatedTime *big.Int\n\tAmount *big.Int\n\tPaidUntilEpoch *big.Int\n\tToStakerID *big.Int\n}, error) {\n\treturn _SfcV2Contract.Contract.Delegations(&_SfcV2Contract.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "0c4ba17c7719e49b39452e46e6892a06", "score": "0.4818012", "text": "func (_MdexFarm *MdexFarmCaller) Reward(opts *bind.CallOpts, blockNumber *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _MdexFarm.contract.Call(opts, &out, \"reward\", blockNumber)\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": "e4d18b3642c6f68d3f7daa38a035a522", "score": "0.4813996", "text": "func (k Keeper) GetAllRedelegations(\n\tctx context.Context, delegator sdk.AccAddress, srcValAddress, dstValAddress sdk.ValAddress,\n) ([]types.Redelegation, error) {\n\tstore := k.storeService.OpenKVStore(ctx)\n\tdelegatorPrefixKey := types.GetREDsKey(delegator)\n\n\titerator, err := store.Iterator(delegatorPrefixKey, storetypes.PrefixEndBytes(delegatorPrefixKey)) // smallest to largest\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer iterator.Close()\n\n\tsrcValFilter := !(srcValAddress.Empty())\n\tdstValFilter := !(dstValAddress.Empty())\n\n\tredelegations := []types.Redelegation{}\n\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\tredelegation := types.MustUnmarshalRED(k.cdc, iterator.Value())\n\t\tvalSrcAddr, err := sdk.ValAddressFromBech32(redelegation.ValidatorSrcAddress)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvalDstAddr, err := sdk.ValAddressFromBech32(redelegation.ValidatorDstAddress)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif srcValFilter && !(srcValAddress.Equals(valSrcAddr)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif dstValFilter && !(dstValAddress.Equals(valDstAddr)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tredelegations = append(redelegations, redelegation)\n\t}\n\n\treturn redelegations, nil\n}", "title": "" }, { "docid": "60efdebe2fe25dc06d4b945215001afb", "score": "0.48097464", "text": "func (cu *CandidateUpdate) RewardAddress() address.Address { return cu.rewardAddress }", "title": "" }, { "docid": "a115be4da5d465883b3a29c3e89595fe", "score": "0.4803017", "text": "func (_SfcV2Contract *SfcV2ContractSession) Delegations(arg0 common.Address, arg1 *big.Int) (struct {\n\tCreatedEpoch *big.Int\n\tCreatedTime *big.Int\n\tDeactivatedEpoch *big.Int\n\tDeactivatedTime *big.Int\n\tAmount *big.Int\n\tPaidUntilEpoch *big.Int\n\tToStakerID *big.Int\n}, error) {\n\treturn _SfcV2Contract.Contract.Delegations(&_SfcV2Contract.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "3ed81f266a566dbf66ca13702f4bddcb", "score": "0.47875234", "text": "func (_SfcV2Contract *SfcV2ContractSession) TotalBurntLockupRewards() (*big.Int, error) {\n\treturn _SfcV2Contract.Contract.TotalBurntLockupRewards(&_SfcV2Contract.CallOpts)\n}", "title": "" }, { "docid": "71df4d08c3929cdf5a7ccc4b4f940071", "score": "0.47864348", "text": "func (s *Store) GetStakerClaimedRewards(stakerID idx.StakerID) *big.Int {\n\tamount, err := s.table.StakerOldRewards.Get(stakerID.Bytes())\n\tif err != nil {\n\t\ts.Log.Crit(\"Failed to erase key-value\", \"err\", err)\n\t}\n\tif amount == nil {\n\t\treturn big.NewInt(0)\n\t}\n\treturn new(big.Int).SetBytes(amount)\n}", "title": "" }, { "docid": "5529c790465e61f5342f75c71ab01a76", "score": "0.47690943", "text": "func (_SfcV2Contract *SfcV2ContractCaller) WithdrawalRequests(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (struct {\n\tStakerID *big.Int\n\tEpoch *big.Int\n\tTime *big.Int\n\tAmount *big.Int\n\tDelegation bool\n}, error) {\n\tvar out []interface{}\n\terr := _SfcV2Contract.contract.Call(opts, &out, \"withdrawalRequests\", arg0, arg1)\n\n\toutstruct := new(struct {\n\t\tStakerID *big.Int\n\t\tEpoch *big.Int\n\t\tTime *big.Int\n\t\tAmount *big.Int\n\t\tDelegation bool\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.StakerID = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\toutstruct.Epoch = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\toutstruct.Time = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\toutstruct.Amount = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\toutstruct.Delegation = *abi.ConvertType(out[4], new(bool)).(*bool)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "01903eb7f485c9bd1d03eac04191dccc", "score": "0.47645253", "text": "func (_SfcV1Contract *SfcV1ContractCallerSession) Delegations(arg0 common.Address) (struct {\n\tCreatedEpoch *big.Int\n\tCreatedTime *big.Int\n\tDeactivatedEpoch *big.Int\n\tDeactivatedTime *big.Int\n\tAmount *big.Int\n\tPaidUntilEpoch *big.Int\n\tToStakerID *big.Int\n}, error) {\n\treturn _SfcV1Contract.Contract.Delegations(&_SfcV1Contract.CallOpts, arg0)\n}", "title": "" }, { "docid": "ba1d6fa976fa801c3aa630ad5d41f8e8", "score": "0.47605973", "text": "func (_SfcV1Contract *SfcV1ContractFilterer) WatchClaimedDelegationReward(opts *bind.WatchOpts, sink chan<- *SfcV1ContractClaimedDelegationReward, from []common.Address, stakerID []*big.Int) (event.Subscription, error) {\n\n\tvar fromRule []interface{}\n\tfor _, fromItem := range from {\n\t\tfromRule = append(fromRule, fromItem)\n\t}\n\tvar stakerIDRule []interface{}\n\tfor _, stakerIDItem := range stakerID {\n\t\tstakerIDRule = append(stakerIDRule, stakerIDItem)\n\t}\n\n\tlogs, sub, err := _SfcV1Contract.contract.WatchLogs(opts, \"ClaimedDelegationReward\", fromRule, stakerIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(SfcV1ContractClaimedDelegationReward)\n\t\t\t\tif err := _SfcV1Contract.contract.UnpackLog(event, \"ClaimedDelegationReward\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "217e6d151ec5a6263b3dbd2b69fc43af", "score": "0.47509968", "text": "func (s *Store) SetDelegatorClaimedRewards(addr common.Address, amount *big.Int) {\n\terr := s.table.DelegatorOldRewards.Put(addr.Bytes(), amount.Bytes())\n\tif err != nil {\n\t\ts.Log.Crit(\"Failed to put key-value\", \"err\", err)\n\t}\n}", "title": "" }, { "docid": "ae353f12f58e5de5e70c760f246d407c", "score": "0.47475848", "text": "func (_SfcV2Contract *SfcV2ContractTransactor) PrepareToWithdrawDelegationPartial(opts *bind.TransactOpts, wrID *big.Int, toStakerID *big.Int, amount *big.Int) (*types.Transaction, error) {\n\treturn _SfcV2Contract.contract.Transact(opts, \"prepareToWithdrawDelegationPartial\", wrID, toStakerID, amount)\n}", "title": "" } ]
d376b9c150d9695c820ef40e10dddb33
merkleLeafHash returns the merkle leaf hash for the provided leaf value. This is the same merkle leaf hash that is calculated by trillian.
[ { "docid": "9e2d13f4b3bae4c26e826c2a07a6e1d9", "score": "0.8553368", "text": "func merkleLeafHash(leafValue []byte) []byte {\n\treturn hasher.HashLeaf(leafValue)\n}", "title": "" } ]
[ { "docid": "999ed861b3d7d3164dc9cd61bfb67f3d", "score": "0.74812037", "text": "func leafHash(leaf []byte) []byte {\n\treturn tmhash.Sum(append(leafPrefix, leaf...))\n}", "title": "" }, { "docid": "bd1469640a29c378f9d1b730e2f6b67e", "score": "0.692196", "text": "func LeafHash(h hash.Hash, out, in []byte) []byte {\n\th.Reset()\n\n\t// Domain separator to prevent second-preimage attacks.\n\t// https://en.wikipedia.org/wiki/Merkle_tree#Second_preimage_attack\n\th.Write([]byte{0})\n\n\th.Write(in)\n\n\treturn h.Sum(out)\n}", "title": "" }, { "docid": "6a15b017021698e54b64a708099665f9", "score": "0.68379277", "text": "func (o *objhasher) HashLeaf(leaf []byte) []byte {\n\thash := objecthash.CommonJSONHash(string(leaf))\n\treturn hash[:]\n}", "title": "" }, { "docid": "a9bc9490588a0f155d4aeee6710502db", "score": "0.66308707", "text": "func hashLeaf(out *[sha512.Size256]byte, in []byte) {\n\th := sha512trunc.New()\n\th.Write(hashLeafTweak)\n\th.Write(in)\n\th.Sum(out[:0])\n}", "title": "" }, { "docid": "48b24169e0c2cd4bed55b019999d526b", "score": "0.6480678", "text": "func leafHashOpt(s hash.Hash, leaf []byte) []byte {\n\ts.Reset()\n\ts.Write(leafPrefix)\n\ts.Write(leaf)\n\treturn s.Sum(nil)\n}", "title": "" }, { "docid": "9532d8af93848cfb02684952c7c4cef2", "score": "0.63908654", "text": "func (l *leaf) hash() hash.Hash32B {\n\tstream := append([]byte{l.Ext}, l.Path...)\n\tstream = append(stream, l.Value...)\n\treturn blake2b.Sum256(stream)\n}", "title": "" }, { "docid": "af49c909e74ec5a0804a0fc676c7da8f", "score": "0.63746303", "text": "func (vt *VTree) MerkleHash() string {\n\treturn vt.Head.MerkleHash()\n}", "title": "" }, { "docid": "708cdf176f7945d77f2e12718947ed06", "score": "0.63554376", "text": "func (l merkleLeaf) CalculateHash() ([]byte, error) {\n\treturn l.trans.hash()\n}", "title": "" }, { "docid": "7d1e9b32b1195567477f87f96c9696d9", "score": "0.62654614", "text": "func (mt *MerkleTree) MerkleRootHash() []byte {\n\treturn mt.RootNode.Hash\n}", "title": "" }, { "docid": "ce13eb0cba1996bc552c77350ac524a1", "score": "0.62256575", "text": "func (merklePath *MerklePath) GetLeaf() *MerkleHash {\n\treturn merklePath.Hashes[0]\n}", "title": "" }, { "docid": "9e503d35d681c150a90f1a7bb413453a", "score": "0.589777", "text": "func (tx Transaction) MerkleHash() []byte {\n\thash := sha256.Sum256(tx.TxBytes())\n\treturn hash[:]\n}", "title": "" }, { "docid": "49442e0a63f115c23a1557ca304028d6", "score": "0.5836729", "text": "func (rmds *RootMetadataSigned) MerkleHash(config Config) (MerkleHash, error) {\n\treturn config.Crypto().MakeMerkleHash(rmds)\n}", "title": "" }, { "docid": "5ffa44dbef88efc14df10328642ee38d", "score": "0.58191854", "text": "func merkleRootHash(txs []transaction.Transaction) []byte {\n\ttree := gomerkle.NewTree(sha256.New())\n\tfor _, tx := range txs {\n\t\ttree.AddHash(tx.ID)\n\t}\n\n\ttree.Generate()\n\treturn tree.Root()\n}", "title": "" }, { "docid": "b585592c3f6d789bf5b233001463e6ec", "score": "0.5782285", "text": "func (t TapLeaf) TapHash() chainhash.Hash {\n\t// TODO(roasbeef): cache these and the branch due to the recursive\n\t// call, so memoize\n\n\t// The leaf encoding is: leafVersion || compactSizeof(script) ||\n\t// script, where compactSizeof returns the compact size needed to\n\t// encode the value.\n\tvar leafEncoding bytes.Buffer\n\n\t_ = leafEncoding.WriteByte(byte(t.LeafVersion))\n\t_ = wire.WriteVarBytes(&leafEncoding, 0, t.Script)\n\n\treturn *chainhash.TaggedHash(chainhash.TagTapLeaf, leafEncoding.Bytes())\n}", "title": "" }, { "docid": "b6b02814fa4cc30ee6eae6f830e3c8e4", "score": "0.57164806", "text": "func (dln *DictionaryLeafNode) GetHash() []byte {\n\tif dln.recalculateHash {\n\t\tcopy(dln.commitmentHash, crypto.WitnessKeyAndValue(dln.key[:], dln.value[:]))\n\t\tdln.recalculateHash = false\n\t}\n\treturn dln.commitmentHash\n}", "title": "" }, { "docid": "d5804f12fad2b235ac4b38d611314461", "score": "0.5711833", "text": "func Merkle(nodeList []HashCode) HashCode {\n\n\t// check parameters\n\tif len(nodeList) == 0 {\n\t\tpanic(\"input is empty\")\n\t}\n\n\t// if len is 1, then get the root, else continue calculate\n\tfor len(nodeList) > 1 {\n\t\tnodeLength := len(nodeList)\n\n\t\t// patch element's count to be 2x\n\t\tif nodeLength%2 != 0 {\n\t\t\tlastNode := nodeList[nodeLength-1]\n\t\t\tnodeList = append(nodeList, lastNode)\n\t\t}\n\n\t\tnodeLength = len(nodeList)\n\t\tnewNodeList := make([]HashCode, 0, nodeLength/2)\n\n\t\t// calculate high level nodes\n\t\tfor i := 0; i < nodeLength/2; i++ {\n\t\t\thash1 := nodeList[2*i][:]\n\t\t\thash2 := nodeList[2*i+1][:]\n\t\t\tdata := append(hash1, hash2...)\n\t\t\thash := sha256.Sum256(data)\n\t\t\tnewNodeList = append(newNodeList, hash)\n\t\t}\n\n\t\t// set to higher level\n\t\tnodeList = newNodeList\n\t}\n\n\t// fmt.Printf(\"merkleroot = %x\\n\", nodeList[0])\n\n\treturn nodeList[0]\n}", "title": "" }, { "docid": "9390c261975d9ee3c1cae0e047af683e", "score": "0.5646939", "text": "func (tree MerkleTree) MerkleRoot() hash.Byte32 {\n\treturn tree.topRow()[0]\n}", "title": "" }, { "docid": "5a6c2a038c032dff87dfdb8f229181dd", "score": "0.55773115", "text": "func (th *tileHasher) hashTile(depthBits uint, leaves []smt.Node) ([]byte, error) {\n\th, err := smt.NewHStar3(leaves, th.h.HashChildren, uint(leaves[0].ID.BitLen()), depthBits)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr, err := h.Update(th)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(r) != 1 {\n\t\treturn nil, fmt.Errorf(\"expected single root but got %d\", len(r))\n\t}\n\treturn r[0].Hash, nil\n}", "title": "" }, { "docid": "f76c8ccf2729761a465582116013baeb", "score": "0.5564654", "text": "func (merkleTree *MerkleTree) GetLastNodeHash() *MerkleHash {\n\treturn merkleTree.lastNodeHash\n}", "title": "" }, { "docid": "350e196dc9eca89a9d50c82b17ca2971", "score": "0.555698", "text": "func (tree MerkleTree) MerklePathForLeaf(leafIndex int) (\n\tmerklePath MerklePath) {\n\ti := leafIndex\n\t// This iteration starts at the leaf row and consume all the row above\n\t// except the top one containing the Merkle Root.\n\tfor _, row := range tree.rows[:len(tree.rows)-1] {\n\t\tsibling, useFirstInConcatenation := row.evaluateSibling(i)\n\t\tmerklePathElement := MerklePathElement{\n\t\t\tHash: row[sibling],\n\t\t\tUseFirstInConcatenation: useFirstInConcatenation}\n\t\tmerklePath = append(merklePath, merklePathElement)\n\t\t// This division produces the index that should be used in the row\n\t\t// above to find a given node's parent. The truncating integer division\n\t\t// is deliberate and necessary to produce the same parent for two\n\t\t// adjacent nodes.\n\t\ti = i / 2\n\t}\n\treturn\n}", "title": "" }, { "docid": "0f3f5ad6d194761427aec7cd3565f624", "score": "0.5551923", "text": "func ReadMerkleTreeLeaf(r io.Reader) (*MerkleTreeLeaf, error) {\n\tvar m MerkleTreeLeaf\n\tif err := binary.Read(r, binary.BigEndian, &m.Version); err != nil {\n\t\treturn nil, err\n\t}\n\tif m.Version != V1 {\n\t\treturn nil, fmt.Errorf(\"unknown Version %d\", m.Version)\n\t}\n\tif err := binary.Read(r, binary.BigEndian, &m.LeafType); err != nil {\n\t\treturn nil, err\n\t}\n\tif m.LeafType != TimestampedEntryLeafType {\n\t\treturn nil, fmt.Errorf(\"unknown LeafType %d\", m.LeafType)\n\t}\n\tif err := ReadTimestampedEntryInto(r, &m.TimestampedEntry); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &m, nil\n}", "title": "" }, { "docid": "88ca8eb606b23ec3793d79ff81ecf7f2", "score": "0.5500761", "text": "func (node *mapAuditNode) CalcHash() []byte {\n\tif node.Hash == nil {\n\t\tif node.Leaf {\n\t\t\tnode.Hash = node.LeafHash\n\t\t\tfor i := 256; i > node.Depth; i-- {\n\t\t\t\tif node.KeyPath[i-1] {\n\t\t\t\t\tnode.Hash = merkle.NodeHash(defaultLeafValues[i], node.Hash)\n\t\t\t\t} else {\n\t\t\t\t\tnode.Hash = merkle.NodeHash(node.Hash, defaultLeafValues[i])\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tvar left, right []byte\n\t\t\tif node.Left == nil {\n\t\t\t\tleft = defaultLeafValues[node.Depth+1]\n\t\t\t} else {\n\t\t\t\tleft = node.Left.CalcHash()\n\t\t\t}\n\t\t\tif node.Right == nil {\n\t\t\t\tright = defaultLeafValues[node.Depth+1]\n\t\t\t} else {\n\t\t\t\tright = node.Right.CalcHash()\n\t\t\t}\n\t\t\tnode.Hash = merkle.NodeHash(left, right)\n\t\t}\n\t}\n\treturn node.Hash\n}", "title": "" }, { "docid": "082a3aff004eefafdb9ee8fdb2424d1f", "score": "0.54585356", "text": "func hashLeaves(left chainhash.Hash, right chainhash.Hash) *chainhash.Hash {\n\t// Concatenate the left and right nodes.\n\tvar hash [chainhash.HashSize * 2]byte\n\tcopy(hash[:chainhash.HashSize], left[:])\n\tcopy(hash[chainhash.HashSize:], right[:])\n\n\tnewHash := chainhash.DoubleHashH(hash[:])\n\treturn &newHash\n}", "title": "" }, { "docid": "0785e4df9f4efbc66a66a17e15a24688", "score": "0.5437452", "text": "func (h *HistoricalBatch) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(h)\n}", "title": "" }, { "docid": "61937f724e6eb7f3c3d2bf196707a61a", "score": "0.5417472", "text": "func (f *Fork) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(f)\n}", "title": "" }, { "docid": "5d7b6051221ae924378229294d0deadf", "score": "0.54115075", "text": "func (_ZSLMerkleTree *ZSLMerkleTreeCallerSession) GetLeafIndex(cm [32]byte) (*big.Int, error) {\n\treturn _ZSLMerkleTree.Contract.GetLeafIndex(&_ZSLMerkleTree.CallOpts, cm)\n}", "title": "" }, { "docid": "5f2cbe5b67be27713ccf1d7b03f3006d", "score": "0.5396109", "text": "func (_ZSLMerkleTree *ZSLMerkleTreeSession) GetLeafIndex(cm [32]byte) (*big.Int, error) {\n\treturn _ZSLMerkleTree.Contract.GetLeafIndex(&_ZSLMerkleTree.CallOpts, cm)\n}", "title": "" }, { "docid": "4f2ac4dab97bf7530fdbf9c90d483c29", "score": "0.5322539", "text": "func (t *ImmutableTree) Hash() ([]byte, error) {\n\thash, _, err := t.root.hashWithCount()\n\treturn hash, err\n}", "title": "" }, { "docid": "4a0f2ac45479acd957a51ca31207cfed", "score": "0.52971184", "text": "func (t *Tree) RootHash() []byte {\n\n\tif t.subTree == nil {\n\t\treturn sum(t.hashF) // zero hash\n\t}\n\n\trootHash := t.subTree.root.hash\n\tcurrent := t.subTree.left\n\n\tfor current != nil {\n\t\trootHash = sum(t.hashF, rootHash, current.root.hash)\n\t\tcurrent = current.left\n\t}\n\n\treturn rootHash\n}", "title": "" }, { "docid": "ee86870bd53c99185d4f6076b0e99584", "score": "0.52908087", "text": "func (b *branch) hash() hash.Hash32B {\n\tstream := []byte{}\n\tfor i := 0; i < RADIX; i++ {\n\t\tstream = append(stream, b.Path[i]...)\n\t}\n\tstream = append(stream, b.Value...)\n\treturn blake2b.Sum256(stream)\n}", "title": "" }, { "docid": "05d47407e59339b4767401a4db1a2cc5", "score": "0.5244763", "text": "func (mpt *MerklePatriciaTrie) addLeavesToBranch(newLeaf Node, branch *Node, index uint8) {\n branch.branch_value[index] = newLeaf.hash_node()\n}", "title": "" }, { "docid": "8109145c9a1b927885efb2bf3bf9d735", "score": "0.5239278", "text": "func CalculateMerkleRootFromMerklePath(\n\tleafHash hash.Byte32, merklePath MerklePath) hash.Byte32 {\n\n\tcumulativeHash := leafHash\n\tfor _, merklePathElement := range merklePath {\n\t\tif merklePathElement.UseFirstInConcatenation {\n\t\t\tcumulativeHash = hash.JoinAndHash(\n\t\t\t\tmerklePathElement.Hash, cumulativeHash)\n\t\t} else {\n\t\t\tcumulativeHash = hash.JoinAndHash(\n\t\t\t\tcumulativeHash, merklePathElement.Hash)\n\t\t}\n\t}\n\treturn cumulativeHash\n}", "title": "" }, { "docid": "86bce88782aff445bd1a0a03b54d1649", "score": "0.5224657", "text": "func (p *Prover) generateMerkle() []byte {\n\tvar stack []int64\n\tvar hashStack [][]byte\n\n\tcur := int64(1)\n\tcount := int64(1)\n\n\tfor count == 1 || len(stack) != 0 {\n\t\tempty := p.emptyMerkle(cur)\n\t\tfor ; cur < 2*p.pow2 && !empty; cur *= 2 {\n\t\t\tif cur < p.pow2 { //right child\n\t\t\t\tstack = append(stack, 2*cur+1)\n\t\t\t}\n\t\t\tstack = append(stack, cur)\n\t\t}\n\n\t\tif empty {\n\t\t\tcount += p.graph.subtree(cur)\n\t\t\thashStack = append(hashStack, make([]byte, hashSize))\n\t\t}\n\n\t\tcur, stack = stack[len(stack)-1], stack[:len(stack)-1]\n\n\t\tif len(stack) > 0 && cur < p.pow2 &&\n\t\t\t(stack[len(stack)-1] == 2*cur+1) {\n\t\t\tstack = stack[:len(stack)-1]\n\t\t\tstack = append(stack, cur)\n\t\t\tcur = 2*cur + 1\n\t\t\tcontinue\n\t\t}\n\n\t\tif cur >= p.pow2 {\n\t\t\tif cur >= p.pow2+p.size {\n\t\t\t\thashStack = append(hashStack, make([]byte, hashSize))\n\t\t\t\tcount++\n\t\t\t} else {\n\t\t\t\tn := p.graph.GetId(count)\n\t\t\t\tcount++\n\t\t\t\thashStack = append(hashStack, n.H)\n\t\t\t}\n\t\t} else if !p.emptyMerkle(cur) {\n\t\t\thash2 := hashStack[len(hashStack)-1]\n\t\t\thashStack = hashStack[:len(hashStack)-1]\n\t\t\thash1 := hashStack[len(hashStack)-1]\n\t\t\thashStack = hashStack[:len(hashStack)-1]\n\t\t\tval := append(hash1[:], hash2[:]...)\n\t\t\thash := sha3.Sum256(val)\n\n\t\t\thashStack = append(hashStack, hash[:])\n\n\t\t\tp.graph.NewNodeById(count, hash[:])\n\t\t\tcount++\n\t\t}\n\t\tcur = 2 * p.pow2\n\t}\n\n\treturn hashStack[0]\n}", "title": "" }, { "docid": "03a028c3d91baaf007f8e543249f6cb6", "score": "0.5216917", "text": "func (b *BeaconBlockHeader) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(b)\n}", "title": "" }, { "docid": "62f6c5a9e68d606d926e0a68fc8a7f20", "score": "0.52123636", "text": "func (n *node) getHash() []byte {\n\thash := md5.New()\n\tif n.left == nil && n.right == nil && n.leaf != nil {\n\t\thash.Write(n.leaf.GetHash())\n\t} else {\n\t\tif n.left != nil {\n\t\t\thash.Write(n.left.getHash())\n\t\t}\n\t\tif n.right != nil {\n\t\t\thash.Write(n.right.getHash())\n\t\t}\n\t}\n\treturn hash.Sum(nil)\n}", "title": "" }, { "docid": "ab78d972f8926e4cf4cd5504b5e9449b", "score": "0.5200028", "text": "func (t Tree) leafKey(key []byte) []byte {\n\treturn t.nodeKey(0, key)\n}", "title": "" }, { "docid": "fa7088653cfb4479b0facb2b91c2635d", "score": "0.51588744", "text": "func FetchLeafHashes(ctx context.Context, f Fetcher, first, N, logSize uint64) ([][]byte, error) {\n\tnc := newNodeCache(newTileFetcher(f, logSize), logSize)\n\tret := make([][]byte, 0, N)\n\tfor i, seq := uint64(0), first; i < N; i, seq = i+1, seq+1 {\n\t\tnID := compact.NodeID{Level: 0, Index: seq}\n\t\th, err := nc.GetNode(ctx, nID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to fetch node %v: %v\", nID, err)\n\t\t}\n\t\tret = append(ret, h)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "5d3938df2c289bd4d69079c3f83c90ce", "score": "0.5121554", "text": "func (c *Checkpoint) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(c)\n}", "title": "" }, { "docid": "3238a6b721b80c5a0a3eb8bcb4493ead", "score": "0.51048106", "text": "func (b *BeaconState) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(b)\n}", "title": "" }, { "docid": "6c5fb2e02afc1fa463477ed1d0c6ade5", "score": "0.51018447", "text": "func hashBranch(leftNode, rightNode *types.Node) (branchNode *types.Node) {\n\t// 如果只有一个node,则该node 为branch node\n\tif rightNode == nil {\n\t\treturn leftNode\n\t}\n\thLeafNodeId := sha256.Sum256(leftNode.ID)\n\thRightNodeId := sha256.Sum256(rightNode.ID)\n\t// hLeafNodeMaxRange := sha256.Sum256(PaddedBigBytes(big.NewInt(int64(leftNode.MaxByteRange)), 32))\n\thLeafNodeMaxRange := sha256.Sum256(intToBuffer(leftNode.MaxByteRange))\n\t// id := hashArray([][]byte{hLeafNodeId[:], hRightNodeId[:], hLeafNodeMaxRange[:]})\n\tid := Hash([][]byte{hLeafNodeId[:], hRightNodeId[:], hLeafNodeMaxRange[:]})\n\tbranchNode = &types.Node{\n\t\tType: types.BranchNodeType,\n\t\tID: id,\n\t\tDataHash: nil,\n\t\tMinByteRange: 0,\n\t\tMaxByteRange: rightNode.MaxByteRange,\n\t\tByteRange: leftNode.MaxByteRange,\n\t\tLeftChild: leftNode,\n\t\tRightChild: rightNode,\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6beb886dc2dc233722801fe712442d6b", "score": "0.509083", "text": "func TestNewMerkleTree(t *testing.T) {\n\tdata := [][]byte{\n\t\t[]byte(\"node1\"),\n\t\t[]byte(\"node2\"),\n\t\t[]byte(\"node3\"),\n\t\t[]byte(\"node4\"),\n\t\t[]byte(\"node5\"),\n\t}\n\t// Level 1\n\tn11 := NewMerkleNode(nil, nil, data[0])\n\tn12 := NewMerkleNode(nil, nil, data[1])\n\tn13 := NewMerkleNode(nil, nil, data[2])\n\tn14 := NewMerkleNode(nil, nil, data[3])\n\tn15 := NewMerkleNode(nil, nil, data[4])\n\n\t// Level 2\n\tn21 := NewMerkleNode(n11, n12, nil)\n\tn22 := NewMerkleNode(n13, n14, nil)\n\tn23 := NewMerkleNode(n15, n15, nil)\n\n\t// Level 3\n\tn31 := NewMerkleNode(n21, n22, nil)\n\tn32 := NewMerkleNode(n23, n23, nil)\n\n\t// Level 4\n\tn41 := NewMerkleNode(n31, n32, nil)\n\n\trootHash := fmt.Sprintf(\"%x\", n41.Data)\n\tmTree := NewMerkleTree(data)\n\n\tassert.Equal(t, rootHash, fmt.Sprintf(\"%x\", mTree.RootNode.Data), \"Merkle tree root hash is correct\")\n}", "title": "" }, { "docid": "3bf261253dac88e4a557b9bff5df2617", "score": "0.50875205", "text": "func (b *BeaconBlockBody) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(b)\n}", "title": "" }, { "docid": "3bf261253dac88e4a557b9bff5df2617", "score": "0.50875205", "text": "func (b *BeaconBlockBody) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(b)\n}", "title": "" }, { "docid": "6365ed7cc015f3b7eb737ac848112c9c", "score": "0.5070411", "text": "func (v *Validator) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(v)\n}", "title": "" }, { "docid": "6a701a695683eb0f3666c129fbf13bfd", "score": "0.5069646", "text": "func (_ZSLMerkleTree *ZSLMerkleTreeCaller) GetLeafIndex(opts *bind.CallOpts, cm [32]byte) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ZSLMerkleTree.contract.Call(opts, out, \"getLeafIndex\", cm)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6c4c7324a8607370c0a53abfe6a9515b", "score": "0.50631607", "text": "func (t *Tree) Hash() Hash {\n\treturn t.root.Hash()\n}", "title": "" }, { "docid": "2cb8d88c59aaf1827c6d740bfaafdf44", "score": "0.5046218", "text": "func (b *BeaconBlock) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(b)\n}", "title": "" }, { "docid": "6f16ae891e7613c35cde576988dfe403", "score": "0.50358874", "text": "func (sf *factory) RootHash() hash.Hash32B {\n\treturn sf.accountTrie.RootHash()\n}", "title": "" }, { "docid": "bada6c508fd18f7062f8c7364679fda7", "score": "0.5032531", "text": "func (sf *stateFactory) RootHash() common.Hash32B {\n\treturn sf.trie.RootHash()\n}", "title": "" }, { "docid": "1f7f3416d6e7a186d6049742ed784de2", "score": "0.50312155", "text": "func (b *Block) GenerateMerkelRoot() []byte {\n\n\t//var merkell func(hashes [][]byte) []byte\n\t/*\n\t\t\tmerkell = func(hashes [][]byte) []byte {\n\n\t\t\t\t//\n\t\t\t\tnumNodes := len(hashes)\n\t\t\t\tselect {\n\t\t\t\tcase numNodes == 0:\n\t\t\t\t\treturn nil\n\t\t\t\tcase numNodes == 1:\n\t\t\t\t\treturn hashes[0]\n\t\t\t\tcase numNodes%2 == 1:\n\t\t\t\t\treturn merkell([][]byte{\n\t\t\t\t\t\tmerkell(hashes[:numNodes-1]), hashes[numNodes-1]\n\t\t\t\t\t})\n\t\t\t\tdefault:\n\t\t\t\t\tbs := make([][]byte, numNodes/2)\n\t\t\t\t\tfor i := range bs {\n\t\t\t\t\t\tj, k := i*2, (i*2)+1\n\t\t\t\t\t\thash := sha256.New()\n\t\t\t\t\t\tbs[i] = hash.Write(append(hashes[j], hashes[k]...))\n\t\t\t\t\t}\n\t\t\t\t\treturn merkell(bs)\n\t\t\t\t}\n\t\t\t}\n\n\t\tts := functional.Map(\n\t\t\tfunc(t Transaction) []byte {\n\t\t\t\treturn t.Hash()\n\t\t\t},\n\t\t\t[]Transaction(*b.TransactionSlice)).([][]byte)\n\t*/\n\treturn nil //merkell(ts)\n\n}", "title": "" }, { "docid": "aead7b7a7b468b5ba74e80b28d6978de", "score": "0.5023694", "text": "func (e *Eth1Data) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(e)\n}", "title": "" }, { "docid": "6c0d296ddae5d3a6a6df15f2dd38ef90", "score": "0.50172764", "text": "func (b *Block) hash_block(value p1.MerklePatriciaTrie) string {\n\t//hash_str := string(header.Height) + string(header.Timestamp) + header.ParentHash + value.GetRoot() + string(header.Size)\n\thash_str := string(b.Header.Height) + string(b.Header.Timestamp) + b.Header.ParentHash + value.GetRoot() + string(b.Header.Size)\n\thash := sha3.Sum256([]byte(hash_str))\n\thash_str = hex.EncodeToString(hash[:])\n\treturn hash_str\n}", "title": "" }, { "docid": "2df5c12fee0ae27cb28deb9228136110", "score": "0.5010491", "text": "func GetMerkleRoot(hashes []common.Hash) (common.Hash, error) {\n\tif len(hashes) == 0 {\n\t\treturn common.Hash{}, nil\n\t}\n\tif len(hashes) == 1 {\n\t\treturn hashes[0], nil\n\t}\n\n\treturn NewMerkleTree(hashes).Root.hash, nil\n}", "title": "" }, { "docid": "4f098bb9ca07f938b66a12cd159bfb9d", "score": "0.5003596", "text": "func (tn *BuildTreeNode) hash() string {\n\thash := string(tn.char)\n\tif tn.final {\n\t\thash += \"1\"\n\t} else {\n\t\thash += \"0\"\n\t}\n\n\t// Iterating a map is not deterministic in its ordering,\n\t// so we have to copy the values into a slice and sort it.\n\ttmp := make([]string, 0, len(tn.Edges))\n\tfor char, child := range tn.Edges {\n\t\ttmp = append(tmp, string(char)+strconv.Itoa(child.id))\n\t}\n\tsort.Strings(tmp)\n\thash += strings.Join(tmp, \"_\")\n\n\treturn hash\n}", "title": "" }, { "docid": "17b4e4f8279ab5919520f94b40c398f8", "score": "0.49993247", "text": "func (e *Eth1Block) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(e)\n}", "title": "" }, { "docid": "fd3bacc35133d1277a2fcfd556abf3e1", "score": "0.4985212", "text": "func (h HashFn) HashTreeRoot(fields ...HTR) Root {\n\t// TODO; benchmark, may be worth hard-coding a few more common short-paths\n\tn := uint64(len(fields))\n\tswitch n {\n\tcase 0:\n\t\treturn Root{}\n\tcase 1:\n\t\treturn fields[0].HashTreeRoot(h)\n\tcase 2:\n\t\treturn h(fields[0].HashTreeRoot(h), fields[1].HashTreeRoot(h))\n\tdefault:\n\t\treturn Merkleize(h, uint64(len(fields)), uint64(len(fields)), func(i uint64) Root {\n\t\t\treturn fields[i].HashTreeRoot(h)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "b7069bc14ce96a1c88d96a1743100e6c", "score": "0.49823782", "text": "func (s *SignedBeaconBlockHeader) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(s)\n}", "title": "" }, { "docid": "a5d8d60e6f3dbb50fd805600fa67e22d", "score": "0.4946727", "text": "func (bundle *ClustersPerPolicyBundle) GetLeafHubName() string {\n\treturn bundle.LeafHubName\n}", "title": "" }, { "docid": "1081d0c1965bda110fcb043383b938a0", "score": "0.4933954", "text": "func (n *NodeService) CommitHash() (string, error) {\n\tvar c string\n\tquery := \"/monitor/commit_hash\"\n\tresp, err := n.gt.Get(query, nil)\n\tif err != nil {\n\t\treturn c, errors.Wrapf(err, \"could not node commit hash '%s'\", query)\n\t}\n\n\tc, err = unmarshalString(resp)\n\tif err != nil {\n\t\treturn c, errors.Wrapf(err, \"could not node commit hash '%s'\", query)\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "a51aa546986749f039c8942daa9f393a", "score": "0.49292403", "text": "func (v *VoluntaryExit) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(v)\n}", "title": "" }, { "docid": "ee3d54cdd655ebaac66a00a04fc931a2", "score": "0.49262816", "text": "func HashTree(path string, write bool) (string, error) {\n\tt, err := NewTreeFromDirectory(path)\n\tif errors.Is(err, ErrEmptyTree) {\n\t\treturn \"\", errors.New(\"directory is empty\")\n\t} else if err != nil {\n\t\treturn \"\", err\n\t}\n\tif write {\n\t\tif err := t.Write(); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn CalculateHash(t)\n}", "title": "" }, { "docid": "adbce76930e6434a18bc74ba1182c903", "score": "0.49200624", "text": "func (_TokenDistributor *TokenDistributorCaller) MerkleRoot(opts *bind.CallOpts) ([32]byte, error) {\n\tvar out []interface{}\n\terr := _TokenDistributor.contract.Call(opts, &out, \"merkleRoot\")\n\n\tif err != nil {\n\t\treturn *new([32]byte), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "5105ec434900ab463deb987d34586e5f", "score": "0.49043602", "text": "func Hash(root string, excludePaths []string) (*[32]byte, error) {\n\tl, err := ListBytes(root, excludePaths)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\th := sha256.Sum256(l)\n\treturn &h, nil\n}", "title": "" }, { "docid": "0d012af50345448b1f651f1df3ec6ea3", "score": "0.48984537", "text": "func (t *Transfer) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(t)\n}", "title": "" }, { "docid": "4d28368c0cfdcc51a29cf57dfd158319", "score": "0.4897249", "text": "func (n *NodeService) CommitHash() (string, error) {\n\tvar c string\n\tquery := \"/monitor/commit_hash\"\n\tresp, err := n.tzclient.Get(query, nil)\n\tif err != nil {\n\t\treturn c, errors.Wrapf(err, \"could not node commit hash '%s'\", query)\n\t}\n\n\tc, err = unmarshalString(resp)\n\tif err != nil {\n\t\treturn c, errors.Wrapf(err, \"could not node commit hash '%s'\", query)\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "e8b1d5e8f9c6a26381e3e00b5751ec71", "score": "0.48951262", "text": "func (st *Store) LatestRootHash() []byte {\n\treturn st.tree.WorkingHash()\n}", "title": "" }, { "docid": "2507d8acee575c11b1fc0c67ee3ea88a", "score": "0.4885345", "text": "func buildMerkleTree(hashes []chainhash.Hash) []*chainhash.Hash {\n\t// Calculate how many entries are required to hold the binary merkle\n\t// tree as a linear array and create an array of that size.\n\tnextPoT := nextPow(len(hashes))\n\tarraySize := nextPoT*2 - 1\n\tmerkles := make([]*chainhash.Hash, arraySize)\n\n\t// Create the base transaction hashes and populate the array with them.\n\tfor i := range hashes {\n\t\tmerkles[i] = &hashes[i]\n\t}\n\n\t// Start the array offset after the last transaction and adjusted to the\n\t// next power of two.\n\toffset := nextPoT\n\tfor i := 0; i < arraySize-1; i += 2 {\n\t\tswitch {\n\t\t// When there is no left child node, the parent is nil too.\n\t\tcase merkles[i] == nil:\n\t\t\tmerkles[offset] = nil\n\n\t\t// When there is no right child, the parent is generated by\n\t\t// hashing the concatenation of the left child with itself.\n\t\tcase merkles[i+1] == nil:\n\t\t\tnewHash := hashLeaves(*merkles[i], *merkles[i])\n\t\t\tmerkles[offset] = newHash\n\n\t\t// The normal case sets the parent node to the double sha256\n\t\t// of the concatentation of the left and right children.\n\t\tdefault:\n\t\t\tnewHash := hashLeaves(*merkles[i], *merkles[i+1])\n\t\t\tmerkles[offset] = newHash\n\t\t}\n\t\toffset++\n\t}\n\n\treturn merkles\n}", "title": "" }, { "docid": "050e19739976d907ad323621905ab093", "score": "0.48850626", "text": "func (b *BeaconBlockBody) HashTreeRootWith(hh *ssz.Hasher) (err error) {\n\tindx := hh.Index()\n\n\t// Field (0) 'RANDAOReveal'\n\thh.PutBytes(b.RANDAOReveal[:])\n\n\t// Field (1) 'ETH1Data'\n\tif err = b.ETH1Data.HashTreeRootWith(hh); err != nil {\n\t\treturn\n\t}\n\n\t// Field (2) 'Graffiti'\n\tif len(b.Graffiti) != 32 {\n\t\terr = ssz.ErrBytesLength\n\t\treturn\n\t}\n\thh.PutBytes(b.Graffiti)\n\n\t// Field (3) 'ProposerSlashings'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.ProposerSlashings))\n\t\tif num > 16 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.ProposerSlashings[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 16)\n\t}\n\n\t// Field (4) 'AttesterSlashings'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.AttesterSlashings))\n\t\tif num > 2 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.AttesterSlashings[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 2)\n\t}\n\n\t// Field (5) 'Attestations'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.Attestations))\n\t\tif num > 128 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.Attestations[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 128)\n\t}\n\n\t// Field (6) 'Deposits'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.Deposits))\n\t\tif num > 16 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.Deposits[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 16)\n\t}\n\n\t// Field (7) 'VoluntaryExits'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.VoluntaryExits))\n\t\tif num > 16 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.VoluntaryExits[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 16)\n\t}\n\n\thh.Merkleize(indx)\n\treturn\n}", "title": "" }, { "docid": "a0b5b6ddc7b1d7dc0df9a44844afc575", "score": "0.48785037", "text": "func (b *BeaconState) HashTreeRootWith(hh *ssz.Hasher) (err error) {\n\tindx := hh.Index()\n\n\t// Field (0) 'GenesisTime'\n\thh.PutUint64(b.GenesisTime)\n\n\t// Field (1) 'Slot'\n\thh.PutUint64(b.Slot)\n\n\t// Field (2) 'Fork'\n\tif err = b.Fork.HashTreeRootWith(hh); err != nil {\n\t\treturn\n\t}\n\n\t// Field (3) 'LatestBlockHeader'\n\tif err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil {\n\t\treturn\n\t}\n\n\t// Field (4) 'BlockRoots'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tfor _, i := range b.BlockRoots {\n\t\t\thh.Append(i[:])\n\t\t}\n\t\thh.Merkleize(subIndx)\n\t}\n\n\t// Field (5) 'StateRoots'\n\t{\n\t\tif len(b.StateRoots) != 64 {\n\t\t\terr = ssz.ErrVectorLength\n\t\t\treturn\n\t\t}\n\t\tsubIndx := hh.Index()\n\t\tfor _, i := range b.StateRoots {\n\t\t\thh.Append(i[:])\n\t\t}\n\t\thh.Merkleize(subIndx)\n\t}\n\n\t// Field (6) 'HistoricalRoots'\n\t{\n\t\tif len(b.HistoricalRoots) > 16777216 {\n\t\t\terr = ssz.ErrListTooBig\n\t\t\treturn\n\t\t}\n\t\tsubIndx := hh.Index()\n\t\tfor _, i := range b.HistoricalRoots {\n\t\t\thh.Append(i[:])\n\t\t}\n\t\tnumItems := uint64(len(b.HistoricalRoots))\n\t\thh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(16777216, numItems, 32))\n\t}\n\n\t// Field (7) 'Eth1Data'\n\tif err = b.Eth1Data.HashTreeRootWith(hh); err != nil {\n\t\treturn\n\t}\n\n\t// Field (8) 'Eth1DataVotes'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.Eth1DataVotes))\n\t\tif num > 16 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.Eth1DataVotes[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 16)\n\t}\n\n\t// Field (9) 'Eth1DepositIndex'\n\thh.PutUint64(b.Eth1DepositIndex)\n\n\t// Field (10) 'Validators'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.Validators))\n\t\tif num > 1099511627776 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.Validators[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 1099511627776)\n\t}\n\n\t// Field (11) 'Balances'\n\t{\n\t\tif len(b.Balances) > 1099511627776 {\n\t\t\terr = ssz.ErrListTooBig\n\t\t\treturn\n\t\t}\n\t\tsubIndx := hh.Index()\n\t\tfor _, i := range b.Balances {\n\t\t\thh.AppendUint64(i)\n\t\t}\n\t\thh.FillUpTo32()\n\t\tnumItems := uint64(len(b.Balances))\n\t\thh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8))\n\t}\n\n\t// Field (12) 'RandaoMixes'\n\t{\n\t\tif len(b.RandaoMixes) != 64 {\n\t\t\terr = ssz.ErrVectorLength\n\t\t\treturn\n\t\t}\n\t\tsubIndx := hh.Index()\n\t\tfor _, i := range b.RandaoMixes {\n\t\t\tif len(i) != 32 {\n\t\t\t\terr = ssz.ErrBytesLength\n\t\t\t\treturn\n\t\t\t}\n\t\t\thh.Append(i)\n\t\t}\n\t\thh.Merkleize(subIndx)\n\t}\n\n\t// Field (13) 'Slashings'\n\t{\n\t\tif len(b.Slashings) != 64 {\n\t\t\terr = ssz.ErrVectorLength\n\t\t\treturn\n\t\t}\n\t\tsubIndx := hh.Index()\n\t\tfor _, i := range b.Slashings {\n\t\t\thh.AppendUint64(i)\n\t\t}\n\t\thh.Merkleize(subIndx)\n\t}\n\n\t// Field (14) 'PreviousEpochAttestations'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.PreviousEpochAttestations))\n\t\tif num > 1024 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.PreviousEpochAttestations[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 1024)\n\t}\n\n\t// Field (15) 'CurrentEpochAttestations'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.CurrentEpochAttestations))\n\t\tif num > 1024 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.CurrentEpochAttestations[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 1024)\n\t}\n\n\t// Field (16) 'JustificationBits'\n\tif len(b.JustificationBits) != 1 {\n\t\terr = ssz.ErrBytesLength\n\t\treturn\n\t}\n\thh.PutBytes(b.JustificationBits)\n\n\t// Field (17) 'PreviousJustifiedCheckpoint'\n\tif err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil {\n\t\treturn\n\t}\n\n\t// Field (18) 'CurrentJustifiedCheckpoint'\n\tif err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil {\n\t\treturn\n\t}\n\n\t// Field (19) 'FinalizedCheckpoint'\n\tif err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil {\n\t\treturn\n\t}\n\n\thh.Merkleize(indx)\n\treturn\n}", "title": "" }, { "docid": "36d623050a85cba3b61872b157231912", "score": "0.48716927", "text": "func (f *Fork) HashTreeRootWith(hh *ssz.Hasher) (err error) {\n\tindx := hh.Index()\n\n\t// Field (0) 'PreviousVersion'\n\tif len(f.PreviousVersion) != 4 {\n\t\terr = ssz.ErrBytesLength\n\t\treturn\n\t}\n\thh.PutBytes(f.PreviousVersion)\n\n\t// Field (1) 'CurrentVersion'\n\tif len(f.CurrentVersion) != 4 {\n\t\terr = ssz.ErrBytesLength\n\t\treturn\n\t}\n\thh.PutBytes(f.CurrentVersion)\n\n\t// Field (2) 'Epoch'\n\thh.PutUint64(f.Epoch)\n\n\thh.Merkleize(indx)\n\treturn\n}", "title": "" }, { "docid": "a3974e9e01effed32bb6b1c517ca4f08", "score": "0.4858584", "text": "func (dln *DictionaryLeafNode) GetGraphHash() []byte {\n\treturn dln.GetHash()\n}", "title": "" }, { "docid": "ea92de6fdc6964ea13598af9af9ffbcb", "score": "0.4850367", "text": "func GetNodeHashForKey(key string) uint64 {\n\n keyHash := Hashcode(key)\n keys := circle.Keys()\n\n return keys[getNodeIndex(keys, keyHash, 0)].(uint64)\n}", "title": "" }, { "docid": "804415cb5f96d270f697880d5c311911", "score": "0.48416153", "text": "func hashNode(out *[sha512.Size256]byte, left, right []byte) {\n\th := sha512trunc.New()\n\th.Write(hashNodeTweak)\n\th.Write(left)\n\th.Write(right)\n\th.Sum(out[:0])\n}", "title": "" }, { "docid": "a31ae6d6da9e4b5c7568f5c4aac9aae5", "score": "0.48386848", "text": "func (m *MsgDeposit) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(m)\n}", "title": "" }, { "docid": "f751ec9bc16161bd0f6584a122c66d11", "score": "0.48379213", "text": "func (d *DepositData) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(d)\n}", "title": "" }, { "docid": "278e699d99b454679c4e6e751b914dac", "score": "0.4835529", "text": "func (d *Deposit) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(d)\n}", "title": "" }, { "docid": "278e699d99b454679c4e6e751b914dac", "score": "0.4835529", "text": "func (d *Deposit) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(d)\n}", "title": "" }, { "docid": "0e55e9900acffa8d66197ce32c05eb54", "score": "0.4832586", "text": "func (blk *File) ReadBlockHeaderMerkle() chainhash.Hash {\n\tbuffer := blk.readStaticSize(BlockHeaderMerkle)\n\treturn converter.Convert32Bytes(buffer)\n}", "title": "" }, { "docid": "fc059c938bb47e2e85aee5fecceeeca8", "score": "0.48325238", "text": "func node_to_leaf_number(node_number uint64) uint64 {\n\treturn (node_number + 1) / 2\n}", "title": "" }, { "docid": "8824a5e3c436f5d941936783de741792", "score": "0.4832303", "text": "func (h *Backend) KeyLeaf(key string) string {\n\telems := h.SplitKey(key)\n\tif len(elems) > 0 {\n\t\treturn elems[len(elems)-1]\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "3e1cab7b55bfcdf17991c8dce1697452", "score": "0.48237124", "text": "func (d *DepositMessage) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(d)\n}", "title": "" }, { "docid": "fdd3eed11b0b2593ef9e36ba9854c8ff", "score": "0.48213208", "text": "func (e *Eth1Block) HashTreeRootWith(hh *ssz.Hasher) (err error) {\n\tindx := hh.Index()\n\n\t// Field (0) 'Timestamp'\n\thh.PutUint64(e.Timestamp)\n\n\thh.Merkleize(indx)\n\treturn\n}", "title": "" }, { "docid": "7eb641fdcde67af7a9177474740ce68e", "score": "0.4819814", "text": "func RootHash() Hash {\n\treturn Hash(make([]byte, shaHashSize))\n}", "title": "" }, { "docid": "aa8b578496d522db47511cf14e7dc48b", "score": "0.48192263", "text": "func (h *HistoricalBatch) HashTreeRootWith(hh *ssz.Hasher) (err error) {\n\tindx := hh.Index()\n\n\t// Field (0) 'BlockRoots'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tfor _, i := range h.BlockRoots {\n\t\t\thh.Append(i[:])\n\t\t}\n\t\thh.Merkleize(subIndx)\n\t}\n\n\t// Field (1) 'StateRoots'\n\t{\n\t\tif len(h.StateRoots) != 64 {\n\t\t\terr = ssz.ErrVectorLength\n\t\t\treturn\n\t\t}\n\t\tsubIndx := hh.Index()\n\t\tfor _, i := range h.StateRoots {\n\t\t\tif len(i) != 32 {\n\t\t\t\terr = ssz.ErrBytesLength\n\t\t\t\treturn\n\t\t\t}\n\t\t\thh.Append(i)\n\t\t}\n\t\thh.Merkleize(subIndx)\n\t}\n\n\thh.Merkleize(indx)\n\treturn\n}", "title": "" }, { "docid": "5d9c35205c19896c65cecf1fd57938cf", "score": "0.48152733", "text": "func deriveHash_1(object *TreeNode) uint64 {\n\tif object == nil {\n\t\treturn 0\n\t}\n\th := uint64(17)\n\th = 31*h + deriveHash_14(object.Name)\n\th = 31*h + deriveHash_13(object.Colon)\n\th = 31*h + deriveHash(object.Pattern)\n\treturn h\n}", "title": "" }, { "docid": "49ee7d0ad20d87be8a87bb753612b7c3", "score": "0.48090217", "text": "func (b *block) getRootHash() []byte {\n\treturn b.rootHash\n\t/*\n\t\tret := make([]byte, len(b.rootHash))\n\n\t\tcopy(ret, b.rootHash)\n\n\t\treturn ret\n\t*/\n}", "title": "" }, { "docid": "f75e7d4d8fd926aa483fc55121006bf6", "score": "0.4796005", "text": "func deriveHash_2(object *LeafNode) uint64 {\n\tif object == nil {\n\t\treturn 0\n\t}\n\th := uint64(17)\n\th = 31*h + deriveHash_15(object.Expr)\n\treturn h\n}", "title": "" }, { "docid": "f702d8514cadcf3b19e3e2cc4c56358a", "score": "0.47882926", "text": "func (root *RootValue) HashOf() (hash.Hash, error) {\n\treturn root.valueSt.Hash(root.vrw.Format())\n}", "title": "" }, { "docid": "6460b66eca47dc5f1d2592784791b0b0", "score": "0.47857174", "text": "func (fd *fileDescription) generateMerkle(ctx context.Context) ([]byte, uint64, error) {\n\tfdReader := vfs.FileReadWriteSeeker{\n\t\tFD: fd.lowerFD,\n\t\tCtx: ctx,\n\t}\n\tmerkleReader := vfs.FileReadWriteSeeker{\n\t\tFD: fd.merkleReader,\n\t\tCtx: ctx,\n\t}\n\tmerkleWriter := vfs.FileReadWriteSeeker{\n\t\tFD: fd.merkleWriter,\n\t\tCtx: ctx,\n\t}\n\tparams := &merkletree.GenerateParams{\n\t\tTreeReader: &merkleReader,\n\t\tTreeWriter: &merkleWriter,\n\t\t//TODO(b/156980949): Support passing other hash algorithms.\n\t\tHashAlgorithms: fd.d.fs.alg.toLinuxHashAlg(),\n\t}\n\n\tswitch atomic.LoadUint32(&fd.d.mode) & linux.S_IFMT {\n\tcase linux.S_IFREG:\n\t\t// For a regular file, generate a Merkle tree based on its\n\t\t// content.\n\t\tvar err error\n\t\tstat, err := fd.lowerFD.Stat(ctx, vfs.StatOptions{})\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\tparams.File = &fdReader\n\t\tparams.Size = int64(stat.Size)\n\t\tparams.Name = fd.d.name\n\t\tparams.Mode = uint32(stat.Mode)\n\t\tparams.UID = stat.UID\n\t\tparams.GID = stat.GID\n\t\tparams.DataAndTreeInSameFile = false\n\tcase linux.S_IFDIR:\n\t\t// For a directory, generate a Merkle tree based on the hashes\n\t\t// of its children that has already been written to the Merkle\n\t\t// tree file.\n\t\tmerkleStat, err := fd.merkleReader.Stat(ctx, vfs.StatOptions{})\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\tparams.Size = int64(merkleStat.Size)\n\n\t\tstat, err := fd.lowerFD.Stat(ctx, vfs.StatOptions{})\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\tparams.File = &merkleReader\n\t\tparams.Name = fd.d.name\n\t\tparams.Mode = uint32(stat.Mode)\n\t\tparams.UID = stat.UID\n\t\tparams.GID = stat.GID\n\t\tparams.DataAndTreeInSameFile = true\n\tdefault:\n\t\t// TODO(b/167728857): Investigate whether and how we should\n\t\t// enable other types of file.\n\t\treturn nil, 0, syserror.EINVAL\n\t}\n\thash, err := merkletree.Generate(params)\n\treturn hash, uint64(params.Size), err\n}", "title": "" }, { "docid": "619cc18106ac9e2d4359ff5e1b1656b7", "score": "0.4783701", "text": "func (s *SignedBeaconBlock) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(s)\n}", "title": "" }, { "docid": "4ab1d6d5fc2f2a6224c0121c71513b08", "score": "0.47807485", "text": "func (a *AggregateAndProof) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(a)\n}", "title": "" }, { "docid": "60169adb7b0d9def551d9d8f8875e2d0", "score": "0.4780031", "text": "func makeLeaf(value byte) HuffmanTree {\n\treturn HuffmanTree{Value: value}\n}", "title": "" }, { "docid": "4bf0e84dc3098026eb565d51883767c9", "score": "0.4764495", "text": "func NewMerkleLibCaller(address common.Address, caller bind.ContractCaller) (*MerkleLibCaller, error) {\n\tcontract, err := bindMerkleLib(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &MerkleLibCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "e896d459c566e55f1a483c98de04d1b9", "score": "0.47619557", "text": "func (t *logTreeTX) getLeafDataByIdentityHash(ctx context.Context, leafHashes [][]byte) ([]*trillian.LogLeaf, error) {\n\ttmpl, err := t.ls.getLeavesByLeafIdentityHashStmt(ctx, len(leafHashes))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn t.getLeavesByHashInternal(ctx, leafHashes, tmpl, \"leaf-identity\")\n}", "title": "" }, { "docid": "4202eaec4974b837ed77832fcd69ac8b", "score": "0.47545892", "text": "func (b *BeaconBlockBody) HashTreeRootWith(hh *ssz.Hasher) (err error) {\n\tindx := hh.Index()\n\n\t// Field (0) 'RandaoReveal'\n\tif len(b.RandaoReveal) != 96 {\n\t\terr = ssz.ErrBytesLength\n\t\treturn\n\t}\n\thh.PutBytes(b.RandaoReveal)\n\n\t// Field (1) 'Eth1Data'\n\tif err = b.Eth1Data.HashTreeRootWith(hh); err != nil {\n\t\treturn\n\t}\n\n\t// Field (2) 'Graffiti'\n\thh.PutBytes(b.Graffiti[:])\n\n\t// Field (3) 'ProposerSlashings'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.ProposerSlashings))\n\t\tif num > 16 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.ProposerSlashings[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 16)\n\t}\n\n\t// Field (4) 'AttesterSlashings'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.AttesterSlashings))\n\t\tif num > 1 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.AttesterSlashings[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 1)\n\t}\n\n\t// Field (5) 'Attestations'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.Attestations))\n\t\tif num > 128 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.Attestations[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 128)\n\t}\n\n\t// Field (6) 'Deposits'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.Deposits))\n\t\tif num > 16 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.Deposits[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 16)\n\t}\n\n\t// Field (7) 'VoluntaryExits'\n\t{\n\t\tsubIndx := hh.Index()\n\t\tnum := uint64(len(b.VoluntaryExits))\n\t\tif num > 16 {\n\t\t\terr = ssz.ErrIncorrectListSize\n\t\t\treturn\n\t\t}\n\t\tfor i := uint64(0); i < num; i++ {\n\t\t\tif err = b.VoluntaryExits[i].HashTreeRootWith(hh); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\thh.MerkleizeWithMixin(subIndx, num, 16)\n\t}\n\n\thh.Merkleize(indx)\n\treturn\n}", "title": "" }, { "docid": "1ff2e9ea9a53a7070c5ffbc71ed9e909", "score": "0.4751126", "text": "func (t TapBranch) TapHash() chainhash.Hash {\n\tleftHash := t.leftNode.TapHash()\n\trightHash := t.rightNode.TapHash()\n\treturn tapBranchHash(leftHash[:], rightHash[:])\n}", "title": "" }, { "docid": "7147dfa8a886305ea75004bec74a59b5", "score": "0.47470608", "text": "func (e *Eth1Data) HashTreeRootWith(hh *ssz.Hasher) (err error) {\n\tindx := hh.Index()\n\n\t// Field (0) 'DepositRoot'\n\tif len(e.DepositRoot) != 32 {\n\t\terr = ssz.ErrBytesLength\n\t\treturn\n\t}\n\thh.PutBytes(e.DepositRoot)\n\n\t// Field (1) 'DepositCount'\n\thh.PutUint64(e.DepositCount)\n\n\t// Field (2) 'BlockHash'\n\tif len(e.BlockHash) != 32 {\n\t\terr = ssz.ErrBytesLength\n\t\treturn\n\t}\n\thh.PutBytes(e.BlockHash)\n\n\thh.Merkleize(indx)\n\treturn\n}", "title": "" }, { "docid": "73d45d058a351fee699601c43376ce07", "score": "0.47454447", "text": "func NewMerkleNode(left, right *MerkleNode, data []byte) *MerkleNode{\n var hash [32]byte\n if left == nil && right == nil {\n hash = sha256.Sum256(data)\n } else {\n hash = sha256.Sum256(append(left.data, right.data...))\n }\n return &MerkleNode{left, right, hash[:]}\n}", "title": "" }, { "docid": "10bf43d4d28d80f5e483f8040b54f1a0", "score": "0.47366485", "text": "func (c *ControlBlock) RootHash(revealedScript []byte) []byte {\n\t// We'll start by creating a new tapleaf from the revealed script,\n\t// this'll serve as the initial hash we'll use to incrementally\n\t// reconstruct the merkle root using the control block elements.\n\tmerkleAccumulator := NewTapLeaf(c.LeafVersion, revealedScript).TapHash()\n\n\t// Now that we have our initial hash, we'll parse the control block one\n\t// node at a time to build up our merkle accumulator into the taproot\n\t// commitment.\n\t//\n\t// The control block is a series of nodes that serve as an inclusion\n\t// proof as we can start hashing with our leaf, with each internal\n\t// branch, until we reach the root.\n\tnumNodes := len(c.InclusionProof) / ControlBlockNodeSize\n\tfor nodeOffset := 0; nodeOffset < numNodes; nodeOffset++ {\n\t\t// Extract the new node using our index to serve as a 32-byte\n\t\t// offset.\n\t\tleafOffset := 32 * nodeOffset\n\t\tnextNode := c.InclusionProof[leafOffset : leafOffset+32]\n\n\t\tmerkleAccumulator = tapBranchHash(merkleAccumulator[:], nextNode)\n\t}\n\n\treturn merkleAccumulator[:]\n}", "title": "" }, { "docid": "246dec72f0d1b32d3942c4fd55d62761", "score": "0.4734965", "text": "func (_TokenDistributor *TokenDistributorCallerSession) MerkleRoot() ([32]byte, error) {\n\treturn _TokenDistributor.Contract.MerkleRoot(&_TokenDistributor.CallOpts)\n}", "title": "" } ]
e5965df511a7108e0032bbf23b7995fe
ProtoToServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold converts a ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold object from its proto representation.
[ { "docid": "781b0577dbe3ab013f98e5ab3509ce54", "score": "0.86610466", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold{\n\t\tPerformance: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformance(p.GetPerformance()),\n\t\tBasicSliPerformance: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformance(p.GetBasicSliPerformance()),\n\t\tThreshold: dcl.Float64OrNil(p.GetThreshold()),\n\t}\n\treturn obj\n}", "title": "" } ]
[ { "docid": "9ee3e083d3c554402d863bd0de0585b5", "score": "0.850553", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold{}\n\tp.SetPerformance(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceToProto(o.Performance))\n\tp.SetBasicSliPerformance(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceToProto(o.BasicSliPerformance))\n\tp.SetThreshold(dcl.ValueOrEmptyDouble(o.Threshold))\n\treturn p\n}", "title": "" }, { "docid": "8552722bc751c085e1a5bfbf8ca3570c", "score": "0.82763684", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformance(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformance) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformance {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformance{\n\t\tGoodTotalRatio: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatio(p.GetGoodTotalRatio()),\n\t\tDistributionCut: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCut(p.GetDistributionCut()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "62a946519ec9ffc64080f98981a14f7b", "score": "0.8222917", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatio(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatio) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatio {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatio{\n\t\tGoodServiceFilter: dcl.StringOrNil(p.GetGoodServiceFilter()),\n\t\tBadServiceFilter: dcl.StringOrNil(p.GetBadServiceFilter()),\n\t\tTotalServiceFilter: dcl.StringOrNil(p.GetTotalServiceFilter()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "a55b8d1019ada75487e8f8d53b608705", "score": "0.82116556", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformance) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformance {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformance{}\n\tp.SetGoodTotalRatio(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatioToProto(o.GoodTotalRatio))\n\tp.SetDistributionCut(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutToProto(o.DistributionCut))\n\treturn p\n}", "title": "" }, { "docid": "61649b78aa76649fb5561c5ec1a8dd76", "score": "0.8108238", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatioToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatio) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatio {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceGoodTotalRatio{}\n\tp.SetGoodServiceFilter(dcl.ValueOrEmptyString(o.GoodServiceFilter))\n\tp.SetBadServiceFilter(dcl.ValueOrEmptyString(o.BadServiceFilter))\n\tp.SetTotalServiceFilter(dcl.ValueOrEmptyString(o.TotalServiceFilter))\n\treturn p\n}", "title": "" }, { "docid": "2988d82e90a03c61023af96f6f93354e", "score": "0.75408584", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCut(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCut) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCut {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCut{\n\t\tDistributionFilter: dcl.StringOrNil(p.GetDistributionFilter()),\n\t\tRange: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRange(p.GetRange()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "33d843fdd46022550e2c485683c7866c", "score": "0.7332001", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRange(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRange) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRange {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRange{\n\t\tMin: dcl.Float64OrNil(p.GetMin()),\n\t\tMax: dcl.Float64OrNil(p.GetMax()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "641c576a18c4424c29733b25da028656", "score": "0.7157605", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatio(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatio) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatio {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatio{\n\t\tGoodServiceFilter: dcl.StringOrNil(p.GetGoodServiceFilter()),\n\t\tBadServiceFilter: dcl.StringOrNil(p.GetBadServiceFilter()),\n\t\tTotalServiceFilter: dcl.StringOrNil(p.GetTotalServiceFilter()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "b5ea250c08aeed21ff10089f538ac595", "score": "0.70674974", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatioToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatio) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatio {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatio{}\n\tp.SetGoodServiceFilter(dcl.ValueOrEmptyString(o.GoodServiceFilter))\n\tp.SetBadServiceFilter(dcl.ValueOrEmptyString(o.BadServiceFilter))\n\tp.SetTotalServiceFilter(dcl.ValueOrEmptyString(o.TotalServiceFilter))\n\treturn p\n}", "title": "" }, { "docid": "fbb26be9f06768804ab1c8e848318e71", "score": "0.69399893", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCut) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCut {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCut{}\n\tp.SetDistributionFilter(dcl.ValueOrEmptyString(o.DistributionFilter))\n\tp.SetRange(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRangeToProto(o.Range))\n\treturn p\n}", "title": "" }, { "docid": "c6f98cf6b27428d14404601642989fe3", "score": "0.69321495", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatency) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatency {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatency{}\n\tp.SetThreshold(dcl.ValueOrEmptyString(o.Threshold))\n\tp.SetExperience(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnumToProto(o.Experience))\n\treturn p\n}", "title": "" }, { "docid": "7ed55ad4ea0633e8b5b1d0e52b462774", "score": "0.6902378", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatency) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatency {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatency{}\n\tp.SetThreshold(dcl.ValueOrEmptyString(o.Threshold))\n\tp.SetExperience(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnumToProto(o.Experience))\n\treturn p\n}", "title": "" }, { "docid": "0769a64a5bc8c47e3c1b378d7c5decf3", "score": "0.6813624", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRangeToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRange) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRange {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdPerformanceDistributionCutRange{}\n\tp.SetMin(dcl.ValueOrEmptyDouble(o.Min))\n\tp.SetMax(dcl.ValueOrEmptyDouble(o.Max))\n\treturn p\n}", "title": "" }, { "docid": "1e31d49cfd31eb7a8bd264b3a979f647", "score": "0.6750772", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBased(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBased) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBased {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBased{\n\t\tGoodBadMetricFilter: dcl.StringOrNil(p.GetGoodBadMetricFilter()),\n\t\tGoodTotalRatioThreshold: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThreshold(p.GetGoodTotalRatioThreshold()),\n\t\tMetricMeanInRange: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRange(p.GetMetricMeanInRange()),\n\t\tMetricSumInRange: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRange(p.GetMetricSumInRange()),\n\t\tWindowPeriod: dcl.StringOrNil(p.GetWindowPeriod()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "7af755433a5d399faa1fb83095667b3a", "score": "0.6746526", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatency(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatency) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatency {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatency{\n\t\tThreshold: dcl.StringOrNil(p.GetThreshold()),\n\t\tExperience: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum(p.GetExperience()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "6e8b7f47a9e896631adec84ac081bf46", "score": "0.6742727", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatency(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatency) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatency {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatency{\n\t\tThreshold: dcl.StringOrNil(p.GetThreshold()),\n\t\tExperience: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum(p.GetExperience()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "b08226f72b2c1ddadb215c2149232dc1", "score": "0.6617628", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformance(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformance) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformance {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformance{\n\t\tAvailability: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailability(p.GetAvailability()),\n\t\tLatency: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatency(p.GetLatency()),\n\t\tOperationAvailability: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailability(p.GetOperationAvailability()),\n\t\tOperationLatency: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatency(p.GetOperationLatency()),\n\t}\n\tfor _, r := range p.GetMethod() {\n\t\tobj.Method = append(obj.Method, r)\n\t}\n\tfor _, r := range p.GetLocation() {\n\t\tobj.Location = append(obj.Location, r)\n\t}\n\tfor _, r := range p.GetVersion() {\n\t\tobj.Version = append(obj.Version, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "b99b3760ab1e6e6380a485c20849c24e", "score": "0.6611947", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformance) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformance {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformance{}\n\tp.SetAvailability(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailabilityToProto(o.Availability))\n\tp.SetLatency(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyToProto(o.Latency))\n\tp.SetOperationAvailability(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailabilityToProto(o.OperationAvailability))\n\tp.SetOperationLatency(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyToProto(o.OperationLatency))\n\tsMethod := make([]string, len(o.Method))\n\tfor i, r := range o.Method {\n\t\tsMethod[i] = r\n\t}\n\tp.SetMethod(sMethod)\n\tsLocation := make([]string, len(o.Location))\n\tfor i, r := range o.Location {\n\t\tsLocation[i] = r\n\t}\n\tp.SetLocation(sLocation)\n\tsVersion := make([]string, len(o.Version))\n\tfor i, r := range o.Version {\n\t\tsVersion[i] = r\n\t}\n\tp.SetVersion(sVersion)\n\treturn p\n}", "title": "" }, { "docid": "d74eab75af410d1902ae2993a5a000f3", "score": "0.65861154", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBased) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBased {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBased{}\n\tp.SetGoodBadMetricFilter(dcl.ValueOrEmptyString(o.GoodBadMetricFilter))\n\tp.SetGoodTotalRatioThreshold(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdToProto(o.GoodTotalRatioThreshold))\n\tp.SetMetricMeanInRange(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeToProto(o.MetricMeanInRange))\n\tp.SetMetricSumInRange(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeToProto(o.MetricSumInRange))\n\tp.SetWindowPeriod(dcl.ValueOrEmptyString(o.WindowPeriod))\n\treturn p\n}", "title": "" }, { "docid": "13289d418f932aff65114d88e1d8ed4c", "score": "0.6259757", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailabilityToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailability) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailability {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailability{}\n\treturn p\n}", "title": "" }, { "docid": "f86296887c0de4c08611da53e6876df3", "score": "0.62229604", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRange(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRange) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRange {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRange{\n\t\tTimeSeries: dcl.StringOrNil(p.GetTimeSeries()),\n\t\tRange: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRange(p.GetRange()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "0ba20dbf1eaa105ba01c8eb3835ca71c", "score": "0.6217499", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailabilityToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailability) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailability {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailability{}\n\treturn p\n}", "title": "" }, { "docid": "75b6a617f27714b45fcea316bb6676c6", "score": "0.610592", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRange(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRange) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRange {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRange{\n\t\tMin: dcl.Float64OrNil(p.GetMin()),\n\t\tMax: dcl.Float64OrNil(p.GetMax()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "1c327ef954ab43fd566105d206a07003", "score": "0.6010684", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailability(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailability) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailability {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceAvailability{}\n\treturn obj\n}", "title": "" }, { "docid": "65d98323ef7ab817d2151f0d8353d5b8", "score": "0.60090315", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnumToProto(e *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum) monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum {\n\tif e == nil {\n\t\treturn monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum(0)\n\t}\n\tif v, ok := monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum_value[\"ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum\"+string(*e)]; ok {\n\t\treturn monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum(v)\n\t}\n\treturn monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum(0)\n}", "title": "" }, { "docid": "adeedebff92d84f736d5f46ee8b394d5", "score": "0.59865826", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailability(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailability) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailability {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationAvailability{}\n\treturn obj\n}", "title": "" }, { "docid": "c3b919d830e6356ed3a0012078b396af", "score": "0.59405375", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRange(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRange) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRange {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRange{\n\t\tMin: dcl.Float64OrNil(p.GetMin()),\n\t\tMax: dcl.Float64OrNil(p.GetMax()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "4aa8dddc8605dc01bd54d77ca945d9fb", "score": "0.5938506", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnumToProto(e *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum) monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum {\n\tif e == nil {\n\t\treturn monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum(0)\n\t}\n\tif v, ok := monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum_value[\"ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum\"+string(*e)]; ok {\n\t\treturn monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum(v)\n\t}\n\treturn monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum(0)\n}", "title": "" }, { "docid": "5cd386fc6aec4580705f908c9a6124c0", "score": "0.5916668", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRange(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRange) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRange {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRange{\n\t\tTimeSeries: dcl.StringOrNil(p.GetTimeSeries()),\n\t\tRange: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRange(p.GetRange()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "ffd209ec412756009134673671875911", "score": "0.5909001", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRange) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRange {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRange{}\n\tp.SetTimeSeries(dcl.ValueOrEmptyString(o.TimeSeries))\n\tp.SetRange(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRangeToProto(o.Range))\n\treturn p\n}", "title": "" }, { "docid": "aba20a1941a7500b9704619d5df6c605", "score": "0.5819661", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRangeToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRange) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRange {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricSumInRangeRange{}\n\tp.SetMin(dcl.ValueOrEmptyDouble(o.Min))\n\tp.SetMax(dcl.ValueOrEmptyDouble(o.Max))\n\treturn p\n}", "title": "" }, { "docid": "8bb2dba8a3ff02aa75361b4b80c37ab0", "score": "0.5676968", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBased(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBased) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBased {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBased{\n\t\tGoodTotalRatio: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatio(p.GetGoodTotalRatio()),\n\t\tDistributionCut: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCut(p.GetDistributionCut()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "31c2a3d773f88802516a44cbbc66bd7f", "score": "0.56433475", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRange) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRange {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRange{}\n\tp.SetTimeSeries(dcl.ValueOrEmptyString(o.TimeSeries))\n\tp.SetRange(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRangeToProto(o.Range))\n\treturn p\n}", "title": "" }, { "docid": "f1517d89d968ff7e8271d969506780ad", "score": "0.561526", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRangeToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRange) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRange {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedMetricMeanInRangeRange{}\n\tp.SetMin(dcl.ValueOrEmptyDouble(o.Min))\n\tp.SetMax(dcl.ValueOrEmptyDouble(o.Max))\n\treturn p\n}", "title": "" }, { "docid": "4dc44bfb32bf2e2fcce57178187941fb", "score": "0.5419531", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum(e monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum_name[int32(e)]; ok {\n\t\te := monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum(n[len(\"MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d2e513da1df241952f9b21b0308e2bc7", "score": "0.5361481", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum(e monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum_name[int32(e)]; ok {\n\t\te := monitoring.ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum(n[len(\"MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db7bbb4354727d8a7bea8c35debc83df", "score": "0.53253627", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBased) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBased {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBased{}\n\tp.SetGoodTotalRatio(MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedGoodTotalRatioToProto(o.GoodTotalRatio))\n\tp.SetDistributionCut(MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCutToProto(o.DistributionCut))\n\treturn p\n}", "title": "" }, { "docid": "e812ceeaf7fba1b162908d71c9ec9a8a", "score": "0.5254546", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicator) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicator {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicator{}\n\tp.SetBasicSli(MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliToProto(o.BasicSli))\n\tp.SetRequestBased(MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedToProto(o.RequestBased))\n\tp.SetWindowsBased(MonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBasedToProto(o.WindowsBased))\n\treturn p\n}", "title": "" }, { "docid": "d52110109dbd1fe827a5fb41c337a29c", "score": "0.5205939", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicator(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicator) *monitoring.ServiceLevelObjectiveServiceLevelIndicator {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicator{\n\t\tBasicSli: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSli(p.GetBasicSli()),\n\t\tRequestBased: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBased(p.GetRequestBased()),\n\t\tWindowsBased: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorWindowsBased(p.GetWindowsBased()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "87e935c3726abf6b811832f7d67f9b7f", "score": "0.47642854", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCut(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCut) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCut {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCut{\n\t\tDistributionFilter: dcl.StringOrNil(p.GetDistributionFilter()),\n\t\tRange: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCutRange(p.GetRange()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "bb812bfe0ceaf796d05744e85130c800", "score": "0.4757836", "text": "func ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnumRef(s string) *ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum {\n\tv := ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceOperationLatencyExperienceEnum(s)\n\treturn &v\n}", "title": "" }, { "docid": "1e0156bc6c5d94b4c9bbcb7ac1018b53", "score": "0.46678948", "text": "func (o BudgetManagementGroupNotificationOutput) Threshold() pulumi.IntOutput {\n\treturn o.ApplyT(func(v BudgetManagementGroupNotification) int { return v.Threshold }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "e8d48ffcbbaae7061a2f20f7865f2aa7", "score": "0.46267182", "text": "func (o BudgetResourceGroupNotificationOutput) Threshold() pulumi.IntOutput {\n\treturn o.ApplyT(func(v BudgetResourceGroupNotification) int { return v.Threshold }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "506459023a53cbcd1d72a6e769908f38", "score": "0.460329", "text": "func ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnumRef(s string) *ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum {\n\tv := ServiceLevelObjectiveServiceLevelIndicatorWindowsBasedGoodTotalRatioThresholdBasicSliPerformanceLatencyExperienceEnum(s)\n\treturn &v\n}", "title": "" }, { "docid": "060b8a477de9ea2cec6e39dda32f0a71", "score": "0.4566875", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatency(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatency) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatency {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatency{\n\t\tThreshold: dcl.StringOrNil(p.GetThreshold()),\n\t\tExperience: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatencyExperienceEnum(p.GetExperience()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "3dcad310993db260f772bee158258f06", "score": "0.4555014", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCutRange(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCutRange) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCutRange {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCutRange{\n\t\tMin: dcl.Float64OrNil(p.GetMin()),\n\t\tMax: dcl.Float64OrNil(p.GetMax()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "553dabeed7254f8627f095b4df4ca2e4", "score": "0.4525395", "text": "func (o ElastigroupScalingUpPolicyOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v ElastigroupScalingUpPolicy) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "13c9f68bf9b702a1fb350dbcd66c2c40", "score": "0.44780496", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatencyToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatency) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatency {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatency{}\n\tp.SetThreshold(dcl.ValueOrEmptyString(o.Threshold))\n\tp.SetExperience(MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatencyExperienceEnumToProto(o.Experience))\n\treturn p\n}", "title": "" }, { "docid": "ba66be9db0de2ea1f9f4deb2e51f0a24", "score": "0.44706514", "text": "func ServiceLevelObjectiveToProto(resource *monitoring.ServiceLevelObjective) *monitoringpb.MonitoringServiceLevelObjective {\n\tp := &monitoringpb.MonitoringServiceLevelObjective{}\n\tp.SetName(dcl.ValueOrEmptyString(resource.Name))\n\tp.SetDisplayName(dcl.ValueOrEmptyString(resource.DisplayName))\n\tp.SetServiceLevelIndicator(MonitoringServiceLevelObjectiveServiceLevelIndicatorToProto(resource.ServiceLevelIndicator))\n\tp.SetGoal(dcl.ValueOrEmptyDouble(resource.Goal))\n\tp.SetRollingPeriod(dcl.ValueOrEmptyString(resource.RollingPeriod))\n\tp.SetCalendarPeriod(MonitoringServiceLevelObjectiveCalendarPeriodEnumToProto(resource.CalendarPeriod))\n\tp.SetCreateTime(dcl.ValueOrEmptyString(resource.CreateTime))\n\tp.SetDeleteTime(dcl.ValueOrEmptyString(resource.DeleteTime))\n\tp.SetServiceManagementOwned(dcl.ValueOrEmptyBool(resource.ServiceManagementOwned))\n\tp.SetProject(dcl.ValueOrEmptyString(resource.Project))\n\tp.SetService(dcl.ValueOrEmptyString(resource.Service))\n\tmUserLabels := make(map[string]string, len(resource.UserLabels))\n\tfor k, r := range resource.UserLabels {\n\t\tmUserLabels[k] = r\n\t}\n\tp.SetUserLabels(mUserLabels)\n\n\treturn p\n}", "title": "" }, { "docid": "3c6922246cfae2e97cc4c91bd2b1be27", "score": "0.4461825", "text": "func (o GetBudgetResourceGroupNotificationOutput) Threshold() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetBudgetResourceGroupNotification) int { return v.Threshold }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "93eba56c58cee39279a6823c3429bfed", "score": "0.44170332", "text": "func (o ServiceLevelObjectiveOutput) WarningThreshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v *ServiceLevelObjective) pulumi.Float64Output { return v.WarningThreshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "538b24bbb00b5ea2641612cb87a9d4a9", "score": "0.4404366", "text": "func (o *GetRandomRecipes200ResponseRecipesInner) GetWeightWatcherSmartPointsOk() (*float32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.WeightWatcherSmartPoints, true\n}", "title": "" }, { "docid": "f03c8559903bf353542a02ef6246d550", "score": "0.43970746", "text": "func (o *EnvironmentDatabasesCurrentMetricResponseCpu) GetWarningThresholdInPercentOk() (*float32, bool) {\n\tif o == nil || o.WarningThresholdInPercent == nil {\n\t\treturn nil, false\n\t}\n\treturn o.WarningThresholdInPercent, true\n}", "title": "" }, { "docid": "e9f7e54de4090635a5973d4b8eec448f", "score": "0.4395033", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliLatency(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliLatency) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliLatency {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliLatency{\n\t\tThreshold: dcl.StringOrNil(p.GetThreshold()),\n\t\tExperience: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliLatencyExperienceEnum(p.GetExperience()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "ead9d2ec042f0332d639ae43cc2ca9bd", "score": "0.437995", "text": "func (o ServiceLevelObjectiveOutput) Thresholds() ServiceLevelObjectiveThresholdArrayOutput {\n\treturn o.ApplyT(func(v *ServiceLevelObjective) ServiceLevelObjectiveThresholdArrayOutput { return v.Thresholds }).(ServiceLevelObjectiveThresholdArrayOutput)\n}", "title": "" }, { "docid": "b57a3fdf411bff3451afa5e6221274b1", "score": "0.4374997", "text": "func ProtoToServiceLevelObjective(p *monitoringpb.MonitoringServiceLevelObjective) *monitoring.ServiceLevelObjective {\n\tobj := &monitoring.ServiceLevelObjective{\n\t\tName: dcl.StringOrNil(p.GetName()),\n\t\tDisplayName: dcl.StringOrNil(p.GetDisplayName()),\n\t\tServiceLevelIndicator: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicator(p.GetServiceLevelIndicator()),\n\t\tGoal: dcl.Float64OrNil(p.GetGoal()),\n\t\tRollingPeriod: dcl.StringOrNil(p.GetRollingPeriod()),\n\t\tCalendarPeriod: ProtoToMonitoringServiceLevelObjectiveCalendarPeriodEnum(p.GetCalendarPeriod()),\n\t\tCreateTime: dcl.StringOrNil(p.GetCreateTime()),\n\t\tDeleteTime: dcl.StringOrNil(p.GetDeleteTime()),\n\t\tServiceManagementOwned: dcl.Bool(p.GetServiceManagementOwned()),\n\t\tProject: dcl.StringOrNil(p.GetProject()),\n\t\tService: dcl.StringOrNil(p.GetService()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "8c77686d8c35220870b66423e0058696", "score": "0.43708277", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSli(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSli) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSli {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSli{\n\t\tAvailability: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliAvailability(p.GetAvailability()),\n\t\tLatency: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliLatency(p.GetLatency()),\n\t\tOperationAvailability: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailability(p.GetOperationAvailability()),\n\t\tOperationLatency: ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatency(p.GetOperationLatency()),\n\t}\n\tfor _, r := range p.GetMethod() {\n\t\tobj.Method = append(obj.Method, r)\n\t}\n\tfor _, r := range p.GetLocation() {\n\t\tobj.Location = append(obj.Location, r)\n\t}\n\tfor _, r := range p.GetVersion() {\n\t\tobj.Version = append(obj.Version, r)\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "e5f320d36cfabf184f55ab946b5a4d26", "score": "0.43677175", "text": "func (o *EnvironmentDatabasesCurrentMetricResponseCpu) GetAlertThresholdInPercentOk() (*float32, bool) {\n\tif o == nil || o.AlertThresholdInPercent == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AlertThresholdInPercent, true\n}", "title": "" }, { "docid": "0ac0233467b558b492f04c01bac3942e", "score": "0.4355695", "text": "func (o *EnvironmentApplicationsCurrentScaleResponse) GetWarningThresholdInPercentOk() (*float32, bool) {\n\tif o == nil || o.WarningThresholdInPercent == nil {\n\t\treturn nil, false\n\t}\n\treturn o.WarningThresholdInPercent, true\n}", "title": "" }, { "docid": "9652b77d7c232638987075dbc0f60f22", "score": "0.43464237", "text": "func (o *VirtualizationVmwareDatastoreClusterAllOf) GetUtilizedSpaceThresholdOk() (*int32, bool) {\n\tif o == nil || o.UtilizedSpaceThreshold == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UtilizedSpaceThreshold, true\n}", "title": "" }, { "docid": "6069bb13cbfaf5f337281c2cf7b3bf81", "score": "0.43358037", "text": "func (o *VirtualizationVmwareDatastoreClusterAllOf) GetReservablePercentThresholdOk() (*int32, bool) {\n\tif o == nil || o.ReservablePercentThreshold == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ReservablePercentThreshold, true\n}", "title": "" }, { "docid": "18d7eaee8d58b37cf57131898ea94376", "score": "0.4333515", "text": "func (o *EnvironmentApplicationsCurrentScaleResponse) GetAlertThresholdInPercentOk() (*float32, bool) {\n\tif o == nil || o.AlertThresholdInPercent == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AlertThresholdInPercent, true\n}", "title": "" }, { "docid": "e07f87ffe8951f549fe716511db10789", "score": "0.43073547", "text": "func (o BudgetSubscriptionNotificationOutput) Threshold() pulumi.IntOutput {\n\treturn o.ApplyT(func(v BudgetSubscriptionNotification) int { return v.Threshold }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "67c0e51aca9426f94eb5b7f03446b919", "score": "0.42669845", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailability(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailability) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailability {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailability{}\n\treturn obj\n}", "title": "" }, { "docid": "aafb760dd680c87e30b976a3bcb877c1", "score": "0.4249814", "text": "func (o GroupMixedInstancesPolicyLaunchTemplateOverrideOutput) WeightedCapacity() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GroupMixedInstancesPolicyLaunchTemplateOverride) *string { return v.WeightedCapacity }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "80c47816bb7fe13ad92327eeaa8184c3", "score": "0.42495844", "text": "func (o *UpdateBillableWeightOK) WithPayload(payload *ghcmessages.Order) *UpdateBillableWeightOK {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "dc97759161aec1e693742416f8e9f64a", "score": "0.42106217", "text": "func (o GetBudgetSubscriptionNotificationOutput) Threshold() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetBudgetSubscriptionNotification) int { return v.Threshold }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "de018ec4433c8e41b05e2a608c897b00", "score": "0.420411", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliLatencyToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliLatency) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliLatency {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliLatency{}\n\tp.SetThreshold(dcl.ValueOrEmptyString(o.Threshold))\n\tp.SetExperience(MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliLatencyExperienceEnumToProto(o.Experience))\n\treturn p\n}", "title": "" }, { "docid": "c57ae5649a8d56f9c0d8a8eeb3487883", "score": "0.4194748", "text": "func (o MetricAlertCriteriaOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v MetricAlertCriteria) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "742eeec0218de4c83b4467ad16f8b6d2", "score": "0.4173505", "text": "func (o AutoscaleSettingProfileRuleMetricTriggerOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v AutoscaleSettingProfileRuleMetricTrigger) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "fff9872edc6b580282a78ae82b59d993", "score": "0.41695863", "text": "func calculateThreshold(ratio float64) uint64 {\n\t// Use big.Float and big.Int to calculate threshold because directly convert\n\t// math.MaxUint64 to float64 will cause digits/bits to be cut off if the converted value\n\t// doesn't fit into bits that are used to store digits for float64 in Golang\n\tboundary := new(big.Float).SetInt(new(big.Int).SetUint64(math.MaxUint64))\n\tres, _ := boundary.Mul(boundary, big.NewFloat(ratio)).Uint64()\n\treturn res\n}", "title": "" }, { "docid": "98024f30de761aa253ff208740897f93", "score": "0.41617942", "text": "func (o NotificationOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v Notification) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "5e412515d789fa774cf82d600677a9a0", "score": "0.41593447", "text": "func (o ElastigroupScalingDownPolicyOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v ElastigroupScalingDownPolicy) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "23a45e13b54b493db46d5ffc8d0224d9", "score": "0.41539317", "text": "func (o NotificationResponseOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v NotificationResponse) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "53f53e6ee7405588b560d1fb03278be2", "score": "0.40868118", "text": "func (o *GetRandomRecipes200ResponseRecipesInner) GetWeightWatcherSmartPoints() float32 {\n\tif o == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\n\treturn o.WeightWatcherSmartPoints\n}", "title": "" }, { "docid": "a23c97b3e6164a3d44587d189dd23705", "score": "0.40765426", "text": "func ProtoToMonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliAvailability(p *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliAvailability) *monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliAvailability {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliAvailability{}\n\treturn obj\n}", "title": "" }, { "docid": "f85ef1e25db9ee82837176a1460f016d", "score": "0.40728232", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSli) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSli {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSli{}\n\tp.SetAvailability(MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliAvailabilityToProto(o.Availability))\n\tp.SetLatency(MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliLatencyToProto(o.Latency))\n\tp.SetOperationAvailability(MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailabilityToProto(o.OperationAvailability))\n\tp.SetOperationLatency(MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationLatencyToProto(o.OperationLatency))\n\tsMethod := make([]string, len(o.Method))\n\tfor i, r := range o.Method {\n\t\tsMethod[i] = r\n\t}\n\tp.SetMethod(sMethod)\n\tsLocation := make([]string, len(o.Location))\n\tfor i, r := range o.Location {\n\t\tsLocation[i] = r\n\t}\n\tp.SetLocation(sLocation)\n\tsVersion := make([]string, len(o.Version))\n\tfor i, r := range o.Version {\n\t\tsVersion[i] = r\n\t}\n\tp.SetVersion(sVersion)\n\treturn p\n}", "title": "" }, { "docid": "846aa22a2334493a6b05fdd09d35c06d", "score": "0.40666887", "text": "func NewThresholdDecisionPolicy(threshold string, votingPeriod, minExecutionPeriod time.Duration) DecisionPolicy {\n\treturn &ThresholdDecisionPolicy{threshold, &DecisionPolicyWindows{votingPeriod, minExecutionPeriod}}\n}", "title": "" }, { "docid": "d85d63f6c6ca0dac4dbd9349d7e8fdb8", "score": "0.40488398", "text": "func (o ScheduledQueryRulesAlertTriggerMetricTriggerPtrOutput) Threshold() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *ScheduledQueryRulesAlertTriggerMetricTrigger) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Threshold\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "e9753e5d0548b6c7fcf5013a78c1dbea", "score": "0.40380457", "text": "func (s *Stream) BufferedAmountLowThreshold() uint64 {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\n\treturn s.bufferedAmountLow\n}", "title": "" }, { "docid": "3dd56ecce6285d450061207f316d4377", "score": "0.4035571", "text": "func MessageThreshold() float64 {\n\treturn conf.MThreshold\n}", "title": "" }, { "docid": "9d81947f4b31280347a5313c51f4ed89", "score": "0.40304637", "text": "func (o *CreateFlowcontrolApiserverV1alpha1PriorityLevelConfigurationOK) WithPayload(payload *models.IoK8sAPIFlowcontrolV1alpha1PriorityLevelConfiguration) *CreateFlowcontrolApiserverV1alpha1PriorityLevelConfigurationOK {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "0919998b2bfb74347d7af0f6e7dd1a87", "score": "0.40282524", "text": "func (x *CryptoUpdateTransactionBody) GetSendRecordThresholdWrapper() *wrappers.UInt64Value {\n\tif x, ok := x.GetSendRecordThresholdField().(*CryptoUpdateTransactionBody_SendRecordThresholdWrapper); ok {\n\t\treturn x.SendRecordThresholdWrapper\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83ed93b7d65dc77e6df5e50dbff98de5", "score": "0.4026544", "text": "func (o ScheduledQueryRulesAlertTriggerMetricTriggerOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v ScheduledQueryRulesAlertTriggerMetricTrigger) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "f8aa98bb7823435648048e683eb639b8", "score": "0.4023146", "text": "func (o *DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationOK {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "831d8db697e0b93195430841373679b4", "score": "0.39970228", "text": "func (o ScheduledQueryRulesAlertTriggerPtrOutput) Threshold() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *ScheduledQueryRulesAlertTrigger) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Threshold\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "8088ba7a38b09b519a7996eafece9f01", "score": "0.39927062", "text": "func (in *Threshold) DeepCopy() *Threshold {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Threshold)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "87a12f771c05e904cfc4bef9fcd90856", "score": "0.39906943", "text": "func (o *VirtualizationVmwareDatastoreClusterAllOf) GetIoLoadImbalanceThresholdOk() (*int32, bool) {\n\tif o == nil || o.IoLoadImbalanceThreshold == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IoLoadImbalanceThreshold, true\n}", "title": "" }, { "docid": "93ac5da2c9ce1d4f57d6be0dacf153db", "score": "0.39883053", "text": "func (o GetScheduledQueryRulesAlertTriggerMetricTriggerOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v GetScheduledQueryRulesAlertTriggerMetricTrigger) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "dce70e1efc01d6590ea3067d222573ff", "score": "0.39773208", "text": "func (o *VirtualizationVmwareDatastoreClusterAllOf) GetIoLatencyThresholdOk() (*int32, bool) {\n\tif o == nil || o.IoLatencyThreshold == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IoLatencyThreshold, true\n}", "title": "" }, { "docid": "5db0330d36fe7b848ad04908c4ce634e", "score": "0.3974939", "text": "func (o OrchestratedVirtualMachineScaleSetPriorityMixOutput) RegularPercentageAboveBase() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v OrchestratedVirtualMachineScaleSetPriorityMix) *int { return v.RegularPercentageAboveBase }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "ad3c074d5d2aebbdf2571f4b918bcf30", "score": "0.39489472", "text": "func (o ScheduledQueryRulesAlertTriggerOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v ScheduledQueryRulesAlertTrigger) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "709703d1a83737cc85f9c558af7539fb", "score": "0.39397717", "text": "func (o *MobileCustomApdex) GetToleratedThresholdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ToleratedThreshold, true\n}", "title": "" }, { "docid": "42dad0c99f6447ee6cb08e975fe6e79b", "score": "0.39339766", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCutToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCut) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCut {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCut{}\n\tp.SetDistributionFilter(dcl.ValueOrEmptyString(o.DistributionFilter))\n\tp.SetRange(MonitoringServiceLevelObjectiveServiceLevelIndicatorRequestBasedDistributionCutRangeToProto(o.Range))\n\treturn p\n}", "title": "" }, { "docid": "a554a67f15c2351596bf9512f7a8ff49", "score": "0.39308733", "text": "func (o OrchestratedVirtualMachineScaleSetPriorityMixPtrOutput) RegularPercentageAboveBase() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *OrchestratedVirtualMachineScaleSetPriorityMix) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.RegularPercentageAboveBase\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "ac1d990397d8f94288bbb481bac7a545", "score": "0.39283806", "text": "func MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailabilityToProto(o *monitoring.ServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailability) *monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailability {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &monitoringpb.MonitoringServiceLevelObjectiveServiceLevelIndicatorBasicSliOperationAvailability{}\n\treturn p\n}", "title": "" }, { "docid": "1934874060cfe1e28bd08c54ab949f19", "score": "0.39240023", "text": "func (o ScheduledQueryRulesAlertV2CriteriaOutput) Threshold() pulumi.Float64Output {\n\treturn o.ApplyT(func(v ScheduledQueryRulesAlertV2Criteria) float64 { return v.Threshold }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "891de731ec0a330c8d2e451b7009db1b", "score": "0.39191246", "text": "func ProtoToComputeUrlMapPathMatcherPathRuleRouteActionWeightedBackendService(p *computepb.ComputeUrlMapPathMatcherPathRuleRouteActionWeightedBackendService) *compute.UrlMapPathMatcherPathRuleRouteActionWeightedBackendService {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &compute.UrlMapPathMatcherPathRuleRouteActionWeightedBackendService{\n\t\tBackendService: dcl.StringOrNil(p.BackendService),\n\t\tWeight: dcl.Int64OrNil(p.Weight),\n\t\tHeaderAction: ProtoToComputeUrlMapHeaderAction(p.GetHeaderAction()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "c85823b0a13ec05a1265f31c067d3723", "score": "0.3917965", "text": "func (o AlarmModelSimpleRulePtrOutput) Threshold() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AlarmModelSimpleRule) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Threshold\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7e1017cd9c334ac2062ce2a8337d2fbf", "score": "0.39125243", "text": "func (o *AzureSupportingService) GetMonitoredMetricsOk() (*[]AzureMonitoredMetric, bool) {\n\tif o == nil || o.MonitoredMetrics == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MonitoredMetrics, true\n}", "title": "" } ]
fcb0708b0722056acc14c61f56fd6802
OldUSERNAME returns the old USERNAME value of the Customer. If the Customer object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or database query fails.
[ { "docid": "cfd140e774d89005b9fbe2dd8c805dae", "score": "0.85511804", "text": "func (m *CustomerMutation) OldUSERNAME(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldUSERNAME is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldUSERNAME 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 OldUSERNAME: %w\", err)\n\t}\n\treturn oldValue.USERNAME, nil\n}", "title": "" } ]
[ { "docid": "a81ca7bed886b22053afa96d918ea4e8", "score": "0.7592049", "text": "func (m *UserMutation) OldUserName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldUserName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldUserName 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 OldUserName: %w\", err)\n\t}\n\treturn oldValue.UserName, nil\n}", "title": "" }, { "docid": "960efd4a668b86626f564ac57d291257", "score": "0.7591528", "text": "func (m *UserMutation) OldUserName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldUserName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldUserName 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 OldUserName: %w\", err)\n\t}\n\treturn oldValue.UserName, nil\n}", "title": "" }, { "docid": "88fd587415b53232c5557905bcf64898", "score": "0.7430191", "text": "func (m *UserMutation) OldUsername(ctx context.Context) (v *string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldUsername is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldUsername 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 OldUsername: %w\", err)\n\t}\n\treturn oldValue.Username, nil\n}", "title": "" }, { "docid": "98cae552ab31d789081be0e79f92d0ba", "score": "0.7420429", "text": "func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldUsername is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldUsername 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 OldUsername: %w\", err)\n\t}\n\treturn oldValue.Username, nil\n}", "title": "" }, { "docid": "8ac24021f0f946cb82808440fe010c6e", "score": "0.74188024", "text": "func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldUsername is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldUsername 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 OldUsername: %w\", err)\n\t}\n\treturn oldValue.Username, nil\n}", "title": "" }, { "docid": "8ac24021f0f946cb82808440fe010c6e", "score": "0.74188024", "text": "func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldUsername is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldUsername 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 OldUsername: %w\", err)\n\t}\n\treturn oldValue.Username, nil\n}", "title": "" }, { "docid": "03f21ce2164e9bd9651f804814f18787", "score": "0.7372125", "text": "func (m *CustomerMutation) OldNAME(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldNAME is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldNAME 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 OldNAME: %w\", err)\n\t}\n\treturn oldValue.NAME, nil\n}", "title": "" }, { "docid": "8c26a7fa0378bb1205d9e4c6a424bf4d", "score": "0.7097842", "text": "func (m *UserMutation) OldNAME(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldNAME is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldNAME 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 OldNAME: %w\", err)\n\t}\n\treturn oldValue.NAME, nil\n}", "title": "" }, { "docid": "9b8b3dba46824e4d8c3f80a6941b87cc", "score": "0.7076801", "text": "func (m *CustomerMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "470903b40a3434cd4c44a0bbc287e051", "score": "0.6741948", "text": "func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "470903b40a3434cd4c44a0bbc287e051", "score": "0.6741948", "text": "func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "470903b40a3434cd4c44a0bbc287e051", "score": "0.6741948", "text": "func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "470903b40a3434cd4c44a0bbc287e051", "score": "0.6741948", "text": "func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "37031443d6ed30428461c08169343ec0", "score": "0.6740252", "text": "func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "37031443d6ed30428461c08169343ec0", "score": "0.6740252", "text": "func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "37031443d6ed30428461c08169343ec0", "score": "0.6740252", "text": "func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "37031443d6ed30428461c08169343ec0", "score": "0.6740252", "text": "func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "37031443d6ed30428461c08169343ec0", "score": "0.6740252", "text": "func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "b39540a51bab0137a0216869bcaa4106", "score": "0.6678547", "text": "func (m *MessageMutation) OldSenderUsername(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldSenderUsername is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldSenderUsername 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 OldSenderUsername: %w\", err)\n\t}\n\treturn oldValue.SenderUsername, nil\n}", "title": "" }, { "docid": "a99e6fe69a3f304e2d0a532170530d31", "score": "0.6671164", "text": "func (m *UserMutation) OldDoctorName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldDoctorName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldDoctorName 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 OldDoctorName: %w\", err)\n\t}\n\treturn oldValue.DoctorName, nil\n}", "title": "" }, { "docid": "51dff1c4fa27b1d21e03a7760815f686", "score": "0.663974", "text": "func (m *CustomerMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase customer.FieldUSERNAME:\n\t\treturn m.OldUSERNAME(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Customer field %s\", name)\n}", "title": "" }, { "docid": "0e0dab7581c4c7866764fa94e8af9308", "score": "0.64897287", "text": "func (m *UsersGroupMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "3f2e9f5657ee912aca62e1cbc2078b3b", "score": "0.6476179", "text": "func (m *DoctorMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "98cbcec1e9bed37791d3c9d501adff5d", "score": "0.64341533", "text": "func (m *VendorMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "69195ed0e72e19a7c7d0860f62c65e4e", "score": "0.6421193", "text": "func (m *CustomerMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase customer.FieldNAME:\n\t\treturn m.OldNAME(ctx)\n\tcase customer.FieldAGE:\n\t\treturn m.OldAGE(ctx)\n\tcase customer.FieldEMAIL:\n\t\treturn m.OldEMAIL(ctx)\n\tcase customer.FieldUSERNAME:\n\t\treturn m.OldUSERNAME(ctx)\n\tcase customer.FieldPASSWORD:\n\t\treturn m.OldPASSWORD(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Customer field %s\", name)\n}", "title": "" }, { "docid": "9b875f286a20d6edb72794cf3301c08e", "score": "0.6418764", "text": "func (m *UserMutation) OldOptionalName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldOptionalName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldOptionalName 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 OldOptionalName: %w\", err)\n\t}\n\treturn oldValue.OptionalName, nil\n}", "title": "" }, { "docid": "425395d54216b6f98ee300d958dc916d", "score": "0.64036953", "text": "func (m *UserMutation) OldFirstName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldFirstName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldFirstName 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 OldFirstName: %w\", err)\n\t}\n\treturn oldValue.FirstName, nil\n}", "title": "" }, { "docid": "0292a9c690fc3d68692c113ba6cbb28c", "score": "0.6396893", "text": "func (m *PatientrecordMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "bff7c5cd949dfe3b9a58d61120e5158c", "score": "0.63948464", "text": "func (m *EmployeeMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "e2dbe6ad185f9ef9a3c51fd88958482c", "score": "0.63943654", "text": "func (m *KqiSourceMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "bf6f5dfb9b48160c1d61c3374028984b", "score": "0.6374056", "text": "func (m *KqiMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "83588ac5176b2b99addf12b8d148a1ee", "score": "0.63578373", "text": "func (m *SurveyMutation) OldOwnerName(ctx context.Context) (v *string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldOwnerName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldOwnerName 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 OldOwnerName: %w\", err)\n\t}\n\treturn oldValue.OwnerName, nil\n}", "title": "" }, { "docid": "111cd04f303362f49e41c8bab71cae6f", "score": "0.63092095", "text": "func (m *PatientMutation) OldPatientname(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldPatientname is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldPatientname 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 OldPatientname: %w\", err)\n\t}\n\treturn oldValue.Patientname, nil\n}", "title": "" }, { "docid": "06aa7c724d1e3255e7a9789edfee4532", "score": "0.6293779", "text": "func (m *KqiTargetMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "b254fdb8e0cac7afaad2461e8e2c15b8", "score": "0.62929296", "text": "func (m *CardMutation) OldName(ctx context.Context) (v sql.NullString, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "56df0fe382509c9d834bc49e9853ec9d", "score": "0.6280488", "text": "func (m *SkillMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "3ce8f92e748a50b0d640dd7b2fd12a2c", "score": "0.6272265", "text": "func (m *PlayerMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "2bc7aafa980480f2238c264a8979feaa", "score": "0.62711126", "text": "func (m *MessageMutation) OldReceiverUsername(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldReceiverUsername is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldReceiverUsername 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 OldReceiverUsername: %w\", err)\n\t}\n\treturn oldValue.ReceiverUsername, nil\n}", "title": "" }, { "docid": "5e6b61b183c4abacf7fb13b031ecd858", "score": "0.6269072", "text": "func (m *ComplaintMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "ee0bf451b58f846d633617884f29a950", "score": "0.62629336", "text": "func (m *DomainMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "c73ce30aa2efc5d1473b941051de872e", "score": "0.6257511", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "62cff69a28207ecf7ea9541b5268e449", "score": "0.6239397", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase user.FieldAge:\n\t\treturn m.OldAge(ctx)\n\tcase user.FieldEmail:\n\t\treturn m.OldEmail(ctx)\n\tcase user.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "ae4cd5d9f9ee354ad44958bf36d2a612", "score": "0.6236996", "text": "func (m *RoleMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "4056b893957d10899cbdfd82c9a3b350", "score": "0.6236618", "text": "func (m *ServiceMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "c7a92e479bb1226b728295d6191b3f3c", "score": "0.6233497", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldUserName:\n\t\treturn m.OldUserName(ctx)\n\tcase user.FieldUserEmail:\n\t\treturn m.OldUserEmail(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "d6f6c16259e9c0035ab1ee75c2c3592d", "score": "0.62244385", "text": "func (m *ValidMessageMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "be26c461a51473666df5f5d5abcadf69", "score": "0.6221543", "text": "func (m *ProjectMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "dc8fd87cff396f61e46f78c490ea27ea", "score": "0.6220687", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldUsername:\n\t\treturn m.OldUsername(ctx)\n\tcase user.FieldUseremail:\n\t\treturn m.OldUseremail(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "de0c7c0ef23ccd28e24c1a9bec6424a6", "score": "0.62173533", "text": "func (m *OrganizationMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "18bb976dd69b8148ce8af96421c1a77b", "score": "0.62079114", "text": "func (m *ReportFilterMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "3655a6d7293665b2bf1675a2486c6fd1", "score": "0.62056136", "text": "func (m *PortalMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "74d523573454c88451a6c0a14d71302f", "score": "0.62041634", "text": "func (m *UsertypeMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "422a3287992d47789614ce968ef1b4bc", "score": "0.6204123", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase user.FieldEmail:\n\t\treturn m.OldEmail(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "422a3287992d47789614ce968ef1b4bc", "score": "0.6204123", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase user.FieldEmail:\n\t\treturn m.OldEmail(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "422a3287992d47789614ce968ef1b4bc", "score": "0.6204123", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase user.FieldEmail:\n\t\treturn m.OldEmail(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "b1a4bc7b8651d7f630e1666d4c61f1de", "score": "0.619775", "text": "func (m *NurseMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "ea8bd855e0a01d10198c4b9976a6b2d9", "score": "0.61934584", "text": "func (m *UserMutation) OldNickName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldNickName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldNickName 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 OldNickName: %w\", err)\n\t}\n\treturn oldValue.NickName, nil\n}", "title": "" }, { "docid": "c33d67a37c5d92ac732f8812ab87dc02", "score": "0.6193415", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldEmail:\n\t\treturn m.OldEmail(ctx)\n\tcase user.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "f3d393ff93c757ceffa598d574bd1b2f", "score": "0.61906785", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase user.FieldUsername:\n\t\treturn m.OldUsername(ctx)\n\tcase user.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\tcase user.FieldBio:\n\t\treturn m.OldBio(ctx)\n\tcase user.FieldProfilePic:\n\t\treturn m.OldProfilePic(ctx)\n\tcase user.FieldGender:\n\t\treturn m.OldGender(ctx)\n\tcase user.FieldRole:\n\t\treturn m.OldRole(ctx)\n\tcase user.FieldIsActive:\n\t\treturn m.OldIsActive(ctx)\n\tcase user.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase user.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "287f0b75572f69665ccee0e19fee530e", "score": "0.6190133", "text": "func (m *SurveyMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "b9d475c00f6975decd965de42553499b", "score": "0.61900777", "text": "func (m *ProductMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "cf31d88a86a911dd72615641454efc6a", "score": "0.61889505", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldUserName:\n\t\treturn m.OldUserName(ctx)\n\tcase user.FieldStatus:\n\t\treturn m.OldStatus(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "a4250d77595229e93990c72145b6f9b8", "score": "0.61878246", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldDoctorName:\n\t\treturn m.OldDoctorName(ctx)\n\tcase user.FieldDoctorEmail:\n\t\treturn m.OldDoctorEmail(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "0a0f2187e36d80d6a23384b4bf474310", "score": "0.6184909", "text": "func (m *TechMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "faa23984c3add8b76b7bb0b14bd02c6c", "score": "0.6184632", "text": "func (m *GroupMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "4b8254fa4143a1365c2c24739eda816c", "score": "0.6184137", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldRequiredName:\n\t\treturn m.OldRequiredName(ctx)\n\tcase user.FieldOptionalName:\n\t\treturn m.OldOptionalName(ctx)\n\tcase user.FieldNilableName:\n\t\treturn m.OldNilableName(ctx)\n\tcase user.FieldNilableName2:\n\t\treturn m.OldNilableName2(ctx)\n\tcase user.FieldAge:\n\t\treturn m.OldAge(ctx)\n\tcase user.FieldAge2:\n\t\treturn m.OldAge2(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "d99c9b7fe45ab85b415a790862edac81", "score": "0.61781335", "text": "func (m *FoodmenuMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "03c12fc11a4c2414b08982259d5f48db", "score": "0.61746895", "text": "func (m *HyperlinkMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "8a15f6b2d7bb78d1da9e7ad43b60aa5d", "score": "0.6172341", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldEmail:\n\t\treturn m.OldEmail(ctx)\n\tcase user.FieldPassword:\n\t\treturn m.OldPassword(ctx)\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase user.FieldAge:\n\t\treturn m.OldAge(ctx)\n\tcase user.FieldBirthday:\n\t\treturn m.OldBirthday(ctx)\n\tcase user.FieldTel:\n\t\treturn m.OldTel(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "2f58a67d6d5d9a71f2fc994d9a72c827", "score": "0.61716753", "text": "func (m *BucketSecretMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "e725ccff5a4195f7c618a79320d00f2c", "score": "0.6167609", "text": "func (m *ActivitiesMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "f328bca39cf56ddd0d81a2da9ebc444d", "score": "0.6165422", "text": "func (m *PatientMutation) OldPatientName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldPatientName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldPatientName 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 OldPatientName: %w\", err)\n\t}\n\treturn oldValue.PatientName, nil\n}", "title": "" }, { "docid": "aed2ae1d46656af1592c62f94007c267", "score": "0.61619854", "text": "func (m *PhysicianMutation) OldPhysicianname(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldPhysicianname is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldPhysicianname 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 OldPhysicianname: %w\", err)\n\t}\n\treturn oldValue.Physicianname, nil\n}", "title": "" }, { "docid": "fef3da22435843a82a033038788d50fe", "score": "0.61601216", "text": "func (m *PermissionMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "23e17d606ea4a041403fbaf534bf2254", "score": "0.6157108", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldUserEmail:\n\t\treturn m.OldUserEmail(ctx)\n\tcase user.FieldNAME:\n\t\treturn m.OldNAME(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "8092d391f6ff039f41d31c7eaaa75115", "score": "0.61541283", "text": "func (m *ClubMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "b566a65fe677bc40d7271e0d687c5ca8", "score": "0.61528707", "text": "func (m *CustomerMutation) OldPASSWORD(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldPASSWORD is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldPASSWORD 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 OldPASSWORD: %w\", err)\n\t}\n\treturn oldValue.PASSWORD, nil\n}", "title": "" }, { "docid": "def51bdef08498f070949c1b11b4bb03", "score": "0.61524487", "text": "func (m *CounterFamilyMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "b7d37f0024f5e005d24f856a85523163", "score": "0.61511034", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldUsername:\n\t\treturn m.OldUsername(ctx)\n\tcase user.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase user.FieldSurname:\n\t\treturn m.OldSurname(ctx)\n\tcase user.FieldToken:\n\t\treturn m.OldToken(ctx)\n\tcase user.FieldIsOnline:\n\t\treturn m.OldIsOnline(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" }, { "docid": "0b49612147eaf820c634c4e266cec4d4", "score": "0.61452687", "text": "func (m *FloorPlanMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "249b0a872f91b2c83d23d4485f8621d7", "score": "0.61447716", "text": "func (m *FeatureMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "80d5bb62fee64a45efff4b3e231faa6e", "score": "0.61390024", "text": "func (m *WorkerTypeMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "59aea6b6a152711282c87030e0ef7ea6", "score": "0.61384565", "text": "func (m *AlarmFilterMutation) OldUser(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldUser is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldUser 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 OldUser: %w\", err)\n\t}\n\treturn oldValue.User, nil\n}", "title": "" }, { "docid": "49faae01c10f9ea699ef3836ba11c775", "score": "0.61380637", "text": "func (m *ServiceTypeMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "88ad74309fb4905d4323a828e1d2573d", "score": "0.6126225", "text": "func (m *UserMutation) OldLastName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldLastName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldLastName requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldLastName: %w\", err)\n\t}\n\treturn oldValue.LastName, nil\n}", "title": "" }, { "docid": "a365f31624c5e9f4e2260f8509cd4b43", "score": "0.61232835", "text": "func (m *EmployeeMutation) OldUserID(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldUserID is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldUserID 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 OldUserID: %w\", err)\n\t}\n\treturn oldValue.UserID, nil\n}", "title": "" }, { "docid": "95e3eeb41f229cc7c129758c59deccfa", "score": "0.6122224", "text": "func (m *WorkOrderMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "32efadb08b5f49e62d204d1855219a4e", "score": "0.6121463", "text": "func (m *EmployeeMutation) OldEMPLOYEENAME(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldEMPLOYEENAME is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldEMPLOYEENAME 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 OldEMPLOYEENAME: %w\", err)\n\t}\n\treturn oldValue.EMPLOYEENAME, nil\n}", "title": "" }, { "docid": "a067a1310a6aa901814cfdc59d0417d2", "score": "0.6120199", "text": "func (m *FlowExecutionTemplateMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "07c473be3c11da8aedc01033420aab28", "score": "0.6118485", "text": "func (m *UserMutation) OldRequiredName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldRequiredName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldRequiredName 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 OldRequiredName: %w\", err)\n\t}\n\treturn oldValue.RequiredName, nil\n}", "title": "" }, { "docid": "c3f46a999cd1957d2c01cd603ca51ecc", "score": "0.61094904", "text": "func (m *EventSeverityMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "3610324d01d60f1beb9168c116375989", "score": "0.6108244", "text": "func (m *AlarmFilterMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "f089ccf2f74cc813a7463c68e72e49cc", "score": "0.61059767", "text": "func (m *ProjectTemplateMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "c8e66dc80d0fc08a546b90821657280c", "score": "0.6102446", "text": "func (m *MessageWithPackageNameMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "ac2e941d71d05979e89c78bb258e1265", "score": "0.60975695", "text": "func (m *KqiCategoryMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "217baef8d3ea882acfdec8663578a9e1", "score": "0.6088435", "text": "func (m *KpiMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "0f0228af4efb9176bd81fd6c572e2a7f", "score": "0.60876536", "text": "func (m *CustomerMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase customer.FieldCreateTime:\n\t\treturn m.OldCreateTime(ctx)\n\tcase customer.FieldUpdateTime:\n\t\treturn m.OldUpdateTime(ctx)\n\tcase customer.FieldName:\n\t\treturn m.OldName(ctx)\n\tcase customer.FieldExternalID:\n\t\treturn m.OldExternalID(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown Customer field %s\", name)\n}", "title": "" }, { "docid": "cfb2a3cf051ace75d1b38c4a9f94e917", "score": "0.60859996", "text": "func (m *FlowMutation) OldName(ctx context.Context) (v string, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldName is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldName 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 OldName: %w\", err)\n\t}\n\treturn oldValue.Name, nil\n}", "title": "" }, { "docid": "f96abaebe497dcfe28e615db60442eb6", "score": "0.6084709", "text": "func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {\n\tswitch name {\n\tcase user.FieldCreatedAt:\n\t\treturn m.OldCreatedAt(ctx)\n\tcase user.FieldCreatedByID:\n\t\treturn m.OldCreatedByID(ctx)\n\tcase user.FieldUpdatedAt:\n\t\treturn m.OldUpdatedAt(ctx)\n\tcase user.FieldUpdatedByID:\n\t\treturn m.OldUpdatedByID(ctx)\n\tcase user.FieldUsername:\n\t\treturn m.OldUsername(ctx)\n\t}\n\treturn nil, fmt.Errorf(\"unknown User field %s\", name)\n}", "title": "" } ]
b543e3e838f6ee8658218f398bbfde8f
WriteResponse to the client
[ { "docid": "7c4eed2c07c91708d53da68a67f3e61c", "score": "0.0", "text": "func (o *DeleteUserIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "5f54a58752c5b9126e950514c9674def", "score": "0.78442043", "text": "func WriteResponse(w http.ResponseWriter, httpStatus int, data model.GlobalResponse) {\n\tdata.Timestamp = time.Now()\n\tjs, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\tlog.Error(\"Could not marshal http write data: \", data)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Set response content type\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(httpStatus)\n\tw.Write(js)\n\treturn\n}", "title": "" }, { "docid": "5b2e333c49379bf963f5d4d1533c5e37", "score": "0.7788614", "text": "func (o *AddUserOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "5a5c3b712a0b4d1ced72e67adf660c94", "score": "0.7788584", "text": "func (o *AuthUserOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "9659ff6cb63492f2f7f0ff256182ecb6", "score": "0.7753117", "text": "func (o *PingOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "1be27a8fc6c890a74f4c21c46b821d40", "score": "0.77477926", "text": "func writeResponse(w http.ResponseWriter, message string, status int) {\n\tw.WriteHeader(status)\n\tjson.NewEncoder(w).Encode(Response{Message: message, HTTPStatus: status})\n}", "title": "" }, { "docid": "97ee3687ce31cecb416d8b12dea06dca", "score": "0.77178353", "text": "func WriteResponse(w http.ResponseWriter, code int, data interface{}) {\n\tj, _ := json.Marshal(data)\n\tw.WriteHeader(code)\n\tw.Write(j)\n}", "title": "" }, { "docid": "2e63c0ac6ad1cad49a2160e1d6ff594a", "score": "0.76838505", "text": "func writeResponse(w http.ResponseWriter, r *Response, code int) {\n\tif code == http.StatusNoContent || r == nil {\n\t\tw.WriteHeader(code)\n\t\treturn\n\t}\n\n\t// Marshal the data into a JSON string.\n\tjsonData, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Printf(\"Request Error: marshaling response, %+v\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(jsonData)\n}", "title": "" }, { "docid": "fbb890e78880fb52fdf57e3d5decff26", "score": "0.7666609", "text": "func writeResponse(w http.ResponseWriter, r *Request, response interface{}, e error) (err error) {\n\n\t// Dump meta-data headers\n\tw.Header().Set(HeaderProcessingTime, fmt.Sprintf(\"%.03f\", time.Since(r.StartTime).Seconds()*1000))\n\tw.Header().Set(HeaderRequestId, r.RequestId)\n\n\t// Dump Error if the request failed\n\tif e != nil {\n\t\tcode, message := httpError(e)\n\t\thttp.Error(w, message, code)\n\t\treturn\n\t}\n\n\tvar buf []byte\n\tbuf, err = json.Marshal(response)\n\tif err == nil {\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t\tif r.Callback != \"\" {\n\t\t\tif _, err = fmt.Fprintf(w, \"%s(\", r.Callback); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif _, err = w.Write(buf); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tif r.Callback != \"\" {\n\t\t\tif _, err = fmt.Fprintln(w, \");\"); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "1aa0af264c6d3d751aff1551a08c8f5c", "score": "0.7644964", "text": "func (o *AddDeviceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "a1fc63ad76c614fa6d0f615e627a4e9f", "score": "0.7639846", "text": "func writeResponse(w http.ResponseWriter, res Response) {\n\tif res.Error != nil {\n\t\tlog.Error(w, res.Error)\n\t}\n\n\tif res.Certificate != nil {\n\t\tapi.LogCertificate(w, res.Certificate)\n\t}\n\n\tw.Header().Set(\"Content-Type\", contentHeader(res))\n\t_, _ = w.Write(res.Data)\n}", "title": "" }, { "docid": "e43ef6751eaf2f436f83f781ee10523d", "score": "0.7634974", "text": "func WriteResponse(w http.ResponseWriter, data interface{}, code int) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tj, _ := json.Marshal(data)\n\tw.Write(j)\n}", "title": "" }, { "docid": "2ebfffed298870288645b91f221f493e", "score": "0.7625152", "text": "func (o *PutServiceIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "4fe6021430a5faeaf89825995e052690", "score": "0.762342", "text": "func (o *GetClusterByIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "0fa170e16e8978a5a4783be66e060767", "score": "0.7616826", "text": "func (o *UploadTaskFileCreated) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "e04d5c9883404aada3fdfc56fd8d645f", "score": "0.76137096", "text": "func (o *PostOperationsCreateConnectivityServiceCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "e4fbd3349739f7a014861d279eccd112", "score": "0.76131016", "text": "func (r *Response) write(w http.ResponseWriter, httpStatus int) {\n\tr.Version = Version\n\tw.Header().Set(\"Content-Type\", \"application/json;charset=utf-8\")\n\tw.WriteHeader(httpStatus)\n\tdata, _ := json.Marshal(r)\n\tw.Write(data)\n}", "title": "" }, { "docid": "634642d01eae3719508ca9f4d7fb8f9d", "score": "0.75757974", "text": "func (o *PostOperationsComputeP2PPathCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "a74383c8a7d32d826c5b46bf543c473d", "score": "0.756636", "text": "func (o *PingDefault) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n}", "title": "" }, { "docid": "40f8c2116e3818b04c0ad911fbfde8af", "score": "0.7563151", "text": "func (o *PostDataSomeKeyPathOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "d03533aee6759f7dde2042128cfa3cb6", "score": "0.75510406", "text": "func (o *PutComposersIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "4e8e052fbd1abe180d6fe0e5220a1be8", "score": "0.75469345", "text": "func (o *AddCarCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "48917c1ea37e59ca56bdde0db6b7e8cb", "score": "0.7545381", "text": "func (c *Controller) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\t// as of now, just log errors for writing response\n\tif err != nil {\n\t\t// logger.Errorf(\"Unable to send error response, %s\", err)\n\t\tfmt.Printf(\"Unable to send error response, %s\\n\", err)\n\t}\n}", "title": "" }, { "docid": "f1c20a7bb40097cab8e185680d3075ec", "score": "0.7543838", "text": "func (o *A1ControllerGetHealthcheckOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "af0862b70b0972dfb54b3824930931e6", "score": "0.7543638", "text": "func (o *PutPiecesIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "f7d477c2a48b3e38e9a70ac943803644", "score": "0.75382906", "text": "func (r codecRequest) WriteResponse(w http.ResponseWriter, x interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\trep := reply{\n\t\tCode: 200,\n\t\tData: x,\n\t}\n\tenc := json.NewEncoder(w)\n\tenc.Encode(&rep)\n}", "title": "" }, { "docid": "71585df58b6656f6b33895269e55b3ed", "score": "0.7529468", "text": "func Write(w http.ResponseWriter, response Response) error {\n\tw.WriteHeader(response.HTTPStatus())\n\tbody, err := response.Marshal()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error marshaling response\")\n\t}\n\tw.Write(body)\n\treturn nil\n}", "title": "" }, { "docid": "c574648c6b8e21655fbf134f87297711", "score": "0.75257885", "text": "func (o *PostOperationsGetOamServiceEndPointCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "eb6c577dc1bcf7998fa28cb485d3769f", "score": "0.7521694", "text": "func (r *FileResponder) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\trw.Header().Set(\"Content-Type\", r.contType)\n\trw.Header().Set(\"Content-Length\", strconv.Itoa(len(r.content)))\n\trw.Header().Set(\"Content-Disposition\", `attachment; filename=\"`+r.name+`\"`)\n\trw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\trw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, PUT, GET, OPTIONS, DELETE\")\n\trw.Header().Set(\"Access-Control-Allow-Headers\", \"X-Api-Key, Content-Type\")\n\n\trw.WriteHeader(http.StatusOK)\n\n\tif _, err := rw.Write(r.content); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "47e64c56c1dd56e9a56111698c07b549", "score": "0.75206137", "text": "func (o *IsAuthOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "86b5abee4fff961cacbe247a80e1c0d1", "score": "0.7519822", "text": "func (o *PostControlMessageForDeviceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "1d76513e89352fac5e95428587218fc7", "score": "0.75196433", "text": "func (o *UpdateFacilityUserOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "bd6b9646e0a03854f5cc22a5dc7e2360", "score": "0.75160336", "text": "func writeResponse(w http.ResponseWriter, code int, body interface{}) error {\n\tb, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tw.Write(b)\n\treturn nil\n}", "title": "" }, { "docid": "3ca67541918afe8a6722fed995c843cc", "score": "0.75110567", "text": "func (o *UploadTaskFileDefault) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n}", "title": "" }, { "docid": "a181444bbc5226360c788f53191776bf", "score": "0.7504535", "text": "func WriteResponse(w http.ResponseWriter, code int, data interface{}) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\terr := json.NewEncoder(w).Encode(data)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "ce571106460fe70af06a4c39e9bc2bde", "score": "0.7494259", "text": "func (o *DeviceReadingsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "d61f22d7ee159c045f5bf437a466df07", "score": "0.74906754", "text": "func (o *PostOperationsGetConnectivityServiceAuditListCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "56e5ad7ce863e61097553a63583d1a9d", "score": "0.74882704", "text": "func WriteResponse(w http.ResponseWriter, r *http.Request, resp *discovery.Response, obj interface{}) {\n\tif resp != nil && resp.GetCode() != discovery.ResponseSuccess {\n\t\tWriteError(w, resp.GetCode(), resp.GetMessage())\n\t\treturn\n\t}\n\n\tif obj == nil {\n\t\tw.Header().Set(HeaderContentType, ContentTypeText)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn\n\t}\n\n\tutil.SetRequestContext(r, CtxResponseObject, obj)\n\n\tvar (\n\t\tdata []byte\n\t\terr error\n\t)\n\tswitch body := obj.(type) {\n\tcase []byte:\n\t\tdata = body\n\tdefault:\n\t\tdata, err = codec.Encode(body)\n\t\tif err != nil {\n\t\t\tWriteError(w, discovery.ErrInternal, err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\tw.Header().Set(HeaderContentType, ContentTypeJSON)\n\tw.WriteHeader(http.StatusOK)\n\t_, err = w.Write(data)\n\tif err != nil {\n\t\tlog.Error(\"write response failed\", err)\n\t}\n}", "title": "" }, { "docid": "a7947824ebccd6d0605da696056a17cb", "score": "0.7483943", "text": "func WriteResponse(c appengine.Context, w http.ResponseWriter,\n\tr *http.Request, bytes []byte) {\n\n\t_, err := w.Write(bytes)\n\n\tif err != nil {\n\t\tLog(c, r, \"error\", \"Failed to write: %v\", err.Error())\n\t\tLog(c, r, \"info\", \"Message was: %v\", string(bytes))\n\t}\n}", "title": "" }, { "docid": "3818b4e60d0132ba429540c868ffe5e5", "score": "0.7476084", "text": "func (o *PeerCreateCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Location\n\n\tlocation := o.Location\n\tif location != \"\" {\n\t\trw.Header().Set(\"Location\", location)\n\t}\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "c51af5128fc092e35ddf2ab1d8bd384b", "score": "0.7465029", "text": "func WriteResponse(rw http.ResponseWriter, res ferry.Response, contentType string) {\n\tif contentType != \"\" {\n\t\trw.Header().Set(\"Content-Type\", contentType)\n\t}\n\tstatus, payload := res.Response()\n\trw.WriteHeader(status)\n\trw.Write([]byte(payload))\n}", "title": "" }, { "docid": "bf310a747a18d5b278f71fe9b4f2fae2", "score": "0.7464533", "text": "func (o *UpdateDiscoveryIgnitionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "3fce9a6fbfe15ad493b3c7b77effa301", "score": "0.74573857", "text": "func (o *SaleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "ac86ec021920d1cf5f4ef8adddfc964a", "score": "0.7452727", "text": "func writeResponse(w http.ResponseWriter, data interface{}, statusCode ...int) {\n\tstatus := 200\n\tif len(statusCode) > 0 && statusCode[0] != 0 {\n\t\tstatus = statusCode[0]\n\t}\n\n\tb, err := json.Marshal(data)\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(status)\n\tw.Write(b)\n}", "title": "" }, { "docid": "70cdeb268dae2341b399bf4a88bb029f", "score": "0.7449866", "text": "func (o *PutServiceIDCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "aca2cc87482eb8efbae5898bb0dfff12", "score": "0.74490607", "text": "func (o *GetCharactersCharacterIDPlanetsPlanetIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8555611fe13991b018c7197e156a8ce1", "score": "0.74480265", "text": "func (o *GetEventByIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n}", "title": "" }, { "docid": "a54a030f6561b65c3dea3396bbe2f983", "score": "0.7446597", "text": "func (res APIResponse) Write(w http.ResponseWriter, r *http.Request) {\n\tif res.Status == \"ERROR\" {\n\t\tlog.Printf(\"[ERROR][API][PATH: %s]:: Error handling request. ERROR: %s. User agent: %s\", r.RequestURI, res.Error, r.Header.Get(\"User-Agent\"))\n\t}\n\tWriteJSON(w, res)\n}", "title": "" }, { "docid": "e158bf1aec8bdc308a36d9e081201a62", "score": "0.74443185", "text": "func (o *PostDataMessageForDeviceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "d7dc71323f4399f4160e056af7c6ed90", "score": "0.74392503", "text": "func (res *response) Write(b []byte) (int, error) {\n\tif !res.wroteHeader {\n\t\tres.WriteHeader(http.StatusOK)\n\t}\n\n\treturn res.ResponseWriter.Write(b)\n}", "title": "" }, { "docid": "b368f76767b9d3d85483f1d8caecf0df", "score": "0.74382955", "text": "func (o *DeleteComposersIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "cfd55b0299264c74848eaf1f6b447d60", "score": "0.7434204", "text": "func WriteResponse(w http.ResponseWriter, status int, payload interface{}) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\t_ = json.NewEncoder(w).Encode(payload)\n}", "title": "" }, { "docid": "f18c08592413c3cf483092cc9ae44d60", "score": "0.7423474", "text": "func writeResponse(w http.ResponseWriter, response interface{}) error {\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tjData, err := json.Marshal(response)\n\tif err != nil {\n\t\tlog.Printf(\"JSON marshalling for HTTP response failed. %s\", err)\n\t\treturn err\n\t}\n\n\tif _, err = w.Write(jData); err != nil {\n\t\tlog.Printf(\"Could not write response to HTTP ResponseWriter. %s\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3d23cb60047a7a0a46bbc5457ad9331b", "score": "0.7420763", "text": "func WriteResponse(handler string, w http.ResponseWriter, v []byte, ct string, status int) {\n\t// Header must be set before status is written\n\tif len(v) > 0 {\n\t\tw.Header().Set(\"Content-Type\", ct)\n\t}\n\n\t// Header and status must be written before content is written\n\tw.WriteHeader(status)\n\tif len(v) > 0 {\n\t\tif _, err := w.Write(v); err != nil {\n\t\t\tLogAndReturnError(handler, http.StatusInternalServerError, err, w)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "38c57f70e05068498a0b0e68fa8751e9", "score": "0.7419465", "text": "func (o *PostOperationsCreateConnectivityServiceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "992e4d4c42fc3ef15790965130dfc89f", "score": "0.74146134", "text": "func (w *response) Write(b []byte) (int, error) {\n\n\t// Default to 200 HTTP Status\n\tif !w.wroteHeader {\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n\n\t// Append data to the body and set the wrote flag\n\tw.bodyBuffer.Write(b)\n\n\t// Done, return the response write function\n\treturn w.ResponseWriter.Write(b)\n}", "title": "" }, { "docid": "41255352af13f2dcb987b0aaae1946c9", "score": "0.7412214", "text": "func (o *PutKeysIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "9e835526803ebea2ee46ae440b9b3a15", "score": "0.74111885", "text": "func (r *Response) writeResponse(code int, v interface{}) error {\n\tif len(r.Headers) > 0 {\n\t\tr.writeHeaders()\n\t}\n\n\tr.writeStatusCode(code)\n\n\tif v != nil {\n\t\tbody, err := json.Marshal(v)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif _, err := r.Writer.Write(body); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "439f8055639eb77513fe2d00987ec69f", "score": "0.7410203", "text": "func (o *PlacePurchaseCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "c074758fffe0b73aede914f9e8ae1e53", "score": "0.74101585", "text": "func (o *RefundsTidOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "0f2ab5251f7eeeaa54d462a22e3859ef", "score": "0.74100864", "text": "func (o *UpdatePaymentOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "21137a578f25b44ddc582dadd40fe088", "score": "0.7406279", "text": "func writeResponse(writer http.ResponseWriter, statusCode int, feedback string) {\n\twriter.WriteHeader(statusCode)\n\twriter.Write([]byte(feedback))\n}", "title": "" }, { "docid": "5d9b31e0c0c3531a82b262782ae57bc2", "score": "0.74059224", "text": "func (o *GetVmsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "2585f7c9058e83e61eb273754ab4e707", "score": "0.74039793", "text": "func (o *DeleteStockCompanyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "f2cd842ff03a9fcc4e9843167de3f74a", "score": "0.7403616", "text": "func (o *UpdateCertificateV3OK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "dc4ac890b9f6a61b35cb86b7d534123c", "score": "0.740121", "text": "func (o *PutChannelsViberChannelIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "57d34965eb3f0260d9dfd21d9b975eed", "score": "0.7400904", "text": "func (o *LoginUserOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Set-Cookie\n\n\tsetCookie := o.SetCookie\n\tif setCookie != \"\" {\n\t\trw.Header().Set(\"Set-Cookie\", setCookie)\n\t}\n\n\t// response header X-Request-Id\n\n\txRequestID := o.XRequestID\n\tif xRequestID != \"\" {\n\t\trw.Header().Set(\"X-Request-Id\", xRequestID)\n\t}\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "a039840fde770f512b93ed9aacf91fff", "score": "0.7395233", "text": "func WriteResponse(res http.ResponseWriter, status int, entity interface{}) {\n\tres.WriteHeader(status)\n\tif err := json.NewEncoder(res).Encode(entity); err != nil {\n\t\tlog.WithError(err).Error(\"unable to send response, the entity could not be encoded\")\n\t}\n}", "title": "" }, { "docid": "6c2f44af701b26539fbcdb067ee73b07", "score": "0.73931754", "text": "func (o *GetCredentialByIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bb39cb9adf9dbcc77f4200adb09fa244", "score": "0.7387887", "text": "func (o *WeaviateThingsInsertNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "title": "" }, { "docid": "9ad0387cc484e99517fb9497cd5dcd12", "score": "0.73861986", "text": "func (o *PatchEndpointIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "a939d5664460d2116d4004b15dbaead1", "score": "0.7385323", "text": "func (o *ListPVCsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7b451ac6b8eb331422c4c03a25b23547", "score": "0.73821056", "text": "func (o *PostOperationsGetConnectivityServiceAuditListOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0acfe2ed4e0502a074923b6327190539", "score": "0.7382085", "text": "func (o *IndexTSPPsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Content-Range\n\n\tcontentRange := o.ContentRange\n\tif contentRange != \"\" {\n\t\trw.Header().Set(\"Content-Range\", contentRange)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\t// return empty array\n\t\tpayload = adminmessages.TransportationServiceProviderPerformances{}\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "7dae9192e5ff8e388271af394c7044c9", "score": "0.738177", "text": "func (o *GetCharactersCharacterIDClonesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c6a4bc8bc0983b3529ccbf6b05ac6401", "score": "0.73757064", "text": "func (o *WeaviatePeersAnswersCreateNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "title": "" }, { "docid": "ce3e37a7d19b0c8386768d26ee3211eb", "score": "0.7375508", "text": "func (o *AddTagOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "807dbc75ec462b8bcc8159fc619b420c", "score": "0.73750913", "text": "func (o *PostPortsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "0b4b129732496d5bb56d79294285c00a", "score": "0.7373522", "text": "func (o *UpdatePostOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "85ec41458bc51d440158f1a4b317ddb4", "score": "0.73728293", "text": "func (o *PostOperationsCreateOamServiceEndPointCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "74fc8182b8350813f9abe8e7bb3a5c4f", "score": "0.7368112", "text": "func (o *GetMarketsRegionIDHistoryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetMarketsRegionIDHistoryOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "a54fe88769f6ed19ac3f3afe4fa88edd", "score": "0.7366081", "text": "func (w *responseWriter) Write(b []byte) (int, error) {\n\tif w.status == 0 {\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n\treturn w.ResponseWriter.Write(b)\n}", "title": "" }, { "docid": "a05142a17ca07b63aae4c9203736c0d5", "score": "0.7364311", "text": "func (o *GetInventoryOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "af5420d7101e9f6a65eb87b5e943e118", "score": "0.7363306", "text": "func (o *RegsitrarEntradaCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "fa10e644b2785c06fc855b9f7473ded5", "score": "0.73621273", "text": "func (o *AddTeamToTestOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "81f74e3421d70c7739d3ff5e2006a97d", "score": "0.73575866", "text": "func (o *GetTimeSlotsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "961f3fefa4f7dd02ce7006345a9e93d1", "score": "0.73532444", "text": "func (o *Operation) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\t// as of now, just log errors for writing response\n\tif err != nil {\n\t\tlogger.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "title": "" }, { "docid": "0d357ef0ecdc257c3f78a36f3a576e68", "score": "0.7351236", "text": "func (o *GetClusterByIDOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d6ed16adbe85ca3e4a19e984601b7ae1", "score": "0.7348278", "text": "func (o *GetSpeakersDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(o._statusCode)\n}", "title": "" }, { "docid": "6a370c2de2854712d793832b049c3d68", "score": "0.73473805", "text": "func (o *SetQuestionCorrectedOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "8dae0eedf157534769616fd4b14699e1", "score": "0.7344473", "text": "func (o *AddVerysimpleCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "555dd75df0e725d3055e1b5825e3183b", "score": "0.7343157", "text": "func (o *PostOperationsCreateOamServiceCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "8f3c98614c334c2661b4cc6ff5f3cbf2", "score": "0.7339136", "text": "func (o *PutLibrarianUsernameUserUserCheckoutOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "c339d7f7a2c857e84e8aebb201b8b10c", "score": "0.7335887", "text": "func (o *BookWriteOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "a4e51b58dc20f49186e7f163ed1f3dde", "score": "0.73301387", "text": "func (o *PostSendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "2d994ce86d331f5ba6709d4287445207", "score": "0.73247296", "text": "func (o *DeleteInventoryItemIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "24b0da3ad402d2bc0de7691fa206730c", "score": "0.73203826", "text": "func (o *WeaviateThingsListNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "title": "" }, { "docid": "df8ee19345e63e97929b734a5879aa7c", "score": "0.7320352", "text": "func (o *UpdateUserPlantOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header X-Request-Id\n\n\txRequestID := o.XRequestID\n\tif xRequestID != \"\" {\n\t\trw.Header().Set(\"X-Request-Id\", xRequestID)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ecbd4108f80196729fe7f522c7e9bfd9", "score": "0.7319448", "text": "func (o *WeaviatePeersAnswersCreateAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\n}", "title": "" }, { "docid": "6423b652cf8af11a50fa58817ad12df7", "score": "0.73171353", "text": "func write(comm *RequestResponse) {\n\terr := comm.Resp.WriteHeaderAndJson(\n\t\tcomm.HTTPStatus,\n\t\tcomm.ResponseBody,\n\t\trestful.MIME_JSON,\n\t)\n\tif err != nil {\n\t\tlogrus.Warnf(\"Unable to write response. Error was %v\", err)\n\t}\n}", "title": "" }, { "docid": "4e91b2fdfe5de19e2d59f61e8d46d8c0", "score": "0.73154366", "text": "func (o *GetCharactersCharacterIDCalendarEventIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "76c7cec493e51e14c581a04900fd5630", "score": "0.73117363", "text": "func (o *GetTaskDataOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make([]*models.URLResult, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" } ]
7e4f463fb7b7c4edb704f46a2700dec4
Foo query foo obj. just for test now
[ { "docid": "e508bd0d4e1520013a9cabdb1bb0e8c1", "score": "0.0", "text": "func (entry *Entry) Foo(ctx context.Context) (*model.Foo, error) {\n\treturn entry.A1.Foo(ctx)\n}", "title": "" } ]
[ { "docid": "96ea9163d4a54eac8fab4b4fbbd52a15", "score": "0.5762199", "text": "func TestDeepObjectQuery(t *testing.T) {\n\tnewPet := sw.Pet{\n\t\tId: sw.PtrInt64(12830), Name: \"gopher\",\n\t\tPhotoUrls: []string{\"http://1.com\", \"http://2.com\"}, Status: sw.PtrString(\"pending\"),\n\t\tTags: []sw.Tag{{Id: sw.PtrInt64(1), Name: sw.PtrString(\"tag2\")}},\n\t}\n\n\tnewCategory := sw.Category{Id: sw.PtrInt64(12830), Name: \"cat\"}\n\tconfiguration := sw.NewConfiguration()\n\tapiClient := sw.NewAPIClient(configuration)\n\tr, err := apiClient.FakeAPI.TestQueryDeepObject(context.Background()).TestPet(newPet).InputOptions(newCategory).Execute()\n\tif err != nil {\n\t\t// for sure this will fail as the endpoint is fake\n\t}\n\tif r.StatusCode != 200 {\n\t\tt.Log(r)\n\t}\n}", "title": "" }, { "docid": "9b037880f54ed42c46aa27ecd13abf12", "score": "0.5745035", "text": "func (m *mockTx) Query(string, ...interface{}) (irows, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "132ef8a46320567d77e6ceebbdea910b", "score": "0.55543005", "text": "func TestQuery(t *testing.T) {\n\n\tresults, err := FindAll(Published())\n\tif err != nil {\n\t\tt.Fatalf(\"posts: error getting posts :%s\", err)\n\t}\n\tif len(results) == 0 {\n\t\tt.Fatalf(\"posts: published posts not found :%s\", err)\n\t}\n\n\tresults, err = FindAll(Query().Where(\"id>=? AND id <=?\", 0, 100))\n\tif err != nil || len(results) == 0 {\n\t\tt.Fatalf(\"posts: no post found :%s\", err)\n\t}\n\tif len(results) > 1 {\n\t\tt.Fatalf(\"posts: more than one post found for where :%s\", err)\n\t}\n\n}", "title": "" }, { "docid": "0364d3a05120c0eb36570fc8e593235f", "score": "0.5519611", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n}", "title": "" }, { "docid": "2a460aec1053623df039c4760ee2669d", "score": "0.5396853", "text": "func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error {\n\treturn c.do(ctx, queryOperation, q, variables)\n}", "title": "" }, { "docid": "09b37074d5e5052ce088ee288f3dce41", "score": "0.5396486", "text": "func (t *PurchaseOrder) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\tlogger.Info(\"Query called\")\n\tif function == \"getPoDetails\" {\n\t\treturn getPoDetails(stub, args[0])\n\t} else if function == \"getAllPo\" {\n\t\treturn getAllPo(stub, args)\n\t} \n\t \n\treturn nil, nil\n}", "title": "" }, { "docid": "af424dcb99469f37b0388587e7985a25", "score": "0.53835064", "text": "func (t *SimpleChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\r\n\r\n\t\r\n logger.Debug(\"function--> \", function)\r\n\r\n\tif function == \"getStatus\" {\r\n\t\tif len(args) != 1 { fmt.Printf(\"Incorrect number of arguments passed\"); return nil, errors.New(\"QUERY: Incorrect number of arguments passed\") }\r\n\t\treturn t.getStatus(stub,args[0])\r\n\t}\r\n\t\r\n\treturn nil, errors.New(\"Received unknown function invocation \" + function)\r\n}", "title": "" }, { "docid": "5adbaf88115d9a5b9084e66ba269bbcf", "score": "0.5358872", "text": "func (m *mockDB) Query(string, ...interface{}) (irows, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "5926f3c8c1671c9f84f471058bda2f64", "score": "0.5341579", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tvar pid string\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query.\")\n\t}\n\n\tpid = args[0]\n\n\t// Get the state from the ledger\n\tAvalbytes, err := stub.GetState(pid)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + pid + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + pid + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tjsonResp := \"{\\\"Name\\\":\\\"\" + pid + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\tlogger.Infof(\"Query Response:%s\\n\", jsonResp)\n\treturn shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "5eccce3882b86fe902c7f1f03a966644", "score": "0.5331781", "text": "func FooByID(db XODB, id int) (*Foo, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, name ` +\n\t\t`FROM foo ` +\n\t\t`WHERE id = ?`\n\n\t// run query\n\tXOLog(sqlstr, id)\n\tf := Foo{\n\t\t_exists: true,\n\t}\n\n\terr = db.QueryRow(sqlstr, id).Scan(&f.ID, &f.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &f, nil\n}", "title": "" }, { "docid": "770c93dd925f8af471dd4c879188cadf", "score": "0.53271824", "text": "func (t *Receipt) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n logger.Info(\"work order receipt query\")\n\n // Get the state from the ledger\n logger.Infof(\"query by receipt id: %s\", args[0])\n Avalbytes, err := stub.GetState(args[0])\n if err != nil {\n return shim.Error(err.Error())\n }\n\n if Avalbytes == nil {\n return shim.Error(\"work order receipt with ID '\" + args[0] + \"' does not exist\")\n }\n\n return shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "818b3f19c0b3b51ead1e5524fc0ef145", "score": "0.53212917", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tvar A string // Entities\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n\n\tA = args[0]\n\n\t// Get the state from the ledger\n\tAvalbytes, err := stub.GetState(A)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tjsonResp := \"{\\\"Name\\\":\\\"\" + A + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\tlogger.Infof(\"Query Response:%s\\n\", jsonResp)\n\treturn shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "65e7f1e50b87883b9abd334f823c00a1", "score": "0.5320722", "text": "func (t *FFP) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\r\n\r\n\tif function == \"getUser\" { \r\n\t\tt := FFP{}\r\n\t\treturn t.getUser(stub, args)\r\n\t}\r\n\t\r\n\treturn nil, nil\r\n}", "title": "" }, { "docid": "b253f342d6a9e57183582ea43c968995", "score": "0.53154665", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar A string // Entities\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n\n\tA = args[0]\n\n\t// Get the state from the ledger\n\tAvalbytes, err := stub.GetState(A)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tjsonResp := \"{\\\"Name\\\":\\\"\" + A + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\tfmt.Printf(\"Query Response:%s\\n\", jsonResp)\n\treturn shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "f07aee04669678f3340a9c0ca72ec671", "score": "0.5310297", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar A string // Entities\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n\n\tA = args[0]\n\n\t// Get the state from the ledger\n\tAvalbytes, err := stub.GetState(A)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\t// jsonResp := \"{\\\"Name\\\":\\\"\" + A + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\t// fmt.Printf(\"Query Response:%s\\n\", jsonResp)\n\treturn shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "584ec67ed3ef400028f6bc5e4cf2b82d", "score": "0.5307544", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\r\n\r\n\tvar A string // Entities\r\n\tvar err error\r\n\r\n\tif len(args) != 1 {\r\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\r\n\t}\r\n\r\n\tA = args[0]\r\n\r\n\t// Get the state from the ledger\r\n\tAvalbytes, err := stub.GetState(A)\r\n\tif err != nil {\r\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + A + \"\\\"}\"\r\n\t\treturn shim.Error(jsonResp)\r\n\t}\r\n\r\n\tif Avalbytes == nil {\r\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + A + \"\\\"}\"\r\n\t\treturn shim.Error(jsonResp)\r\n\t}\r\n\r\n//\tjsonResp := \"{\\\"Name\\\":\\\"\" + A + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\r\n//\tlogger.Infof(\"Query Response:%s\\n\", jsonResp)\r\n\treturn shim.Success(Avalbytes)\r\n}", "title": "" }, { "docid": "031bfb3eefc9f4032873013611555e8f", "score": "0.52997065", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar A string // Entities\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n\n\tA = args[0]\n\n\t// Get the state from the ledger\n\tAvalbytes, erro := stub.GetState(A)\n\tif erro != nil {\n\t\treturn shim.Error(erro.Error())\n\t}\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Longxing.QIU Nil amount for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tjsonResp := \"{\\\"Name\\\":\\\"\" + A + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\tfmt.Printf(\"Query Response:%s\\n\", jsonResp)\n\treturn shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "e0ed78907429eab8b27223d0cbe9a249", "score": "0.52817124", "text": "func (t *DatabaseChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"########### DatabaseChaincode query ###########\")\n\n\t// Check whether the number of arguments is sufficient\n\tif len(args) != 2 {\n\t\treturn shim.Error(\"The number of arguments is wrong.\")\n\t}\n\n\t// Like the Invoke function, we manage multiple type of query requests with the second argument.\n\t// Get the state of the value matching the key requested\n\tstate, err := stub.GetState(args[1])\n\tif err != nil {\n\t\treturn Errorf(\"Failed to get state of %s\", args[1])\n\t}\n\n\t// Return this value in response\n\treturn shim.Success(state)\n}", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.5275592", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.5275592", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.5275592", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.5275592", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.5275592", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.5275592", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.5275592", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c6f9b48a92d67cfc7d373da71c2d07c5", "score": "0.5275592", "text": "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c52a8296f0edc10d166820ca9aeb72b2", "score": "0.52729887", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tvar key string // Entities\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n\n\tkey = args[0]\n\n\t// Get the state from the ledger\n\tAvalbytes, err := stub.GetState(key)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + key + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + key + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tjsonResp := \"{\\\"key\\\":\\\"\" + key + \"\\\",\\\"value\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\tlogger.Infof(\"Query Response:%s\\n\", jsonResp)\n\treturn shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "55d63215003ca96db5f37f8b235bc692", "score": "0.52608216", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tvar A string // Entities\n\tvar err error\n\n\tif len(args) != 2 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n\tA = args[1]\n\n\t// Get the state from the ledger\n\tAvalbytes, err := stub.GetState(A)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tjsonResp := \"{\\\"Name\\\":\\\"\" + A + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\tfmt.Printf(\"Query Response:%s\\n\", jsonResp)\n\treturn shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "39753bc132340131a77f62bf15d5757c", "score": "0.52592945", "text": "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar A string // Entities\n\tvar err error\n\n\tif len(args) != 2 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n\n\tA = args[1]\n\n\t// Get the state from the ledger\n\tAvalbytes, erro := stub.GetState(A)\n\tif erro != nil {\n\t\treturn shim.Error(erro.Error())\n\t}\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tjsonResp := \"{\\\"Name\\\":\\\"\" + A + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\tfmt.Printf(\"Query Response:%s\\n\", jsonResp)\n\treturn shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "f4a1da9ca607354ac9759d929b8ff7ef", "score": "0.52581245", "text": "func (t *SimpleChaincode) Query(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "99c73811d5e9a47bbe71eaf6cea88521", "score": "0.5251371", "text": "func getOne(rs interface{}, query string, param ...interface{}) (er error) {\r\n\tconn := open()\r\n\t// defer conn.Close()\r\n\tif param == nil {\r\n\t\treturn conn.Get(rs, query)\r\n\t}\r\n\trows, err := conn.NamedQuery(query, param[0])\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t}\r\n\tfor rows.Next() {\r\n\t\ter = rows.StructScan(rs)\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "cfdf42e7fcf245b42f84d61d765ea516", "score": "0.5250253", "text": "func (r *Repository) Query(rs interface{}, query string, param ...interface{}) error {\r\n\tstr := reflect.TypeOf(rs).String()\r\n\tif strings.Contains(str, \"[]\") {\r\n\t\treturn getMany(rs, query, param...)\r\n\t}\r\n\treturn getOne(rs, query, param...)\r\n}", "title": "" }, { "docid": "da9823e75bfa6e31a4f1c7a6d0523dee", "score": "0.52488816", "text": "func (c *Client) query(path string, qs string, respStruct interface{}) error {\n\tu := c.URL\n\tu.Path = path\n\tu.RawQuery = fmt.Sprintf(\"%s&%s\", u.RawQuery, qs)\n\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn errors.New(\"webpagetest: error creating request\")\n\t}\n\treq.Close = true\n\n\tresp, err := c.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn errors.New(\"webpagetest: error querying webpagetest\")\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn errors.New(\"webpagetest: bad response code from host\")\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn errors.New(\"webpagetest: error ready response body\")\n\t}\n\n\tif c.Debug {\n\t\tlog.Printf(\"WPT Debug Request: %s %s %s\", path, qs, body)\n\t}\n\n\terr = json.Unmarshal(body, &respStruct)\n\n\treturn err\n}", "title": "" }, { "docid": "636114a62cb7ff8329e4f61cd1802a85", "score": "0.5239846", "text": "func (cc CustomerController) QueryByEmail(email string) model.Customer {\n return model.Customer{}\n}", "title": "" }, { "docid": "62a1a285131e3a001a4bc95e2c38bf6f", "score": "0.5232578", "text": "func (f QuerierFunc) Query(ctx context.Context, q Query) (Value, error) {\n\treturn f(ctx, q)\n}", "title": "" }, { "docid": "5161b3fed7cf6f7d80b2a47c3561178c", "score": "0.5213154", "text": "func (this Datastore) Query(q *Query) *Querier {\n\treturn &Querier{this.context, q}\n}", "title": "" }, { "docid": "7011887b3b38d7e48af999cb10709434", "score": "0.5207974", "text": "func (t *SimpleChaincode) Query(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {\n\n\tif len(args) != 1 { return nil, errors.New(\"Incorrect number of arguments passed\") }\n\n\t//if function != \"getBatch\" && function != \"getAllBatches\" && function != \"getAllBatchesDetails\" && function != \"getNbItems\"{\n\t\t//return nil, errors.New(\"Invalid query function name.\")\n\t//}\n\n\tif function == \"getAllDonationsByUserId\" { return t.getAllDonationsByUserId(stub, args[0]) }\n\n\n\treturn nil, nil\t\t\t\t\t\t\t\t\t\t\n}", "title": "" }, { "docid": "fbcb087d1405a68c03237907378c55b6", "score": "0.5193029", "text": "func (t *SimpleChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\r\n\tfmt.Println(\"query is running \" + function)\r\n\r\n\t\r\n\tif function == \"getTxs\" { return t.getTxs(stub, args[1]) }\r\n\tif function == \"getUserAccount\" { return t.getUserAccount(stub, args[1]) }\r\n\tif function == \"getAllContracts\" { return t.getAllContracts(stub) }\r\n\t\r\n\t\r\n\tfmt.Println(\"query did not find func: \" + function)\t\t\t\t\t\t//error\r\n\r\n\treturn nil, errors.New(\"Received unknown function query\")\r\n}", "title": "" }, { "docid": "78a117155400acb55d82e2a5e305af66", "score": "0.5191732", "text": "func (y *YQL) Query(q string) (*Response, error){\n queryUrl := y.buildURL(q)\n resp, err := http.Get(queryUrl)\n \n // HTTP error\n if err != nil {\n return nil, err\n }\n \n resp_str, err := ioutil.ReadAll(resp.Body)\n // Read error\n if err != nil {\n return nil, err\n }\n defer resp.Body.Close()\n \n // Build the Response\n var jsonArray map[string]interface{}\n err = json.Unmarshal(resp_str, &jsonArray)\n // JSON error\n if err != nil {\n return nil, err\n }\n\n // TODO: Revisit once understand of type system is better. Lacks safety (i think?)\n jsonArray = (jsonArray[\"query\"]).(map[string]interface{})\n r := &Response{ jsonArray[\"created\"].(string), jsonArray[\"lang\"].(string), jsonArray[\"results\"].(map[string]interface{}) }\n\n return r, err\n}", "title": "" }, { "docid": "6a0df629638110fb34b813e110eba165", "score": "0.51892114", "text": "func TestQuery01(t *testing.T) {\n\n\t// Start the db connection.\n\tdb, _ := NewDB()\n\tdefer db.Close()\n\n\t// --------- Test 1 -------- //\n\n\t// Place to store the results.\n\tvar results = []User{}\n\n\t// Run the query\n\terr := db.Query(&results, QueryParam{})\n\n\t// Test results\n\tst.Expect(t, err, nil)\n\tst.Expect(t, len(results), 3)\n\n\tst.Expect(t, results[0].FirstName, \"Rob\")\n\tst.Expect(t, results[0].LastName, \"Tester\")\n\tst.Expect(t, results[0].Email, \"spicer+robtester@options.cafe\")\n\n\tst.Expect(t, results[1].FirstName, \"Jane\")\n\tst.Expect(t, results[1].LastName, \"Wells\")\n\tst.Expect(t, results[1].Email, \"spicer+janewells@options.cafe\")\n\n\tst.Expect(t, results[2].FirstName, \"Bob\")\n\tst.Expect(t, results[2].LastName, \"Rosso\")\n\tst.Expect(t, results[2].Email, \"spicer+bobrosso@options.cafe\")\n\n\t// --------- Test 2 -------- //\n\n\t// Place to store the results.\n\tresults = []User{}\n\n\t// Another test to see if search works\n\terr = db.Query(&results, QueryParam{\n\t\tSearchTerm: \"wells\",\n\t\tSearchCols: []string{\"id\", \"first_name\", \"last_name\", \"email\"},\n\t})\n\n\t// Test results\n\tst.Expect(t, err, nil)\n\tst.Expect(t, len(results), 1)\n\n\tst.Expect(t, results[0].FirstName, \"Jane\")\n\tst.Expect(t, results[0].LastName, \"Wells\")\n\tst.Expect(t, results[0].Email, \"spicer+janewells@options.cafe\")\n\n\t// --------- Test 3 -------- //\n\n\t// Place to store the results.\n\tresults = []User{}\n\n\t// Another test to see if search works\n\terr = db.Query(&results, QueryParam{\n\t\tWheres: []KeyValue{{Key: \"email\", Value: \"spicer+bobrosso@options.cafe\"}},\n\t})\n\n\t// Test results\n\tst.Expect(t, err, nil)\n\tst.Expect(t, len(results), 1)\n\n\tst.Expect(t, results[0].Id, uint(3))\n\tst.Expect(t, results[0].FirstName, \"Bob\")\n\tst.Expect(t, results[0].LastName, \"Rosso\")\n\tst.Expect(t, results[0].Email, \"spicer+bobrosso@options.cafe\")\n\n\t// --------- Test 4 -------- //\n\n\t// Place to store the results.\n\tresults = []User{}\n\n\t// Another test to see if search works\n\terr = db.Query(&results, QueryParam{\n\t\tOrder: \"last_name\",\n\t\tSort: \"asc\",\n\t})\n\n\t// Test results\n\tst.Expect(t, err, nil)\n\tst.Expect(t, len(results), 3)\n\n\tst.Expect(t, results[0].Id, uint(3))\n\tst.Expect(t, results[0].FirstName, \"Bob\")\n\tst.Expect(t, results[0].LastName, \"Rosso\")\n\tst.Expect(t, results[0].Email, \"spicer+bobrosso@options.cafe\")\n\n\tst.Expect(t, results[1].Id, uint(1))\n\tst.Expect(t, results[1].FirstName, \"Rob\")\n\tst.Expect(t, results[1].LastName, \"Tester\")\n\tst.Expect(t, results[1].Email, \"spicer+robtester@options.cafe\")\n\n\tst.Expect(t, results[2].Id, uint(2))\n\tst.Expect(t, results[2].FirstName, \"Jane\")\n\tst.Expect(t, results[2].LastName, \"Wells\")\n\tst.Expect(t, results[2].Email, \"spicer+janewells@options.cafe\")\n\n\t// --------- Test 5 -------- //\n\n\t// Place to store the results.\n\tresults = []User{}\n\n\t// Another test to see if search works\n\terr = db.Query(&results, QueryParam{\n\t\tOrder: \"last_name\",\n\t\tSort: \"desc\",\n\t})\n\n\t// Test results\n\tst.Expect(t, err, nil)\n\tst.Expect(t, len(results), 3)\n\n\tst.Expect(t, results[0].Id, uint(2))\n\tst.Expect(t, results[0].FirstName, \"Jane\")\n\tst.Expect(t, results[0].LastName, \"Wells\")\n\tst.Expect(t, results[0].Email, \"spicer+janewells@options.cafe\")\n\n\tst.Expect(t, results[1].Id, uint(1))\n\tst.Expect(t, results[1].FirstName, \"Rob\")\n\tst.Expect(t, results[1].LastName, \"Tester\")\n\tst.Expect(t, results[1].Email, \"spicer+robtester@options.cafe\")\n\n\tst.Expect(t, results[2].Id, uint(3))\n\tst.Expect(t, results[2].FirstName, \"Bob\")\n\tst.Expect(t, results[2].LastName, \"Rosso\")\n\tst.Expect(t, results[2].Email, \"spicer+bobrosso@options.cafe\")\n\n\t// --------- Test 6 -------- //\n\n\t// Place to store the results.\n\tresults = []User{}\n\n\t// Another test to see if search works\n\terr = db.Query(&results, QueryParam{\n\t\tOrder: \"last_name\",\n\t\tSort: \"desc\",\n\t\tLimit: 1,\n\t})\n\n\t// Test results\n\tst.Expect(t, err, nil)\n\tst.Expect(t, len(results), 1)\n\n\tst.Expect(t, results[0].Id, uint(2))\n\tst.Expect(t, results[0].FirstName, \"Jane\")\n\tst.Expect(t, results[0].LastName, \"Wells\")\n\tst.Expect(t, results[0].Email, \"spicer+janewells@options.cafe\")\n\n\t// --------- Test 7 -------- //\n\n\t// Place to store the results.\n\tresults = []User{}\n\n\t// Another test to see if search works\n\terr = db.Query(&results, QueryParam{\n\t\tOrder: \"last_name\",\n\t\tSort: \"desc\",\n\t\tLimit: 1,\n\t\tOffset: 2,\n\t})\n\n\t// Test results\n\tst.Expect(t, err, nil)\n\tst.Expect(t, len(results), 1)\n\n\tst.Expect(t, results[0].Id, uint(3))\n\tst.Expect(t, results[0].FirstName, \"Bob\")\n\tst.Expect(t, results[0].LastName, \"Rosso\")\n\tst.Expect(t, results[0].Email, \"spicer+bobrosso@options.cafe\")\n\n\t// --------- Test 8 -------- //\n\n\t// Place to store the results.\n\tresults = []User{}\n\n\t// Another test to see if search works\n\terr = db.Query(&results, QueryParam{\n\t\tOrder: \"last_name\",\n\t\tSort: \"desc\",\n\t\tLimit: 1,\n\t\tPage: 2,\n\t})\n\n\t// Test results\n\tst.Expect(t, err, nil)\n\tst.Expect(t, len(results), 1)\n\n\tst.Expect(t, results[0].Id, uint(1))\n\tst.Expect(t, results[0].FirstName, \"Rob\")\n\tst.Expect(t, results[0].LastName, \"Tester\")\n\tst.Expect(t, results[0].Email, \"spicer+robtester@options.cafe\")\n}", "title": "" }, { "docid": "42ce378f8e7a35bee215af4e8cc4001f", "score": "0.51823956", "text": "func (c *querierConstructor) Query(query string, args []interface{}, logFields ...interface{}) Querier {\n\tif c.log.HasLevel(logger.TraceLevel) {\n\t\tc.log.Tracew(\"construct `Query`\",\n\t\t\tappend(logFields,\n\t\t\t\t\"query\", query,\n\t\t\t\t\"args\", args)...)\n\t}\n\treturn &querier{c: c, query: query, args: args, logFields: logFields}\n}", "title": "" }, { "docid": "09cd6c4c177529a27c67f5aced27e4f9", "score": "0.5164177", "text": "func (t *SampleChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\r\n\t\t\t\t\t\t\t\t\t \r\n\t\tif function == \"AuthenticateAsUser\" {\r\n\t\t\r\n\t\t\tuser, err := GetUser(stub, args[0])\r\n\t\t\tif err != nil {\r\n\t\t\t\tlogger.Infof(\"User with id %v not found.\", args[0])\r\n\t\t\t}\r\n\t\t\r\n\t\t return json.Marshal(AuthenticateAsUser(stub, user, args[1]))\r\n\t\t\t\r\n\t\t} else if function == \"getUsers\" {\r\n\t\t\r\n\t\t\treturn GetUsers(stub)\r\n\t\t\t \r\n\t\t} else if function == \"GetImagesByUser\" {\r\n\t\t\r\n\t\t\t// args[0] : username\r\n\t\t\treturn GetImagesByUser(stub , args[0])\r\n\t\t\t\r\n\t\t} else if function == \"getImage\" {\r\n\t\t\r\n\t\t\t// args[0] : imageID\r\n\t\t\treturn getImage(stub, args[0]);\r\n\t\t\t\r\n\t\t} else if function == \"GetImages\" {\r\n\t\t\r\n\t\t\treturn GetImages(stub)\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\treturn nil, nil\r\n}", "title": "" }, { "docid": "dc22c328b0db5123532ab4e41d2e88ee", "score": "0.5138398", "text": "func (t *CBDoc) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\r\n\r\n\tif function == \"viewDocumentsByStatus\" {\r\n\t\tt := CBDoc{}\r\n\t\treturn t.viewDocumentsByStatus(stub, args)\t\t\r\n\t} else if function == \"viewDocumentsBySource\" { \r\n\t\tt := CBDoc{}\r\n\t\treturn t.viewDocumentsBySource(stub, args)\r\n\t}else if function == \"viewDocumentsByDestination\" { \r\n\t\tt := CBDoc{}\r\n\t\treturn t.viewDocumentsByDestination(stub, args)\r\n\t}else if function == \"countDocumentsByStatus\" { \r\n\t\tt := CBDoc{}\r\n\t\treturn t.countDocumentsByStatus(stub, args)\r\n\t}else if function == \"viewDocumentTransactionHistory\" { \r\n\t\tt := CBDoc{}\r\n\t\treturn t.viewDocumentTransactionHistory(stub, args)\r\n\t}else if function == \"viewDetailsByDocId\" { \r\n\t\tt := CBDoc{}\r\n\t\treturn t.viewDetailsByDocId(stub, args)\r\n\t}else if function == \"viewItemListByDocumentId\" { \r\n\t\tt := CBDoc{}\r\n\t\treturn t.viewItemListByDocumentId(stub, args)\r\n\t}else if function == \"viewTruckDetailsByDocId\" { \r\n\t\tt := CBDoc{}\r\n\t\treturn t.viewTruckDetailsByDocId(stub, args)\r\n\t}else if function == \"viewAllTruckByDocStatus\" { \r\n\t\tt := CBDoc{}\r\n\t\treturn t.viewAllTruckByDocStatus(stub, args)\r\n\t}else if function == \"viewAllHighPriorityDocuments\" { \r\n\t\tt := CBDoc{}\r\n\t\treturn t.viewAllHighPriorityDocuments(stub, args)\r\n\t}\t\r\n\t\t\r\n\treturn nil, errors.New(\"Invalid query function name.\")\r\n}", "title": "" }, { "docid": "2870b932f7321d3620f4f4514df5fc90", "score": "0.5137919", "text": "func (t *TriPartyRepoChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\tmyLogger.Debugf(\"Query [%s]\", function)\n\tmyLogger.Debugf(\"Args [%s]\", args[0])\n\n\treturn t.GetEntity(stub, function, args[0])\t\n\treturn nil, errors.New(\"Invalid query function name. Expecting 'query' but found '\" + function + \"'\")\n}", "title": "" }, { "docid": "34c60b4bb74aff34477d9f9c9eda54be", "score": "0.51284623", "text": "func (*testPromAPI) Query(c context.Context, query string, ts time.Time, opts ...v1.Option) (model.Value, v1.Warnings, error) {\n\n\ts := model.Sample{Value: expected}\n\tvar v []*model.Sample\n\tv = append(v, &s)\n\n\treturn model.Vector(v), nil, nil\n}", "title": "" }, { "docid": "0ed99853f87834ba07884d260abffd05", "score": "0.5126646", "text": "func (t *CVVerificationChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"Query functions\")\n\n\t// Ensure at least one argument has been provided; otherwise return error\n\tif len(args) < 1 {\n\t\treturn shim.Error(\"No query function specified.\")\n\t}\n\n\tif args[0] == \"id\" {\n\t\treturn t.id(stub, args[1:])\n\t} else if args[0] == \"admin\" {\n\t\treturn t.admin(stub, args[1:])\n\t} else if args[0] == \"applicant\" {\n\t\treturn t.applicant(stub, args[1:])\n\t} else if args[0] == \"applicantkey\" {\n\t\treturn t.applicantkey(stub, args[1:])\n\t} else if args[0] == \"verifier\" {\n\t\treturn t.verifier(stub, args[1:])\n\t} else if args[0] == \"employer\" {\n\t\treturn t.employer(stub, args[1:])\n\t} else if args[0] == \"cv\" {\n\t\treturn t.cv(stub, args[1:])\n\t} else if args[0] == \"cvs\" {\n\t\treturn t.cvs(stub, args[1:])\n\t} else if args[0] == \"cvreviews\" {\n\t\treturn t.cvreviews(stub, args[1:])\n\t}\n\n\t// The passed argument does not match any function; return error\n\treturn shim.Error(\"Invalid second argument supplied.\")\n}", "title": "" }, { "docid": "5e268351fb4f56ef5c18fe0a315c1958", "score": "0.51208204", "text": "func (o *Orm) Where(query string) *Orm {\n if len(tmpQuery) == 0 {\n panic(\"You must declare Find() first!\")\n }\n\n var q map[string]interface{}\n\n err := json.Unmarshal([]byte(query), &q)\n if err != nil {\n return o\n }\n\n tmpQuery[\"query\"].(map[string]interface{})[\"filtered\"].(map[string]interface{})[\"filter\"] = q\n return o\n}", "title": "" }, { "docid": "ccd2acef3b417b5d69161e5a0278473a", "score": "0.5117799", "text": "func (logStdout *LoggerStdout) Query(data []byte, environment, uuid, name string, status int, debug bool) {\n\tlog.Printf(\"Query: %s:%d - %s:%s - %d bytes [%s]\", name, status, environment, uuid, len(data), string(data))\n}", "title": "" }, { "docid": "592a84a3b153edadd8020335a5f95bfc", "score": "0.5113139", "text": "func (o *Orm) Where(query string) *Orm {\n if len(o.tmpQuery) == 0 {\n panic(\"You must declare Find() first!\")\n }\n\n var q map[string]interface{}\n\n err := json.Unmarshal([]byte(query), &q)\n if err != nil {\n return o\n }\n\n o.tmpQuery[\"query\"].(map[string]interface{})[\"filtered\"].(map[string]interface{})[\"filter\"] = q\n return o\n}", "title": "" }, { "docid": "d288c6f6429f8d9e3eaaedf4bce20c3d", "score": "0.5104716", "text": "func queryCallback(scope *Scope) {\n\tif _, skip := scope.InstanceGet(\"aorm:skip_query_callback\"); skip {\n\t\treturn\n\t}\n\n\tscope.ExecTime = NowFunc()\n\tdefer scope.trace(scope.ExecTime)\n\n\tvar (\n\t\tresultType reflect.Type\n\t\tresults, sender = scope.ResultSender()\n\t)\n\n\tif !scope.Search.raw {\n\t\tif orderBy, ok := scope.Get(\"aorm:order_by_primary_key\"); ok {\n\t\t\tif primaryField := scope.Struct().PrimaryField(); primaryField != nil {\n\t\t\t\tscope.Search.Order(fmt.Sprintf(\"%v.%v %v\", scope.QuotedTableName(), scope.Quote(primaryField.DBName), orderBy))\n\t\t\t}\n\t\t}\n\t}\n\n\tif value, ok := scope.Get(\"aorm:query_destination\"); ok {\n\t\tresults = reflect.ValueOf(value)\n\t\tsender = SenderOf(results)\n\t}\n\n\tif sender != nil {\n\t\tif results.Elem().Kind() == reflect.Chan {\n\t\t\tresults = results.Elem()\n\t\t\tdefer results.Close()\n\t\t}\n\t} else {\n\t\tresults = results.Elem()\n\t}\n\n\tresultType, _, _ = StructTypeOf(results.Type())\n\n\tif resultType.Kind() != reflect.Struct {\n\t\tscope.Err(errors.New(\"unsupported destination, should be slice or struct\"))\n\t\treturn\n\t}\n\n\tscope.prepareQuerySQL()\n\n\tif scope.HasError() {\n\t\treturn\n\t}\n\tscope.db.RowsAffected = 0\n\tif str, ok := scope.Get(\"aorm:query_option\"); ok {\n\t\tscope.Query.Query += addExtraSpaceIfExist(fmt.Sprint(str))\n\t}\n\n\tif scope.checkDryRun() {\n\t\treturn\n\t}\n\n\trows := scope.log(LOG_READ).runQueryRows()\n\tif scope.HasError() {\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tcolumns, _ := rows.Columns()\n\tfor rows.Next() {\n\t\tscope.db.RowsAffected++\n\n\t\telem := results\n\t\tif sender != nil {\n\t\t\telem = reflect.New(resultType).Elem()\n\t\t}\n\n\t\tresult := scope.New(elem.Addr().Interface())\n\t\tscope.scan(rows, columns, result.Instance().Fields, elem.Addr().Interface())\n\n\t\tif !scope.HasError() {\n\t\t\tif acv, ok := elem.Interface().(interface {\n\t\t\t\tAfterScan(*Scope)\n\t\t\t}); ok {\n\t\t\t\tacv.AfterScan(scope)\n\t\t\t} else if acv, ok := elem.Interface().(interface {\n\t\t\t\tAfterScan(*DB)\n\t\t\t}); ok {\n\t\t\t\tacv.AfterScan(scope.DB())\n\t\t\t} else if acv, ok := elem.Addr().Interface().(interface {\n\t\t\t\tAfterScan(*Scope)\n\t\t\t}); ok {\n\t\t\t\tacv.AfterScan(scope)\n\t\t\t} else if acv, ok := elem.Addr().Interface().(interface {\n\t\t\t\tAfterScan(*DB)\n\t\t\t}); ok {\n\t\t\t\tacv.AfterScan(scope.DB())\n\t\t\t}\n\t\t}\n\n\t\tif sender != nil {\n\t\t\tsender(elem)\n\t\t}\n\t}\n\n\tif err := rows.Err(); err != nil {\n\t\tscope.Err(err)\n\t} else if scope.db.RowsAffected == 0 && sender == nil {\n\t\tscope.Err(ErrRecordNotFound)\n\t}\n}", "title": "" }, { "docid": "0e039812aa862af4bb920d6bb6789e80", "score": "0.5094648", "text": "func (qw QueryWrapper) run(tx *bolt.Tx) ([][]byte, error) {\n\treturn boltq.TxQuery(tx, qw.q)\n}", "title": "" }, { "docid": "ce1245a1da005ce7f7472a10191003fd", "score": "0.50939417", "text": "func (c *Client) Query(ctx context.Context, soql string, out interface{}) (string, error) {\n\tif out == nil {\n\t\treturn \"\", errors.New(\"missing out argument\")\n\t}\n\tif reflect.TypeOf(out).Kind() != reflect.Ptr {\n\t\treturn \"\", errors.New(\"out argument isn't a pointer\")\n\t}\n\n\t// Build request\n\treq, err := c.newRequest(ctx, http.MethodGet, queryResource, nil)\n\tif err != nil {\n\t\tc.Logger.Printf(\"failed to create the request: %v\", err)\n\t\treturn \"\", err\n\t}\n\tvalues := url.Values{}\n\tvalues.Add(\"q\", soql)\n\treq.URL.RawQuery = values.Encode()\n\n\t// Execute GET\n\tc.Logger.Printf(\"%s %v\\n\", http.MethodGet, req.URL)\n\tres, err := c.HttpClient.Do(req)\n\tif err != nil {\n\t\tc.Logger.Printf(\"failed to execute the request: %v\", err)\n\t\treturn \"\", err\n\t}\n\n\t// Decode response\n\tif err := decodeBody(res, out); err != nil {\n\t\tc.Logger.Printf(\"failed to decode the response: %v\", err)\n\t\treturn \"\", err\n\t}\n\treturn res.Header.Get(\"nextRecordsUrl\"), nil\n}", "title": "" }, { "docid": "69ea018eacc19da6f79ceee458660af7", "score": "0.5093616", "text": "func (ctx *context) Query(query string) (interface{}, error) {\n\tif err := ctx.loadDeferred(query); err != nil {\n\t\treturn nil, err\n\t}\n\n\tquery = strings.TrimSpace(query)\n\tif query == \"\" {\n\t\treturn nil, fmt.Errorf(\"invalid query (nil)\")\n\t}\n\t// compile the query\n\tqueryPath, err := ctx.jp.Query(query)\n\tif err != nil {\n\t\tlogger.Error(err, \"incorrect query\", \"query\", query)\n\t\treturn nil, fmt.Errorf(\"incorrect query %s: %v\", query, err)\n\t}\n\t// search\n\tctx.mutex.RLock()\n\tdefer ctx.mutex.RUnlock()\n\tvar data interface{}\n\tif err := json.Unmarshal(ctx.jsonRaw, &data); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal context: %w\", err)\n\t}\n\tresult, err := queryPath.Search(data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"JMESPath query failed: %w\", err)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "19f9487d9d9ca5c34d7d49ead00cc0a1", "score": "0.50887376", "text": "func (db *DB) Query(ctx context.Context, q *objects.QueryInput) (search.Results, *objects.Error) {\n\ttotalLimit := q.Offset + q.Limit\n\tif totalLimit == 0 {\n\t\treturn nil, nil\n\t}\n\tif len(q.Sort) > 0 {\n\t\tscheme := db.schemaGetter.GetSchemaSkipAuth()\n\t\tif err := filters.ValidateSort(scheme, schema.ClassName(q.Class), q.Sort); err != nil {\n\t\t\treturn nil, &objects.Error{Msg: \"sorting\", Code: objects.StatusBadRequest, Err: err}\n\t\t}\n\t}\n\tidx := db.GetIndex(schema.ClassName(q.Class))\n\tif idx == nil {\n\t\treturn nil, &objects.Error{Msg: \"class not found \" + q.Class, Code: objects.StatusNotFound}\n\t}\n\tif q.Cursor != nil {\n\t\tif err := filters.ValidateCursor(schema.ClassName(q.Class), q.Cursor, q.Offset, q.Filters, q.Sort); err != nil {\n\t\t\treturn nil, &objects.Error{Msg: \"cursor api: invalid 'after' parameter\", Code: objects.StatusBadRequest, Err: err}\n\t\t}\n\t}\n\tres, _, err := idx.objectSearch(ctx, totalLimit, q.Filters,\n\t\tnil, q.Sort, q.Cursor, q.Additional, nil, q.Tenant, 0)\n\tif err != nil {\n\t\tswitch err.(type) {\n\t\tcase objects.ErrMultiTenancy:\n\t\t\treturn nil, &objects.Error{Msg: \"search index \" + idx.ID(), Code: objects.StatusUnprocessableEntity, Err: err}\n\t\tdefault:\n\t\t\treturn nil, &objects.Error{Msg: \"search index \" + idx.ID(), Code: objects.StatusInternalServerError, Err: err}\n\t\t}\n\t}\n\treturn db.getSearchResults(storobj.SearchResults(res, q.Additional, \"\"), q.Offset, q.Limit), nil\n}", "title": "" }, { "docid": "f7cafb163aaf2b1f0f6bbd72eeccc0c5", "score": "0.50721616", "text": "func (b *Base) QueryBase(ctx context.Context, query string, v *url.Values, inst interface{}) error {\n\t// Make request\n\tresp, err := b.QueryRequest(ctx, query, v)\n\tif err != nil && (resp == nil || resp.StatusCode != http.StatusBadRequest) {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Read body into buffer\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Handle bad requests with messages\n\tif resp.StatusCode != http.StatusOK {\n\t\tapiMessage := GoongApiError{}\n\t\tmessageErr := json.Unmarshal(body, &apiMessage)\n\t\tif messageErr == nil {\n\t\t\treturn fmt.Errorf(\"api error: %s\", apiMessage.Error.Message)\n\t\t}\n\t\treturn fmt.Errorf(\"Bad Request (400) - no message\")\n\t}\n\n\t// Attempt to decode body into inst type\n\terr = json.Unmarshal(body, &inst)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7cc49ae84814cd9ece7502c46403864d", "score": "0.5068485", "text": "func (t *CashChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar A string // Entities\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n\n\tA = args[0]\n\n\t// Get the state from the ledger\n\tAvalbytes, err := stub.GetState(A)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Nil amount for \" + A + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\tjsonResp := \"{\\\"Name\\\":\\\"\" + A + \"\\\",\\\"Amount\\\":\\\"\" + string(Avalbytes) + \"\\\"}\"\n\tfmt.Printf(\"Query Response:%s\\n\", jsonResp)\n\treturn shim.Success(Avalbytes)\n}", "title": "" }, { "docid": "c6d2f5563f487d2de74f799ddd22995f", "score": "0.5067432", "text": "func (t *SimpleChaincode) Query(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {\r\n\t\r\n\tif function == \"get_number\" { \r\n\t\t\treturn t.get_number(stub, args) \t\t\r\n\t}\r\n\t\r\n\treturn nil, errors.New(\"Function of that name not found\")\r\n}", "title": "" }, { "docid": "042735e2a50c12b5ae1a3bc014cba717", "score": "0.50545937", "text": "func (cc *Chaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\treturn cc.handleInvocation(stub, function, args)\n}", "title": "" }, { "docid": "391694b16df9c5f4fae724c5388aecd8", "score": "0.5052088", "text": "func query(request Request) *http.Response {\r\n\r\n\treq := bakeRequest(request)\r\n\tclient := &http.Client{}\r\n\tresp, err := client.Do(req)\r\n\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\treturn resp\r\n}", "title": "" }, { "docid": "aaa3f2458041acf53cf949fd9610c3b4", "score": "0.50434446", "text": "func queryCallback(scope *Scope) {\n\tdefer scope.trace(NowFunc())\n\n\tvar (\n\t\tisSlice, isPtr bool\n\t\tresultType reflect.Type\n\t\tresults = scope.IndirectValue()\n\t)\n\n\tif orderBy, ok := scope.Get(\"gorm:order_by_primary_key\"); ok {\n\t\tif primaryField := scope.PrimaryField(); primaryField != nil {\n\t\t\tscope.Search.Order(fmt.Sprintf(\"%v.%v %v\", scope.QuotedTableName(), scope.Quote(primaryField.DBName), orderBy))\n\t\t}\n\t}\n\n\tif value, ok := scope.Get(\"gorm:query_destination\"); ok {\n\t\tresults = indirect(reflect.ValueOf(value))\n\t}\n\n\tif kind := results.Kind(); kind == reflect.Slice {\n\t\tisSlice = true\n\t\tresultType = results.Type().Elem()\n\t\tresults.Set(reflect.MakeSlice(results.Type(), 0, 0))\n\n\t\tif resultType.Kind() == reflect.Ptr {\n\t\t\tisPtr = true\n\t\t\tresultType = resultType.Elem()\n\t\t}\n\t} else if kind != reflect.Struct {\n\t\tscope.Err(errors.New(\"unsupported destination, should be slice or struct\"))\n\t\treturn\n\t}\n\n\tscope.prepareQuerySQL()\n\n\tif !scope.HasError() {\n\t\tscope.db.RowsAffected = 0\n\t\tif str, ok := scope.Get(\"gorm:query_option\"); ok {\n\t\t\tscope.SQL += addExtraSpaceIfExist(fmt.Sprint(str))\n\t\t}\n\t\tvar sqlvarsstr string\n\n\t\tif(scope.TableName()==\"\"){\n\t\t\tsqlvarsstr = fmt.Sprint(*scope.db.QueryExpr())\n\t\t}else{\n\t\t\tvars := fmt.Sprint(scope.SQLVars)\n\t\t\tsqlvarsstr = scope.SQL+vars\n\n\t\t}\n\t\tfmt.Println(sqlvarsstr)\n\t\tiscache :=strings.Contains(scope.SQL,\"true=true\")\n\t\thaskey := md5.Sum([]byte(sqlvarsstr))\n\t\thaskeystr := fmt.Sprintf(\"%x\", haskey) //将[]byte转成16进制\n\t\tfmt.Println(\"query:\",haskeystr)\n\t\t//iscache存在且其值为真,则调用redis缓存逻辑\n\t\tvar firstTableName string\n\t\tif (iscache) {\n\t\t\t//get tables name\n\n\t\t\treg := regexp.MustCompile(\"(?i)\\\\s+(from|join)\\\\s+`*(\\\\w+)`*\\\\s+\")\n\t\t\ttableNames := reg.FindAllStringSubmatch(scope.SQL,-1)\n\t\t\tif len(tableNames)>0 {\n\t\t\t\tfirstTableName = tableNames[0][2]\n\t\t\t//is value exist?\t\t\t/\n\t\t\t\tif (Rds.HExists(firstTableName, haskeystr).Val()) {\n\t\t\t\t\t//get values from redis\n\t\t\t\t\tredisValue, _ := Rds.HGet(firstTableName, haskeystr).Bytes()\n\t\t\t\t\tfmt.Println(redisValue,haskeystr)\n\t\t\t\t\tjson.Unmarshal(redisValue, scope.Value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif rows, err := scope.SQLDB().Query(scope.SQL, scope.SQLVars...); scope.Err(err) == nil {\n\t\t\tdefer rows.Close()\n\t\t\tfmt.Println(\"queryend\")\n\t\t\tcolumns, _ := rows.Columns()\n\t\t\tfor rows.Next() {\n\t\t\t\tscope.db.RowsAffected++\n\n\t\t\t\telem := results\n\t\t\t\tif isSlice {\n\t\t\t\t\telem = reflect.New(resultType).Elem()\n\t\t\t\t}\n\n\t\t\t\tscope.scan(rows, columns, scope.New(elem.Addr().Interface()).Fields())\n\n\t\t\t\tif isSlice {\n\t\t\t\t\tif isPtr {\n\t\t\t\t\t\tresults.Set(reflect.Append(results, elem.Addr()))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresults.Set(reflect.Append(results, elem))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (iscache && len(firstTableName)>0 && scope.Value!=nil) {\n\t\t\t\t//set redis value\n\t\t\t\tjsonValue, _ := json.Marshal(scope.Value)\n\t\t\t\tRds.HSet(firstTableName, haskeystr, jsonValue)\n\t\t\t\tif err := rows.Err(); err != nil {\n\t\t\t\t\tscope.Err(err)\n\t\t\t\t} else if scope.db.RowsAffected == 0 && !isSlice {\n\t\t\t\t\tscope.Err(ErrRecordNotFound)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "03795e73ccca8195cf8159ecf5949b23", "score": "0.50319284", "text": "func (qr *queryResolver) Get(ctx context.Context, name string) (*model.ObjectReturned, error) {\n\treturn &model.ObjectReturned{\n\t\tName: name,\n\t}, nil\n}", "title": "" }, { "docid": "47451787d85be683c67ade0415457ed7", "score": "0.5022445", "text": "func (r *Resolver) Query() graph.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "2c0afd29c0c1c2e5220419c1feed58bc", "score": "0.50213057", "text": "func (r *CapabilityReconciler) queryObjects(log logr.Logger, clusterQueryClient *discovery.ClusterQueryClient, queries []corev1alpha2.QueryObject) []corev1alpha2.QueryResult {\n\treturn r.executeQueries(log.WithValues(\"queryType\", \"Object\"), clusterQueryClient, func() map[string]discovery.QueryTarget {\n\t\tqueryTargets := make(map[string]discovery.QueryTarget)\n\t\tfor i := range queries {\n\t\t\tq := queries[i]\n\t\t\tquery := discovery.Object(q.Name, &q.ObjectReference).WithAnnotations(q.WithAnnotations).WithoutAnnotations(q.WithoutAnnotations)\n\t\t\tqueryTargets[q.Name] = query\n\t\t}\n\t\treturn queryTargets\n\t})\n}", "title": "" }, { "docid": "65e98b53b2f3210133f7a3333ab88008", "score": "0.5018782", "text": "func (base ConcreteService) ReadByQuery(table interface{}, condition map[string]interface{}) (obj interface{}, err error) {\n\tobj = tool.NewInstanceSetValue(table, \"id\", condition[\"id\"])\n\tquery := orm.NewOrm().QueryTable(table)\n\tquery = queryBuilder(query, condition)\n\terr = query.One(&obj)\n\treturn\n}", "title": "" }, { "docid": "27b6f0204dd241bf953ab22030e0e606", "score": "0.50177884", "text": "func (t *SimpleChaincode) Query(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {\n\tfmt.Println(\"query is running \" + function)\n\n\t// Handle different functions\n\tif function == \"read\" {\n\t\texist, errRead := t.read(stub, args)\n\t\tif errRead != nil {\n\t\t\treturn nil, errRead\n\t\t}\n\t\t//exPtn, size:= utf8.DecodeRune(exist)\n\t\t//var pnt MyRecord\n\t\t//err := json.Unmarshal(exPtn, &pnt)\n\t\t//if pnt.VerifyPermission(*doctorID!!!*, \"read\")!=true{\n\t\t//\tfmt.Println(\"error...\")\n\t\t//}\n\t\treturn exist, errRead\n\t}\n\tfmt.Println(\"query did not find func: \" + function)\n\n\treturn nil, errors.New(\"Received unknown function query: \" + function)\n}", "title": "" }, { "docid": "52a4723485b6d283412797b8869786ba", "score": "0.50152403", "text": "func Query(m *mgo.Collection, query interface{}) interface{} {\n\tvar model Model\n\treturn m.Find(query).One(&model)\n}", "title": "" }, { "docid": "afa0be5feca0c48b1df7ffbd1f4988d8", "score": "0.5011198", "text": "func (m *Manager) Query(qf func(t *tickettypes.Ticket) bool, queryOpt ...interface{}) []*tickettypes.Ticket {\n\treturn m.s.Query(qf, queryOpt...)\n}", "title": "" }, { "docid": "15e90aedda247e92848da71fc634da39", "score": "0.50110173", "text": "func (hood *Hood) Query(query string, args ...interface{}) (*sql.Rows, error) {\n\thood.mutex.Lock()\n\tdefer hood.mutex.Unlock()\n\n\thood.logSql(query, args...)\n\treturn hood.qo.Query(query, hood.convertSpecialTypes(args)...)\n}", "title": "" }, { "docid": "0723b764605582df8686cac4d634ae88", "score": "0.49936593", "text": "func (db *DB) QueryOne(model, query interface{}, params ...interface{}) (*types.Result, error) {\n\tmod, err := newSingleModel(model)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := db.Query(mod, query, params...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn assertOneAffected(res)\n}", "title": "" }, { "docid": "edd8d445e3cf8ec414699ba9c84f4d64", "score": "0.49879122", "text": "func (t *SimpleChaincode) queryItemsByOwner(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\t// 0\n\t// \"bob\"\n\tif len(args) < 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 1\")\n\t}\n\n\towner := args[0]\n\n\tqueryString := fmt.Sprintf(\"{\\\"selector\\\":{\\\"docType\\\":\\\"item\\\",\\\"owner\\\":\\\"%s\\\"}}\", owner)\n\n\tqueryResults, err := getQueryResultForQueryString(stub, queryString)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\treturn shim.Success(queryResults)\n}", "title": "" }, { "docid": "dcc4fe6d2e26a1940e6b104661b14901", "score": "0.49812937", "text": "func (c *Contract) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\tfmt.Println(\"query is running \" + function)\n\n\t// Handle different functions\n\tif function == \"queryTicket\" { //read a variable\n\t\treturn c.queryTicket(stub, args)\n\t} else if function == \"queryAllPlan\" {\n\t\treturn c.queryAllPlan(stub, args)\n\t} else if function == \"queryCinema\" {\n\t\treturn c.queryCinema(stub, args)\n\t} else if function == \"queryTicketPlatform\" {\n\t\treturn c.queryTicketPlatform(stub, args)\n\t} else if function == \"queryVideoHall\" {\n\t\treturn c.queryVideoHall(stub, args)\n\t} else if function == \"queryPlan\" {\n\t\treturn c.queryPlan(stub, args)\n\t} else if function == \"queryMovie\" {\n\t\treturn c.queryMovie(stub, args)\n\t} else if function == \"clear\" {\n\t\treturn c.clear(stub, args)\n\t}\n\n\tfmt.Println(\"query did not find func: \" + function)\n\treturn nil, errors.New(\"Received unknown function query: \" + function)\n}", "title": "" }, { "docid": "5289bc27c7936fbe58f80f840bf02ce6", "score": "0.49805444", "text": "func (c *Client) Query(q string) *Query {\n\treturn &Query{\n\t\tclient: c,\n\t\tQueryConfig: QueryConfig{Q: q},\n\t}\n}", "title": "" }, { "docid": "e22cc2cd21a6e6c1d5adbc136fcda525", "score": "0.49800828", "text": "func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, queryImplementors)\n\n\tctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{\n\t\tObject: \"Query\",\n\t})\n\n\tvar wg sync.WaitGroup\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"Query\")\n\t\tcase \"user\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Query_user(ctx, field)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"feeds\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Query_feeds(ctx, field)\n\t\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\t\tinvalid = true\n\t\t\t\t}\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"popularFeeds\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Query_popularFeeds(ctx, field)\n\t\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\t\tinvalid = true\n\t\t\t\t}\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"popularArticles\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Query_popularArticles(ctx, field)\n\t\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\t\tinvalid = true\n\t\t\t\t}\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"__type\":\n\t\t\tout.Values[i] = ec._Query___type(ctx, field)\n\t\tcase \"__schema\":\n\t\t\tout.Values[i] = ec._Query___schema(ctx, field)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\twg.Wait()\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "title": "" }, { "docid": "f04d2af9b8774dba40114f894b773863", "score": "0.49798837", "text": "func (i *impl) Query(ctx context.Context) ([]*Hat, error) {\n\n\t// result := []Book{}\n\t// err := mgm.Coll(&Book{}).SimpleFind(&result, bson.M{\"age\": bson.M{operator.Gt: 24}})\n\n\tresults := []*Hat{}\n\n\terr := mgm.Coll(&Hat{}).SimpleFindWithCtx(ctx, &results, bson.M{})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "cb07991f8a500e5c51df6d5ad23b59fe", "score": "0.49794263", "text": "func (t *SimpleChaincode) Query(stub shim.ChaincodeStubInterface) ([]byte, error) {\n\tfunction, args := stub.GetFunctionAndParameters()\n\n\tswitch function {\n\tcase \"listDoc\":\n\t\tif len(args) != 0 {\n\t\t\tpoeLogger(errorLevel, \"listDoc: Incorrect number of arguments for function: %s Expecting 0\", function)\n\t\t\treturn nil, errors.New(\"listDoc: Incorrect number of arguments. Expecting 0\")\n\t\t}\n\t\treturn t.listDoc(stub)\n\tcase \"readDoc\":\n\t\tif len(args) != 1 {\n\t\t\tpoeLogger(errorLevel, \"readDoc: Incorrect number of arguments for function: %s Expecting 1\", function)\n\t\t\treturn nil, errors.New(\"readDoc: Incorrect number of arguments. Expecting 1\")\n\t\t}\n\t\treturn t.readDoc(stub, args[0])\n\tdefault:\n\t\tpoeLogger(errorLevel, \"Invalid Query function name: %s\",function)\n\t\treturn nil, fmt.Errorf(\"Invalid Query function name: %s\",function)\n\t}\n}", "title": "" }, { "docid": "65e82314307e3beb321b9c43dd20bf38", "score": "0.49769416", "text": "func (t *SimpleChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\tfmt.Println(\"query is running \" + function)\n\n\t// Handle different functions\n\tif function == \"read\" { //read a variable\n\t\treturn t.read(stub, args)\n\t} else if function == \"getcustomerdata\" {\n\t\treturn t.getcustomerdata(stub, args)\n\t} else if function == \"getoperatoratt\" {\n\t\treturn t.getoperatoratt(stub, args)\n\t}\n\n\tfmt.Println(\"query did not find func: \" + function)\n\n\treturn nil, errors.New(\"Received unknown function query: \" + function)\n}", "title": "" }, { "docid": "081c5a4d23476de123e84425e00cf599", "score": "0.4968903", "text": "func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {\n\tvar (\n\t\tresult interface{}\n\t\terr error\n\t)\n\tswitch reqQuery.Path {\n\tcase \"accounts\":\n\t\t{\n\t\t\tif reqQuery.Data == nil {\n\t\t\t\tresQuery.Code = CodeTypeQueryError\n\t\t\t\tresQuery.Log = \"id is not presented in query\"\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresult, err = app.state.GetAccount(string(reqQuery.Data))\n\t\t\tif err != nil {\n\t\t\t\tresQuery.Code = CodeTypeQueryError\n\t\t\t\tresQuery.Log = err.Error()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbs, _ := json.Marshal(result)\n\t\t\tresQuery.Value = bs\n\t\t}\n\tcase \"accounts/search\":\n\t\t{\n\t\t\tif reqQuery.Data == nil {\n\t\t\t\tresQuery.Code = CodeEmptySearchQuery\n\t\t\t\tresQuery.Log = \"search query is empty\"\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Unmarshal search query\n\t\t\tvar mgoQuery mongoQuery\n\t\t\tif err = json.Unmarshal(reqQuery.Data, &mgoQuery); err != nil {\n\t\t\t\tresQuery.Code = CodeParseSearchQueryError\n\t\t\t\tresQuery.Log = err.Error()\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Check limit and offset values\n\t\t\tif mgoQuery.Limit > resLimit || resOffset <= 0 {\n\t\t\t\tmgoQuery.Limit = resLimit\n\t\t\t}\n\t\t\tif mgoQuery.Offset < resOffset {\n\t\t\t\tmgoQuery.Offset = resOffset\n\t\t\t}\n\t\t\t// Search accounts in Database\n\t\t\tresult, err = app.state.SearchAccounts(mgoQuery.Query, mgoQuery.Limit, mgoQuery.Offset)\n\t\t\tif err != nil {\n\t\t\t\tresQuery.Code = CodeParseSearchQueryError\n\t\t\t\tresQuery.Log = err.Error()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbs, _ := json.Marshal(result)\n\t\t\tresQuery.Value = bs\n\t\t}\n\tcase \"payloads\":\n\t\t{\n\t\t\tif reqQuery.Data == nil {\n\t\t\t\tresQuery.Code = CodeTypeQueryError\n\t\t\t\tresQuery.Log = \"id is not presented in query\"\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresult, err = app.state.GetPayload(string(reqQuery.Data))\n\t\t\tif err != nil {\n\t\t\t\tresQuery.Code = CodeTypeQueryError\n\t\t\t\tresQuery.Log = err.Error()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbs, _ := json.Marshal(result)\n\t\t\tresQuery.Value = bs\n\t\t}\n\tcase \"payloads/search\":\n\t\t{\n\t\t\tif reqQuery.Data == nil {\n\t\t\t\tresQuery.Code = CodeEmptySearchQuery\n\t\t\t\tresQuery.Log = \"search query is empty\"\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Unmarshal search query\n\t\t\tvar mgoQuery mongoQuery\n\t\t\tif err = json.Unmarshal(reqQuery.Data, &mgoQuery); err != nil {\n\t\t\t\tresQuery.Code = CodeParseSearchQueryError\n\t\t\t\tresQuery.Log = err.Error()\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Check limit and offset values\n\t\t\tif mgoQuery.Limit > resLimit || resOffset <= 0 {\n\t\t\t\tmgoQuery.Limit = resLimit\n\t\t\t}\n\t\t\tif mgoQuery.Offset < resOffset {\n\t\t\t\tmgoQuery.Offset = resOffset\n\t\t\t}\n\t\t\t// Search transaction data in Database\n\t\t\tresult, err = app.state.SearchPayloads(mgoQuery.Query, mgoQuery.Limit, mgoQuery.Offset)\n\t\t\tif err != nil {\n\t\t\t\tresQuery.Code = CodeParseSearchQueryError\n\t\t\t\tresQuery.Log = err.Error()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbs, _ := json.Marshal(result)\n\t\t\tresQuery.Value = bs\n\t\t}\n\tdefault:\n\t\t{\n\t\t\tresQuery.Code = CodeTypeUnknownRequest\n\t\t\tresQuery.Log = \"the path was not detected\"\n\t\t\treturn\n\t\t}\n\t}\n\tresQuery.Code = CodeTypeOK\n\treturn\n}", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "de5dd008f864a460cbca2a551fedf1e8", "score": "0.49610677", "text": "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "title": "" } ]
3b1d41649dffe631ab7f97df82183488
String returns a humanreadable string representation of the value.
[ { "docid": "c6bd4d90c21be7a5c3256ebf0f54730d", "score": "0.0", "text": "func (i Int64) String() string {\n\treturn strconv.FormatInt(int64(i), 10)\n}", "title": "" } ]
[ { "docid": "4db6576bc25f3abe356b5695ba1b8db7", "score": "0.80978096", "text": "func (v Value) String() string {\n\treturn fmt.Sprintf(\"%s: %s\", v.Type, v.Encode(nil))\n}", "title": "" }, { "docid": "1003698f091ca845cc64ac2276229e76", "score": "0.79773307", "text": "func (v Value) String() string {\n\ty, m, d := ToUnits(v)\n\treturn fmt.Sprintf(\"%04d-%02d-%02d\", y, m, d)\n}", "title": "" }, { "docid": "0dd664e75f05a4ebe9cb6519df594e74", "score": "0.7962788", "text": "func (s Value) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0dd664e75f05a4ebe9cb6519df594e74", "score": "0.7962788", "text": "func (s Value) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0dd664e75f05a4ebe9cb6519df594e74", "score": "0.7962788", "text": "func (s Value) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "378912f95e4fb2074ee549135e6e4046", "score": "0.7776216", "text": "func (v *Value) String() string {\n\tif v == nil {\n\t\treturn \"nil\" // should never happen, but not panicking helps with debugging\n\t}\n\treturn fmt.Sprintf(\"v%d\", v.ID)\n}", "title": "" }, { "docid": "542d4bda7049f432cdf46af252c5a0a5", "score": "0.76921135", "text": "func (v *Value) String() string {\n\ttxt := \"Value \"\n\tif v == nil {\n\t\ttxt += \"[nil]\"\n\t} else {\n\t\ttxt += fmt.Sprintf(\"[Relay: %d, State: %t]\", v.Relay, v.State)\n\t}\n\treturn txt\n}", "title": "" }, { "docid": "f4aba4cf6b6fc456184d037b803cade9", "score": "0.767161", "text": "func (v *Value) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tif v.ElemValue != nil {\n\t\tfields[i] = fmt.Sprintf(\"ElemValue: %v\", v.ElemValue)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Value{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "82d0fae81aa73a418e9e4ec351eb7041", "score": "0.7607746", "text": "func (a Value) String(always bool) string {\n\tswitch v := a.v.(type) {\n\tcase nil:\n\t\treturn \"nil\"\n\tcase string:\n\t\treturn v\n\tcase json.RawMessage:\n\t\treturn trim(v)\n\tcase reflect.Value:\n\t\treturn fmt.Sprintf(\"%v\", v.Interface())\n\tcase fmt.Stringer:\n\t\treturn v.String()\n\tcase error:\n\t\treturn v.Error()\n\t}\n\n\tif always {\n\t\treturn fmt.Sprint(a.v)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "9c87d54a4933671a59b44f74dd821368", "score": "0.7575264", "text": "func (val *Value) String() (string, error) {\n\tresult, err := cast.ToStringE(val.data)\n\tif nil != err {\n\t\terr = errors.Wrap(\n\t\t\terr,\n\t\t\terrors.ErrTypeConversionFailed,\n\t\t\t\"could not convert value '%v' to a string\",\n\t\t\tval.data,\n\t\t)\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "a1d46948d0a81f58487f3737b5febe47", "score": "0.7573701", "text": "func (v value) String() string {\n\tswitch v.k {\n\tcase VK_BOOL:\n\t\tb, _ := v.v.(bool)\n\t\treturn `( Bool ) -> ` + strconv.FormatBool(b)\n\tcase VK_NUMBER:\n\t\tn, _ := v.v.(float64)\n\t\treturn `(Number) -> ` + strconv.FormatFloat(n, byte('g'), -1, 64)\n\tcase VK_STRING:\n\t\ts, _ := v.v.(string)\n\t\treturn `(String) -> ` + \"`\" + s + \"`\"\n\tcase VK_TUPLE:\n\t\tt, _ := v.v.([]Value)\n\t\treturn tupleString(t)\n\tdefault:\n\t\treturn `(UNDEFINED)`\n\t}\n}", "title": "" }, { "docid": "d9c8b9944551279b640377154ab7797c", "score": "0.7571973", "text": "func (v *Value) String() string {\n\treturn fmt.Sprintf(\"count:%d bytes:%d\", v.Count, v.Bytes)\n}", "title": "" }, { "docid": "1e173b2b76eaf903bdea979176329ac9", "score": "0.75690955", "text": "func (v UnsignedValue) String() string {\n\treturn fmt.Sprintf(\"%v %v\", time.Unix(0, v.unixnano), v.Value())\n}", "title": "" }, { "docid": "19f65cadec2e7a70b5b9dc79e27b9895", "score": "0.7545587", "text": "func (v Value) String() string {\n\tswitch v.Type {\n\tcase NullValue:\n\t\treturn \"NULL\"\n\tcase TextValue:\n\t\treturn strconv.Quote(v.V.(string))\n\tcase BlobValue:\n\t\treturn stringutil.Sprintf(\"%v\", v.V)\n\t}\n\n\td, _ := v.MarshalJSON()\n\treturn string(d)\n}", "title": "" }, { "docid": "4267e290c335a4270df042bfc7b630ef", "score": "0.7488769", "text": "func (md *Value) String() string {\n\treturn fmt.Sprintf(\"%s %s\", md.Type(), md.Ident())\n}", "title": "" }, { "docid": "3b38c03d94acd9182236978d04754f98", "score": "0.74746126", "text": "func (t ValueType) String() string {\n\tif t > Unknown {\n\t\tt = NotExist\n\t} else if t < 0 {\n\t\tt = NotExist\n\t}\n\treturn typeStr[int(t)]\n}", "title": "" }, { "docid": "6c2c7b92818934cfbac9db7518a93f53", "score": "0.7469683", "text": "func (s CacheNodeTypeSpecificValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "769b2bcee83bf7d0ab46bbe0d82f4622", "score": "0.7400552", "text": "func (s NodeTypeSpecificValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "900dfc52aa5ed41b34bcef74f9c1a43c", "score": "0.737847", "text": "func (v *RawValue) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [6]string\n\ti := 0\n\tif v.BinaryValue != nil {\n\t\tfields[i] = fmt.Sprintf(\"BinaryValue: %v\", v.BinaryValue)\n\t\ti++\n\t}\n\tif v.BoolValue != nil {\n\t\tfields[i] = fmt.Sprintf(\"BoolValue: %v\", *(v.BoolValue))\n\t\ti++\n\t}\n\tif v.DoubleValue != nil {\n\t\tfields[i] = fmt.Sprintf(\"DoubleValue: %v\", *(v.DoubleValue))\n\t\ti++\n\t}\n\tif v.Int32Value != nil {\n\t\tfields[i] = fmt.Sprintf(\"Int32Value: %v\", *(v.Int32Value))\n\t\ti++\n\t}\n\tif v.Int64Value != nil {\n\t\tfields[i] = fmt.Sprintf(\"Int64Value: %v\", *(v.Int64Value))\n\t\ti++\n\t}\n\tif v.StringValue != nil {\n\t\tfields[i] = fmt.Sprintf(\"StringValue: %v\", *(v.StringValue))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"RawValue{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "d609e3ae8e6b069e76425c124d9ecae9", "score": "0.7375659", "text": "func (v CustomFieldValue) String() string {\n\treturn fmt.Sprintf(\"%s\", v.val)\n}", "title": "" }, { "docid": "f906a6049e398c1261ca42d171c85ced", "score": "0.73677033", "text": "func (me TOpacityValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "4bdbf7361dc70679241ee8afa4d56093", "score": "0.73505634", "text": "func (s VariableValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "53758ea487bcb7f8fc3c01295e7d0361", "score": "0.7337052", "text": "func (s ValueHolder) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "dd94e53223b6dd775b6a995f5e4fa086", "score": "0.7328663", "text": "func ValueToString(e interface{}) string {\n\treturn string(ValueToBytes(e))\n}", "title": "" }, { "docid": "b3bbbf79fee4ba1469f9020551a9fe38", "score": "0.73108816", "text": "func (s RuntimeHintValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "db3ca84b45d04647d1c3ee27a977a67a", "score": "0.73070276", "text": "func (instance *Values) String() string {\n\treturn fmt.Sprintf(\"%s\", *instance)\n}", "title": "" }, { "docid": "4f2b0cbc48b58caf52af003d3533bf51", "score": "0.72972035", "text": "func (c Value) String() string {\n\tif c.Path == \"\" {\n\t\treturn \"InvalidChange\"\n\t}\n\treturn fmt.Sprintf(\"%s %v %t\", c.Path, c.Value, c.Remove)\n}", "title": "" }, { "docid": "5feb609dc687be177fbcccf0d3962aa5", "score": "0.7289678", "text": "func (n *InputValue) String() string {\n\treturn recString(n)\n}", "title": "" }, { "docid": "4d42836f475b0292d429cb749e2f0ed4", "score": "0.7279737", "text": "func (o *OutputFormatValue) String() string {\n\treturn o.value\n}", "title": "" }, { "docid": "b49d5125d8bce8d60e851cbb38b7d9eb", "score": "0.72727674", "text": "func (v Value) String() string {\n\tname, ok := names[v]\n\tif ok {\n\t\treturn name\n\t}\n\t// Un-named capabilities are referred to numerically (in decimal).\n\treturn strconv.Itoa(int(v))\n}", "title": "" }, { "docid": "71f413605ae335535b8c8d9f571a4708", "score": "0.72481495", "text": "func (phpVal *PHPValue) String(depth int) string {\n\tswitch phpVal.Type {\n\tcase PhpTypeBoolean:\n\t\treturn util.NewValue(phpVal.Value).String()\n\tcase PhpTypeNumber:\n\t\treturn util.NewValue(phpVal.Value).String()\n\tcase PhpTypeString:\n\t\treturn fmtPhpString(util.NewValue(phpVal.Value).String())\n\tcase PhpTypeArray:\n\t\tphpArr := phpVal.Value.(*PHPArray)\n\t\treturn phpArr.String(depth)\n\tcase PhpTypeValue:\n\t\tphpVal := phpVal.Value.(*PHPValue)\n\t\treturn phpVal.String(depth)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "20ff3309b8ddf041cf0e9cf2746a4433", "score": "0.72390497", "text": "func (s MetricValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1bc06e878c151b8f7561b172f6d3ad54", "score": "0.72360754", "text": "func (s AttributeValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bb392f50db1855d168e175737280252d", "score": "0.72357374", "text": "func (v Value) String() (string, error) {\n\tv, _ = v.Default()\n\tctx := v.ctx()\n\tif err := v.checkKind(ctx, stringKind); err != nil {\n\t\treturn \"\", v.toErr(err)\n\t}\n\treturn v.eval(ctx).(*stringLit).Str, nil\n}", "title": "" }, { "docid": "1bc06e878c151b8f7561b172f6d3ad54", "score": "0.7235724", "text": "func (s AttributeValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c3371f502e3917520c3736b82fc91a22", "score": "0.7222528", "text": "func (b BoolValue) String() string {\n\tif b.IsUnknown() {\n\t\treturn attr.UnknownValueString\n\t}\n\n\tif b.IsNull() {\n\t\treturn attr.NullValueString\n\t}\n\n\treturn fmt.Sprintf(\"%t\", b.value)\n}", "title": "" }, { "docid": "b6313f7efc487a65f9f1b1d2c14ad43d", "score": "0.7218977", "text": "func (v IntegerValue) String() string {\n\treturn fmt.Sprintf(\"%v %v\", time.Unix(0, v.unixnano), v.Value())\n}", "title": "" }, { "docid": "2860887de4344d2e5cdea3da1c330003", "score": "0.71930385", "text": "func (l Value) String() string {\n\tif types.IsNil(l.Val) {\n\t\treturn \"NULL\"\n\t}\n\tswitch x := l.Val.(type) {\n\tcase string:\n\t\treturn fmt.Sprintf(\"%q\", x)\n\tcase *types.DataItem:\n\t\tif x.Type.Tp == mysql.TypeString {\n\t\t\treturn fmt.Sprintf(\"%q\", x.Data)\n\t\t}\n\t\treturn fmt.Sprintf(\"%v\", x.Data)\n\t}\n\treturn fmt.Sprintf(\"%v\", l.Val)\n}", "title": "" }, { "docid": "589cf6495f87f44a4f5f577d1623eb12", "score": "0.71917", "text": "func (t *RichTextValue) String() string {\n\treturn fmt.Sprintf(`{\"attrs\":%s,\"val\":\"%s\"}`, t.attrs.Marshal(), t.value)\n}", "title": "" }, { "docid": "f07b541673ffb9dad4c02451ef22cb37", "score": "0.71768254", "text": "func String(v interface{}) string {\n\treturn fmt.Sprintf(\"%v\", v)\n}", "title": "" }, { "docid": "f14bf1da8cb7aafcd921efa19d21c006", "score": "0.71749586", "text": "func (s StructValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "95d0e17952423a17deed3700e12f2d83", "score": "0.71449125", "text": "func (s Stats) String() string {\n\treturn fmt.Sprintf(\"%d\", s.Value)\n}", "title": "" }, { "docid": "666980441b516cdd15af81dd5d5b4009", "score": "0.7129713", "text": "func (v *Value) String() string {\n\ts := C.ValueToString(v.ptr)\n\tdefer C.free(unsafe.Pointer(s))\n\n\treturn C.GoString(s)\n}", "title": "" }, { "docid": "c904cd4086840619326558532d62714b", "score": "0.71239454", "text": "func (v *Value) String() string {\n\ts := C.ValueToString(v.ptr)\n\tdefer C.free(unsafe.Pointer(s))\n\treturn C.GoString(s)\n}", "title": "" }, { "docid": "e8defe53b477e8d9ea37bd4b77381120", "score": "0.71021086", "text": "func (me TClipValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "b0d2c0a76c82de63f1a3b1c67c279b03", "score": "0.71019584", "text": "func (me TBaselineShiftValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "2cf813359381c808b782878e59c452bf", "score": "0.70995694", "text": "func (d Description) String() string {\n\treturn d.value\n}", "title": "" }, { "docid": "78f31d1c00afac19b035aa59a0cafa34", "score": "0.70603496", "text": "func (s TagValues) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f94e9a71c6e92cd52044faa4da2c8f59", "score": "0.7058064", "text": "func (s ParameterValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d5959df38b1862fc847cccdb0cf44b0d", "score": "0.7047472", "text": "func toString(v Value) string {\n\tbuf := new(strings.Builder)\n\twriteValue(buf, v, nil)\n\treturn buf.String()\n}", "title": "" }, { "docid": "62ee62a2dd27501b9f4488560ee77b20", "score": "0.7045616", "text": "func (t *timestampValue) String() string {\n\treturn fmt.Sprintf(\"%#v\", t.timestamp)\n}", "title": "" }, { "docid": "24e603de995205f8e169f397fe0b1f31", "score": "0.7044487", "text": "func (t *Type) String() string {\n\treturn tconv(t, 0, fmtGo)\n}", "title": "" }, { "docid": "4ae96c3d035c24c283aac595ff54f7dc", "score": "0.70251197", "text": "func (v ValueString) String() string {\n\treturn string(v)\n}", "title": "" }, { "docid": "5580674047d33faeddb6372c4ddec216", "score": "0.7018422", "text": "func (f *Field) String() string {\n\tswitch f.Type {\n\tcase SkipType:\n\t\treturn \"<skipped>\"\n\tcase BoolType:\n\t\tif f.Value.(bool) {\n\t\t\treturn \"true\"\n\t\t}\n\t\treturn \"false\"\n\tcase Int8Type:\n\t\treturn strconv.Itoa(int(f.Value.(int8)))\n\tcase Int16Type:\n\t\treturn strconv.Itoa(int(f.Value.(int16)))\n\tcase Int32Type:\n\t\treturn strconv.Itoa(int(f.Value.(int32)))\n\tcase Int64Type:\n\t\treturn strconv.Itoa(int(f.Value.(int64)))\n\tcase Uint8Type:\n\t\treturn strconv.Itoa(int(f.Value.(uint8)))\n\tcase Uint16Type:\n\t\treturn strconv.Itoa(int(f.Value.(uint16)))\n\tcase Uint32Type:\n\t\treturn strconv.Itoa(int(f.Value.(uint32)))\n\tcase Uint64Type:\n\t\treturn strconv.Itoa(int(f.Value.(uint64)))\n\tcase UintptrType:\n\t\treturn strconv.Itoa(int(f.Value.(uintptr)))\n\tcase Float32Type:\n\t\treturn strconv.FormatFloat(float64(f.Value.(float32)), 'g', 10, 64)\n\tcase Float64Type:\n\t\treturn strconv.FormatFloat(f.Value.(float64), 'g', 10, 64)\n\tcase Complex64Type:\n\t\treturn fmt.Sprintf(\"%v\", f.Value.(complex64))\n\tcase Complex128Type:\n\t\treturn fmt.Sprintf(\"%v\", f.Value.(complex128))\n\tcase StringType:\n\t\treturn f.Value.(string)\n\tcase BinaryType:\n\t\treturn string(f.Value.([]byte)[:])\n\tcase ByteStringType:\n\t\treturn string(f.Value.([]byte)[:])\n\tcase ErrorType:\n\t\treturn f.Value.(error).Error()\n\tcase TimeType:\n\t\treturn f.Value.(time.Time).String()\n\tcase DurationType:\n\t\treturn f.Value.(time.Duration).String()\n\tcase StringerType:\n\t\treturn f.Value.(fmt.Stringer).String()\n\tdefault:\n\t\treturn fmt.Sprintf(\"%v\", f.Value)\n\t}\n}", "title": "" }, { "docid": "4c940364b986e3c5bd7e47463abf9c03", "score": "0.7016245", "text": "func (v Variable) String() string {\n\treturn v.name + sep + v.value\n}", "title": "" }, { "docid": "01461ec273b3ef90b7f25b58b0eeed51", "score": "0.70140326", "text": "func (s Get) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a71ece21220d14d9a297ef98129389dd", "score": "0.7013802", "text": "func (v BooleanValue) String() string {\n\treturn fmt.Sprintf(\"%v %v\", time.Unix(0, v.unixnano), v.Value())\n}", "title": "" }, { "docid": "05ca57a2681f326bb41c1f4cb18b8c56", "score": "0.7002197", "text": "func (r *Resource) String() string {\n\treturn fmt.Sprintf(\"%s:%v\", r.Abbrv, r.Value)\n}", "title": "" }, { "docid": "37ae092c6f247df7c3df2f6bdb062428", "score": "0.6985539", "text": "func (d *Data) String() string {\n\treturn string(d.Value)\n}", "title": "" }, { "docid": "0a6b8cfe012b0e39aced643e297d0bb2", "score": "0.6982707", "text": "func toString(value reflect.Value) string {\n\tvalueKind := value.Kind()\n\tif valueKind == reflect.Ptr {\n\t\tvalue = value.Elem()\n\t}\n\n\tvalueType := value.Type().String()\n\tswitch valueType {\n\tcase \"bool\":\n\t\treturn strconv.FormatBool(value.Bool())\n\tcase \"int\", \"int8\", \"int32\", \"int64\",\n\t\t\"uint\", \"uint8\", \"uint32\", \"uint64\":\n\t\treturn strconv.FormatInt(value.Int(), 10)\n\tcase \"float32\":\n\t\treturn strconv.FormatFloat(value.Float(), 'f', -1, 32)\n\tcase \"float64\":\n\t\treturn strconv.FormatFloat(value.Float(), 'f', -1, 64)\n\tcase \"string\":\n\t\treturn value.String()\n\tcase \"time.Time\":\n\t\treturn value.Interface().(time.Time).String()\n\tcase \"uuid.UUID\":\n\t\treturn value.Interface().(uuid.UUID).String()\n\tdefault:\n\t\tjsonValue, _ := json.Marshal(value.Interface())\n\t\treturn string(jsonValue)\n\t}\n}", "title": "" }, { "docid": "052470cc76490fdcac09b6be51593fe6", "score": "0.6975186", "text": "func (s ComponentBindingPropertiesValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b6372a28e11598bcba45851965c58350", "score": "0.69729316", "text": "func (v myVertex) String() string {\n\treturn fmt.Sprintf(\"%d\", v.value)\n}", "title": "" }, { "docid": "110ae99933b7aa0484fc9594be74bcef", "score": "0.69724303", "text": "func (v FloatValue) String() string {\n\treturn fmt.Sprintf(\"%v %v\", time.Unix(0, v.unixnano), v.value)\n}", "title": "" }, { "docid": "e76c422bd4cc59723d1a6c104e4892bb", "score": "0.69644165", "text": "func (v StringValue) String() string {\n\treturn fmt.Sprintf(\"%v %v\", time.Unix(0, v.unixnano), v.Value())\n}", "title": "" }, { "docid": "b9a76be2af3df8340e4c7703f68b66cf", "score": "0.6955151", "text": "func (lf Field) String() string {\n\treturn fmt.Sprint(lf.key, \": \", lf.Value())\n}", "title": "" }, { "docid": "5e48b8b5132f768ae6707a3ec7bce0f4", "score": "0.694907", "text": "func (ssv StaySetVariable) String() string {\n\treturn fmt.Sprintf(ssiString, ssv.Id, ssv.Count, ssv.ActValue, ssv.MinValue, ssv.MaxValue, ssv.AvgValue)\n}", "title": "" }, { "docid": "009df4b3327dcb6fe60765a6bde2bf00", "score": "0.6947193", "text": "func (s ThemeValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "45cf06a2d32bda10ce9ace8dbbac2477", "score": "0.6942841", "text": "func (n Numeral) String() string {\n\treturn n.value\n}", "title": "" }, { "docid": "308d7b36c70c05020aa81ef0e954f976", "score": "0.69365954", "text": "func (value CapValue) String() string {\n\tvar s = C.cap_to_name(C.cap_value_t(value))\n\tC.cap_free(unsafe.Pointer(s))\n\n\treturn C.GoString(s)\n}", "title": "" }, { "docid": "3493481c8809540cb502446f1117acc6", "score": "0.6935736", "text": "func (s pgStatMonitorSettingsTextValue) String() string {\n\tres := make([]string, 2)\n\tres[0] = \"Name: \" + reform.Inspect(s.Name, true)\n\tres[1] = \"Value: \" + reform.Inspect(s.Value, true)\n\treturn strings.Join(res, \", \")\n}", "title": "" }, { "docid": "be0805ead20c1850031f5ef6362621d0", "score": "0.69333524", "text": "func (dsv *stdDynamicStatusValue) String() string {\n\treturn fmt.Sprintf(\"Dynamic Status Value %q (value = %q)\", dsv.id, dsv.value)\n}", "title": "" }, { "docid": "d925216bc12703f99e5d08931a1ea3ae", "score": "0.69333386", "text": "func (this *SSVariable) String() string {\n\treturn fmt.Sprintf(ssString, this.Count, this.ActValue, this.MinValue, this.MaxValue)\n}", "title": "" }, { "docid": "97b8755d2dc1d4df8a31498e5ecb1826", "score": "0.6926494", "text": "func (f Float64Value) String() string {\n\tif f.IsUnknown() {\n\t\treturn attr.UnknownValueString\n\t}\n\n\tif f.IsNull() {\n\t\treturn attr.NullValueString\n\t}\n\n\treturn fmt.Sprintf(\"%f\", f.value)\n}", "title": "" }, { "docid": "7d4d0d3546969be87a0dc975e2f455ae", "score": "0.692426", "text": "func strValue(value reflect.Value) string {\n\tresult := \"\"\n\n\tival, ok := printableValue(value)\n\tif !ok {\n\t\tpanic(fmt.Errorf(\"Can't print value: %q\", value))\n\t}\n\n\tval := reflect.ValueOf(ival)\n\n\tswitch val.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\tfor i := 0; i < val.Len(); i++ {\n\t\t\tresult += strValue(val.Index(i))\n\t\t}\n\tcase reflect.Bool:\n\t\tresult = \"false\"\n\t\tif val.Bool() {\n\t\t\tresult = \"true\"\n\t\t}\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\tresult = fmt.Sprintf(\"%d\", ival)\n\tcase reflect.Float32, reflect.Float64:\n\t\tresult = strconv.FormatFloat(val.Float(), 'f', -1, 64)\n\tcase reflect.Invalid:\n\t\tresult = \"\"\n\tdefault:\n\t\tresult = fmt.Sprintf(\"%s\", ival)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "ab86c7f7677fa15a9d2b16abe3a1c1e3", "score": "0.6924105", "text": "func (s ComponentBindingPropertiesValueProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a2cc1e5f9820f550254e140e9ef3d46e", "score": "0.6914138", "text": "func (s ReservationValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "296fffba36bd6980da809860380e6359", "score": "0.6909648", "text": "func ToString(val interface{}) string {\n\tif val == nil {\n\t\treturn \"nil\"\n\t}\n\n\tswitch tval := val.(type) {\n\tcase reflect.Value:\n\t\tnewVal, ok := dark.GetInterface(tval, true)\n\t\tif ok {\n\t\t\treturn ToString(newVal)\n\t\t}\n\n\tcase []reflect.Value:\n\t\tvar buf bytes.Buffer\n\t\tSliceToBuffer(&buf, tval)\n\t\treturn buf.String()\n\n\t\t// no \"(string) \" prefix for printable strings\n\tcase string:\n\t\treturn tdutil.FormatString(tval)\n\n\t\t// no \"(int) \" prefix for ints\n\tcase int:\n\t\treturn strconv.Itoa(tval)\n\n\tcase types.TestDeepStringer:\n\t\treturn tval.String()\n\t}\n\n\treturn tdutil.SpewString(val)\n}", "title": "" }, { "docid": "5aa64a25dab674af8b1b8c1c72fd8859", "score": "0.69068646", "text": "func ToString(v Value) string {\n\tif s, ok := v.(Stringer); ok {\n\t\treturn s.String()\n\t}\n\treturn v.Repr(NoPretty)\n}", "title": "" }, { "docid": "22bd6aa979d135df32ada8d8f5f2586e", "score": "0.68945634", "text": "func (me TClipPathValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "0b4cd8a85514593277c73b1940d8fd9e", "score": "0.6893669", "text": "func (valID ValidatorID) String() string {\n\treturn strconv.FormatUint(valID.Uint64(), 10)\n}", "title": "" }, { "docid": "5ded259a3ad6a0be01cce4ed79958503", "score": "0.68906933", "text": "func (t *Tag) String() string {\n data, err := t.MarshalJSON()\n panicOn(err)\n val := string(data)\n return fmt.Sprintf(\"{Id: %X, Val: %v}\", t.Id, val)\n}", "title": "" }, { "docid": "0a019d3a46876126b46f9d055f4da119", "score": "0.6878876", "text": "func (o Output) String() string {\n\tif reflect.TypeOf(o.value.Interface()).Kind() == reflect.String {\n\t\treturn o.value.Interface().(string)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a550eca673520da9cd72725e4eca18f7", "score": "0.6874559", "text": "func (a attribute) String() string {\n\tif a == nil {\n\t\treturn \"<nil>\"\n\t}\n\treturn fmt.Sprintf(\"Type: %d, Len: %d, Value: %v\", a.Type(), a.Len(), a.Value())\n}", "title": "" }, { "docid": "0a453a6102a9cdd29524b1492c1d2ebc", "score": "0.68740714", "text": "func (m Metric) String() string {\n\treturn fmt.Sprintf(\"%s:%s|%s\", m.Name, m.Value, m.Type)\n}", "title": "" }, { "docid": "3b77a134062462026df138f39ef27f49", "score": "0.6860264", "text": "func (slice SliceValueType) String() string {\n\treturn slice.Print(\" \")\n}", "title": "" }, { "docid": "66c5e5748c2631a391074f09cde75278", "score": "0.68585587", "text": "func (s ModelVariable) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d30248c1556a2e40c70f949ede3ec6df", "score": "0.68490773", "text": "func ToString(value interface{}) string {\n\treturn fmt.Sprintf(\"%s\", value)\n}", "title": "" }, { "docid": "ed139a8d24b5b681a2ffc0157eac261e", "score": "0.6849024", "text": "func (t Type) String() string {\n\tswitch t {\n\tcase Zero:\n\t\treturn \"zero\"\n\tcase Binary:\n\t\treturn \"binary\"\n\tcase Text:\n\t\treturn \"text\"\n\tcase UTF8Text:\n\t\treturn \"utf8-text\"\n\tcase Custom:\n\t\treturn \"custom\"\n\t}\n\treturn \"unknown\"\n}", "title": "" }, { "docid": "9954921b8771752ee1d6fddd127266cd", "score": "0.68444073", "text": "func (v *Decimal) String() string {\n\treturn v.value.String()\n}", "title": "" }, { "docid": "b203dcb6b0539491a946f51896e1dcb5", "score": "0.6843886", "text": "func (me TFilterValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "b1ad87426421a9d5938b63040a161359", "score": "0.6837659", "text": "func ToString(value interface{}) string {\n\treturn fmt.Sprintf(\"%v\", value)\n}", "title": "" }, { "docid": "b73e8efd259642158993a0ea401bd7f6", "score": "0.68375534", "text": "func (s FpgaInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "05567b2892a0df109562df3b0416e659", "score": "0.68351936", "text": "func (s RescoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a4aced30e2157886ed2eaf1e2a8a7254", "score": "0.68328637", "text": "func (s DimensionValues) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a69a463bbb9cfd28d9eb13bc5c39789c", "score": "0.6827166", "text": "func (i *Integer) String() string {\n\treturn strconv.FormatInt(i.Value, i.base)\n}", "title": "" }, { "docid": "6b8c66750e32ea2612a82d9742d1ecd1", "score": "0.6819962", "text": "func (n *InputValues) String() string {\n\treturn recString(n)\n}", "title": "" }, { "docid": "22342cfa96af8b07201c2d6a00141efb", "score": "0.6818712", "text": "func (st SavingThrow) String() string {\n\treturn fmt.Sprintf(\"%v : Proficient: %t\\t Modifier: %d\", st.Ability, st.Proficient, st.Modifier)\n}", "title": "" }, { "docid": "2872db3f62c45f404549f00b8b8bb1c1", "score": "0.6818411", "text": "func (ef *EntryField) String() string {\n\treturn ef.value.(string)\n}", "title": "" }, { "docid": "203a5bce4a38687978eee6e19a87dfd5", "score": "0.6817371", "text": "func (r Record) String () (s string) {\n\tswitch r.V.(type) {\n\tcase string:\n\t\ts = r.V.(string)\n\n\tcase int64:\n\t\ts = strconv.FormatInt (r.V.(int64), 10)\n\n\tcase float64:\n\t\ts = strconv.FormatFloat (r.V.(float64), 'f', -1, 64)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e3fcf3b9020bda78b75b4ef33fd77e15", "score": "0.6811146", "text": "func (s ProductViewAggregationValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9f9e1dd56a50399c9daffb8b455d375d", "score": "0.6807307", "text": "func toString(value reflect.Value) string {\n valueKind := value.Kind()\n if(valueKind == reflect.Ptr) {\n value = value.Elem()\n }\n \n valueType := value.Type().String()\n switch valueType {\n case \"bool\":\n return strconv.FormatBool(value.Bool())\n case \"int\", \"int8\", \"int32\", \"int64\",\n \"uint\", \"uint8\", \"uint32\", \"uint64\":\n return strconv.FormatInt(value.Int(), 10)\n case \"float32\":\n return strconv.FormatFloat(value.Float(), 'f', -1, 32)\n case \"float64\":\n return strconv.FormatFloat(value.Float(), 'f', -1, 64)\n case \"string\":\n return value.String()\t\n case \"time.Time\":\n return value.Interface().(time.Time).String()\n default:\n jsonValue, _ := json.Marshal(value)\n return string(jsonValue[:])\n }\n}", "title": "" } ]
84dbc35c9ae71987dbb54871b09f3aba
NewRegexpFinder returns a new RegexpFinder that checks the field given using the regular expression provided. It will extract the device id from the regular expression result at the label given.
[ { "docid": "c1d5c560390acb82269758cbb8ffdf93", "score": "0.78711885", "text": "func NewRegexpFinder(field Field, regex *regexp.Regexp, deviceLabel string) (*RegexpFinder, error) {\n\tif regex == nil {\n\t\treturn nil, errNilRegex\n\t}\n\tr := RegexpFinder{\n\t\tfield: field,\n\t\tregex: regex,\n\t\tdeviceLabel: deviceLabel,\n\t}\n\tfor idx, val := range r.regex.SubexpNames() {\n\t\tif val == r.deviceLabel {\n\t\t\tr.subExpressionIdx = idx\n\t\t\treturn &r, nil\n\t\t}\n\t}\n\treturn nil, errRegexLabelMismatch\n}", "title": "" } ]
[ { "docid": "e46e5bc65e932d8eeb41ed62dd1de02b", "score": "0.6280709", "text": "func NewRegexpFinderFromStr(field Field, regexStr string, deviceLabel string) (*RegexpFinder, error) {\n\tregex, err := regexp.Compile(regexStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to compile [%v] into a regular expression: %w\", regexStr, err)\n\t}\n\treturn NewRegexpFinder(field, regex, deviceLabel)\n}", "title": "" }, { "docid": "f56e1907df0bbe8753614546efe7ec88", "score": "0.5648346", "text": "func Regexp(fieldName, v string) *F {\n\treturn (&F{}).AndRegexp(fieldName, v)\n}", "title": "" }, { "docid": "49d241deaa897533143659224ef42ad7", "score": "0.5243136", "text": "func Regexp(regexp string) SimpleAddress { return regexpAddr{regexp: regexp} }", "title": "" }, { "docid": "187ee5007f68140e8b8a1304a14c567f", "score": "0.51217544", "text": "func Regex(r *regexp.Regexp, prefix ...string) *RegexpMatcher { return NewRegexMatcher(r, prefix...) }", "title": "" }, { "docid": "2b9fe06e001929644f3deac9b6171834", "score": "0.506104", "text": "func NewRegexMatcher(r *regexp.Regexp, prefix ...string) *RegexpMatcher {\n\tmatcher := &RegexpMatcher{Regexp: r}\n\tif len(prefix) > 0 {\n\t\tmatcher.Prefix = prefix[0]\n\t}\n\treturn matcher\n}", "title": "" }, { "docid": "244dd1bdd08e1d10015657b69526634f", "score": "0.5044332", "text": "func (r *RegexpFinder) FindDeviceID(msg *wrp.Message) (string, error) {\n\tfieldValue := getFieldValue(r.field, msg)\n\tmatches := r.regex.FindStringSubmatch(fieldValue)\n\tif len(matches) == 0 || len(matches) <= r.subExpressionIdx {\n\t\treturn \"\", errNoMatch\n\t}\n\tdeviceID := matches[r.subExpressionIdx]\n\tif deviceID == \"\" {\n\t\treturn \"\", errEmptyDeviceID\n\t}\n\treturn strings.ToLower(deviceID), nil\n}", "title": "" }, { "docid": "8f9a286918c9e3f895e8f58c38332fe0", "score": "0.4884804", "text": "func (self FlagsRuleMaker) makeRegexp(pattern string) Matcher {\n\tp := pattern\n\tif self.flags != \"\" {\n\t\tp = `(?` + self.flags + `)` + p\n\t}\n\treturn regexp.MustCompile(`\\A` + p).FindSubmatchIndex\n}", "title": "" }, { "docid": "89e868655daf5611d667146c939d959c", "score": "0.4864648", "text": "func NewRegexp(s string) (Regexp, error) {\n\tregex, err := regexp.Compile(\"^(?:\" + s + \")$\")\n\treturn Regexp{\n\t\tRegexp: regex,\n\t\toriginal: s,\n\t}, err\n}", "title": "" }, { "docid": "66c5ad8a27cea6dabd3b2046dd262981", "score": "0.48074874", "text": "func RegexpMatch(val string, expr string) string {\n\tif val != \"\" {\n\t\tif expr == \"\" {\n\t\t\tlogger.Errorf(\"no regular expression found\")\n\t\t\treturn \"\"\n\t\t}\n\n\t\tre, err := regexp.Compile(expr)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"invalid regexp: %s error: %s. \\n\", expr, err.Error())\n\t\t\treturn \"\"\n\t\t}\n\n\t\trequiredMatchIndex := -1\n\t\tfor i, val := range re.SubexpNames() {\n\t\t\tif val == \"data\" {\n\t\t\t\trequiredMatchIndex = i\n\t\t\t}\n\t\t}\n\n\t\tif requiredMatchIndex > -1 {\n\t\t\tmatches := re.FindStringSubmatch(val)\n\n\t\t\tif len(matches) < requiredMatchIndex+1 {\n\t\t\t\tlogger.Tracef(\"no match found. str: %s, expr: %s\", val, expr)\n\t\t\t\treturn \"\"\n\t\t\t}\n\t\t\treturn matches[requiredMatchIndex]\n\n\t\t}\n\t\t// when there is no captured group 'data' - just return the whole match\n\t\treturn re.FindString(val)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a2194b45a4a535b26954489f75a812da", "score": "0.47989154", "text": "func newRegexpFilter(re string, match bool) (Filterer, error) {\n\treg, err := regexp.Compile(re)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tf := regexpFilter{reg}\n\tif match {\n\t\treturn f, nil\n\t}\n\treturn newNotFilter(f), nil\n}", "title": "" }, { "docid": "45d6a57c11637947cfc5f56e66398c12", "score": "0.4789169", "text": "func newRegexpMessageHandler(expr string, handler MessageHandler) *regexpMessageHandler {\n\treturn &regexpMessageHandler{regexp.MustCompile(expr), handler}\n}", "title": "" }, { "docid": "0e84a4c82fbdf0fb93d27af339affc86", "score": "0.4775606", "text": "func NewPartialMatcher(matches []string, decorator func(s string) string) (Searcher, error) {\n\trunes := make([][]rune, len(matches))\n\tfor i, s := range matches {\n\t\tds := decorator(s)\n\t\trunes[i] = bytes.Runes([]byte(ds))\n\t}\n\tmachine := new(goahocorasick.Machine)\n\terr := machine.Build(runes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taho := &matchP{\n\t\tmachine: machine,\n\t\tdecorator: decorator,\n\t}\n\treturn aho, nil\n}", "title": "" }, { "docid": "b91646b0a5ab4a2a404ba8d788e49d23", "score": "0.47375786", "text": "func NewMatch() openflow.Match {\n\treturn &match{\n\t\twildcards: wildcard{\n\t\t\tall: true,\n\t\t},\n\t\tdlSrc: net.HardwareAddr([]byte{0, 0, 0, 0, 0, 0}),\n\t\tdlDst: net.HardwareAddr([]byte{0, 0, 0, 0, 0, 0}),\n\t\tnwSrc: net.IPv4zero,\n\t\tnwDst: net.IPv4zero,\n\t}\n}", "title": "" }, { "docid": "05a9631c18791a7716847d539d6788bd", "score": "0.47095016", "text": "func Regex(field string, regex string) IPredicate {\n\treturn NewRegexPredicate(field, regex)\n}", "title": "" }, { "docid": "2891ec7ea68d30bdb3a067926c9b0017", "score": "0.4708255", "text": "func newRegexPredicate(patternString string) (predicate, error) {\n\tpattern, err := regexp.CompilePOSIX(patternString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn func(filePath string) bool {\n\t\treturn pattern.MatchString(filePath)\n\t}, nil\n}", "title": "" }, { "docid": "2f5242a18ee3465014640decfda7a69a", "score": "0.47030202", "text": "func NewRegexpQuery(field, regexp []byte) (Query, error) {\n\tq, err := query.NewRegexpQuery(field, regexp)\n\tif err != nil {\n\t\treturn Query{}, err\n\t}\n\treturn Query{\n\t\tquery: q,\n\t}, nil\n}", "title": "" }, { "docid": "d439580ec0aed5f8b4146982282d1361", "score": "0.4615904", "text": "func NewRegexpMatcher(regexpString string, run Runner) Matcher {\n\treturn regexpMatcher{\n\t\tregexp: util.CompileRegexp(regexpString),\n\t\trun: run,\n\t}\n}", "title": "" }, { "docid": "12bf4f774967d4c50a9999b73df4b30f", "score": "0.4592766", "text": "func Regexp(r string) ProcessorFunc {\n\treturn func(values []string) ([]string, error) {\n\t\tfor i, v := range values {\n\t\t\trx, err := regexp.Compile(r)\n\t\t\tif err != nil {\n\t\t\t\treturn values, err\n\t\t\t}\n\t\t\tvalues[i] = rx.FindString(v)\n\t\t}\n\t\treturn values, nil\n\t}\n}", "title": "" }, { "docid": "338f736d11e5f60f1bd79077bd390a0c", "score": "0.4567247", "text": "func RegEx(field, pattern string) Criterion {\n\treturn newCriterion(field, \"$regex\", pattern)\n}", "title": "" }, { "docid": "e889631d34fe091b68c97ea0c563eaf1", "score": "0.4567247", "text": "func NewGrep(r io.ReadCloser, re *regexp.Regexp, match bool, lf LineFilter, lnum bool, cnum int) *Grep {\n\tg := &Grep{\n\t\tre: re,\n\t\tmatch: match,\n\t\tlf: TrimEOL.Chain(lf),\n\t\tlnum: lnum,\n\t\tcnum: cnum,\n\t}\n\tif cnum > 0 {\n\t\tg.contextBefore = make([][]byte, 0, cnum)\n\t}\n\tg.Base.Init(r, g.readNext)\n\treturn g\n}", "title": "" }, { "docid": "22dae92b70885fdce7339248d43ef817", "score": "0.4553004", "text": "func NewRegexRule(fieldExpr string, regexExpr string) Rule {\n\tregexObject := regexp.MustCompile(regexExpr)\n\treturn regexRule{\n\t\tfieldExpr: fieldExpr,\n\t\tregexExpr: regexExpr,\n\t\tregexObject: regexObject,\n\t}\n}", "title": "" }, { "docid": "93ddf31e1e29742a288d775d3d1d4ceb", "score": "0.450893", "text": "func NewRegexer(regex *regexp.Regexp) *Regexer {\n\treturn &Regexer{\n\t\trxBuf: make([]byte, 0),\n\t\tregex: regex,\n\t\tC: make(chan [][]byte, 10),\n\t}\n}", "title": "" }, { "docid": "9e9f5bd313f22437e786fbc07f7ae981", "score": "0.44894075", "text": "func RegExp(pattern string) Domain {\n\treturn regexp.MustCompile(pattern)\n}", "title": "" }, { "docid": "013629b549b3595b0f83f26a772078cb", "score": "0.44521344", "text": "func NewSelector(s string) (*Selector, error) {\n\tif len(s) == 0 {\n\t\treturn nil, &YError{\"Invalid selector (empty String)\", nil}\n\t}\n\n\tif !pattern.MatchString(s) {\n\t\treturn nil, &YError{\"Invalid selector (not matching regex)\", nil}\n\t}\n\n\tgroups := pattern.FindStringSubmatch(s)\n\tpath := groups[1]\n\tpredicate := groups[3]\n\tproperties := groups[5]\n\tfragment := groups[7]\n\n\treturn newSelector(path, predicate, properties, fragment), nil\n}", "title": "" }, { "docid": "24a705437c5e970517ff3c028db211db", "score": "0.4447778", "text": "func addrRegexp(data []byte, lo, hi int, dir byte, pattern string) (int, int, error) {\n\t// We want ^ and $ to work as in sam/acme, so use ?m.\n\tre, err := regexp.Compile(\"(?m:\" + pattern + \")\")\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tif dir == '-' {\n\t\t// Could implement reverse search using binary search\n\t\t// through file, but that seems like overkill.\n\t\treturn 0, 0, errors.New(\"reverse search not implemented\")\n\t}\n\tm := re.FindIndex(data[hi:])\n\tif len(m) > 0 {\n\t\tm[0] += hi\n\t\tm[1] += hi\n\t} else if hi > 0 {\n\t\t// No match. Wrap to beginning of data.\n\t\tm = re.FindIndex(data)\n\t}\n\tif len(m) == 0 {\n\t\treturn 0, 0, errors.New(\"no match for \" + pattern)\n\t}\n\treturn m[0], m[1], nil\n}", "title": "" }, { "docid": "1502f815d1b5b387cc847b6ae3f93e0c", "score": "0.44420347", "text": "func (l *Lexer) findRegexp(r *regexp.Regexp) string {\n\treturn r.FindString(l.input[l.pos:])\n}", "title": "" }, { "docid": "5fa7844c63365078acad439b2131a044", "score": "0.44350728", "text": "func NewRegexMetric(ns string, name string, description string, valueType prometheus.ValueType, labels []string, pattern string) MatchMetric {\n\treturn &RegexMetric{\n\t\tdesc: prometheus.NewDesc(prometheus.BuildFQName(ns, \"\", name), description, labels, nil),\n\t\tvalueType: valueType,\n\t\tpattern: regexp.MustCompile(pattern),\n\t}\n}", "title": "" }, { "docid": "5926c23198bd26b9746b87cc1a2bfa59", "score": "0.4431481", "text": "func NewItemRegex(value string, pos pos, line int) Item {\n\treturn ItemRegex{\n\t\tItemYaGo{\n\t\t\tValue: value,\n\t\t\tTyp: ItemType[\"ItemRegex\"],\n\t\t\tPos: pos,\n\t\t\tLine: line,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "424f7fa37c3ce12c1a2f2f8d4ceacdac", "score": "0.44083714", "text": "func matchRegexp(t *testing.T, query, re string) chromedp.ActionFunc {\n\treturn func(ctx context.Context) error {\n\t\tvar value string\n\t\terr := chromedp.Text(query, &value, chromedp.ByQuery).Do(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"text %s: %v\", query, err)\n\t\t}\n\t\tt.Logf(\"text %s:\\n%s\", query, value)\n\t\tm, err := regexp.MatchString(re, value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !m {\n\t\t\treturn fmt.Errorf(\"%s: did not find %q in\\n%s\", query, re, value)\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "8195e5ffae4e8100727cd1121497b9be", "score": "0.43953675", "text": "func createMatcher(pattern string, c *cli.Context) FileMatcher {\n if ((pattern == \"\") || pattern == \"*\") {\n return newEmptyMatcher()\n }\n\n insensitive := c.Bool(\"insensitive\")\n\n if c.Bool(\"ext\") || c.Bool(\"full-path\") {\n return newRegexMatcher(pattern, insensitive)\n }\n\n return newFilepathMatcher(pattern, insensitive)\n}", "title": "" }, { "docid": "59652718b30be003cb29b5d1f28abde4", "score": "0.4386004", "text": "func NewParserWithReg(reg *regexp.Regexp) Parser {\n\treturn Parser{reg: reg}\n}", "title": "" }, { "docid": "27dced8f42ad652ad2f988e0498044a0", "score": "0.43858546", "text": "func NewMatcher(t MatchType, n, v string) (*Matcher, error) {\n\tm := &Matcher{\n\t\tType: t,\n\t\tName: n,\n\t\tValue: v,\n\t}\n\tif t == MatchRegexp || t == MatchNotRegexp {\n\t\tre, err := regexp.Compile(\"^(?:\" + v + \")$\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tm.re = re\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "eee1a57bc88a18df024243260fad0768", "score": "0.43614545", "text": "func WithID(id string) DeviceMatcher {\n\treturn func(device *chromecast.Device) bool {\n\t\treturn device != nil && device.ID() == id\n\t}\n}", "title": "" }, { "docid": "44135ee97edd00732587ec4993dd25fb", "score": "0.43153536", "text": "func NewSelector(pkg *types.Package, name, recv, typ string, loc int) *Selector {\n\treturn &Selector{\n\t\tPkg: Package{\n\t\t\tName: pkg.Name(),\n\t\t\tPath: pkg.Path(),\n\t\t},\n\t\tName: name,\n\n\t\tRecv: recv,\n\t\tType: typ,\n\n\t\tLOC: loc,\n\t}\n}", "title": "" }, { "docid": "4e4c401f5cd5af76d3dfae77885eadb6", "score": "0.4303543", "text": "func decodeRegexp(rd *bufio.Reader) (string, Regexp, error) {\n\t// name\n\tname, err := readCstring(rd)\n\tif err != nil {\n\t\treturn \"\", Regexp{}, err\n\t}\n\n\t// pattern\n\tpattern, err := readCstring(rd)\n\tif err != nil {\n\t\treturn \"\", Regexp{}, err\n\t}\n\n\t// options\n\toptions, err := readCstring(rd)\n\tif err != nil {\n\t\treturn \"\", Regexp{}, err\n\t}\n\treturn name, Regexp{Pattern: pattern, Options: options}, nil\n}", "title": "" }, { "docid": "e7c7f768424e455b4e9543f915027397", "score": "0.43030772", "text": "func New() weather.Parser {\n\tgroupRegexpString := strings.Join(groupRegexps, \"\")\n\tgroupRegexp := regexp.MustCompile(groupRegexpString)\n\n\treturn &Parser{groupRegexp: groupRegexp}\n}", "title": "" }, { "docid": "088b5a8619068c6304ef3514f10aa436", "score": "0.43021372", "text": "func (bld *builder) regexp(b bsr.BSR) *RegExp {\n\tre := &RegExp{\n\t\tSymbols: []LexSymbol{bld.lexSymbol(b.GetNTChildI(0))},\n\t}\n\tif b.Alternate() == 1 {\n\t\tre1 := bld.regexp(b.GetNTChildI(1))\n\t\tre.Symbols = append(re.Symbols, re1.Symbols...)\n\t}\n\treturn re\n}", "title": "" }, { "docid": "86a08b13eb9c67233107779274d179c0", "score": "0.4277417", "text": "func NewRegex(pattern string, options CompileOptions, syntax Syntax) (*Regex, error) {\n\tr := new(Regex)\n\terr := regexInit(r, pattern, options, syntax)\n\tif err != nil {\n\t\t// Don't return our probably-invalid Regex object, since accessing it\n\t\t// is likely to cause crashes.\n\t\treturn nil, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "0d6c2efd0a84c9c79db7778d1d5854ad", "score": "0.42462915", "text": "func FieldFunc(kind string, fn func(b []byte) (bool, []byte)) FinderFunc {\n\treturn func(src []byte) (Notes, error) {\n\t\tvar pos int\n\t\tvar notes Notes\n\t\tfields := bytes.Fields(src)\n\t\tfor _, f := range fields {\n\t\t\tif ok, match := fn(f); ok {\n\t\t\t\ts := bytes.Index(src[pos:], match) + pos\n\t\t\t\tif s == -1 {\n\t\t\t\t\t// true was returned without the returned bytes\n\t\t\t\t\t// appearing in the match.\n\t\t\t\t\treturn nil, ErrNoMatch(match)\n\t\t\t\t}\n\t\t\t\tnotes = append(notes, &Note{\n\t\t\t\t\tVal: match,\n\t\t\t\t\tStart: s,\n\t\t\t\t\tKind: kind,\n\t\t\t\t})\n\t\t\t}\n\t\t\tpos += len(f) + 1\n\t\t}\n\t\treturn notes, nil\n\t}\n}", "title": "" }, { "docid": "06958834351fba59f5e3e3d2f7c2ad24", "score": "0.42379472", "text": "func (pg *NativeFinder) Pattern(pattern string) ([]PID, error) {\n\tvar pids []PID\n\tregxPattern, err := regexp.Compile(pattern)\n\tif err != nil {\n\t\treturn pids, err\n\t}\n\tprocsName, err := getProcessesName()\n\tif err != nil {\n\t\treturn pids, err\n\t}\n\tfor pid, name := range procsName {\n\t\tif name == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif regxPattern.MatchString(name) {\n\t\t\tpids = append(pids, PID(pid))\n\t\t}\n\t}\n\treturn pids, err\n}", "title": "" }, { "docid": "f190647fd525bbf353c332d437ab8455", "score": "0.42228895", "text": "func NewLabelMatcher(matchType MatchType, name clientmodel.LabelName, value clientmodel.LabelValue) (*LabelMatcher, error) {\n\tm := &LabelMatcher{\n\t\tType: matchType,\n\t\tName: name,\n\t\tValue: value,\n\t}\n\tif matchType == RegexMatch || matchType == RegexNoMatch {\n\t\tre, err := regexp.Compile(string(value))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tm.re = re\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "dc11edef9f6bd944fb3c83570f98e1a5", "score": "0.42195892", "text": "func NewCmdStepCreatePullRequestRegex(commonOpts *opts.CommonOptions) *cobra.Command {\n\toptions := &StepCreatePullRequestRegexOptions{\n\t\tStepCreatePrOptions: StepCreatePrOptions{\n\t\t\tStepCreateOptions: step.StepCreateOptions{\n\t\t\t\tStepOptions: step.StepOptions{\n\t\t\t\t\tCommonOptions: commonOpts,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"regex\",\n\t\tShort: \"Creates a Pull Request on a git repository, doing an update using the provided regex\",\n\t\tLong: createPullRequestRegexLong,\n\t\tExample: createPullRequestRegexExample,\n\t\tAliases: []string{\"version pullrequest\"},\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\thelper.CheckErr(err)\n\t\t},\n\t}\n\tAddStepCreatePrFlags(cmd, &options.StepCreatePrOptions)\n\tcmd.Flags().StringArrayVarP(&options.Regexps, \"regex\", \"\", make([]string, 0), \"The regex to use when doing updates\")\n\tcmd.Flags().StringArrayVarP(&options.Files, \"files\", \"\", make([]string, 0), \"A glob describing the files to change\")\n\treturn cmd\n}", "title": "" }, { "docid": "7c4a928354c6f19366f03daf79fa9214", "score": "0.42105308", "text": "func RegexpFind(re *regexp.Regexp, b []byte) []byte", "title": "" }, { "docid": "65102929bfa513e79739cc6941f974d4", "score": "0.42064583", "text": "func NotRegexp(fieldName, v string) *F {\n\treturn (&F{}).AndNotRegexp(fieldName, v)\n}", "title": "" }, { "docid": "34ba2c4ef0f0f52a3c33737963a52eed", "score": "0.41941985", "text": "func (e *Env) RegexpSearch(name, re string) fake.Pos {\n\te.T.Helper()\n\tpos, err := e.Editor.RegexpSearch(name, re)\n\tif err == fake.ErrUnknownBuffer {\n\t\tpos, err = e.Sandbox.Workdir.RegexpSearch(name, re)\n\t}\n\tif err != nil {\n\t\te.T.Fatalf(\"RegexpSearch: %v, %v\", name, err)\n\t}\n\treturn pos\n}", "title": "" }, { "docid": "66a460d22c8c89c081b675590c9528d1", "score": "0.41924796", "text": "func InitializeRegexp(configurationInstance configurationtypes.AbstractConfigurationInterface) regexp.Regexp {\n\tu := \"\"\n\tfor k := range configurationInstance.GetUrls() {\n\t\tif \"\" != u {\n\t\t\tu += \"|\"\n\t\t}\n\t\tu += \"(\" + k + \")\"\n\t}\n\n\treturn *regexp.MustCompile(u)\n}", "title": "" }, { "docid": "72e3d7366911d095c1bd3ba6a1feed1a", "score": "0.41550973", "text": "func (sa StringArray) IndexWithRegexp(pattern String) Int {\n\tfor index, value := range sa {\n\t\tif value.Match(pattern) {\n\t\t\treturn Int(index)\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "8cad998fefdb5e03d3fb6249bfe58db5", "score": "0.4139778", "text": "func newMatch(seg *segment, path string) *match {\n\treturn &match{\n\t\tSegment: seg,\n\t\tContext: &context{params: map[string]string{}},\n\t\tRequestURI: path,\n\t}\n}", "title": "" }, { "docid": "6cd0d6b85e8f4991c36c914fe40ed445", "score": "0.41330874", "text": "func NewRPattern(\n\texpr string,\n\n\tmacros map[string]string,\n\tvars map[string][]string,\n\n) *RPattern {\n\t_expr := expandMacros(expr, macros)\n\n\t// Split expr into several parts.\n\t// Adjoining 2 parts have different token with each other.\n\toffset := 0\n\tvar parts []rPart\n\n\tfor _, m := range reVar.FindAllStringSubmatchIndex(_expr, -1) {\n\t\t// Keep plain text before var.\n\t\tplainText := _expr[offset:m[0]]\n\t\tif plainText != \"\" {\n\t\t\tparts = append(parts, rPart{plain, plainText, nil})\n\t\t}\n\n\t\t// Keep var and the var values.\n\t\tvarExpr := captured(_expr, m, 0)\n\t\t_, vals := getVar(varExpr, vars)\n\t\tparts = append(parts, rPart{toVar, varExpr, vals})\n\n\t\toffset = m[1]\n\t}\n\n\t// Keep remaining plain text.\n\tplainText := _expr[offset:]\n\tif plainText != \"\" {\n\t\tparts = append(parts, rPart{plain, plainText, nil})\n\t}\n\n\t// Collect letters in the regexp.\n\tletters := make(map[rune]bool)\n\tfor _, let := range splitLetters(regexpLetters(expr)) {\n\t\tletters[let] = true\n\t}\n\n\treturn &RPattern{expr, parts, letters}\n}", "title": "" }, { "docid": "b75f19a540337d917682bf4624676cc1", "score": "0.41317394", "text": "func (o HttpQueryParameterMatchOutput) RegexMatch() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HttpQueryParameterMatch) *string { return v.RegexMatch }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3174f896f545fe0dacb34dd16ca7f790", "score": "0.41271394", "text": "func NewMatcher(trigger Trigger, on string) *Matcher {\n\treturn &Matcher{\n\t\tTrigger: trigger, On: on,\n\t}\n}", "title": "" }, { "docid": "1b1f5d57dc3056349f8e1d3039a5acd5", "score": "0.41105416", "text": "func parseDNSRecordFilter(d interface{}) *recordFilter {\n\tcfg := d.([]interface{})\n\tf := &recordFilter{}\n\n\tm := cfg[0].(map[string]interface{})\n\n\tdomainName, ok := m[\"domain_name\"]\n\tif ok {\n\t\tf.domainName = domainName.(string)\n\t}\n\n\tname, ok := m[\"name\"]\n\tif ok {\n\t\tf.name = name.(string)\n\t}\n\n\tmatch, ok := m[\"match\"]\n\tif ok {\n\t\tregex, err := regexp.Compile(match.(string))\n\t\tif err != nil {\n\t\t\tlog.Println(\"[WARN] The passed regex is not valid\", err.Error())\n\n\t\t\treturn f\n\t\t}\n\t\tf.regex = regex\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "49dbb8674129550dd6b6a6b2b7b77996", "score": "0.41088122", "text": "func (ntb *NodeSelectorTermBuilder) WithMatchField(key string, op string, values ...string) *NodeSelectorTermBuilder {\n\treq := corev1api.NodeSelectorRequirement{\n\t\tKey: key,\n\t\tOperator: corev1api.NodeSelectorOperator(op),\n\t\tValues: values,\n\t}\n\tntb.object.MatchFields = append(ntb.object.MatchFields, req)\n\treturn ntb\n}", "title": "" }, { "docid": "31002f769ed92d9dc03e7f3fe669c05d", "score": "0.41046003", "text": "func NewMatcher(pattern string) *Matcher {\n\tif len(pattern) > MaxPatternSize {\n\t\tpattern = pattern[:MaxPatternSize]\n\t}\n\n\tm := &Matcher{\n\t\tpattern: pattern,\n\t\tpatternLower: toLower([]byte(pattern), nil),\n\t}\n\n\tfor i, c := range m.patternLower {\n\t\tif pattern[i] != c {\n\t\t\tm.caseSensitive = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif len(pattern) > 3 {\n\t\tm.patternShort = m.patternLower[:3]\n\t} else {\n\t\tm.patternShort = m.patternLower\n\t}\n\n\tm.patternRoles = RuneRoles([]byte(pattern), nil)\n\n\tif len(pattern) > 0 {\n\t\tmaxCharScore := 4\n\t\tm.scoreScale = 1 / float32(maxCharScore*len(pattern))\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "053da6b8bccac7f491f4dc76b4220a0c", "score": "0.41031224", "text": "func extractDeviceId(deviceName string) string {\n\tif deviceName == \"\" {\n\t\treturn \"\"\n\t}\n\tfieldsFunc := strings.FieldsFunc(deviceName, func(r rune) bool { return '/' == r })\n\tid := fieldsFunc[len(fieldsFunc)-1]\n\tif strings.HasPrefix(id, \"scsi\") {\n\t\treturn strings.TrimPrefix(id, \"scsi-0QEMU_QEMU_HARDDISK_\")\n\t}\n\tif strings.HasPrefix(id, \"virtio\") {\n\t\treturn strings.TrimPrefix(id, \"virtio-\")\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e1408f94e49777f9bbc90e054c46909c", "score": "0.40918398", "text": "func (f FieldFinder) FindDeviceID(msg *wrp.Message) (string, error) {\n\treturn strings.ToLower(getFieldValue(f.Field, msg)), nil\n}", "title": "" }, { "docid": "b5bbb50cec88b6b689522cf8bd672739", "score": "0.40834153", "text": "func (p regexRouterParser) parseFieldExtractor(\n\trule *RegexRouter,\n\tfield,\n\tfieldPattern string,\n\tapplyFn func(result *RouteResult, value string) error,\n) error {\n\t// pattern is empty, return default rule\n\tif len(fieldPattern) == 0 {\n\t\treturn errors.Errorf(\"field '%s' match pattern can't be empty\", field)\n\t}\n\n\t// check and parse regexp template\n\tif err := p.checkSubPatterns(rule.pattern, fieldPattern); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\trule.extractors = append(rule.extractors, patExpander{\n\t\ttemplate: fieldPattern,\n\t\tapplyFn: applyFn,\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "78a87c57ae601454443b29777f147362", "score": "0.40832055", "text": "func FindUpepGeneIdentifierGP(id int64, selectCols ...string) *UpepGeneIdentifier {\n\tretobj, err := FindUpepGeneIdentifier(boil.GetDB(), id, selectCols...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn retobj\n}", "title": "" }, { "docid": "b0c565233be730c84516d204b3d34778", "score": "0.40828183", "text": "func NewMatcher(wordList []string, matchCase bool) Matcher {\n\treturn regex.NewRegexMatcher(wordList, matchCase)\n}", "title": "" }, { "docid": "1006ec3222f42be386e7d1dc6f4b25c5", "score": "0.40716267", "text": "func (v Val) Regex() (pattern, options string) {\n\tif v.t != bsontype.Regex {\n\t\tpanic(ElementTypeError{\"bson.Value.Regex\", v.t})\n\t}\n\tregex := v.primitive.(primitive.Regex)\n\treturn regex.Pattern, regex.Options\n}", "title": "" }, { "docid": "269fcb6023d82734aa0391f9c0a5cdb8", "score": "0.4070914", "text": "func Regexp(glob string) (*regexp.Regexp, error) {\n\tvar (\n\t\tgroup bool\n\t\tskip int8\n\t)\n\n\tb := &buffer{new(bytes.Buffer)}\n\tb.WriteString(\"^\")\n\n\tfor pos, char := range glob {\n\t\tif skip > 0 {\n\t\t\tskip--\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch char {\n\t\tcase '\\\\', '$', '^', '+', '.', '(', ')', '=', '!', '|':\n\t\t\tif err := b.WriteRunes('\\\\', char); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase '/':\n\t\t\tskip = forwardSlash(b, pos, glob)\n\t\tcase '?':\n\t\t\tb.WriteRune('.')\n\t\tcase '[', ']':\n\t\t\tb.WriteRune(char)\n\t\tcase '{':\n\t\t\tskip, group = openBrace(b, pos, glob, group)\n\t\tcase '}':\n\t\t\tgroup = closeBrace(b, group)\n\t\tcase ',':\n\t\t\tif err := comma(b, char, group); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase '*':\n\t\t\tskip = asterix(b, pos, glob)\n\t\tdefault:\n\t\t\tb.WriteRune(char)\n\t\t}\n\t}\n\n\tb.WriteString(\"$\")\n\n\treturn regexp.Compile(b.String())\n}", "title": "" }, { "docid": "5c4abb0ffd54cdbb628dfca0cd5153a6", "score": "0.40692377", "text": "func (*textP) Regex(args ...interface{}) TextPredicate {\n\treturn newTextP(\"regex\", args...)\n}", "title": "" }, { "docid": "e8ec468be1d71c09568d05e77ebb5eac", "score": "0.4062501", "text": "func CompileRegexp(pattern string) (*Regexp, error) {\n\tcompiled, err := regexp.Compile(pattern)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tre, err := syntax.Parse(pattern, syntax.Perl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttpl := &template{buffer: new(bytes.Buffer)}\n\ttpl.write(re)\n\treturn &Regexp{\n\t\tcompiled: compiled,\n\t\ttemplate: tpl.buffer.String(),\n\t\tgroups: tpl.groups,\n\t\tindices: tpl.indices,\n\t}, nil\n}", "title": "" }, { "docid": "9a625ea099925d0e4a6ffec367ce5d50", "score": "0.40510914", "text": "func (s *Scanner) ScanWithRegex() (pos token.Pos, tok token.Token, lit string) {\n\treturn s.scan(flux_en_main_with_regex)\n}", "title": "" }, { "docid": "bfca68d3a42dc5aae2e7c39a4a2e3574", "score": "0.40503633", "text": "func (traveler *FileTraveler) FindString(pattern string) (matches []int) {\n rx := regexp.MustCompile(pattern)\n return traveler.Find(rx)\n}", "title": "" }, { "docid": "8125c55e76ceb20c598462755f3977e4", "score": "0.40404686", "text": "func regexMatch(fieldValue, pattern string) bool {\n\tmatch, _ := regexp.MatchString(pattern, fieldValue)\n\treturn match\n}", "title": "" }, { "docid": "f149d8bf172bc2bf7f472c459e1ae798", "score": "0.40367195", "text": "func (p *Parts) Regex() (string, error) {\n\tregex, err := p.RegexFragment()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn \"^\" + regex + \"$\", nil\n}", "title": "" }, { "docid": "a0bc21f50df1054cd0e6e3e26a2cddf8", "score": "0.40306604", "text": "func RegexMatchFunc(args ...interface{}) (interface{}, error) {\n\tname1 := args[0].(string)\n\tname2 := args[1].(string)\n\n\treturn bool(RegexMatch(name1, name2)), nil\n}", "title": "" }, { "docid": "8945e6407243dbdaf76e2e76dc4842af", "score": "0.402203", "text": "func NewTodoMatcher() *TodoMatcher { return &TodoMatcher{} }", "title": "" }, { "docid": "e8e9c2bbe3785c016a4783531d4444ed", "score": "0.40095773", "text": "func NewSubstrMatcher(pattern string) Matcher {\n\treturn substrMatcher(pattern)\n}", "title": "" }, { "docid": "c6add88e4252489d69ab08817f9d7178", "score": "0.4005884", "text": "func (e *Env) DiagnosticAtRegexp(name, re string) DiagnosticExpectation {\n\te.T.Helper()\n\tpos := e.RegexpSearch(name, re)\n\treturn DiagnosticExpectation{path: name, pos: &pos, re: re, present: true}\n}", "title": "" }, { "docid": "affe24717e010e55e1176c7266207d6d", "score": "0.40013286", "text": "func NewMatcher() *Matcher {\n\tclock := timer.New()\n\treturn &Matcher{clock: clock}\n}", "title": "" }, { "docid": "23c1302f69f2380a89d0cab2cc63dee8", "score": "0.39954036", "text": "func (fl *F) AndRegexp(fieldName, v string) *F {\n\tfl.predicates = append(fl.predicates, filterPredicate{fieldName: fieldName, op: regexpEquals, s: &v})\n\treturn fl\n}", "title": "" }, { "docid": "f0d2740b376fa71ee804d4d4e790496c", "score": "0.3994284", "text": "func newMatcher() *matcher {\n\treturn &matcher{\n\t\tgroups: make(map[string]*matcherGroup),\n\t}\n}", "title": "" }, { "docid": "b79609427e691e9cf5b3455e6e4302f8", "score": "0.39929748", "text": "func (rc *RegexClassifier) Register(pattern string, intentID string) error {\n\tre, err := regexp.Compile(pattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trc.patterns = append(rc.patterns, struct {\n\t\tre *regexp.Regexp\n\t\tid string\n\t}{re: re, id: intentID})\n\treturn nil\n}", "title": "" }, { "docid": "7dfb248c1621e6d885dbcc42f8d17373", "score": "0.39818874", "text": "func GetRegexp(scope scope.Scope, pattern string) (map[string]string, error) {\n\treturn getRegexp(execGitConfig)(scope, pattern)\n}", "title": "" }, { "docid": "215c51e456ce460714d76456d1c3096f", "score": "0.3973489", "text": "func MatchAndPull(line, regex, pull string) (substr string) {\n\tmatchRegex, err := regexp.Compile(regex)\n\tif err != nil {\n\t\tlog.Println(\"Unable to parse regex:\", regex)\n\t\treturn \"\"\n\t}\n\n\tif matchRegex.MatchString(line) {\n\t\tpullRegex := regexp.MustCompile(pull)\n\t\tsubstr := pullRegex.FindStringSubmatch(line)\n\t\tif len(substr) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn substr[1]\n\t} else {\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "9e744edc68a5d4b50677c29c02b234b0", "score": "0.39680102", "text": "func (db *TitlesDatabase) RegexpSearch(re *regexp.Regexp) (m SearchMatch) {\n\treturn firstMatch(db.RegexpSearchN(re, 1))\n}", "title": "" }, { "docid": "244d27e7274923e24f83f905b172219e", "score": "0.3967087", "text": "func (s *BaseSqlParserListener) EnterRegexpPredicate(ctx *RegexpPredicateContext) {}", "title": "" }, { "docid": "79e4c15b7d959bea9ef41849fd8959f1", "score": "0.39654198", "text": "func NewMatcher() Matcher {\n\treturn Matcher{\n\t\texpressions: map[string]*regexp.Regexp{},\n\t\tRWMutex: &sync.RWMutex{},\n\t}\n}", "title": "" }, { "docid": "0649f8fe80e074d7ac5da8af93705374", "score": "0.3963792", "text": "func NewPattern(str string) *Pattern {\n\tvar params []string\n\tvar subPatternCount int\n\tvar subPatternName string\n\tregexpPatternStr := triePattern.ReplaceAllStringFunc(str, func(substr string) string {\n\t\tp := strings.Split(strings.Trim(substr, \"<>\"), DefaultPatternDelimeter)\n\t\tparam := p[0]\n\t\tparams = append(params, param)\n\t\tsubPatternName = \"\"\n\t\tif len(p) > 1 {\n\t\t\tsubPatternName = p[1]\n\t\t}\n\t\tsubPatternCount++\n\t\treturn defaultPatternStore.GetPattern(subPatternName)\n\t})\n\n\tvar pattern = regexp.MustCompile(regexpPatternStr)\n\tvar isRegexpPattern = (str != regexpPatternStr)\n\tp := &Pattern{\n\t\tpattern: pattern,\n\t\tparams: params,\n\t\tpatternStr: str,\n\t\tregexpStr: regexpPatternStr,\n\t\tIsRegexpPattern: isRegexpPattern,\n\t}\n\tif subPatternCount == 1 && subPatternName == \"*\" {\n\t\tp.patternName = subPatternName\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "719c95389c0af64efd676a9a42d115e4", "score": "0.39468822", "text": "func RegexpFindSubmatch(re *regexp.Regexp, b []byte) [][]byte", "title": "" }, { "docid": "ecf2e9698c20dfa9c55062d2d62959eb", "score": "0.39408132", "text": "func (sc *StringConstraint) Regexp(rx *regexp.Regexp) *StringConstraint {\n\tsc.regexp = rx\n\treturn sc\n}", "title": "" }, { "docid": "8df973c168c62c7f7dda37e614a4a33d", "score": "0.39340442", "text": "func newDebugReporter(groupSelector string, outputFolder string) *debugReporter {\n\treturn &debugReporter{\n\t\tgroupSelector: config.NewStringMatcher(groupSelector),\n\t\toutputFolder: outputFolder,\n\t}\n}", "title": "" }, { "docid": "76d4da01324dfb72b560845082da73f2", "score": "0.39330804", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatementPtrOutput) FieldToMatch() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatement) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FieldToMatch\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchPtrOutput)\n}", "title": "" }, { "docid": "89c36d2cb6404ded7b77dd6528317f07", "score": "0.3923107", "text": "func (a *Assertion) Regex(val string) *Assertion {\n\n\ta.add(func(i interface{}) error {\n\n\t\tr, err := regexp.Compile(val)\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"assert.regex.compile\")\n\t\t}\n\n\t\tif r.MatchString(fmt.Sprintf(\"%v\", i)) {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fmt.Errorf(\"assert.regex\")\n\t})\n\n\treturn a\n\n}", "title": "" }, { "docid": "8c13101964a6cd00d3da29af7dcf2935", "score": "0.3919759", "text": "func (sc *StringConstraint) RegexpString(pat string) *StringConstraint {\n\treturn sc.Regexp(regexp.MustCompile(pat))\n}", "title": "" }, { "docid": "38fb6baa0361cf1f10959987c92a2fcd", "score": "0.39192942", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatementPtrOutput) FieldToMatch() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatement) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FieldToMatch\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchPtrOutput)\n}", "title": "" }, { "docid": "e275bfc55407e5c8399657e5b8cea546", "score": "0.3919021", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexMatchStatementPtrOutput) FieldToMatch() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexMatchStatementFieldToMatchPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexMatchStatement) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexMatchStatementFieldToMatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FieldToMatch\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexMatchStatementFieldToMatchPtrOutput)\n}", "title": "" }, { "docid": "b7f491eb56ab6caf7f70f550272eb926", "score": "0.3917944", "text": "func findScanner(ctx context.Context, devInfo usbprinter.DevInfo) (bus, device string, err error) {\n\tb, err := testexec.CommandContext(ctx, \"lsusb\", \"-d\", fmt.Sprintf(\"%s:%s\", devInfo.VID, devInfo.PID)).Output(testexec.DumpLogOnError)\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"failed to run lsusb\")\n\t}\n\n\tout := string(b)\n\tcolonIndex := strings.Index(out, \":\")\n\tif colonIndex == -1 {\n\t\treturn \"\", \"\", errors.Wrap(err, \"failed to find ':' in lsusb output\")\n\t}\n\n\ttokens := strings.Split(out[:colonIndex], \" \")\n\tif len(tokens) != 4 || tokens[0] != \"Bus\" || tokens[2] != \"Device\" {\n\t\treturn \"\", \"\", errors.Errorf(\"failed to parse output as Bus [bus-id] Device [device-id]: %s\", out)\n\t}\n\n\treturn tokens[1], tokens[3], nil\n}", "title": "" }, { "docid": "d790db55123ae63f04a139ba6ef50af8", "score": "0.39175737", "text": "func (o RuleGroupRuleStatementNotStatementStatementRegexMatchStatementPtrOutput) FieldToMatch() RuleGroupRuleStatementNotStatementStatementRegexMatchStatementFieldToMatchPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementNotStatementStatementRegexMatchStatement) *RuleGroupRuleStatementNotStatementStatementRegexMatchStatementFieldToMatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FieldToMatch\n\t}).(RuleGroupRuleStatementNotStatementStatementRegexMatchStatementFieldToMatchPtrOutput)\n}", "title": "" }, { "docid": "89595305fe698063d6d0f16117766d56", "score": "0.39160973", "text": "func RouteWithRegexp(pattern string, node UI) {\n\troutes.routeWithRegexp(pattern, node)\n}", "title": "" }, { "docid": "9243df02f8e9e9661239545e2f92be65", "score": "0.39156187", "text": "func (cmd *Command) MatchRE(regex string) *Command {\n\tmatcher := regexp.MustCompile(regex)\n\n\tcmd.MatchFunc = func(input string) bool {\n\t\treturn matcher.MatchString(input)\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "eb9dad3daac018bccfad7e1d0d772a96", "score": "0.39142138", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexMatchStatementPtrOutput) FieldToMatch() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexMatchStatementFieldToMatchPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexMatchStatement) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexMatchStatementFieldToMatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FieldToMatch\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexMatchStatementFieldToMatchPtrOutput)\n}", "title": "" }, { "docid": "dc0679817c0e44351d179a0c81ca89d9", "score": "0.3910297", "text": "func getID(label string, r *http.Request) (string, error) {\n\tregex := fmt.Sprintf(\"^/(%s)/([a-zA-Z0-9]+)$\", label)\n\tvar validPath = regexp.MustCompile(regex)\n\tm := validPath.FindStringSubmatch(r.URL.Path)\n\tif m == nil {\n\t\treturn \"\", fmt.Errorf(\"could not extract id from path %s\", r.URL.Path)\n\t}\n\treturn m[2], nil\n}", "title": "" }, { "docid": "91e9b9fd2baa608f4469dca9c5c23128", "score": "0.39046508", "text": "func NewMatcher() *Matcher {\n\treturn &Matcher{}\n}", "title": "" }, { "docid": "a3c9f1e5f6d51dab7f6cba8bd6ff58a0", "score": "0.38966736", "text": "func StringToRegexpHookFunc() mapstructure.DecodeHookFuncType {\n\treturn func(f reflect.Type, t reflect.Type, data any) (value any, err error) {\n\t\tvar ptr bool\n\n\t\tif f.Kind() != reflect.String {\n\t\t\treturn data, nil\n\t\t}\n\n\t\tprefixType := \"\"\n\n\t\tif t.Kind() == reflect.Ptr {\n\t\t\tptr = true\n\t\t\tprefixType = \"*\"\n\t\t}\n\n\t\texpectedType := reflect.TypeOf(regexp.Regexp{})\n\n\t\tif ptr && t.Elem() != expectedType {\n\t\t\treturn data, nil\n\t\t} else if !ptr && t != expectedType {\n\t\t\treturn data, nil\n\t\t}\n\n\t\tdataStr := data.(string)\n\n\t\tvar result *regexp.Regexp\n\n\t\tif dataStr != \"\" {\n\t\t\tif result, err = regexp.Compile(dataStr); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(errFmtDecodeHookCouldNotParse, dataStr, prefixType, expectedType, err)\n\t\t\t}\n\t\t}\n\n\t\tif ptr {\n\t\t\treturn result, nil\n\t\t}\n\n\t\tif result == nil {\n\t\t\treturn nil, fmt.Errorf(errFmtDecodeHookCouldNotParseEmptyValue, prefixType, expectedType, errDecodeNonPtrMustHaveValue)\n\t\t}\n\n\t\treturn *result, nil\n\t}\n}", "title": "" }, { "docid": "c78c6c45606669b800ff845e61ec7d92", "score": "0.3884793", "text": "func (p *FieldParser) NewRune(r rune) (ret State) {\n\tvar id IdentParser\n\tidentChain := MakeChain(&id, Statement(\"post field\", func(r rune) (ret State) {\n\t\t// after we have parsed the identifier, check the incoming rune.\n\t\tif n := id.Identifier(); len(n) > 0 {\n\t\t\tp.fields = append(p.fields, n)\n\t\t\tif isDot(r) {\n\t\t\t\tp.pending = true // a new reference is pending.\n\t\t\t\tret = p\n\t\t\t} else {\n\t\t\t\tp.pending = false\n\t\t\t}\n\t\t}\n\t\treturn\n\t}))\n\t// the field was started with a dot that we are asked to parse\n\t// on subsequent loops we are left just after the dot, and we need that first letter.\n\tif len(p.fields) != 0 {\n\t\tret = identChain.NewRune(r)\n\t} else if !isDot(r) {\n\t\tp.err = errutil.New(\"field should start with dot (.)\")\n\t} else {\n\t\tret = identChain\n\t}\n\treturn\n}", "title": "" }, { "docid": "c959e2911991e64094e4219440f3f6c5", "score": "0.38822776", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatementPtrOutput) FieldToMatch() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatement) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatementFieldToMatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FieldToMatch\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchPtrOutput)\n}", "title": "" }, { "docid": "85fe67d757a67cc1b80ffacdfa85bcab", "score": "0.38782355", "text": "func newSel(e ast.Expr, label label) ast.Expr {\n\tif label.isDef {\n\t\treturn ast.NewSel(e, label.name)\n\n\t}\n\tif ast.IsValidIdent(label.name) && !internal.IsDefOrHidden(label.name) {\n\t\treturn ast.NewSel(e, label.name)\n\t}\n\treturn &ast.IndexExpr{X: e, Index: ast.NewString(label.name)}\n}", "title": "" } ]
c5ce3358ae2787cd60e8a3963a175f76
Override adds a keyvalue pair to the environment as an overridden value according to the specification:
[ { "docid": "f9aec0a0f02e82c96e1ba6583a75c1f2", "score": "0.81905496", "text": "func (e Environment) Override(name, value string) {\n\te[name+\".override\"] = value\n}", "title": "" } ]
[ { "docid": "fe8b7e2447c9159a3c9730a05e8e00b2", "score": "0.67912745", "text": "func Override(opts ...Option) {\n\tfor _, opt := range opts {\n\t\tif !strings.HasPrefix(opt.Key, AppPrefix) {\n\t\t\topt.Key = AppPrefix + \"_\" + opt.Key\n\t\t}\n\t\tos.Setenv(strings.TrimSpace(opt.Key), strings.TrimSpace(opt.Value))\n\t}\n}", "title": "" }, { "docid": "fb516dbf10d1a8bf4964ae1c33f306c6", "score": "0.6788502", "text": "func (c *jsiiProxy_CfnEnvironment) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "bbf761dba582b13ab47ebaec71a56691", "score": "0.6670823", "text": "func Override(ctx context.Context, name string, value bool) context.Context {\n\tov := overrides{}\n\tif old, ok := ctx.Value(overrideContextKey).(overrides); ok {\n\t\tfor k, v := range old {\n\t\t\tov[k] = v\n\t\t}\n\t}\n\tov[name] = value\n\treturn context.WithValue(ctx, overrideContextKey, ov)\n}", "title": "" }, { "docid": "0d6709917c8eff103d36fc4fd30afc08", "score": "0.62534153", "text": "func (c *Client) Override(serial, property, value string) error {\n\tdata, err := json.Marshal(hostmgr.Host{\n\t\tOverrides: map[string]interface{}{property: value},\n\t})\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\tresp, err := httputil.Put(fmt.Sprintf(\"%s://%s:%d/admin/host/%s/override\", c.Scheme, c.Host, c.Port, serial), contentType, bytes.NewBuffer(data))\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode > 399 {\n\t\treturn microerror.Mask(fmt.Errorf(\"invalid status code '%d'\", resp.StatusCode))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e998021876b2230e46519967ffa741ee", "score": "0.62186563", "text": "func (c *jsiiProxy_CfnApplication) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "a16bd9e27b203f5a9ae7b3599defaa09", "score": "0.6185502", "text": "func (c *jsiiProxy_CfnApplicationVersion) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "1ff59933b2b7edcad60ee6fb1bf7268d", "score": "0.6071233", "text": "func (c *jsiiProxy_CfnExperimentTemplate) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "1cc8c1c257e6642d10ec9b23e2d1008b", "score": "0.6047549", "text": "func (c *jsiiProxy_CfnDataLakeSettings) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "fa086b4f82a93f2d662e34f6e0a0147d", "score": "0.6023168", "text": "func (mg *MailgunImpl) AddOverrideHeader(k string, v string) {\n\tif mg.overrideHeaders == nil {\n\t\tmg.overrideHeaders = make(map[string]string)\n\t}\n\tmg.overrideHeaders[k] = v\n}", "title": "" }, { "docid": "a39400759149739efbee59f9b19a2e31", "score": "0.6010145", "text": "func (c *jsiiProxy_CfnPackagingConfiguration) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "32139db0942886fa9a3a009301d7d8dd", "score": "0.6003373", "text": "func EnvOverride(dst, src []corev1.EnvVar) []corev1.EnvVar {\n\tfor _, cre := range src {\n\t\tpos := GetEnvVar(cre.Name, dst)\n\t\tif pos != -1 {\n\t\t\tdst[pos] = cre\n\t\t} else {\n\t\t\tdst = append(dst, cre)\n\t\t}\n\t}\n\treturn dst\n}", "title": "" }, { "docid": "15ec058c530dded5398d4d5726c55274", "score": "0.5975899", "text": "func WithOverride(config *Config) {\n\tconfig.Overwrite = true\n}", "title": "" }, { "docid": "e513251d1450af7b3a095d24cd54e34a", "score": "0.59741735", "text": "func (e *env) Update(name string, value Value) error {\n\tif _, ok := e.env[name]; ok {\n\t\te.env[name] = value\n\t\treturn nil\n\t}\n\n\t// Only define can introduce new bindings.\n\tif e.parent == nil {\n\t\treturn errors.New(\"no such binding\")\n\t}\n\n\treturn e.parent.Update(name, value)\n}", "title": "" }, { "docid": "beff5a4ce61f9b4f55180c67d83c00fc", "score": "0.5961379", "text": "func (e *environ) Set(key, val string) {\n\te.Unset(key)\n\t*e = append(*e, key+\"=\"+val)\n}", "title": "" }, { "docid": "beff5a4ce61f9b4f55180c67d83c00fc", "score": "0.5961379", "text": "func (e *environ) Set(key, val string) {\n\te.Unset(key)\n\t*e = append(*e, key+\"=\"+val)\n}", "title": "" }, { "docid": "37d3f79fe809b2d6a558c80944908829", "score": "0.59036255", "text": "func envOverride(config *DefaultConfig) (*DefaultConfig, error) {\n\t// override SymbolsUpdateTime\n\tsymbolsUpdateTime := os.Getenv(\"ALPACA_BROKER_FEEDER_SYMBOLS_UPDATE_TIME\")\n\tif symbolsUpdateTime != \"\" {\n\t\tt, err := time.Parse(ctLayout, symbolsUpdateTime)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconfig.SymbolsUpdateTime = t\n\t}\n\n\t// override UpdateTime\n\tupdateTime := os.Getenv(\"ALPACA_BROKER_FEEDER_UPDATE_TIME\")\n\tif updateTime != \"\" {\n\t\tt, err := time.Parse(ctLayout, updateTime)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconfig.UpdateTime = t\n\t}\n\n\t// override API Key ID / API Secret Key\n\tapiKeyID := os.Getenv(\"ALPACA_BROKER_FEEDER_API_KEY_ID\")\n\tif apiKeyID != \"\" {\n\t\tconfig.APIKeyID = apiKeyID\n\t}\n\n\tapiSecretKey := os.Getenv(\"ALPACA_BROKER_FEEDER_API_SECRET_KEY\")\n\tif apiSecretKey != \"\" {\n\t\tconfig.APISecretKey = apiSecretKey\n\t}\n\n\t// override the basic Auth of Stocks Json URL and basic auth\n\t// override the basic Auth of Stocks Json URL\n\tstocksJSONURL := os.Getenv(\"ALPACA_BROKER_FEEDER_STOCKS_JSON_URL\")\n\tif stocksJSONURL != \"\" {\n\t\tconfig.StocksJSONURL = stocksJSONURL\n\t}\n\tstocksJSONBasicAuth := os.Getenv(\"ALPACA_BROKER_FEEDER_STOCKS_JSON_BASIC_AUTH\")\n\tif stocksJSONBasicAuth != \"\" {\n\t\tconfig.StocksJSONBasicAuth = stocksJSONBasicAuth\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "4eab6746a7b4eefe5eedc918059f91b9", "score": "0.5898827", "text": "func (c *jsiiProxy_CfnDevice) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "974614c7cdb0abf6923401aa8767e4a3", "score": "0.58664346", "text": "func envOverrides(url string, initial map[string]interface{}) map[string]interface{} {\n\turl = strings.TrimRight(url, \"/\")\n\toverrides := map[string]interface{}{\n\t\t\"bundleServiceURL\": url + \"/bundleservice/\",\n\t\t\"charmstoreURL\": url + \"/charmstore/\",\n\t\t\"paymentURL\": url + \"/payment/\",\n\t\t\"plansURL\": url + \"/omnibus/\",\n\t\t\"ratesURL\": url + \"/omnibus/\",\n\t\t\"termsURL\": url + \"/terms/\",\n\t\tbaseURLKey: \"/\",\n\t\t// In all main GUI scenarios we can assume gisf to be true.\n\t\t\"gisf\": true,\n\t}\n\tfor k, v := range initial {\n\t\toverrides[k] = v\n\t}\n\treturn overrides\n}", "title": "" }, { "docid": "ef78bf73e5bf33044047e0c0c47c12a6", "score": "0.58158255", "text": "func (c *jsiiProxy_CfnCluster) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "ef78bf73e5bf33044047e0c0c47c12a6", "score": "0.58158255", "text": "func (c *jsiiProxy_CfnCluster) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "51b0c81bd0f7b048439735d22784c08e", "score": "0.58134025", "text": "func (r Parameters) Override(with Parameters) Parameters {\n\twithG := make(map[interface{}]interface{})\n\tfor k, v := range with {\n\t\twithG[k] = v\n\t}\n\trG := make(map[interface{}]interface{})\n\tfor k, v := range r {\n\t\trG[k] = v\n\t}\n\tdst := make(map[interface{}]interface{})\n\tmerge(dst, rG)\n\tmerge(dst, withG)\n\tret := make(map[string]interface{})\n\tfor k, v := range dst {\n\t\tret[fmt.Sprintf(\"%v\", k)] = v\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "9dd122bb6af0c836f8f0761c511aa38c", "score": "0.58127457", "text": "func (c *jsiiProxy_CfnService) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "a86d51eadbd8f4796275357af09afff0", "score": "0.5810249", "text": "func (c *jsiiProxy_CfnChannel) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "a86d51eadbd8f4796275357af09afff0", "score": "0.5810249", "text": "func (c *jsiiProxy_CfnChannel) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "138bcab1c1f472842040fefd8958ba42", "score": "0.58020663", "text": "func Append(dest, source map[string]interface{}, override bool) {\n\tfor k, v := range source {\n\t\tif _, ok := dest[k]; ok && !override {\n\t\t\tcontinue\n\t\t}\n\t\tdest[k] = v\n\t}\n}", "title": "" }, { "docid": "752ecce94269e24930b5eacea198c444", "score": "0.57827044", "text": "func (c *jsiiProxy_CfnWirelessDevice) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "e3df28028e211904285badd389db0dee", "score": "0.5772299", "text": "func (c *jsiiProxy_CfnConfigurationTemplate) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "469f19ae6f8bc4a51eec4cb6a5210338", "score": "0.57537454", "text": "func (c *jsiiProxy_CfnInput) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "75641c121e09d5990e8d4e5e96882596", "score": "0.575271", "text": "func (c *jsiiProxy_CfnSlackChannelConfiguration) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "97f431e8680a370445de3375bd20c9bf", "score": "0.5734871", "text": "func (c *jsiiProxy_CfnEnvironment) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "10e56696af25f372d7c1a821f7d39f8e", "score": "0.5733054", "text": "func (c *jsiiProxy_CfnParameterGroup) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "07f75f5abb82310e93a4eff46117e982", "score": "0.5714666", "text": "func (c *jsiiProxy_CfnClusterCapacityProviderAssociations) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "1b7bdfecb512fe15ee050dec2d0afe90", "score": "0.5712229", "text": "func (c *jsiiProxy_CfnCapacityProvider) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "4fd0648fd56e970553e06d56644241f5", "score": "0.56974405", "text": "func (c *jsiiProxy_CfnPackagingGroup) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "9c2409bea791173e1106d34030ff2630", "score": "0.5689975", "text": "func (c *jsiiProxy_CfnSite) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "62b2c81b27b268bb5804766bee59a3f1", "score": "0.56712335", "text": "func (t *RequestModifyingTransport) Override(requestURI *regexp.Regexp, setHeaders http.Header, runOnlyOnce bool) {\n\tt.overridesMu.Lock()\n\tdefer t.overridesMu.Unlock()\n\tif t.overrides == nil {\n\t\tt.overrides = make(map[*regexp.Regexp]requestOverride)\n\t}\n\tt.overrides[requestURI] = requestOverride{setHeaders, runOnlyOnce}\n}", "title": "" }, { "docid": "fd7b076bb491489d3abfb7617bc8673c", "score": "0.5669483", "text": "func TestProcessorWithEnv_Override(t *testing.T) {\n\tdone := make(chan struct{})\n\n\tp := func(c context.Context, h map[string]string, b []byte) error {\n\t\tif x := h[\"foo\"]; x != \"bar\" {\n\t\t\tt.Errorf(\"Environment variables are overriden\")\n\t\t}\n\n\t\tclose(done)\n\n\t\treturn nil\n\t}\n\n\tp = ProcessorWithEnv(p, map[string]string{\"foo\": \"overriden\"})\n\tp(context.Background(), map[string]string{\"foo\": \"bar\"}, nil)\n\n\tselect {\n\tcase <-done:\n\tdefault:\n\t\tt.Errorf(\"Inner processor was not executed\")\n\t}\n}", "title": "" }, { "docid": "c702a6e0855f715aa558ef44ddc2d131", "score": "0.56658757", "text": "func (e *Env) Set(key, val string) {\n\te.Unset(key)\n\t*e = append(*e, key+\"=\"+val)\n}", "title": "" }, { "docid": "b4b2fe9da95df9af07b053f719cbd72b", "score": "0.5665843", "text": "func (e *Env) Set(k string, v interface{}) error {\n\te.Lock()\n\tdefer e.Unlock()\n\tki := strings.ToLower(k)\n\tif _, ok := e.env[ki]; ok {\n\t\tval, ok := v.(reflect.Value)\n\t\tif !ok {\n\t\t\tval = reflect.ValueOf(v)\n\t\t}\n\t\te.env[ki] = val\n\t\treturn nil\n\t}\n\tif e.parent == nil {\n\t\treturn fmt.Errorf(\"Unknown symbol '%s'\", k)\n\t}\n\treturn e.parent.Set(ki, v)\n}", "title": "" }, { "docid": "72bef67cfe41c9324d4c0edc18efab08", "score": "0.5653674", "text": "func (c *jsiiProxy_CfnInputSecurityGroup) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "0cdabcd86890b479b4e0039c0e8b6c67", "score": "0.56483585", "text": "func (a *ApplicationEnvironmentVariableApiService) CreateApplicationEnvironmentVariableOverride(ctx _context.Context, applicationId string, environmentVariableId string) ApiCreateApplicationEnvironmentVariableOverrideRequest {\n\treturn ApiCreateApplicationEnvironmentVariableOverrideRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tapplicationId: applicationId,\n\t\tenvironmentVariableId: environmentVariableId,\n\t}\n}", "title": "" }, { "docid": "2d245f9708dcecbc44a3c30fd55515ba", "score": "0.5640803", "text": "func (c *jsiiProxy_CfnOriginEndpoint) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "1a870d3d9763beb90a47db465450b7e2", "score": "0.56328416", "text": "func (c *jsiiProxy_CfnDeviceProfile) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "00a81c666c49a329a1fb8b8f804ee00e", "score": "0.5624251", "text": "func (c *jsiiProxy_CfnPartnerAccount) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "75fe09bc474375f0e064af8bdbc72d29", "score": "0.5623536", "text": "func (c *jsiiProxy_CfnGlobalNetwork) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "dad9b56ce34a72a8fc6cfb8c58f91ba1", "score": "0.5612245", "text": "func (c *jsiiProxy_CfnServiceProfile) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "d4d989cbad8a2674ba0ce83f85035d57", "score": "0.56055236", "text": "func overrideConfigWithEnv(config map[string]string) map[string]string {\n\tfor configKey, envVarName := range CONFIG_ENV_OVERRIDE_MAP {\n\t\tif envValue := os.Getenv(envVarName); len(envValue) > 0 {\n\t\t\tconfig[configKey] = envValue\n\t\t}\n\t}\n\treturn config\n}", "title": "" }, { "docid": "c6a564b6fb957b6f379ae870771bb4ae", "score": "0.55971813", "text": "func (c *jsiiProxy_CfnTaskSet) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "fc3cf17bbc3e0d77daffb40c622ac53f", "score": "0.55694926", "text": "func Overrides(env Environment, flags []string, config map[string]interface{}) map[string]interface{} {\n\tnumOverrides := len(env.overrides) + len(config)\n\tnumFlags := len(flags)\n\tif numFlags > 0 {\n\t\tnumOverrides += 1\n\t} else if numOverrides == 0 {\n\t\treturn nil\n\t}\n\toverrides := make(map[string]interface{}, numOverrides)\n\t// Handle environment specific overrides.\n\tfor k, v := range env.overrides {\n\t\toverrides[k] = v\n\t}\n\t// Handle feature flags.\n\tif numFlags != 0 {\n\t\tfs := make(map[string]bool, numFlags)\n\t\tfor _, flag := range flags {\n\t\t\tfs[flag] = true\n\t\t}\n\t\toverrides[\"flags\"] = fs\n\t}\n\t// Handle provided configuration options.\n\tfor k, v := range config {\n\t\toverrides[k] = v\n\t}\n\treturn overrides\n}", "title": "" }, { "docid": "f9d5ee0567294477488d8c71d192e105", "score": "0.556354", "text": "func (c *jsiiProxy_CfnTaskDefinition) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "f9d5ee0567294477488d8c71d192e105", "score": "0.556354", "text": "func (c *jsiiProxy_CfnTaskDefinition) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "78c236d33b429e0838528a2071185ebe", "score": "0.5545922", "text": "func (c *jsiiProxy_CfnWirelessGateway) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "f4385e2ceaafa2e0adbf879f2ad4e116", "score": "0.5541708", "text": "func (b *ZArgsBuilder) Set(key, value interface{}) {\n\tb.Args[b.parent.argsMap[key]] = value\n}", "title": "" }, { "docid": "2bb3cbb8839a4e33fc37bdb74090c655", "score": "0.55311215", "text": "func Add(key, value string) {\n\n\tif os.Getenv(key) == \"\" {\n\t\tvars[key] = value\n\t\tfmt.Printf(\"Set Environment Variable (Default): %s = %s\\n\", key, value)\n\t\treturn\n\t}\n\n\tvars[key] = os.Getenv(key)\n\tfmt.Printf(\"Set Environment Variable: %s = %s\\n\", key, vars[key])\n\n}", "title": "" }, { "docid": "8b1b65198ee7cea916ae7a1ae87c8966", "score": "0.5518937", "text": "func (c *jsiiProxy_CfnAsset) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "7b1fea8d76a11b976f1fc48fe360d01e", "score": "0.55182624", "text": "func (v *Version) overrideWith(other Version) {\n\tv.Enabled = gosettings.OverrideWithPointer(v.Enabled, other.Enabled)\n}", "title": "" }, { "docid": "e4a4025dcf8e6e0c7d676ecfe9d80f10", "score": "0.55162567", "text": "func Set(key, val string) {\n\tenvy.Set(key, val)\n}", "title": "" }, { "docid": "f9fa3eb97ece542075ea7a8f712c2cde", "score": "0.5512646", "text": "func (c *jsiiProxy_CfnTransitGatewayRegistration) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "b0a09c4045a430a5944b8fbe54fa5cff", "score": "0.550366", "text": "func (e *EnvVariable) Update(value interface{}) {\n\n\tswitch value.(type) {\n\tcase bool:\n\t\te.val = strconv.FormatBool(value.(bool))\n\tcase float64:\n\t\te.val = strconv.FormatFloat(value.(float64), 'f', -1, 64)\n\tcase int:\n\t\te.val = strconv.FormatInt(int64(value.(int)), 10)\n\tcase string:\n\t\te.val = value.(string)\n\t}\n\n\te.isDefined = true\n\tos.Setenv(e.key, e.val)\n}", "title": "" }, { "docid": "699b9fa23ee6f8c498f0740f0d71d101", "score": "0.5496116", "text": "func (c *jsiiProxy_CfnResource) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "bfbc220919438f17a6efd7c768bb3b9a", "score": "0.5449146", "text": "func (c *jsiiProxy_CfnCustomerGatewayAssociation) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c1c69a21c7d03931dd56209744a07364", "score": "0.54078406", "text": "func (c *jsiiProxy_CfnEnvironment) AddDeletionOverride(path *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addDeletionOverride\",\n\t\t[]interface{}{path},\n\t)\n}", "title": "" }, { "docid": "8f80610a96373ce0f4575393f04a5b6a", "score": "0.540602", "text": "func (c *jsiiProxy_CfnPrimaryTaskSet) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "7200f344b63e6f95033e977a291726a9", "score": "0.5381486", "text": "func (carrier *envVarCarrier) Set(key, val string) {\n\tvar newCarrier []string\n\tkeyUpper := strings.ToUpper(key)\n\tctxKey := escape(environmentKeyPrefix + keyUpper)\n\tif carrier != nil {\n\t\tfor _, item := range *carrier {\n\t\t\tif strings.Index(item, ctxKey) < 0 {\n\t\t\t\tnewCarrier = append(newCarrier, item)\n\t\t\t}\n\t\t}\n\t}\n\tnewCarrier = append(newCarrier, fmt.Sprintf(\"%s=%s\", ctxKey, val))\n\t*carrier = newCarrier\n}", "title": "" }, { "docid": "3aaf1caf43cc24e98799f5b5486814b6", "score": "0.53803635", "text": "func OverrideSettings(settings map[string]interface{}) {\n\tfor k, v := range settings {\n\t\tviper.Set(k, v)\n\t}\n}", "title": "" }, { "docid": "9c2aebbe1f0f6dfc6d47192fe5557e73", "score": "0.5375408", "text": "func (s *DBTestSuite) OverrideConfig(envVar string, value string) {\n\ts.savedConfigVars[envVar] = os.Getenv(envVar)\n\n\tos.Setenv(envVar, value)\n\n\tconfig, err := config.GetConfigurationData()\n\trequire.NoError(s.T(), err)\n\ts.Configuration = config\n}", "title": "" }, { "docid": "5affb377bdb1947c91e73b3f103221fc", "score": "0.53720933", "text": "func (e Environment) Append(name, value, delim string) {\n\te[name+\".append\"] = value\n\n\tdelete(e, name+\".delim\")\n\tif delim != \"\" {\n\t\te[name+\".delim\"] = delim\n\t}\n}", "title": "" }, { "docid": "c0868396d99af61ef8f22aca81f813fc", "score": "0.53425556", "text": "func OverrideParameterWithSystemDefault(execSpec util.ExecutionSpec) error {\n\t// Patch the default value to workflow spec.\n\tif common.GetBoolConfigWithDefault(common.HasDefaultBucketEnvVar, false) {\n\t\tparams := execSpec.SpecParameters()\n\t\tpatched := make(util.SpecParameters, 0, len(params))\n\t\tfor _, currentParam := range params {\n\t\t\tif currentParam.Value != nil {\n\t\t\t\tdesiredValue, err := common.PatchPipelineDefaultParameter(*currentParam.Value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to patch default value to pipeline. Error: %v\", err)\n\t\t\t\t}\n\t\t\t\tpatched = append(patched, util.SpecParameter{Name: currentParam.Name, Value: &desiredValue})\n\t\t\t} else if currentParam.Default != nil {\n\t\t\t\tdesiredValue, err := common.PatchPipelineDefaultParameter(*currentParam.Default)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to patch default value to pipeline. Error: %v\", err)\n\t\t\t\t}\n\t\t\t\tpatched = append(patched, util.SpecParameter{Name: currentParam.Name, Default: &desiredValue})\n\t\t\t}\n\t\t}\n\t\texecSpec.SetSpecParameters(patched)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d1c9ac51c6cd16478bba22ff52ab6d0e", "score": "0.5337188", "text": "func (src Source) Set(ctx context.Context, key Key, value Value) (err error) {\n\tif err = os.Setenv(string(key), string(value)); err != nil {\n\t\treturn\n\t}\n\n\terr = src.SourceImpl.Set(ctx, key, value)\n\treturn\n}", "title": "" }, { "docid": "0e65633bbf05661e96cf5a4687757f14", "score": "0.5335524", "text": "func setEnv(cmd *exec.Cmd, key, value string) {\n\tkv := key + \"=\" + value\n\tif cmd.Env == nil {\n\t\tcmd.Env = os.Environ()\n\t}\n\n\tprefix := kv[:len(key)+1]\n\tfor i, entry := range cmd.Env {\n\t\tif strings.HasPrefix(entry, prefix) {\n\t\t\tcmd.Env[i] = kv\n\t\t\treturn\n\t\t}\n\t}\n\n\tcmd.Env = append(cmd.Env, kv)\n}", "title": "" }, { "docid": "55c554cdf2fedcdf37e965a772c75ab9", "score": "0.5322866", "text": "func WithHostOverride(value string) options.Opt {\r\n\treturn func(p options.Params) {\r\n\t\tif setter, ok := p.(hostOverrideSetter); ok {\r\n\t\t\tsetter.SetHostOverride(value)\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "b6b84e76baae41ef67f788f2acb15819", "score": "0.52953064", "text": "func NewCfnEnvironment_Override(c CfnEnvironment, scope awscdk.Construct, id *string, props *CfnEnvironmentProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_elasticbeanstalk.CfnEnvironment\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "title": "" }, { "docid": "4fbf5d9517cec0665a06adb6d7abce00", "score": "0.52480394", "text": "func Set(key string, value interface {}) {\n\tviper.Set(key, value)\n}", "title": "" }, { "docid": "2b1323732b25877f2357f3a5816f065c", "score": "0.5247202", "text": "func (t *StringsChaincode) overwrite(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tstub.PutState(args[0], []byte(args[1]))\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "0dd65cd0e8177baf54c1f74048456607", "score": "0.52469254", "text": "func (c *jsiiProxy_CfnPermissions) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "c9d5c1af53b07db858d34135c7e4526e", "score": "0.5223574", "text": "func (c *jsiiProxy_CfnApplicationVersion) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "1a618c49c789cc2b507e2d5dc40d99b0", "score": "0.52205455", "text": "func (c *jsiiProxy_CfnSubnetGroup) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "f318a37b3bf135327ec4b985a50d90ad", "score": "0.521777", "text": "func (u *Updater) overrideWith(other Updater) {\n\tu.Period = gosettings.OverrideWithPointer(u.Period, other.Period)\n\tu.DNSAddress = gosettings.OverrideWithString(u.DNSAddress, other.DNSAddress)\n\tu.MinRatio = gosettings.OverrideWithNumber(u.MinRatio, other.MinRatio)\n\tu.Providers = gosettings.OverrideWithSlice(u.Providers, other.Providers)\n}", "title": "" }, { "docid": "f450f91d73ca2f4c49dce4a0a4250ae0", "score": "0.5213333", "text": "func Override(implementation Implementation) func() {\n\toverridden.Lock()\n\timpl.Store(implValue{implementation})\n\treturn func() {\n\t\timpl.Store(implValue{Default{}})\n\t\toverridden.Unlock()\n\t}\n}", "title": "" }, { "docid": "d3c7fc83bec5d9d51a3554d684f4c744", "score": "0.5180968", "text": "func (ep *EnvPatcher) Install() Patcher {\n\t// Be idempotent\n\tif ep.applied {\n\t\treturn ep\n\t}\n\n\t// Save the current value of the environment variable\n\tif value, ok := lookupenv(ep.name); ok {\n\t\tep.original = &value\n\t} else {\n\t\tep.original = nil\n\t}\n\n\t// Set the environment variable to the desired value\n\tsetEnv(ep.name, ep.value)\n\tep.applied = true\n\n\treturn ep\n}", "title": "" }, { "docid": "bcbc84b504bf093a33c1ead585d5ac03", "score": "0.51788896", "text": "func (scope *Scope) SetExtra(key string, value interface{}) {\n\tscope.mu.Lock()\n\tdefer scope.mu.Unlock()\n\n\tscope.extra[key] = value\n}", "title": "" }, { "docid": "c4f86879bed1415d406dbc6427b78119", "score": "0.5175659", "text": "func (c *jsiiProxy_CfnDestination) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "cd31bf2bc457f1d5366e65fd005b2e43", "score": "0.51746446", "text": "func setDefault(key string, value interface{}) {\n\tglobalViper.SetDefault(key, value)\n}", "title": "" }, { "docid": "93454ea1826f3f52c574b9fae67e9c30", "score": "0.5156663", "text": "func Set(key string, value interface{}) {\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\tviper.Set(key, value)\n}", "title": "" }, { "docid": "db50ffeac2dd95ce206f6be2d996826b", "score": "0.5130999", "text": "func (e Environment) Prepend(name, value, delim string) {\n\te[name+\".prepend\"] = value\n\n\tdelete(e, name+\".delim\")\n\tif delim != \"\" {\n\t\te[name+\".delim\"] = delim\n\t}\n}", "title": "" }, { "docid": "fd1effe66aeae489906ca6d07f142a19", "score": "0.51255316", "text": "func (c *jsiiProxy_CfnLink) AddPropertyOverride(propertyPath *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyOverride\",\n\t\t[]interface{}{propertyPath, value},\n\t)\n}", "title": "" }, { "docid": "0d58d81069f50369c2cdd4fee811745f", "score": "0.51233053", "text": "func TestOverriddenValues(t *testing.T) {\n\tgodotenv.Load(\".env.test\")\n\tc := config.Load()\n\tassertEqual(t, \"localhost:7000\", c.RedisAddress, \"Overriden RedisURL mismatch\")\n\tassertEqual(t, \"foo\", c.RedisPassword, \"Overriden RedisPassword mismatch\")\n\tassertEqual(t, int64(1), c.RedisDatabase, \"Overriden RedisDb mismatch\")\n\tassertEqual(t, \"mayday\", c.HeartbeatChannel, \"Overriden Heartbeat channel mismatch\")\n\tassertEqual(t, int64(10), c.HeartbeatInterval, \"Overriden Heartbeat interval mismatch\")\n}", "title": "" }, { "docid": "b9762ddfdfc0d3aa6ead8ea4c16243a3", "score": "0.51160693", "text": "func (c *jsiiProxy_CfnApplication) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "dd48f94aee98c25134496a09214debc0", "score": "0.51087654", "text": "func (e *env) Define(name string, value Value) {\n\te.env[name] = value\n}", "title": "" }, { "docid": "5cecb393224b87beaf092def16dbe47e", "score": "0.5097881", "text": "func mergeOverride(override *model.Override, side string, param string, newRule model.Override) {\n\tupdated := false\n\tfor _, c := range override.Configs {\n\t\tif c.Side == side && c.Parameters[param] != \"\" {\n\t\t\tc.Parameters[param] = newRule.Configs[0].Parameters[param]\n\t\t\tc.Enabled = newRule.Enabled\n\t\t\tupdated = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !updated {\n\t\toverride.Configs = append(override.Configs, newRule.Configs[0])\n\t}\n\n\toverride.Enabled = newRule.Enabled\n}", "title": "" }, { "docid": "043b0d853b24723e5ebf96173cfdc74a", "score": "0.5092309", "text": "func (a *ApplicationEnvironmentVariableApiService) CreateApplicationEnvironmentVariableOverrideExecute(r ApiCreateApplicationEnvironmentVariableOverrideRequest) (EnvironmentVariableResponse, *_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 EnvironmentVariableResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApplicationEnvironmentVariableApiService.CreateApplicationEnvironmentVariableOverride\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/application/{applicationId}/environmentVariable/{environmentVariableId}/override\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"applicationId\"+\"}\", _neturl.PathEscape(parameterToString(r.applicationId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"environmentVariableId\"+\"}\", _neturl.PathEscape(parameterToString(r.environmentVariableId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.value\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "85735bbbcf122d992627ec2259c80e13", "score": "0.5082689", "text": "func addEnvToJob(data *baseProwJobTemplateData, key, value string) {\n\t// Value should always be string. Add quotes if we get a number\n\tif isNum(value) {\n\t\tvalue = \"\\\"\" + value + \"\\\"\"\n\t}\n\n\t(*data).Env = append((*data).Env, []string{\"- name: \" + key, \" value: \" + value}...)\n}", "title": "" }, { "docid": "fc02767cd377410b398e8661d849faeb", "score": "0.50808936", "text": "func (c *ControlServer) overrideWith(other ControlServer) {\n\tc.Address = gosettings.OverrideWithPointer(c.Address, other.Address)\n\tc.Log = gosettings.OverrideWithPointer(c.Log, other.Log)\n}", "title": "" }, { "docid": "a48a0f7cf712e9bfbc0eee37435b6cca", "score": "0.5078275", "text": "func (r *Environment) Customize(from Component, with *Environment) error {\n\n\t// We don't want to customize the templates defined into the environment\n\t// But instead we want to keep them into the component\n\tr.Platform().KeepTemplates(from, with.ekara.Templates)\n\twith.ekara.Templates = Patterns{}\n\n\t// basic informations (name, qualifier, description) are only accepted once if the are not already defined\n\tif r.Name == \"\" {\n\t\tr.Name = with.Name\n\t}\n\n\tif r.Qualifier == \"\" {\n\t\tr.Qualifier = with.Qualifier\n\t}\n\n\tif r.Description == \"\" {\n\t\tr.Description = with.Description\n\t}\n\n\tif err := r.Orchestrator.customize(with.Orchestrator); err != nil {\n\t\treturn err\n\t}\n\n\tprs, err := r.Providers.customize(r, with.Providers)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.Providers = prs\n\n\tnds, err := r.NodeSets.customize(r, with.NodeSets)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.NodeSets = nds\n\n\tsts, err := r.Stacks.customize(r, with.Stacks)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.Stacks = sts\n\n\ttas, err := r.Tasks.customize(r, with.Tasks)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.Tasks = tas\n\n\tr.Vars = r.Vars.inherit(with.Vars)\n\n\terr = r.Hooks.customize(with.Hooks)\n\n\tl, err := lines(*r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.parcels = append(r.parcels, Parcel{ID: from.Id, Lines: l})\n\n\treturn err\n}", "title": "" }, { "docid": "eab68b7aa40515654521cd9221af6363", "score": "0.507657", "text": "func (c *jsiiProxy_CfnDataLakeSettings) AddPropertyDeletionOverride(propertyPath *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addPropertyDeletionOverride\",\n\t\t[]interface{}{propertyPath},\n\t)\n}", "title": "" }, { "docid": "0f5ab52f08e00964502800236a54d7d0", "score": "0.5076417", "text": "func (p *pointer) overrideValue(newValue []byte) []byte {\n\toldValue := p.value.([]byte)\n\tp.value = newValue\n\n\treturn oldValue\n}", "title": "" }, { "docid": "f0ddd96dff022b57083ea85efccfac6a", "score": "0.50749594", "text": "func TestEnvOverride(t *testing.T) {\n\tvar cs fdc.Config\n\tvar rc bool\n\tvar msg string\n\tcc := []byte(config)\n\tyaml.Unmarshal(cc, &cs)\n\tchkConfig(&cs)\n\tos.Setenv(\"TEST_COUCHBASE_PWD\", \"testpwd\")\n\tcs.CouchDb.Pwd = os.Getenv(\"TEST_COUCHBASE_PWD\")\n\trc, msg = chkConfig(&cs)\n\tif rc == true {\n\t\tt.Errorf(\"Should be false but got true %s\", msg)\n\t} else {\n\t\tos.Setenv(\"TEST_COUCHBASE_PWD\", \"testpw\")\n\t\tcs.CouchDb.Pwd = os.Getenv(\"TEST_COUCHBASE_PWD\")\n\t\trc, msg = chkConfig(&cs)\n\t}\n\tif rc == false {\n\t\tt.Errorf(msg)\n\t}\n\tos.Setenv(\"BFPD_PW_TEST\", \"\")\n}", "title": "" }, { "docid": "567edfcf8f3722b36d78674bb0375bac", "score": "0.50716186", "text": "func OverrideDefault(newhost string) {\n\thostnameOverride = newhost\n}", "title": "" }, { "docid": "4f40c9da4a750e188ba21a2b7f477109", "score": "0.50701165", "text": "func (values *ConfigScopedValues) Set(key string, source ConfigScopedValue) {\n\tvalues.safe()\n\n\tif _, found := values.configMap[key]; !found {\n\t\tvalues.order = append(values.order, key)\n\t}\n\tvalues.configMap[key] = source\n}", "title": "" }, { "docid": "26f91af80932e018cfba8b1e7d7a63fd", "score": "0.50683194", "text": "func (e *environment) Define(sym Symbol, val interface{}) {\n\tif e.writable {\n\t\titem := newEnvItem(sym, val)\n\t\te.vars.ReplaceOrInsert(item)\n\t}\n}", "title": "" } ]
bb4441970a03bbebd12fbd83bdcaef66
Encrypts the write key for a KeyData entry.
[ { "docid": "aff0a2b42dd2ced75758a699b51a6192", "score": "0.66809267", "text": "func encryptWriteKey(plain []byte, key SymmetricKey, s Suite) (enc []byte, err error) {\n\tvar block cipher.Block\n\tblock, err = s.blockCipher(key)\n\tif err != nil {\n\t\treturn\n\t}\n\t// Zeroed IV\n\tiv := make([]byte, block.BlockSize())\n\tstream := cipher.NewCTR(block, iv)\n\n\tenc = make([]byte, len(plain))\n\tstream.XORKeyStream(enc, plain)\n\treturn\n}", "title": "" } ]
[ { "docid": "2a8616f53e0ec648ba20e40e3eb4bd9e", "score": "0.6169644", "text": "func encryptKey(key *Key, password []byte, scryptN, scryptP int) ([]byte, error) {\n\tkeyBytes, err := json.Marshal(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcryptoStruct, err := encryptData(keyBytes, password, scryptN, scryptP)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tencryptedKey := encryptedKey{\n\t\thex.EncodeToString([]byte(key.Address.String())),\n\t\tcryptoStruct,\n\t\tkey.ID.String(),\n\t\tversion,\n\t}\n\treturn json.Marshal(encryptedKey)\n}", "title": "" }, { "docid": "9620f31a20812fbd91e9135073c59552", "score": "0.59760994", "text": "func (i *ibmKpK8sSecret) Encrypt(\n\tsecretID string,\n\tplaintTextData string,\n\tkeyContext map[string]string,\n) (string, error) {\n\treturn i.ibmKp.Encrypt(secretID, plaintTextData, keyContext)\n}", "title": "" }, { "docid": "6159fdeb62f2974fe2308009ee163a39", "score": "0.5903966", "text": "func (security) Encrypt(w io.Writer, data []byte) (int, error) {\n\treturn w.Write(data)\n}", "title": "" }, { "docid": "f966abc0ad0bce84328956a896b4e3c1", "score": "0.58762884", "text": "func (d *KeyData) WriteAtomic(w KeyDataWriter) error {\n\tenc := json.NewEncoder(w)\n\tif err := enc.Encode(d.data); err != nil {\n\t\treturn xerrors.Errorf(\"cannot encode keydata: %w\", err)\n\t}\n\n\tif err := w.Commit(); err != nil {\n\t\treturn xerrors.Errorf(\"cannot commit keydata: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b42e0e26e0923734683a6603e94dd88a", "score": "0.58736503", "text": "func EncryptKey(k *openpgp.Entity, pass string) error {\n\tif k.PrivateKey.Encrypted {\n\t\treturn fmt.Errorf(\"key already encrypted\")\n\t}\n\treturn k.PrivateKey.Encrypt([]byte(pass))\n}", "title": "" }, { "docid": "fe36a4380e5d0e1eef262a8908e82143", "score": "0.58306235", "text": "func (crypter *Crypter) Encrypt(key string, data []byte) ([]byte, error) {\n\thashKey := normalize(key)\n\n\tblock, err := aes.NewCipher(hashKey)\n\tif err != nil {\n\t\treturn nil, errors.New(\"could not set up cipher\")\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, errors.New(\"could not set up gcm\")\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, errors.New(\"could not set up nonce\")\n\t}\n\n\tciphertext := gcm.Seal(nonce, nonce, data, nil)\n\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "ef34671cf324a32eaeeddcf66be8cd82", "score": "0.58116764", "text": "func (k *keeper) Encrypt(ctx context.Context, plaintext []byte) ([]byte, error) {\n\tsecret, err := k.client.Logical().Write(\n\t\tpath.Join(\"transit/encrypt\", k.keyID),\n\t\tmap[string]interface{}{\n\t\t\t\"plaintext\": plaintext,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn []byte(secret.Data[\"ciphertext\"].(string)), nil\n}", "title": "" }, { "docid": "ad3b17fbf1c812faba568dd2ab3d679f", "score": "0.57808256", "text": "func KeyEncrypt(privKey *HDPrivateKey, passphrase string) (string, error) {\n\tciphertext, err := keycrypt.Encrypt(&privKey.key, privKey.Path, passphrase)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"KeyEncrypt: failed to encrypt: %w\", err)\n\t}\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "5d8e0b0c76f85d1e9f7c39e7f6885fa3", "score": "0.57674927", "text": "func Encrypt(data *[]byte, pubKey, privKey *Key) ([]byte, error) {\n\tnonce, err := newNonce()\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tout := make([]byte, 24)\n\tcopy(out, nonce[:])\n\tout = box.Seal(out, *data, nonce, &pubKey.Raw, &privKey.Raw)\n\treturn out, nil\n}", "title": "" }, { "docid": "be17982d786f62a151be668b44299e1f", "score": "0.573425", "text": "func (repo *InfraRepository) EncryptInfraData(\n\tinfra *models.Infra,\n\tkey *[32]byte,\n) error {\n\tif len(infra.LastApplied) > 0 {\n\t\tcipherData, err := encryption.Encrypt(infra.LastApplied, key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tinfra.LastApplied = cipherData\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6d1e557ea141d504c604fd9c395d1f5f", "score": "0.57183266", "text": "func (dek *DataEncryptionKey) Encrypt(plaintext []byte) []byte {\n\treturn Encrypt(dek.cipher, plaintext, nil)\n}", "title": "" }, { "docid": "7c9b975102fe1d666c6670d610da8a8a", "score": "0.5644153", "text": "func Encrypt(plain []byte, key SymmetricKey, s Suite) (rootIdx int, priv []PrivateShard, err error) {\n\tr := raw{content: plain}\n\treturn encrypt(r, key, s)\n}", "title": "" }, { "docid": "51e48cf9163143de51d3ef35b9186353", "score": "0.5623471", "text": "func (c *kesClient) EncryptKey(keyID string, plaintext []byte, ctx Context) ([]byte, error) {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\n\tctxBytes, err := ctx.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.enclave.Encrypt(context.Background(), keyID, plaintext, ctxBytes)\n}", "title": "" }, { "docid": "927eb0e64ca91c8627e7312a62a52ad2", "score": "0.5605345", "text": "func (c *AesCipher) Encrypt(data []byte, key []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gcm.Seal(nonce, nonce, data, nil), nil\n}", "title": "" }, { "docid": "cfb7ba1583469ba2b420f2c9967697a5", "score": "0.5605062", "text": "func (c *APIClient) Encrypt(ctx context.Context, key string, context, data []byte) (string, error) {\n\treturn c.Transit.Encrypt(ctx, key, context, data)\n}", "title": "" }, { "docid": "b2d9c466cd55fe4bb850f584100a08f7", "score": "0.5572045", "text": "func (hs *handshaker) writeEncrypted(w io.Writer, data []byte, publicKey *ecdsa.PublicKey) error {\n\tdata, err := ecies.Encrypt(rand.Reader, ecies.ImportECDSAPublic(publicKey), data, nil, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error encrypting session key: %v\", err)\n\t}\n\tif err := write(w, data); err != nil {\n\t\treturn fmt.Errorf(\"error writing ecdsa.PublicKey signature to io.Writer: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7114e0f7287324d493cb01be6beee0fd", "score": "0.5559548", "text": "func Encrypt(key []byte, data []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Never use more than 2^32 random nonces with a given key because of the risk of a repeat.\n\tnonce := make([]byte, NonceLength)\n\tif _, err := io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Prefix sealed data with nonce for decryption - see below.\n\treturn append(nonce, gcm.Seal(nil, nonce, data, nil)...), nil\n}", "title": "" }, { "docid": "fcd9ce9eeecdb2f3f117bd356d3111f0", "score": "0.55574155", "text": "func (t *StackedHost) Encrypt(data []byte) (encrypted []byte, err error) {\n\tif t.keys == nil || t.keys.CryptingKey == nil {\n\t\t// TODO(tmroeder) (from TODO(kwalsh) in tao_stacked_host.cc):\n\t\t// where should the policy come from here?\n\t\treturn t.hostTao.Seal(data, SealPolicyDefault)\n\t}\n\n\treturn t.keys.CryptingKey.Encrypt(data)\n}", "title": "" }, { "docid": "2e46c8394f19325ae5a5100c8749a12c", "score": "0.55508476", "text": "func EncryptData(data, key []byte) ([]byte, error) {\n\t// Creates cipher and Galois/Counter mode object for sym key crypto block ciphers.\n\tgcm, err := genGCM(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create a random nonce.\n\tnonce := make([]byte, gcm.NonceSize())\n\t_, err = io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Encrypt using Seal.\n\treturn gcm.Seal(nonce, nonce, data, nil), nil\n}", "title": "" }, { "docid": "bbd358cf3bd371a23ff96e0ade0f2ea8", "score": "0.55493504", "text": "func Encrypt(key interface{}, message []byte) ([]byte, error) {\n switch key.(type) {\n\tcase *rsa.PublicKey:\n\t return encryptRsa(key.(*rsa.PublicKey), message)\n\tcase *ecdsa.PublicKey:\n\tcase ed25519.PublicKey:\n\t return nil, errors.New(\"This key type is not usable for encryption\")\n\t}\n\n\treturn nil, errors.New(\"Unknown key type for signing\")\n}", "title": "" }, { "docid": "2f7db85edcdd7381aba22d1d4a7eb069", "score": "0.5537789", "text": "func (kc *keyCrypter) Encrypt(plaintext []uint8) (string, error) {\n\tkey := kc.kz.getPrimaryKey()\n\tencryptKey := key.(encryptKey)\n\tcompressedPlaintext := kc.compress(plaintext)\n\tciphertext, err := encryptKey.Encrypt(compressedPlaintext)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\ts := kc.encode(ciphertext)\n\treturn s, nil\n}", "title": "" }, { "docid": "f52c52502e6e0175d954d1327bee9990", "score": "0.5536023", "text": "func (s *AESEncryptedStorage) Put(key, value string) {\n\tif len(key) == 0 {\n\t\treturn\n\t}\n\tdata, err := s.readEncryptedStorage()\n\tif err != nil {\n\t\tlog.Warn(\"Failed to read encrypted storage\", \"err\", err, \"file\", s.filename)\n\t\treturn\n\t}\n\tciphertext, iv, err := encrypt(s.key, []byte(value), []byte(key))\n\tif err != nil {\n\t\tlog.Warn(\"Failed to encrypt entry\", \"err\", err)\n\t\treturn\n\t}\n\tencrypted := storedCredential{Iv: iv, CipherText: ciphertext}\n\tdata[key] = encrypted\n\tif err = s.writeEncryptedStorage(data); err != nil {\n\t\tlog.Warn(\"Failed to write entry\", \"err\", err)\n\t}\n}", "title": "" }, { "docid": "097483fa784fd086345ef9c7900d2355", "score": "0.55240744", "text": "func writeKey(filename, pathFormat string, data []byte) error {\n\tdst := make([]byte, hex.EncodedLen(len(data))) //StdEncoding.EncodedLen(len(data)))\n\thex.Encode(dst, data) // StdEncoding.Encode(dst, data)\n\tfilePath := fmt.Sprintf(pathFormat, filename)\n\treturn writeFile(filePath, dst)\n}", "title": "" }, { "docid": "186e90fe3ac4202118ab068d577c953a", "score": "0.5509375", "text": "func (ks Server) Encrypt(ctx context.Context,\n\treq *keyservice.EncryptRequest) (*keyservice.EncryptResponse, error) {\n\tkey := req.Key\n\tvar response *keyservice.EncryptResponse\n\tswitch k := key.KeyType.(type) {\n\tcase *keyservice.Key_PgpKey:\n\t\tciphertext, err := ks.encryptWithPgp(k.PgpKey, req.Plaintext)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse = &keyservice.EncryptResponse{\n\t\t\tCiphertext: ciphertext,\n\t\t}\n\tcase *keyservice.Key_AgeKey:\n\t\tciphertext, err := ks.encryptWithAge(k.AgeKey, req.Plaintext)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse = &keyservice.EncryptResponse{\n\t\t\tCiphertext: ciphertext,\n\t\t}\n\tdefault:\n\t\treturn ks.Encrypt(ctx, req)\n\t}\n\tif ks.Prompt {\n\t\terr := ks.prompt(key, \"encrypt\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "0a1e65c60e627aebcbfbfadc6d422ed1", "score": "0.5509281", "text": "func Encrypt(key, data []byte) ([]byte, error) {\n\tvar nonce [NonceLen]byte\n\n\t_, err := rand.Read(nonce[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taesgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tencrypted := aesgcm.Seal(nil, nonce[:], data, nil)\n\n\treturn append(nonce[:], encrypted...), nil\n}", "title": "" }, { "docid": "630b5ddae81fce15a08680c78087ee05", "score": "0.5492231", "text": "func writeKey(file string, data []byte) error {\n\tb := &pem.Block{\n\t\tType: \"EC PRIVATE KEY\",\n\t\tBytes: data,\n\t}\n\n\treturn os.WriteFile(file, pem.EncodeToMemory(b), keyFileMode)\n}", "title": "" }, { "docid": "f10894732e0952cc69d90615d09a1888", "score": "0.5487573", "text": "func (a *AESGCMCipher) Encrypt(data []byte, key Key) ([]byte, error) {\n\taesKey, ok := key.(*AESKey)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"key must be of *AESKey, but was %T\", key)\n\t}\n\n\tgcm, err := newBlockCipher(aesKey, a.nonceSizeBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// generate random nonce/IV\n\tnonce, err := RandomBytes(gcm.NonceSize())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to generate nonce: %v\", err)\n\t}\n\n\tencrypted := gcm.Seal(nil, nonce, data, nil)\n\n\treturn append(nonce, encrypted...), nil\n}", "title": "" }, { "docid": "98476d74e101d8297a871edd4d840405", "score": "0.5466552", "text": "func encrypt(data []byte, pubkey *[32]byte) (wrappedKey []byte, ciphertext []byte, err error) {\n\tkey := make([]byte, 16)\n\tif _, err := io.ReadFull(rand.Reader, key); err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"Error reading random for key\")\n\t}\n\taesgcm, err := aesgcm(key)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tnonce := make([]byte, aesgcm.NonceSize())\n\tif _, err := io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"Error reading random for nonce\")\n\t}\n\n\twrapped, err := wrap(pubkey, key)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Seal appends to the first parameter, so we append ciphertext to the nonce\n\treturn wrapped, aesgcm.Seal(nonce, nonce, data, nil), nil\n}", "title": "" }, { "docid": "cdf3bbd546c771853639e70a7eeb0e93", "score": "0.5447296", "text": "func Encrypt(key string, w io.Writer) (*cipher.StreamWriter, error) {\n\tiv := make([]byte, aes.BlockSize)\n\t_, err := io.ReadFull(rand.Reader, iv)\n\tstream, err := encryptStream(key, iv)\n\tn, err := w.Write(iv)\n\terr = checkIV(n, iv, err)\n\treturn &cipher.StreamWriter{S: stream, W: w}, err\n}", "title": "" }, { "docid": "286932b90347e0034619a41a60fe5337", "score": "0.54442275", "text": "func (this *XorKey) Encrypt(data []byte) []byte {\n\tencrypted := make([]byte, len(data))\n\tfor i := 0; i < len(encrypted); i++ {\n\t\tencrypted[i] = data[i] ^ this.Key[i%len(this.Key)]\n\t}\n\treturn encrypted\n}", "title": "" }, { "docid": "7fb11088ef4b905a5425bed260d5f8e6", "score": "0.54175514", "text": "func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error) {\n\tauthArray := []byte(auth)\n\tsalt := randentropy.GetEntropyCSPRNG(32)\n\tderivedKey, err := scrypt.Key(authArray, salt, scryptN, scryptR, scryptP, scryptDKLen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tencryptKey := derivedKey[:16]\n\tkeyBytes := math.PaddedBigBytes(key.PrivateKey.D, 32)\n\n\tiv := randentropy.GetEntropyCSPRNG(aes.BlockSize) // 16\n\tcipherText, err := aesCTRXOR(encryptKey, keyBytes, iv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmac := crypto.Keccak256(derivedKey[16:32], cipherText)\n\n\tscryptParamsJSON := make(map[string]interface{}, 5)\n\tscryptParamsJSON[\"n\"] = scryptN\n\tscryptParamsJSON[\"r\"] = scryptR\n\tscryptParamsJSON[\"p\"] = scryptP\n\tscryptParamsJSON[\"dklen\"] = scryptDKLen\n\tscryptParamsJSON[\"salt\"] = hex.EncodeToString(salt)\n\n\tcipherParamsJSON := cipherparamsJSON{\n\t\tIV: hex.EncodeToString(iv),\n\t}\n\n\tcryptoStruct := cryptoJSON{\n\t\tCipher: \"aes-128-ctr\",\n\t\tCipherText: hex.EncodeToString(cipherText),\n\t\tCipherParams: cipherParamsJSON,\n\t\tKDF: keyHeaderKDF,\n\t\tKDFParams: scryptParamsJSON,\n\t\tMAC: hex.EncodeToString(mac),\n\t}\n\tencryptedKeyJSONV3 := encryptedKeyJSONV3{\n\t\thex.EncodeToString(key.Address[:]),\n\t\tcryptoStruct,\n\t\t// key.Id.String(),\n\t\tversion,\n\t}\n\treturn json.Marshal(encryptedKeyJSONV3)\n}", "title": "" }, { "docid": "4640eeb61ac7368615b1f7e2f7ed1f4e", "score": "0.5390241", "text": "func (_Accounts *AccountsTransactor) SetAccountDataEncryptionKey(opts *bind.TransactOpts, dataEncryptionKey []byte) (*types.Transaction, error) {\n\treturn _Accounts.contract.Transact(opts, \"setAccountDataEncryptionKey\", dataEncryptionKey)\n}", "title": "" }, { "docid": "7b191a42c0832e8490600c513e75cfe7", "score": "0.53839713", "text": "func encryptSymmetric(keyName string, plaintext []byte) ([]byte, error) {\n\tctx := context.Background()\n\tclient, err := cloudkms.NewKeyManagementClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Build the request.\n\treq := &kmspb.EncryptRequest{\n\t\tName: keyName,\n\t\tPlaintext: plaintext,\n\t}\n\t// Call the API.\n\tresp, err := client.Encrypt(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.Ciphertext, nil\n}", "title": "" }, { "docid": "6449eeb2541555065e03331c2a0099ef", "score": "0.5378653", "text": "func (serv OrchioWriteService) PutKey(data, name, key string) {\n datastore.TraceMsg(\"==> Orchio::PutKey:\")\n\n req := serv.Context.Request()\n response := updateResponse(serv.ResponseBuilder(), \"\")\n\n var responseCode int\n var msgCode string\n var ok bool\n if responseCode, msgCode, ok = checkContentType(req.Header, \"put\"); ok {\n responseCode, msgCode, ok = checkConditionalHeaders(req.Header, name, key)\n }\n\n if !ok {\n errorMsgBody := keyErrorMsgBody(responseCode, msgCode, name, key)\n completeTheResponse(response, responseCode, errorMsgBody)\n return\n }\n\n ref := datastore.PutKey(data, name, key)\n response.AddHeader(\"Location\", locationString(name, key, ref))\n response.AddHeader(\"Etag\", strconv.Quote(ref))\n completeTheResponse(response, 201, \"\")\n return\n}", "title": "" }, { "docid": "d4e442c15de20c2081090c0acb65188c", "score": "0.5374312", "text": "func (w *Wrapper) Set(ctx context.Context, key string, val string) error {\n\tvar err error\n\tvalue := []byte(val)\n\tif w.crypto != nil {\n\t\tvalue, err = w.crypto.Encrypt(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tw.kv.Put(ctx, key, string(value))\n\treturn nil\n}", "title": "" }, { "docid": "df60319b44c47ca826ab9a8373f433c2", "score": "0.5359399", "text": "func writeKeyToDisk(keyPath string, data []byte) error {\n\tif err := os.MkdirAll(filepath.Dir(keyPath), os.FileMode(0755)); err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(keyPath, data, os.FileMode(0600))\n}", "title": "" }, { "docid": "b08be3798261f1590a080b7670d74d36", "score": "0.5330846", "text": "func (v *PrimaryKey) Encode(sw stream.Writer) error {\n\tif err := sw.WriteStructBegin(); err != nil {\n\t\treturn err\n\t}\n\n\tif v.PartitionKeys != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TList}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := _List_String_Encode(v.PartitionKeys, sw); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif v.ClusteringKeys != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TList}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := _List_ClusteringKey_Encode(v.ClusteringKeys, sw); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn sw.WriteStructEnd()\n}", "title": "" }, { "docid": "1f01741ef2c08daec6c39e3694ad73ad", "score": "0.53177834", "text": "func (otp *OneTimePad) Encrypt(text string) (string, error) {\n\tif len(otp.key) < len(text) {\n\t\treturn \"\", errors.New(\"key must be at least as long as the plaintext\")\n\t}\n\tkeyChars := []rune(otp.key)\n\treturn mapAlpha(text, func(i, char int) int {\n\t\treturn char + alphaIndex(keyChars[i])\n\t}), nil\n}", "title": "" }, { "docid": "4d97716ed1b7e86c35285883def6cad5", "score": "0.53163975", "text": "func (v *ClusteringKey) Encode(sw stream.Writer) error {\n\tif err := sw.WriteStructBegin(); err != nil {\n\t\treturn err\n\t}\n\n\tif v.Name != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TBinary}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteString(*(v.Name)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif v.Asc != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TBool}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteBool(*(v.Asc)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn sw.WriteStructEnd()\n}", "title": "" }, { "docid": "d23fa6ce77f19f0e77ed8b3fb5375e11", "score": "0.5312499", "text": "func (m MockTransitClient) Encrypt(ctx context.Context, key string, context, data []byte) (string, error) {\n\treturn base64.StdEncoding.EncodeToString(data), nil\n}", "title": "" }, { "docid": "9a648d6515f0c1fc14f80fb804a3cb22", "score": "0.5310967", "text": "func (db *RocksDB) Write(key []byte, value []byte) error {\n\treturn db.db.Put(db.wopt, key, value)\n}", "title": "" }, { "docid": "025be845e2847cf3bb5134ed513785bb", "score": "0.52752364", "text": "func encryptWriter(wtr io.Writer, key []byte) (io.Writer, error) {\n\tb, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error: %w\", err)\n\t}\n\n\tstream := cipher.NewCTR(b, key)\n\n\treturn cipher.StreamWriter{\n\t\tS: stream,\n\t\tW: wtr,\n\t}, nil\n}", "title": "" }, { "docid": "aca355d0c7773910aa1e36baa19144df", "score": "0.52733153", "text": "func (k *Key) Encrypt(plaintext []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(k.raw[:32])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taesgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tciph := aesgcm.Seal(nil, k.raw[32:], plaintext, nil)\n\treturn ciph, nil\n}", "title": "" }, { "docid": "40f8b67b8ff60ce1df54dd7522a953a7", "score": "0.5271113", "text": "func (repo *InfraRepository) EncryptOperationData(\n\toperation *models.Operation,\n\tkey *[32]byte,\n) error {\n\tif len(operation.LastApplied) > 0 {\n\t\tcipherData, err := encryption.Encrypt(operation.LastApplied, key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\toperation.LastApplied = cipherData\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "608e52af6afe79e67a5c9d997c5d1987", "score": "0.5255443", "text": "func Encrypt(data []byte, passphrase string) ([]byte, error) {\n\t// create aes.NewCipher from hashed md5 passphrase\n\tblock, _ := aes.NewCipher([]byte(createHash(passphrase)))\n\t// NewGCM returns the given 128-bit, block cipher wrapped in\n\t// Galois Counter Mode with the standard nonce length.\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// initialize slice with length of nonce that must be passed to Seal and Open.\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Seal encrypts and authenticates plaintext, authenticates the\n\t// additional data and appends the result to dst, returning the updated\n\t// slice. The nonce must be NonceSize() bytes long and unique for all\n\t// time, for a given key.\n\tciphertext := gcm.Seal(nonce, nonce, data, nil)\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "0f70159ecd1356f9fd31afddbb896a31", "score": "0.52472353", "text": "func PKEncrypt(data sodium.Bytes, receiverPublicKey sodium.BoxPublicKey, senderPrivateKey sodium.BoxSecretKey) EncryptedData {\n\tvar ed EncryptedData\n\tnonce := sodium.BoxNonce{}\n\tsodium.Randomize(&nonce)\n\tnonce.Next()\n\ted.Content = string(data.Box(nonce, receiverPublicKey, senderPrivateKey))\n\ted.Nonce = string(nonce.Bytes)\n\treturn ed\n}", "title": "" }, { "docid": "e3bb1e7ddac601c8edd466deb8af16ab", "score": "0.52466387", "text": "func (m *Metadata) Encrypt(pubKey []byte) error {\n\t// Generate a random AES private key.\n\taesKey := make([]byte, 32)\n\tif _, err := rand.Read(aesKey); err != nil {\n\t\treturn fmt.Errorf(\"generate aes key: %v\", err)\n\t}\n\n\t// RSA encrypt the key with the client's pubkey for transit.\n\tcert, err := x509.ParsePKIXPublicKey(pubKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"decoding public key: %v\", err)\n\t}\n\n\tm.AESKey, err = rsa.EncryptOAEP(newHash(), rng, cert.(*rsa.PublicKey), aesKey, []byte(\"\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"encrypting aes key: %v\", err)\n\t}\n\n\t// AES encrypt the blob.\n\tblock, err := aes.NewCipher(aesKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"aes cipher: %v\", err)\n\t}\n\tm.Nonce = make([]byte, 12)\n\tif _, err := io.ReadFull(rng, m.Nonce); err != nil {\n\t\treturn fmt.Errorf(\"aes nonce: %v\", err)\n\t}\n\taesgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"aes gcm: %v\", err)\n\t}\n\tm.Data = aesgcm.Seal(nil, m.Nonce, m.Data, nil)\n\n\treturn nil\n}", "title": "" }, { "docid": "e33bf5c4bd5c38222574a912a956e5dc", "score": "0.52429396", "text": "func Encrypt(id string) (encrypted string) {\n\tkey := []byte(id)\n\tc := hmac.New(md5.New, key)\n\tencrypted = fmt.Sprintf(\"%x\", c.Sum(nil))\n\tlog.Println(\"Generating Key\", encrypted, \"for id\", id)\n\treturn\n}", "title": "" }, { "docid": "6a8a83a3a8c8af28a74fd97082d1e214", "score": "0.52341455", "text": "func (s *Store) Write(key interface{}, value []byte) error {\n\tif key == nil {\n\t\tkey = rand.Int63()\n\t}\n\tid := s.IDFunc(key)\n\tlog.Debug(\"Write\", \"id\", id, \"value\", string(value), \"V\", logV)\n\treturn ioutil.WriteFile(filepath.Join(s.Dir, string(id)), value, 0644)\n}", "title": "" }, { "docid": "f73aa8202e5e67de3186c8310b6c7246", "score": "0.52318126", "text": "func (h *Handler) Encrypt() (string, error) {\n\n\tec, err := h.ParseEncryptionContext()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\toutput, err := h.Service.Encrypt(&kms.EncryptInput{\n\t\tKeyId: &h.KeyID,\n\t\tEncryptionContext: ec,\n\t\tPlaintext: []byte(h.Plaintext),\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tciphertext := base64.StdEncoding.EncodeToString(output.CiphertextBlob)\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "ae7264d674b15bbb45d075f9aa0ca2d6", "score": "0.5228365", "text": "func (ks *FSKeystore) Put(name string, data []byte) error {\n\tif err := validateName(name); err != nil {\n\t\treturn err\n\t}\n\n\tkp := filepath.Join(ks.dir, name)\n\n\t_, err := os.Stat(kp)\n\tif err == nil {\n\t\treturn ErrKeyExists\n\t} else if !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\n\tfi, err := os.Create(kp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\t_ = fi.Close()\n\t}()\n\n\t_, err = fi.Write(data)\n\n\treturn err\n}", "title": "" }, { "docid": "cb3bbf0cb7a2e8fe131615fc480b728e", "score": "0.52259564", "text": "func EncryptWriter(key string, w io.Writer) (*cipher.StreamWriter, error) {\n\tiv := make([]byte, aes.BlockSize)\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\tstream, err := encryptStream(key, iv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tn, err := w.Write(iv)\n\tif n != len(iv) || err != nil {\n\t\treturn nil, errors.New(\"encrypt: unable to write full iv\")\n\t}\n\treturn &cipher.StreamWriter{S: stream, W: w}, nil\n}", "title": "" }, { "docid": "1e1ac62ac13b0442fc04d9f82cc9b210", "score": "0.5221126", "text": "func (cert *Certificate) Encrypt(data []byte) ([]byte, error) {\n\tswitch pub := cert.X509.PublicKey.(type) {\n\tcase *rsa.PublicKey:\n\t\treturn rsa.EncryptOAEP(sha256.New(), rand.Reader, pub, data, nil)\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported public key: %T\",\n\t\t\tcert.X509.PublicKey)\n\t}\n}", "title": "" }, { "docid": "4fd9f56e37e15b2c7e690c346bdb8a04", "score": "0.521826", "text": "func EncryptArmorPrivKey(privKey cryptotypes.PrivKey, passphrase string, header map[string]string) string {\n\tsaltBytes, encBytes := encryptPrivKey(privKey, passphrase)\n\tif header == nil {\n\t\theader = map[string]string{}\n\t}\n\theader[\"kdf\"] = \"bcrypt\"\n\theader[\"salt\"] = fmt.Sprintf(\"%X\", saltBytes)\n\treturn armor.EncodeArmor(blockTypePrivKey, header, encBytes)\n}", "title": "" }, { "docid": "bcba7775d9c15ed09b5e793286afc404", "score": "0.52036154", "text": "func EncryptWriter(key string, w io.Writer) (*cipher.StreamWriter, error) {\n\tiv := make([]byte, aes.BlockSize)\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\tstream, err := encryptStream(key, iv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tn, err := w.Write(iv)\n\tif n != len(iv) || err != nil {\n\t\treturn nil, errors.New(\"Unable to write iv to writer\")\n\t}\n\treturn &cipher.StreamWriter{S: stream, W: w}, nil\n}", "title": "" }, { "docid": "07fe40a988293aaea59bf68d02d77eaa", "score": "0.5193949", "text": "func Encrypt(data []byte, passphrase string) ([]byte, error) {\n\tgcm, err := getCipher(passphrase)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, fmt.Errorf(\"error generating nonce for encryption: %v\", err)\n\t}\n\treturn gcm.Seal(nonce, nonce, data, nil), nil\n}", "title": "" }, { "docid": "3f945b8612d96ba05206c94392e07c19", "score": "0.5180006", "text": "func (s *ShardedSecret) AppendData(key string, data []byte) {\n\tif s == nil {\n\t\treturn\n\t}\n\ts.data[key] = data\n}", "title": "" }, { "docid": "a59458d78d1b786d9711732fb0107639", "score": "0.5166207", "text": "func EncryptWriter(key string, w io.Writer) (*cipher.StreamWriter, error) {\n\tiv := make([]byte, aes.BlockSize)\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\tstream, err := encryptStream(key, iv)\n\tif err != nil {\n\t\tlogger.ErrorLogger.Printf(\"error establishing an encryption stream: %s\", err)\n\t\treturn nil, err\n\t}\n\tn, err := w.Write(iv)\n\tif n != len(iv) || err != nil {\n\t\tlogger.ErrorLogger.Println(\"encrypt writer not able to write full iv to writer\")\n\t\treturn nil, errors.New(\"encrypt writer not able to write full iv to writer\")\n\t}\n\treturn &cipher.StreamWriter{S: stream, W: w}, nil\n}", "title": "" }, { "docid": "75715fa93bc676be1a3019f5e1bac722", "score": "0.516544", "text": "func (k *MasterKey) Encrypt(plaintext []byte) (ciphertext []byte, iv []byte, err error) {\n\tif k.key == nil {\n\t\treturn plaintext, nil, nil\n\t}\n\treturn AesGcmEncrypt(k.key, plaintext)\n}", "title": "" }, { "docid": "8ca047fd4f265f29ab7353d031af6f54", "score": "0.5160055", "text": "func generateKeyAndEncrypt(id int, plaintext string) ([]byte, error) {\n\tdb := NewDB()\n\terr := db.CheckIfIDAllReadyExists(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpublicKey := generateKey()\n\tencryptedData, err := encrypt(publicKey, plaintext)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = db.store(id, string(publicKey), encryptedData)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn publicKey, nil\n}", "title": "" }, { "docid": "f21c811ff9d8851d877325ce15fe5a70", "score": "0.5159674", "text": "func (cache *DataEncryptionKeyCache) Put(encryptedDEK []byte, dek *DataEncryptionKey) {\n\tcache.lru.Add(string(encryptedDEK), dek)\n}", "title": "" }, { "docid": "af2814ab8439ce6a572a2d2241736a59", "score": "0.51534426", "text": "func Encrypt(secretKey, additional, data []byte) ([]byte, error) {\n\tif len(secretKey) != 32 {\n\t\treturn nil, fmt.Errorf(\"secret key is not for AES-256: total %d bits\", 8*len(secretKey))\n\t}\n\n\t// prepare AES-256-GSM cipher\n\tblock, err := aes.NewCipher(secretKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taesGCM, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// make random nonce\n\tnonce := make([]byte, aesGCM.NonceSize())\n\tif _, err := io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// encrypt data with second key\n\tcipherText := aesGCM.Seal(nonce, nonce, data, additional)\n\treturn cipherText, nil\n}", "title": "" }, { "docid": "dd6919165c65fe4152927d9b2004c878", "score": "0.5152663", "text": "func Encrypt(data []byte, passphrase string) ([]byte, error) {\n\t// generate password hash\n\tpwdKey, err := createHash(passphrase)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Creating cipher\n\tblock, _ := aes.NewCipher(pwdKey)\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Generating Nonce\n\tnonce := make([]byte, gcm.NonceSize())\n\t_, err = io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn gcm.Seal(nonce, nonce, data, nil), nil\n}", "title": "" }, { "docid": "b08641f199e515cd100cd3a9e9ebb296", "score": "0.5147578", "text": "func EnCrypto(d string, s string) string {\n\tdata := append([]byte(d), s...)\n\thas := sha512.Sum512_256(data)\n\tstr := fmt.Sprintf(\"%x\", has)\n\treturn str\n}", "title": "" }, { "docid": "9af3f5943f530450276ce35ab364ef78", "score": "0.5145473", "text": "func (s *DynamoDBStore) SetEncryptedDataKeysConditionally(ctx context.Context, id string, encryptedKeysMap map[string]string) error {\n\titem := item{ID: id, Keys: encryptedKeysMap}\n\tmarshalledItem, err := dynamodbattribute.MarshalMap(item)\n\n\tconditionExpression := \"attribute_not_exists(id)\"\n\tinput := &dynamodb.PutItemInput{\n\t\tTableName: s.tableName,\n\t\tItem: marshalledItem,\n\t\tConditionExpression: aws.String(conditionExpression),\n\t}\n\n\t_, err = s.client.PutItemWithContext(ctx, input)\n\tif err != nil {\n\t\tif awsErr, ok := err.(awserr.Error); ok {\n\t\t\tif awsErr.Code() == dynamodb.ErrCodeConditionalCheckFailedException {\n\t\t\t\treturn IDAlreadyExistsStoreError{ID: id}\n\t\t\t}\n\t\t}\n\n\t\tlogger.Print(err)\n\t\treturn err\n\t}\n\n\ts.keysCache.Set(id, &encryptedKeysMap, cache.DefaultExpiration)\n\treturn nil\n}", "title": "" }, { "docid": "dd1bc98cfc73d9c3ee22da284953a943", "score": "0.5139871", "text": "func (r *Repository) Encrypt(ciphertext, plaintext []byte) ([]byte, error) {\n\tif r.key == nil {\n\t\treturn nil, errors.New(\"key for repository not set\")\n\t}\n\n\treturn crypto.Encrypt(r.key, ciphertext, plaintext)\n}", "title": "" }, { "docid": "dccc8ffb9c40d5a43c58afb1072e2af6", "score": "0.5134303", "text": "func (key *LedgerKey) SetData(account AccountId, name string) error {\n\tdata := LedgerKeyData{account, String64(name)}\n\tnkey, err := NewLedgerKey(LedgerEntryTypeData, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*key = nkey\n\treturn nil\n}", "title": "" }, { "docid": "32fae12e9378bac8482e832240762627", "score": "0.512315", "text": "func EncryptionKey(key []byte) Option {\n\treturn func(ins *instance) {\n\t\tins.encryptionKey = key\n\t}\n}", "title": "" }, { "docid": "f3bbbb109df61c6b96bd61996e995544", "score": "0.5121615", "text": "func (w *Welcome) EncryptTo(kp KeyPackage, pathSecret []byte) {\n\t// Check that the ciphersuite is acceptable\n\tif kp.CipherSuite != w.CipherSuite {\n\t\tpanic(fmt.Errorf(\"mls.welcome: cipher suite mismatch %v != %v\", kp.CipherSuite, w.CipherSuite))\n\t}\n\n\t// Compute the hash of the kp\n\tdata, err := syntax.Marshal(kp)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"mls.welcome: kp marshal failure %v\", err))\n\t}\n\n\tkpHash := w.CipherSuite.Digest(data)\n\n\t// Encrypt the group init secret to new member's public key\n\tgs := GroupSecrets{\n\t\tEpochSecret: w.epochSecret,\n\t}\n\n\tif pathSecret != nil {\n\t\tgs.PathSecret = &PathSecret{pathSecret}\n\t}\n\n\tpt, err := syntax.Marshal(gs)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"mls.welcome: KeyPackage marshal failure %v\", err))\n\t}\n\n\tegs, err := w.CipherSuite.hpke().Encrypt(kp.InitKey, []byte{}, pt)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"mls.welcome: encrpyting KeyPackage failure %v\", err))\n\t}\n\n\t// Assemble and append the key package\n\tekp := EncryptedGroupSecrets{\n\t\tKeyPackageHash: kpHash,\n\t\tEncryptedGroupSecrets: egs,\n\t}\n\tw.Secrets = append(w.Secrets, ekp)\n}", "title": "" }, { "docid": "190a29052a15c6e164cdf344dc9311b8", "score": "0.5118516", "text": "func (p Plugin) WriteKey() error {\n\treturn repo.WriteKey(\n\t\tp.Config.Key,\n\t)\n}", "title": "" }, { "docid": "2c49362f45b63561431da74b204f4f4a", "score": "0.51152444", "text": "func Encrypt(key, textValue string) (string, error) {\n\t// Load your secret key from a safe place and reuse it across multiple\n\t// NewCipher calls. (Obviously don't use this example key for anything\n\t// real.) If you want to convert a passphrase to a key, use a suitable\n\t// package like bcrypt or scrypt.\n\t//Create a Hasher\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tciphertext := make([]byte, aes.BlockSize+len(textValue))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn \"\", err\n\t}\n\tstream, err := encryptStream(key, iv)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], []byte(textValue))\n\n\t//Return encrypted element\n\treturn fmt.Sprintf(\"%x\", ciphertext), nil\n\n}", "title": "" }, { "docid": "36be2814d544d510654741e059656aaf", "score": "0.5104838", "text": "func (xp *Xp) Encrypt(context types.Node, publickey *rsa.PublicKey, ee *Xp) (err error) {\n\tects := ee.QueryDashP(nil, `/xenc:EncryptedData`, \"\", nil)\n\tects.(types.Element).SetAttribute(\"Type\", \"http://www.w3.org/2001/04/xmlenc#Element\")\n\tee.QueryDashP(ects, `xenc:EncryptionMethod[@Algorithm=\"http://www.w3.org/2009/xmlenc11#aes256-gcm\"]`, \"\", nil)\n\t//ee.QueryDashP(ects, `xenc:EncryptionMethod[@Algorithm=\"http://www.w3.org/2001/04/xmlenc#aes256-cbc\"]`, \"\", nil)\n\tee.QueryDashP(ects, `ds:KeyInfo/xenc:EncryptedKey/xenc:EncryptionMethod[@Algorithm=\"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p\"]/ds:DigestMethod[@Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"]`, \"\", nil)\n\n\tsessionkey, ciphertext, err := encryptAESGCM([]byte(context.ToString(1, true)))\n\t//sessionkey, ciphertext, err := encryptAESCBC([]byte(context.ToString(1, true)))\n\tif err != nil {\n\t\treturn\n\t}\n\tencryptedSessionkey, err := rsa.EncryptOAEP(sha1.New(), rand.Reader, publickey, sessionkey, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tee.QueryDashP(ects, `ds:KeyInfo/xenc:EncryptedKey/xenc:CipherData/xenc:CipherValue`, base64.StdEncoding.EncodeToString(encryptedSessionkey), nil)\n\tee.QueryDashP(ects, `xenc:CipherData/xenc:CipherValue`, base64.StdEncoding.EncodeToString(ciphertext), nil)\n\n\tec, _ := ee.Doc.DocumentElement()\n\tec = xp.CopyNode(ec, 1)\n\tcontext.AddPrevSibling(ec)\n\tRmElement(context)\n\treturn\n}", "title": "" }, { "docid": "f888e517a1dacac9f53457e4975e9a1a", "score": "0.5094417", "text": "func (o ContainerServiceSshPublicKeyOutput) KeyData() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ContainerServiceSshPublicKey) string { return v.KeyData }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3abe2ffbb4864517fc4a5293802bf460", "score": "0.50864875", "text": "func encryptedSecretKeyName(secretID string) string {\n\treturn \"wdek_\" + secretID\n}", "title": "" }, { "docid": "29ab9655ee4c5ca9461bd0b9277afb61", "score": "0.5070099", "text": "func encryptData(data, password []byte, scryptN, scryptP int) (CryptoJSON, error) {\n\tsalt := make([]byte, 32)\n\tif _, err := io.ReadFull(rand.Reader, salt); err != nil {\n\t\treturn CryptoJSON{}, fmt.Errorf(\"reading from crypto/rand failed: \" + err.Error())\n\t}\n\tderivedKey, err := scrypt.Key(password, salt, scryptN, scryptR, scryptP, scryptDKLen)\n\tif err != nil {\n\t\treturn CryptoJSON{}, err\n\t}\n\tencryptKey := derivedKey[:16]\n\n\tiv := make([]byte, aes.BlockSize) // 16\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn CryptoJSON{}, fmt.Errorf(\"reading from crypto/rand failed: \" + err.Error())\n\t}\n\tcipherText, err := aesCTRXOR(encryptKey, data, iv)\n\tif err != nil {\n\t\treturn CryptoJSON{}, err\n\t}\n\tmac := keccak256(derivedKey[16:32], cipherText)\n\n\tscryptParamsJSON := make(map[string]interface{}, 5)\n\tscryptParamsJSON[\"n\"] = scryptN\n\tscryptParamsJSON[\"r\"] = scryptR\n\tscryptParamsJSON[\"p\"] = scryptP\n\tscryptParamsJSON[\"dklen\"] = scryptDKLen\n\tscryptParamsJSON[\"salt\"] = hex.EncodeToString(salt)\n\tcipherParams := cipherParams{\n\t\tIV: hex.EncodeToString(iv),\n\t}\n\n\tcryptoStruct := CryptoJSON{\n\t\tCipher: \"aes-128-ctr\",\n\t\tCipherText: hex.EncodeToString(cipherText),\n\t\tCipherParams: cipherParams,\n\t\tKDF: keyHeaderKDF,\n\t\tKDFParams: scryptParamsJSON,\n\t\tMAC: hex.EncodeToString(mac),\n\t}\n\treturn cryptoStruct, nil\n}", "title": "" }, { "docid": "6a4a2f5c2bee11b66c22c2a7a3a315d7", "score": "0.50590193", "text": "func EncryptKMS(kmsSvc *kms.KMS, dataKey string, keyName string, unencryptedVal string) (string, error) {\n\n\treq := &kms.EncryptInput{\n\t\tKeyId: aws.String(\"alias/\" + keyName),\n\t\tPlaintext: []byte(unencryptedVal),\n\t}\n\n\tresp, err := kmsSvc.Encrypt(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn base64.StdEncoding.EncodeToString(resp.CiphertextBlob), err\n}", "title": "" }, { "docid": "f65e7709cc7b6f18679edc481d1856ca", "score": "0.50582135", "text": "func encryptPrivKey(privKey cryptotypes.PrivKey, passphrase string) (saltBytes []byte, encBytes []byte) {\n\tsaltBytes = crypto.CRandBytes(16)\n\tkey, err := tmbcrypt.GenerateFromPassword(saltBytes, []byte(passphrase), BcryptSecurityParameter)\n\n\tif err != nil {\n\t\tpanic(errors.Wrap(err, \"generating bcrypt key from passphrase\"))\n\t}\n\n\tkey = crypto.Sha256(key) // get 32 bytes\n\tprivKeyBytes := privKey.Bytes()\n\n\treturn saltBytes, xsalsa20symmetric.EncryptSymmetric(privKeyBytes, key)\n}", "title": "" }, { "docid": "1877cd5d081bb66db8f927a286c9aca1", "score": "0.5057941", "text": "func (provider *disk) Write(key string, target interface{}) error {\n\tprovider.mutex.Lock()\n\tdefer provider.mutex.Unlock()\n\t// get the full path\n\tfilePath, err := provider.getFullPath(key)\n\tif nil != err {\n\t\treturn err\n\t}\n\n\tfileutil.EnsureDir(filepath.Dir(filePath), provider.Mode)\n\n\t// create the file, this will overwrite if it already exists.\n\tw, err := os.Create(filePath)\n\tif nil != err {\n\t\treturn err\n\t}\n\tdefer w.Close()\n\tencoder := gob.NewEncoder(w)\n\treturn encoder.Encode(target)\n}", "title": "" }, { "docid": "b4c6114901f2174454332e721f9bebbb", "score": "0.50553316", "text": "func encryptDataBlock(plaintext, key []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gcm.Seal(nonce, nonce, plaintext, nil), nil\n}", "title": "" }, { "docid": "4116e31d95f5cff7fb6408248ece71a6", "score": "0.50427926", "text": "func (s *SecoureSocket) EncryptData(conn *net.TCPConn, buf []byte) (n int, err error) {\n\t// encrypt data into buffer slice\n\ts.Cipher.Encrypt(buf)\n\t// write encryption data into output stream\n\tn, err = conn.Write(buf)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "ec012b3f77765d66d599ae12bca5a8c7", "score": "0.5036042", "text": "func Encrypt(text []byte, key *[32]byte) ([]byte, error) {\n\n\tblock, err := aes.NewCipher(key[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\t_, err = io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gcm.Seal(nonce, nonce, text, nil), nil\n}", "title": "" }, { "docid": "ac84645546d4971a41b4e3f1e0312245", "score": "0.503141", "text": "func (rk *RKeystore) Put(name string, pk ci.PrivKey) error {\n\treturn errors.New(\"key puts not permitted\")\n}", "title": "" }, { "docid": "60a7491ecb7ddf68f28482dbcc2a2457", "score": "0.50224733", "text": "func (c *_cipher) Encrypt(text string) (string, error) {\n\treturn encrypt(c.key, text)\n}", "title": "" }, { "docid": "12367de983050904287cc778c6764775", "score": "0.5021464", "text": "func (d *DiskIO) writeEncode(config int, key string, valToWrite interface{}) error {\n\td.mu.Lock()\n\tdefer d.mu.Unlock()\n\n\tvar network bytes.Buffer\n\tenc := gob.NewEncoder(&network)\n\terr := enc.Encode(valToWrite)\n\n\tif err != nil {\n\t\tfmt.Println(\"Could not encode key: \",key)\n\t}\n\n\tdirpath := d.BasePath + \"/\" + d.me + \"_\" + strconv.Itoa(config)\n\tfullpath := dirpath + \"/\" + key\n\n\tvar pathPerm os.FileMode = 0777\n\tvar filePerm os.FileMode = 0666\n\n\tif err := os.MkdirAll(dirpath, pathPerm); err != nil {\n\t\tfmt.Println(\"Could not make dir\",key)\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(fullpath, network.Bytes(), filePerm)\n\treturn err\n\n}", "title": "" }, { "docid": "9b937c4a83a65f9fdea2a8886acb81ce", "score": "0.5018651", "text": "func writeKey(in *plugin.Clone) error {\n\tif len(in.Keypair.Private) == 0 {\n\t\treturn nil\n\t}\n\tu, err := user.Current()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsshpath := filepath.Join(u.HomeDir, \".ssh\")\n\tif err := os.MkdirAll(sshpath, 0700); err != nil {\n\t\treturn err\n\t}\n\tconfpath := filepath.Join(sshpath, \"config\")\n\tprivpath := filepath.Join(sshpath, \"id_rsa\")\n\tioutil.WriteFile(confpath, []byte(\"StrictHostKeyChecking no\\n\"), 0700)\n\treturn ioutil.WriteFile(privpath, []byte(in.Keypair.Private), 0600)\n}", "title": "" }, { "docid": "1c15dc8800564043811487834a4a270e", "score": "0.5012937", "text": "func (store *KeyStore) SaveDataEncryptionKeys(id []byte, keypair *keys.Keypair) error {\n\tfilename := GetServerDecryptionKeyFilename(id)\n\treturn store.SaveKeyPairWithFilename(keypair, filename, id)\n}", "title": "" }, { "docid": "82bc1a9ffdc230ee60b711f339277a3e", "score": "0.5011156", "text": "func (c *CdbWriter) Add(Key, Data string) (err error) {\n\tbuf := new(bytes.Buffer)\n\tif err = binary.Write(buf, binary.LittleEndian, uint32(len(Key))); err != nil {\n\t\treturn fmt.Errorf(\"key length: %v\", err)\n\t}\n\tif err = binary.Write(buf, binary.LittleEndian, uint32(len(Data))); err != nil {\n\t\treturn fmt.Errorf(\"data length: %v\", err)\n\t}\n\tif err = binary.Write(buf, binary.LittleEndian, []byte(Key)); err != nil {\n\t\treturn fmt.Errorf(\"key: %v\", err)\n\t}\n\tif err = binary.Write(buf, binary.LittleEndian, []byte(Data)); err != nil {\n\t\treturn fmt.Errorf(\"data: %v\", err)\n\t}\n\tif _, err = c.File.Write(buf.Bytes()); err != nil {\n\t\treturn err\n\t}\n\t// add data in hash table\n\thash := cdbHash([]byte(Key))\n\thashMod := hash % 256\n\t// update HashTable\n\tc.HashTable[hashMod] = append(\n\t\tc.HashTable[hashMod],\n\t\tHashItem{hash, c.Position},\n\t)\n\t// get next global position\n\tc.Position += uint32(len(Key)) + uint32(len(Data)) + 8\n\treturn nil\n}", "title": "" }, { "docid": "de3e48d53ad15154f995a7975e89c369", "score": "0.49957234", "text": "func (enc *encryptor) Encrypt(plaintext *Plaintext, ctOut *Ciphertext) {\n\tenc.Encryptor.Encrypt(&rlwe.Plaintext{Value: plaintext.Value}, &rlwe.Ciphertext{Value: ctOut.Value})\n}", "title": "" }, { "docid": "77f51a28c26da2a3d3b8ee2301120526", "score": "0.49917015", "text": "func (t *XTinyEncryptionAlgorithm) Encrypt(dst, src []byte) {\n\tv0, v1 := binary.BigEndian.Uint32(src), binary.BigEndian.Uint32(src[4:])\n\n\tvar sum uint32\n\tfor i := 0; i < 32; i++ {\n\t\tv0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + t.keys[sum&3])\n\t\tsum += delta\n\t\tv1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + t.keys[(sum>>11)&3])\n\t}\n\n\tbinary.BigEndian.PutUint32(dst, v0)\n\tbinary.BigEndian.PutUint32(dst[4:], v1)\n}", "title": "" }, { "docid": "daeed887ef24a392804b11ca59cc9f7e", "score": "0.49887496", "text": "func Encrypt(data []byte, name string) ([]byte, error) {\n\tout := dpBlob{}\n\terr := cryptProtectData(bytesToBlob(data), windows.StringToUTF16Ptr(name), nil, 0, 0, dpCRYPTPROTECT_UI_FORBIDDEN, &out)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Unable to encrypt DPAPI protected data: \" + err.Error())\n\t}\n\n\toutSlice := *(*[]byte)(unsafe.Pointer(&(struct {\n\t\taddr uintptr\n\t\tlen int\n\t\tcap int\n\t}{out.data, int(out.len), int(out.len)})))\n\tret := make([]byte, len(outSlice))\n\tcopy(ret, outSlice)\n\twindows.LocalFree(windows.Handle(out.data))\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "0a8119b4816e8a2c64dcae2d157b33ba", "score": "0.4986832", "text": "func (s *safeService) CreateDataKey(ctx context.Context, req *pb.CreateDataKeyRequest) (*pb.CreateDataKeyResponse, error) {\n\tresp := &pb.CreateDataKeyResponse{}\n\n\tif !accountValidator.MatchString(req.GetAccountName()) {\n\t\tresp.ErrorCode = 510\n\t\tresp.ErrorMessage = \"account_name invalid format\"\n\t\treturn resp, nil\n\t}\n\n\tif !dataKeyValidator.MatchString(req.GetDataKeyName()) {\n\t\tresp.ErrorCode = 510\n\t\tresp.ErrorMessage = \"data_key_name invalid format\"\n\t\treturn resp, nil\n\t}\n\n\t// generate a new key\n\tnewkey := make([]byte, 32)\n\tif _, err := io.ReadFull(rand.Reader, newkey); err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"ReadFull\", \"error\", err)\n\t\tresp.ErrorCode = 511\n\t\tresp.ErrorMessage = \"unable to generate new aes key\"\n\t\treturn resp, nil\n\t}\n\n\tmkey, err := s.GetMasterKey()\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"GetMasterKey\", \"error\", err)\n\t\tresp.ErrorCode = 512\n\t\tresp.ErrorMessage = \"unable to get master key\"\n\t\treturn resp, nil\n\t}\n\n\tdatakey, err := cryptutil.AesGcmEncrypt(mkey, newkey)\n\t// clear master key\n\tfor k := 0; k < len(mkey); k++ {\n\t\tmkey[k] = 0\n\t}\n\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"AesGcmEncrypt\", \"error\", err)\n\t\tresp.ErrorCode = 512\n\t\tresp.ErrorMessage = \"unable to encrypt data key\"\n\t\treturn resp, nil\n\t}\n\n\tsqlstring := `INSERT INTO tb_DataKey (\n\t\tdtmCreated, dtmModified, dtmDeleted, bitIsDeleted, intVersion, \n\t\tchvAccountName, chvDataKeyName, chvDataKeyDescription, binDataKey)\n\t\tVALUES(NOW(), NOW(), NOW(), 0, 1, ?, ?, ?, UNHEX(?))`\n\n\tstmt, err := s.db.Prepare(sqlstring)\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"Prepare\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = \"db.Prepare failed\"\n\t\treturn resp, nil\n\t}\n\n\tdefer stmt.Close()\n\n\tres, err := stmt.Exec(req.GetAccountName(), req.GetDataKeyName(), req.GetDataKeyDescription(), hex.EncodeToString(datakey))\n\tif err == nil {\n\t\tdataKeyId, err := res.LastInsertId()\n\t\tif err != nil {\n\t\t\tlevel.Error(s.logger).Log(\"what\", \"LastInsertId\", \"error\", err)\n\t\t} else {\n\t\t\tlevel.Debug(s.logger).Log(\"dataKeyId\", dataKeyId)\n\t\t}\n\n\t\tresp.DataKeyId = dataKeyId\n\t\tresp.Version = 1\n\t} else {\n\t\tresp.ErrorCode = 501\n\t\tresp.ErrorMessage = err.Error()\n\t\tlevel.Error(s.logger).Log(\"what\", \"Exec\", \"error\", err)\n\t\terr = nil\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "ce1cd67887a4fbcf3cdbb56854f70166", "score": "0.49795866", "text": "func (p *localKeyVault) encryptData(data []byte) ([]byte, error) {\n\tblockCipher, err := aes.NewCipher(p.encryptionKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgcm, err := cipher.NewGCM(blockCipher)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = rand.Read(nonce); err != nil {\n\t\treturn nil, err\n\t}\n\tciphertext := gcm.Seal(nonce, nonce, data, nil)\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "0350a65246515eb8105770d81fad4b6e", "score": "0.49734214", "text": "func (dao *Simple) Put(entity io.Serializable, key []byte) error {\n\treturn dao.putWithBuffer(entity, key, io.NewBufBinWriter())\n}", "title": "" }, { "docid": "735ab2f5ea4c4dc4bbd332c620bfc896", "score": "0.4970697", "text": "func encrypt(plaintext, purpose []byte, key Key) (string, error) {\n\tvar bCiphertext []byte\n\tvar err error\n\tswitch key.cipher {\n\tcase CipherXsalsa20Poly1305:\n\t\tbCiphertext, err = encryptXsalsa20Poly1305(plaintext, purpose, key.key)\n\t}\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tciphertext := base64.RawURLEncoding.EncodeToString(bCiphertext)\n\treturn ciphertext, nil\n}", "title": "" }, { "docid": "905f2f56f3297318c2b6b4e2bf86bd86", "score": "0.4960658", "text": "func setKey(adb *database.AdminDB, key string, value interface{}, insertStatement string, args ...interface{}) error {\n\n\tb, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\targs = append(args, key, string(b))\n\treturn runStatement(adb, insertStatement, args)\n}", "title": "" }, { "docid": "07d0a85e3c916e7fd5d0301bb4d13787", "score": "0.4955292", "text": "func (r *EncryptedPostData) Encrypt() (ret string, err error) {\n\tret, err = EncryptParams(r.text)\n\treturn\n}", "title": "" }, { "docid": "c81e2d0fa2a42e1d63a9dda8825b9a0c", "score": "0.4953556", "text": "func (o *UserProfileOracle) Encrypt(p *UserProfile) []byte {\n\tecb := block.NewECB(o.key)\n\treturn ecb.Encrypt([]byte(p.String()))\n}", "title": "" }, { "docid": "182276c203d3d8bc0897e1f4d86f7091", "score": "0.4953345", "text": "func Encrypt(profile, key []byte) ([]byte, error) {\n\tencrypted, err := crypto.EcbEncrypt(profile, key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn encrypted, nil\n}", "title": "" }, { "docid": "373842372deda6402626c027101ddc18", "score": "0.4952675", "text": "func Encrypt(src io.Reader, dst io.Writer, key []byte) error {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ecrypt cipher: %w\", err)\n\t}\n\t// the key is unique for each cipher-text, then it's ok to use a zero IV.\n\tvar iv [aes.BlockSize]byte\n\tstream := cipher.NewOFB(block, iv[:])\n\n\twriter := &cipher.StreamWriter{S: stream, W: dst}\n\tif _, err := io.Copy(writer, src); err != nil {\n\t\treturn fmt.Errorf(\"copy for ecryption: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a9726c8dde823c79239fcb0361777019", "score": "0.4948348", "text": "func Encrypt(data string, salt string) (string, error) {\n\thash := md5.New()\n\t_, err := hash.Write([]byte(salt))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tcipher := hash.Sum(nil)\n\n\tbuf := new(bytes.Buffer)\n\tbuf.Write(cipher)\n\tbuf.WriteString(data)\n\t_, err = hash.Write(buf.Bytes())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hex.EncodeToString(hash.Sum(nil)), nil\n}", "title": "" } ]
6081646f5efd0fe55f61e3a9a6f49468
Deprecated, Use BatchGetDistributionsResponse.ProtoReflect.Descriptor instead.
[ { "docid": "2d4cf57edae420473cbe4b0187cc2819", "score": "0.7541198", "text": "func (*BatchGetDistributionsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" } ]
[ { "docid": "a789e1b14ea3a5eb76020dfc0e2e1d0c", "score": "0.75380415", "text": "func (*BatchGetDistributionsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "4af8172ba6dc1d5f707ea4c85e7e177e", "score": "0.7119522", "text": "func (*ListDistributionsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "36d56b0237c367bcd0a5c10894dfb663", "score": "0.711748", "text": "func (*WatchDistributionsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "c9a04dbef824b605678e059dc0086408", "score": "0.71127903", "text": "func (*ListDistributionsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "78f2f5d6c512e25065fcd833d701b71f", "score": "0.7044595", "text": "func (*DeleteDistributionRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "4b31a754bc9b8bb3915395282f7022af", "score": "0.7035166", "text": "func (*WatchDistributionsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "626a236f28cdb208dcd8739943b6a01f", "score": "0.6992625", "text": "func (*GetDistributionRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "12f7a3550a7d7e2c3696865c374051bf", "score": "0.68199366", "text": "func (*UpdateDistributionRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "4ff8ed5c62012c2e63562d93f543dd3b", "score": "0.68170846", "text": "func (*BatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_logdog_api_endpoints_coordinator_services_v1_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "b23a7d35c712b7b89492f2b9b5657bb1", "score": "0.6795624", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_logdog_api_endpoints_coordinator_services_v1_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "0bbe1d6c143b59a1f360b7dfd8532108", "score": "0.675605", "text": "func (*WatchDistributionsResponse_PageTokenChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "6a3144dd8c89fc535802c94c8069e434", "score": "0.6746489", "text": "func (*WatchDistributionResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "3a27198c5be3ef2c007dd847b644229e", "score": "0.6726166", "text": "func (*UpgradeClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "07eb4671d8fc667b455e686b8a4205a5", "score": "0.67183703", "text": "func (*BulkDeleteMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_discord_v1_rest_proto_rawDescGZIP(), []int{65}\n}", "title": "" }, { "docid": "a66499aff7555efe770189079d441b08", "score": "0.6702409", "text": "func (*BatchResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_logdog_api_endpoints_coordinator_services_v1_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "06da3460d3a1810652d7f710ac35f25c", "score": "0.6695626", "text": "func (*WatchDistributionRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "b363bc9f1366fe079f2ece2752ac95bf", "score": "0.6679572", "text": "func (*DeprecatedPipelineBatchCreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_base_proto_rawDescGZIP(), []int{76}\n}", "title": "" }, { "docid": "14b28d5e803a58dd455239436ec9b6b6", "score": "0.6656874", "text": "func (*SliceDelete) Descriptor() ([]byte, []int) {\n\treturn file_e2sm_rsm_v1_e2sm_rsm_v1_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "ab8900e565c8d40b6b4473a6d14725b3", "score": "0.6640709", "text": "func (*BulkDeleteMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_discord_v1_rest_proto_rawDescGZIP(), []int{66}\n}", "title": "" }, { "docid": "a9fb86d7f6991e0573625904771dcaed", "score": "0.66147375", "text": "func (*GetClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{35}\n}", "title": "" }, { "docid": "93b935b6d8758b79921014a47a7c7d5b", "score": "0.66100764", "text": "func (*DeprecatedPipelineBatchCreateResponse) Descriptor() ([]byte, []int) {\n\treturn file_base_proto_rawDescGZIP(), []int{77}\n}", "title": "" }, { "docid": "bde208c66548fd86726a8316ace9ed36", "score": "0.6556029", "text": "func (*IdsRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_infrastructure_delivery_grpc_proto_client_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "5c53bfcdcf8a19bdcefb949319a8fd4b", "score": "0.65265805", "text": "func (*UpgradeClusterResponse) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{57}\n}", "title": "" }, { "docid": "25ff568c490113cff80ca21bcf0b2e98", "score": "0.6518131", "text": "func (*CreateDistributionRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_distribution_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "2b9baee1e0d857e2da0899e964ad2be0", "score": "0.6516783", "text": "func (*DeleteClustersRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_resources_services_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "069abd18140d8a2743b893a517609cc0", "score": "0.6510092", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_product_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "444a80beff5a38972848e604cfdf15b0", "score": "0.65034586", "text": "func (*ProductLadderDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_api_front_admin_v1_pms_proto_rawDescGZIP(), []int{133}\n}", "title": "" }, { "docid": "7116c100da114f125b65495719114b8d", "score": "0.6495554", "text": "func (*DeleteClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visionai_v1alpha1_streams_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "9912c3a39a268e55eaf5b999b5f0c271", "score": "0.6484478", "text": "func (*DeleteCredentialRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "14603093ee9365a220d759a6079eae44", "score": "0.647184", "text": "func (*DeleteBulkStateRequest) Descriptor() ([]byte, []int) {\n\treturn file_dapr_proto_runtime_v1_dapr_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "1b6ec1be6aded04784cac2418b35e975", "score": "0.6471566", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_protocol_services_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "9f76f1bc5c31d6724cd04402a7aa24dc", "score": "0.64620256", "text": "func (*ProcessMultipleNodeDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_ingest_response_action_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "b96db02ddca1ed1a1af2ae8ad832cd4d", "score": "0.6448527", "text": "func (*GetBulkSecretRequest) Descriptor() ([]byte, []int) {\n\treturn file_dapr_proto_runtime_v1_dapr_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "fa445ca01090af1750c38f31bc218434", "score": "0.6446454", "text": "func (*DeleteLakeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "167d5a9a98824afaecc5e9b549f316c0", "score": "0.6440989", "text": "func (*TopologyUpdateConfigDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_studio_v1_services_gen_proto_rawDescGZIP(), []int{100}\n}", "title": "" }, { "docid": "fb9e8f51604635709bf52cdd8f1c0d61", "score": "0.64372784", "text": "func (*GetQueryServicesDescriptorResponse) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_base_reflection_v2alpha1_reflection_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "386dcdf80a2d4b73ce4c89f1e6f4ab5f", "score": "0.64348054", "text": "func (*DeleteResourcePolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{96}\n}", "title": "" }, { "docid": "0777113b6c3db67496ed6f123ac2cf41", "score": "0.643409", "text": "func (*GetManyByIDsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_operating_system_operating_system_reader_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "e666b1f28ebf785de1f1b9851f13c47b", "score": "0.6433035", "text": "func (*SliceMetrics) Descriptor() ([]byte, []int) {\n\treturn file_e2sm_rsm_v1_e2sm_rsm_v1_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "765a0eaa9b27399c294c0b6f6ef8d821", "score": "0.6426343", "text": "func (*DeleteMetricDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_metric_descriptor_custom_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "b855d98380ed9046f77fe26e9c1e90ca", "score": "0.64252096", "text": "func (*DeleteChannelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_v1_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "28db9b85b66ad112e2e3cbe24563a660", "score": "0.64133394", "text": "func (*ResDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_cluster_resources_cluster_resources_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "fabbf09fecabf1ff6e084810870ad413", "score": "0.6406899", "text": "func (*UnregisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_discovery_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "7a4fb17d31dfacaede04f859c55f0ecb", "score": "0.6406678", "text": "func (*UpdateClusterConfigParamResponse) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{103}\n}", "title": "" }, { "docid": "01c16293ebfb2c70fc613adda33b6eba", "score": "0.64055437", "text": "func (*GetQueryServicesDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_base_reflection_v2alpha1_reflection_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "b4ff00e2669b46abd13492f33ef1db7b", "score": "0.64044493", "text": "func (*UpdateClusterConfigParamRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{100}\n}", "title": "" }, { "docid": "fc30c93464f188d19eddfdca6e382242", "score": "0.6403096", "text": "func (*DeleteWalletLedgerRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "4bdbdc890097ce80249e0ddab795710b", "score": "0.64020514", "text": "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{96}\n}", "title": "" }, { "docid": "d16a4e10fae3225eea05387e328a2bfe", "score": "0.6401832", "text": "func (*DeleteResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientNamenodeProtocol_proto_rawDescGZIP(), []int{41}\n}", "title": "" }, { "docid": "e205622ef5afe3c72d94188138ddc770", "score": "0.6399663", "text": "func (*BatchGetResourcesRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_meta_proto_v1alpha2_resource_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "2793d771ff3671a43e9a0ca09306cf8d", "score": "0.63985926", "text": "func (*BatchRequest_Entry) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_logdog_api_endpoints_coordinator_services_v1_service_proto_rawDescGZIP(), []int{7, 0}\n}", "title": "" }, { "docid": "7fb005380566af281a547aacfa1c2f98", "score": "0.6397464", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_search_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "ee9a63880ffad9bb72fc1a666f62b6f9", "score": "0.6389677", "text": "func (*ListAdminEndpointsRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "58cd35440a2bd8b88562b819d9480f72", "score": "0.63880634", "text": "func (*GetResourcePolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{95}\n}", "title": "" }, { "docid": "8a5cbf240b37883bfc9e7314779afbb9", "score": "0.63857836", "text": "func (*PipelineDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_base_proto_rawDescGZIP(), []int{62}\n}", "title": "" }, { "docid": "8fb59509e0bf19e6a774acad114816d9", "score": "0.6384213", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_space_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "8695d72e01e4035465aef82475658561", "score": "0.638333", "text": "func (*DeletePolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_dataflow_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "4f5ab9c8cc18e39847da65e38aaa6b4c", "score": "0.63817465", "text": "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_message_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "a335e9a1c84b05aa549ef569a5028ace", "score": "0.6381014", "text": "func (*DeleteResourceRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_meta_proto_v1alpha2_resource_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "e17f16f8ec46b961597ba86ac661f1c3", "score": "0.6373601", "text": "func (*MemberStatisticsInfoDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{97}\n}", "title": "" }, { "docid": "12dea42ab33b4fb4a927fcc2301fab04", "score": "0.6373438", "text": "func (*DeleteChannelPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_discord_v1_rest_proto_rawDescGZIP(), []int{73}\n}", "title": "" }, { "docid": "045fcc0b8b799e4984239d81eef103d2", "score": "0.63720423", "text": "func (*DisableFeatureFlagRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{85}\n}", "title": "" }, { "docid": "36bd7bde92aac1fe63c984fd68b2e5e4", "score": "0.63719374", "text": "func (*Delta) Descriptor() ([]byte, []int) {\n\treturn file_internal_pkg_delivery_grpc_stat_service_proto_scheme_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b1d92a98236125e8349ccfa93f7de80b", "score": "0.63707095", "text": "func (*DeleteRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientNamenodeProtocol_proto_rawDescGZIP(), []int{40}\n}", "title": "" }, { "docid": "e2986010052a8522107f3cc1784f56c1", "score": "0.6370401", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_udfmanager_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "5d41e6e30333e353b877801a945e71d8", "score": "0.636951", "text": "func (*DeletePlanRequest) Descriptor() ([]byte, []int) {\n\treturn file_dataflow_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "b7174dc37c618a913b51e2479d3c6f7b", "score": "0.63655955", "text": "func (*TopologyUpdateSyncConfigDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_arista_studio_v1_services_gen_proto_rawDescGZIP(), []int{116}\n}", "title": "" }, { "docid": "92e05bacd627b0999474c6738efc7cb4", "score": "0.6365434", "text": "func (*DeleteAdminEndpointRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "8c3146f8f02755efde57352d89f55b0d", "score": "0.6363111", "text": "func (*DeleteResultRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "43ed02c26b9d2add9d55e353e8f3ab6f", "score": "0.6361634", "text": "func (*GetCLRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_internal_admin_api_admin_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "c120a4fba2fc5b4c87a8945cadd044a7", "score": "0.63578576", "text": "func (*DeleteDetectionRequest) Descriptor() ([]byte, []int) {\n\treturn file_medifor_v1_pipeline_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "48e5eed37e85dc7b6f2231e93b62fff7", "score": "0.6357296", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_product_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "27c56def773cd735037aaf7d3d329f40", "score": "0.6356026", "text": "func (*ReqDeleteCluster) Descriptor() ([]byte, []int) {\n\treturn file_proto_services_auth_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "35890b417e6b0f74e9f86720bc53184c", "score": "0.63558567", "text": "func (*UninstallRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_connector_connector_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "9758ae651dd233ce0895a70c8cfcde63", "score": "0.63542444", "text": "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "871e246b88e560a66cac61970d6989bd", "score": "0.63532394", "text": "func (*DeleteFailedAnalyticsRequest) Descriptor() ([]byte, []int) {\n\treturn file_medifor_v1_pipeline_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "a0f3b88e452c6bab5386ce459a69359e", "score": "0.6352378", "text": "func (*TopologyUpdateConfigDeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_arista_studio_v1_services_gen_proto_rawDescGZIP(), []int{101}\n}", "title": "" }, { "docid": "b1868dd1254d86b52b93103bd2960f3c", "score": "0.63521373", "text": "func (*ListClustersRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_resources_services_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "bb2e9b4ab8c32ebf368401baa4423f58", "score": "0.63497007", "text": "func (*ListGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_api_v1_users_group_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "eccb6f5804a9194619d204b2b22f21d6", "score": "0.6347363", "text": "func (*GetAdminEndpointRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d46c3330d3bd6aa0d2c02f3790eedaf6", "score": "0.6341898", "text": "func (*BatchResponse_Entry) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_logdog_api_endpoints_coordinator_services_v1_service_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "78de2a54763acc7e6414732018b5a0e4", "score": "0.63400376", "text": "func (*GetManyByIDsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_os_os_reader_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "fd14eb6d9f59e1ffa436364c10183275", "score": "0.63323957", "text": "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_discovery_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "460b5846576c91455aa487afa74ced22", "score": "0.63301474", "text": "func (*DeleteStepRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_pkg_pipeline_pb_pipeline_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "5a96fca13c1a64f348e13c7b94d5ecd9", "score": "0.6329764", "text": "func (*DeleteClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_mysql_v1alpha_cluster_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "1f03eec853cf6004a97a6dc34e012195", "score": "0.6328984", "text": "func (*DisableServerRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "5c0a7842e3e80fa3e94b4ada8b3ed316", "score": "0.6328137", "text": "func (*BatchGetResourcesResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_meta_proto_v1alpha2_resource_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "845054d8d81b58e12b848e925762d08d", "score": "0.6325588", "text": "func (*RefreshProjectCLsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_internal_admin_api_admin_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "c0af34c2c7ac5de3b5f076218b608128", "score": "0.6322655", "text": "func (*ProductLadderDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_api_front_admin_v1_pms_proto_rawDescGZIP(), []int{134}\n}", "title": "" }, { "docid": "38830592852eeb72eb91c441e0e4ea72", "score": "0.63224804", "text": "func (*DeletePolicyResponse) Descriptor() ([]byte, []int) {\n\treturn file_dataflow_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "82f4259e40aa17510c9c441ff3369f39", "score": "0.63208777", "text": "func (*GetCLResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_internal_admin_api_admin_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "8d84c93842da335f25422d81c2bc6b65", "score": "0.63176125", "text": "func (*ListFeatureFlagsRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{87}\n}", "title": "" }, { "docid": "c5b2999bf3e95b361538d8a5a8392fc5", "score": "0.6317116", "text": "func (*DeleteSeriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visionai_v1alpha1_streams_service_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "f35841f025b9e155a1f682c3cc2b8c70", "score": "0.631699", "text": "func (*UpdateResourcePolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_lightbits_api_duros_v2_durosapiv2_proto_rawDescGZIP(), []int{91}\n}", "title": "" }, { "docid": "66909bbcf7d6ced83423445f194a0119", "score": "0.6311624", "text": "func (*DeletePlanResponse) Descriptor() ([]byte, []int) {\n\treturn file_dataflow_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "29ce4cac4d81f7c444638ae6fd1dac0e", "score": "0.6309423", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "a8dadaf2477a64d9685e844e610a05a4", "score": "0.6309084", "text": "func (*GetPollerRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_internal_admin_api_admin_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "06cae249a58b3c5144db7d32f3676b44", "score": "0.63078946", "text": "func (*DeletePodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_resources_services_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "182f4f0e0fd9678d02e0d2bd0465ebb1", "score": "0.6302018", "text": "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_cx_v3beta1_version_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "ec48ea2e6acee1d7aa22f474d34268fe", "score": "0.6299393", "text": "func (*ListPrivateCloudsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_vmwareengine_v1_vmwareengine_proto_rawDescGZIP(), []int{0}\n}", "title": "" } ]
c715ebcf1ab11f8742a2b7cf731587a0
parseContentLength trims whitespace from s and returns 1 if no value is set, or the value if it's >= 0.
[ { "docid": "e645da6c99e96517e72510634360dbcd", "score": "0.7565981", "text": "func parseContentLength(cl string) (int64, error) {\n\tcl = textproto.TrimString(cl)\n\tif cl == \"\" {\n\t\treturn -1, nil\n\t}\n\tn, err := strconv.ParseUint(cl, 10, 63)\n\tif err != nil {\n\t\treturn 0, badStringError(\"bad Content-Length\", cl)\n\t}\n\treturn int64(n), nil\n\n}", "title": "" } ]
[ { "docid": "cb451b602097811b85274ae453a5130f", "score": "0.6537647", "text": "func findContentLength(lines []string) (int, error) {\n\tfor _, v := range lines {\n\t\tlv := strings.ToLower(v)\n\t\t// Content-Length\n\t\tif strings.HasPrefix(lv, lowerClKey) {\n\t\t\tl, e := strconv.Atoi(strings.TrimSpace(lv[len(lowerClKey):]))\n\t\t\tif e != nil {\n\t\t\t\treturn 0, fmt.Errorf(\"Content-Length exists but it can not be parsed: %w\", e)\n\t\t\t}\n\t\t\treturn l, nil\n\t\t}\n\t}\n\treturn 0, nil\n}", "title": "" }, { "docid": "75fd82044794b4479a0f90e11efe29a0", "score": "0.5970009", "text": "func readContentLengthHeader(r *bufio.Reader) (contentLength int64, err error) {\n\t// Look for <some header>\\r\\n\\r\\n\n\theaderWithCr, err := r.ReadString('\\r')\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tnextThree := make([]byte, 3)\n\tif _, err = io.ReadFull(r, nextThree); err != nil {\n\t\treturn 0, err\n\t}\n\tif string(nextThree) != \"\\n\\r\\n\" {\n\t\treturn 0, ErrHeaderDelimiterNotCrLfCrLf\n\t}\n\n\t// If header is in the right format, get the length\n\theader := strings.TrimSuffix(headerWithCr, \"\\r\")\n\theaderAndLength := contentLengthHeaderRegex.FindStringSubmatch(header)\n\tif len(headerAndLength) < 2 {\n\t\treturn 0, ErrHeaderNotContentLength\n\t}\n\treturn strconv.ParseInt(headerAndLength[1], 10, 64)\n}", "title": "" }, { "docid": "04a9650b392e6749690399ebe30818ca", "score": "0.55778885", "text": "func (ctx *Context) GetContentLength() int64 {\n\tif v := ctx.GetHeader(ContentLengthHeaderKey); v != \"\" {\n\t\tn, _ := strconv.ParseInt(v, 10, 64)\n\t\treturn n\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "bb8681cfcb27d3549861901dcb5b3740", "score": "0.55202585", "text": "func TestContentLength(t *testing.T) {\n\tsize := int64(32768)\n\ttestCases := []struct {\n\t\tName string\n\t\tURL string\n\t\tExpect int64\n\t\tMatch bool\n\t}{\n\t\t{\"Good size in HEAD request\", fmt.Sprintf(\"?size=%d\", size), size, true},\n\t\t{\"Good size in GET request\", fmt.Sprintf(\"?nohead&size=%d\", size), size, true},\n\t\t{\"Bad size in HEAD request\", fmt.Sprintf(\"?size=%d\", size-1), size, false},\n\t\t{\"Bad size in GET request\", fmt.Sprintf(\"?nohead&size=%d\", size-1), size, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\tt.Run(tc.Name, func(t *testing.T) {\n\t\t\treq, _ := NewRequest(\".testSize-mismatch-head\", ts.URL+tc.URL)\n\t\t\treq.Size = size\n\n\t\t\tresp := DefaultClient.Do(req)\n\t\t\tdefer os.Remove(resp.Filename)\n\t\t\terr := resp.Err()\n\t\t\tif tc.Match {\n\t\t\t\tif err == ErrBadLength {\n\t\t\t\t\tt.Errorf(\"error: %v\", err)\n\t\t\t\t} else if err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t} else if resp.Size != size {\n\t\t\t\t\tt.Errorf(\"expected %v bytes, got %v bytes\", size, resp.Size)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err == nil {\n\t\t\t\t\tt.Errorf(\"expected: %v, got %v\", ErrBadLength, err)\n\t\t\t\t} else if err != ErrBadLength {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttestComplete(t, resp)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e24565238b1fc3ee83ea354327f08fbc", "score": "0.5475652", "text": "func parseSize(v string) (uint64, error) {\n\tsize, err := strconv.ParseUint(v, 10, 64)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn size * 1024, nil\n}", "title": "" }, { "docid": "110a322e79d1a553dada881864a513b2", "score": "0.53419864", "text": "func tryComputeContentLength(content io.Reader, headers ObjectHeaders) {\n\th := headers.SizeBytes()\n\tif h.Exists() {\n\t\treturn\n\t}\n\tswitch r := content.(type) {\n\tcase *bytes.Buffer:\n\t\th.Set(uint64(r.Len()))\n\tcase *bytes.Reader:\n\t\th.Set(uint64(r.Len()))\n\t}\n}", "title": "" }, { "docid": "a851c359f5f1116ace615454fffb9006", "score": "0.5285347", "text": "func (x *Compressor) GetContentLength() *wrappers.UInt32Value {\n\tif x != nil {\n\t\treturn x.ContentLength\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2fdf85de7472b7d6dc19faa4766e18ce", "score": "0.5140782", "text": "func HumanSizeParse(s string) uint64 {\n\tparts := formatSizeRegex.FindStringSubmatch(s)\n\tif len(parts) < 3 {\n\t\treturn 0\n\t}\n\n\treturn HumanSizeParseParts(parts[1], parts[2], 1024)\n}", "title": "" }, { "docid": "547dcf6604961e2e725341b4309a296b", "score": "0.51178855", "text": "func contentLenght(b []byte) int {\n\tre := regexp.MustCompile(`Content-Length:\\s+(\\d+)`)\n\tmatch := re.FindStringSubmatch(string(b))\n\tif len(match) >= 2 {\n\t\tnumberStr := match[1]\n\t\tnumber, err := strconv.Atoi(numberStr)\n\t\tif err == nil {\n\t\t\treturn number\n\t\t} else {\n\t\t\treturn 0\n\t\t}\n\t} else {\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "8f9ad53bf7405477026e03945f7bf16b", "score": "0.50850457", "text": "func parseSize(d []byte) (n int) {\n\tif len(d) == 0 {\n\t\treturn -1\n\t}\n\tfor _, dec := range d {\n\t\tif dec < ascii_0 || dec > ascii_9 {\n\t\t\treturn -1\n\t\t}\n\t\tn = n*10 + (int(dec) - ascii_0)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "9a9f55a06d689ad7260066c98c754da8", "score": "0.50732857", "text": "func fixLength(isResponse bool, status int, requestMethod string, header http.Header, chunked bool) (int64, error) {\n\tisRequest := !isResponse\n\tcontentLens := header[\"Content-Length\"]\n\n\t// Hardening against HTTP request smuggling\n\tif len(contentLens) > 1 {\n\t\t// Per RFC 7230 Section 3.3.2, prevent multiple\n\t\t// Content-Length headers if they differ in value.\n\t\t// If there are dups of the value, remove the dups.\n\t\t// See Issue 16490.\n\t\tfirst := textproto.TrimString(contentLens[0])\n\t\tfor _, ct := range contentLens[1:] {\n\t\t\tif first != textproto.TrimString(ct) {\n\t\t\t\treturn 0, fmt.Errorf(\"http: message cannot contain multiple Content-Length headers; got %q\", contentLens)\n\t\t\t}\n\t\t}\n\n\t\t// deduplicate Content-Length\n\t\theader.Del(\"Content-Length\")\n\t\theader.Add(\"Content-Length\", first)\n\n\t\tcontentLens = header[\"Content-Length\"]\n\t}\n\n\t// Logic based on response type or status\n\tif noResponseBodyExpected(requestMethod) {\n\t\t// For HTTP requests, as part of hardening against request\n\t\t// smuggling (RFC 7230), don't allow a Content-Length header for\n\t\t// methods which don't permit bodies. As an exception, allow\n\t\t// exactly one Content-Length header if its value is \"0\".\n\t\tif isRequest && len(contentLens) > 0 && !(len(contentLens) == 1 && contentLens[0] == \"0\") {\n\t\t\treturn 0, fmt.Errorf(\"http: method cannot contain a Content-Length; got %q\", contentLens)\n\t\t}\n\t\treturn 0, nil\n\t}\n\tif status/100 == 1 {\n\t\treturn 0, nil\n\t}\n\tswitch status {\n\tcase 204, 304:\n\t\treturn 0, nil\n\t}\n\n\t// Logic based on Transfer-Encoding\n\tif chunked {\n\t\treturn -1, nil\n\t}\n\n\t// Logic based on Content-Length\n\tvar cl string\n\tif len(contentLens) == 1 {\n\t\tcl = textproto.TrimString(contentLens[0])\n\t}\n\tif cl != \"\" {\n\t\tn, err := parseContentLength(cl)\n\t\tif err != nil {\n\t\t\treturn -1, err\n\t\t}\n\t\treturn n, nil\n\t}\n\theader.Del(\"Content-Length\")\n\n\tif isRequest {\n\t\t// RFC 7230 neither explicitly permits nor forbids an\n\t\t// entity-body on a GET request so we permit one if\n\t\t// declared, but we default to 0 here (not -1 below)\n\t\t// if there's no mention of a body.\n\t\t// Likewise, all other request methods are assumed to have\n\t\t// no body if neither Transfer-Encoding chunked nor a\n\t\t// Content-Length are set.\n\t\treturn 0, nil\n\t}\n\n\t// Body-EOF logic based on other methods (like closing, or chunked coding)\n\treturn -1, nil\n}", "title": "" }, { "docid": "79027e1fd13137ecfa4e0c630044c245", "score": "0.5069789", "text": "func Parse(s string, flags Flags) (Int64, error) {\n\t// [-+]?([0-9]*(\\.[0-9]*)? ?([kmgtpezyKMGTPEZY]i?)?\n\tvar (\n\t\torig = `\"` + s + `\"`\n\t\tneg = false\n\t\tx, frac int64\n\t\tfracscale = 1\n\t\terr error\n\t)\n\n\t// Consume [-+]?\n\tif s != \"\" {\n\t\tswitch s[0] {\n\t\tcase '-':\n\t\t\tneg = true\n\t\t\tfallthrough\n\t\tcase '+':\n\t\t\ts = s[1:]\n\t\t}\n\t}\n\n\t// Special case: if all that is left is \"0\", this is zero.\n\tif s == \"0\" {\n\t\treturn 0, nil\n\t}\n\tif s == \"\" {\n\t\treturn 0, errors.New(\"humanize: invalid size \" + orig)\n\t}\n\n\t// The next character must be [0-9.]\n\tif !(s[0] == '.' || ('0' <= s[0] && s[0] <= '9')) {\n\t\treturn 0, errors.New(\"humanize: invalid size \" + orig)\n\t}\n\t// Consume [0-9]*\n\tpl := len(s)\n\tx, s, err = leadingInt(s)\n\tif err != nil {\n\t\tif err == errOverflow {\n\t\t\treturn 0, errors.New(\"humanize: size too large \" + orig)\n\t\t}\n\t\treturn 0, errors.New(\"humanize: invalid size \" + orig)\n\t}\n\tpre := pl != len(s) // whether we consumed anything before a period\n\n\t// Consume (\\.[0-9]*)?\n\tpost := false\n\tif s != \"\" && s[0] == '.' {\n\t\ts = s[1:]\n\t\tpl = len(s)\n\t\tfrac, s, err = leadingInt(s)\n\t\tif err != nil {\n\t\t\treturn 0, errors.New(\"humanize: invalid size \" + orig)\n\t\t}\n\t\tfor n := pl - len(s); n > 0; n-- {\n\t\t\tfracscale *= 10\n\t\t}\n\t\tpost = pl != len(s)\n\t}\n\tif !pre && !post {\n\t\t// no digits (e.g. \".k\" or \"-.k\")\n\t\treturn 0, errors.New(\"humanize: invalid size \" + orig)\n\t}\n\n\t// Consume optional space before unit.\n\tfor s != \"\" && s[0] == ' ' { // just ' ', no '\\t' etc allowed\n\t\ts = s[1:]\n\t}\n\n\t// All that remains is the unit.\n\tif s != \"\" {\n\t\tif len(s) > 2 || (len(s) > 1 && s[1] != 'i') {\n\t\t\treturn 0, errors.New(`humanize: unknown unit \"` + s + `\" in size ` + orig)\n\t\t}\n\t\tmul := int64(1000)\n\t\tvar max int64 = (1<<63 - 1000) / 1000\n\t\tbase2 := flags&(Divisor1000|SIPrefixes) == 0\n\t\tif base2 || len(s) == 2 { // SI prefix: Ki, Mi, etc\n\t\t\tmul = 1024\n\t\t\tmax = (1<<63 - 1024) / 1024\n\t\t}\n\t\tscale := 0\n\t\tswitch s[0] {\n\t\tcase 'b', 'B':\n\t\t\tscale = 0\n\t\tcase 'k', 'K':\n\t\t\tscale = 1\n\t\tcase 'm', 'M':\n\t\t\tscale = 2\n\t\tcase 'g', 'G':\n\t\t\tscale = 3\n\t\tcase 't', 'T':\n\t\t\tscale = 4\n\t\tcase 'p', 'P':\n\t\t\tscale = 5\n\t\tcase 'e', 'E':\n\t\t\tscale = 6\n\t\tcase 'z', 'Z':\n\t\t\tscale = 7\n\t\tcase 'y', 'Y':\n\t\t\tscale = 8\n\t\tdefault:\n\t\t\treturn 0, errors.New(`humanize: unknown unit \"` + s + `\" in size ` + orig)\n\t\t}\n\t\tfor ; scale > 0; scale-- {\n\t\t\tif frac >= max && fracscale > 1 {\n\t\t\t\tfrac /= int64(fracscale)\n\t\t\t\tfracscale = 1\n\t\t\t}\n\t\t\tif x >= max || frac >= max {\n\t\t\t\treturn 0, errors.New(\"humanize: size too large \" + orig)\n\t\t\t}\n\t\t\tx *= mul\n\t\t\tfrac *= mul\n\t\t}\n\t}\n\n\t// Combine parts, negate if required\n\tfrac /= int64(fracscale)\n\tif x > 1<<63-1-frac {\n\t\treturn 0, errors.New(\"humanize: size too large \" + orig)\n\t}\n\tx += frac\n\tif neg {\n\t\tx = -x\n\t}\n\n\treturn Int64(x), nil\n}", "title": "" }, { "docid": "bb99d19f4ff10616b061560230ab9aec", "score": "0.50573653", "text": "func (buf buffer) ParseSize(prefix byte, fallback error) (int64, error) {\n\tdata := buf.TrimCRLF()\n\n\tif len(data) == 0 {\n\t\treturn 0, re.ProtoErrorf(\"Protocol error: expected '%s', got ' '\", string(prefix))\n\t} else if data[0] != prefix {\n\t\treturn 0, re.ProtoErrorf(\"Protocol error: expected '%s', got '%s'\", string(prefix), string(data[0]))\n\t} else if len(data) < 2 {\n\t\treturn 0, fallback\n\t}\n\tvar n int64\n\tfor _, c := range data[1:] {\n\t\tif c >= '0' && c <= '9' {\n\t\t\tn = n*10 + int64(c-'0')\n\t\t} else {\n\t\t\treturn 0, fallback\n\t\t}\n\t}\n\tif n < 0 {\n\t\treturn 0, fallback\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "eae564678f2c170f8396b6b7e130fc11", "score": "0.5050498", "text": "func asNotEmptyInt(s string) (int, error) {\n\t_, err := asNotEmpty(s)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn asInt(s)\n}", "title": "" }, { "docid": "f49473413816ad8414d2cdca80cb0e3f", "score": "0.49995503", "text": "func parseInt(s string) int {\n\tf, err := strconv.ParseInt(strings.Trim(s, \" \"), 10, BS)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn int(f)\n}", "title": "" }, { "docid": "c3611f7590f93a3ab63d2271c17cc746", "score": "0.49995217", "text": "func contentRangeStart(r *http.Request) (n int64, err error) {\n\tvalues := r.Header[\"Content-Range\"]\n\tif values == nil {\n\t\treturn 0, nil\n\t}\n\n\tmatches := contentRangeRegexp.FindStringSubmatch(values[0])\n\tif len(matches) < 4 {\n\t\treturn 0, fmt.Errorf(\"Invalid Content-Range header: %q\", values)\n\t}\n\n\treturn strconv.ParseInt(matches[1], 10, 64)\n}", "title": "" }, { "docid": "d99cb5d1f95cc67dddc919200a3eb5c1", "score": "0.49968112", "text": "func actualContentLength(req *http.Request) int64 {\n\tif req.Body == nil {\n\t\treturn 0\n\t}\n\tif req.ContentLength != 0 {\n\t\treturn req.ContentLength\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "d99cb5d1f95cc67dddc919200a3eb5c1", "score": "0.49968112", "text": "func actualContentLength(req *http.Request) int64 {\n\tif req.Body == nil {\n\t\treturn 0\n\t}\n\tif req.ContentLength != 0 {\n\t\treturn req.ContentLength\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "eadad624f6d1d9eb82a8154fef9b7fea", "score": "0.49820718", "text": "func (rx *ResumableUpload) parseRange(res *http.Response) (err error) {\n\trangeString := res.Header.Get(\"Range\")\n\t// Range header not returned if no bytes have been sent.\n\tif rangeString == \"\" {\n\t\trx.progress = 0\n\t\treturn nil\n\t}\n\tif ranges := strings.Split(rangeString, \"-\"); len(ranges) == 2 {\n\t\tif rx.progress, err = strconv.ParseInt(ranges[1], 10, 64); err == nil {\n\t\t\trx.progress += 1\n\t\t\treturn\n\t\t}\n\t}\n\terr = fmt.Errorf(\"unable to parse range header: %s\", rangeString)\n\treturn\n}", "title": "" }, { "docid": "bf0190288909804eabe4145c884771a7", "score": "0.49575585", "text": "func ParseInt64OrReturnBadRequest(w http.ResponseWriter, s string) (n int64, ok bool) {\n\tvar err error\n\n\tn, err = strconv.ParseInt(s, 10, 64)\n\tif err != nil {\n\t\terr := fmt.Errorf(\"'%s' is not a valid int64\", s)\n\t\tWriteErrorResponse(w, http.StatusBadRequest, err.Error())\n\t\treturn n, false\n\t}\n\n\treturn n, true\n}", "title": "" }, { "docid": "bd5b85398115627f387183902cd461c1", "score": "0.49205396", "text": "func parseContentRange(s string) (*contentRange, error) {\n\tconst prefix = \"bytes \"\n\toffset := strings.Index(s, prefix)\n\tif offset != 0 {\n\t\treturn nil, errInvalidRange\n\t}\n\ts = s[len(prefix):]\n\n\tparts := strings.Split(s, \"/\")\n\tif len(parts) != 2 {\n\t\treturn nil, errInvalidRange\n\t}\n\n\tr := new(contentRange)\n\n\tif parts[0] == \"*\" {\n\t\tr.Start = 0\n\t\tr.End = -1\n\t} else {\n\t\toffsets := strings.Split(parts[0], \"-\")\n\t\tif len(offsets) != 2 {\n\t\t\treturn nil, errInvalidRange\n\t\t}\n\n\t\tif offset, err := strconv.ParseInt(offsets[0], 10, 64); err == nil {\n\t\t\tr.Start = offset\n\t\t} else {\n\t\t\treturn nil, errInvalidRange\n\t\t}\n\n\t\tif offset, err := strconv.ParseInt(offsets[1], 10, 64); err == nil {\n\t\t\tr.End = offset\n\t\t} else {\n\t\t\treturn nil, errInvalidRange\n\t\t}\n\n\t\t// A byte-content-range-spec with a byte-range-resp-spec whose last-\n\t\t// byte-pos value is less than its first-byte-pos value, or whose\n\t\t// instance-length value is less than or equal to its last-byte-pos value,\n\t\t// is invalid. The recipient of an invalid byte-content-range- spec MUST\n\t\t// ignore it and any content transferred along with it.\n\t\tif r.End <= r.Start {\n\t\t\treturn nil, errInvalidRange\n\t\t}\n\t}\n\n\tif parts[1] == \"*\" {\n\t\tr.Size = -1\n\t\treturn r, nil\n\t} else if size, err := strconv.ParseInt(parts[1], 10, 64); err == nil {\n\t\tr.Size = size\n\t\treturn r, nil\n\t}\n\treturn nil, errInvalidRange\n}", "title": "" }, { "docid": "f0b491d48aec5e8321a46e3f063a83a9", "score": "0.48665807", "text": "func ParseParameterToInt(r *http.Request, s string) int {\n\ti, err := strconv.Atoi(r.PostFormValue(s))\n\tif err != nil {\n\t\tpanic(&ParseError{\n\t\t\tParameter: s,\n\t\t\tError: err,\n\t\t})\n\t}\n\treturn i\n}", "title": "" }, { "docid": "ee848a61e2bcde2b0cb0bcfb3f850fdf", "score": "0.4821149", "text": "func parseContent(form url.Values) (string, error) {\n\tif _, ok := form[\"content\"]; !ok || len(form[\"content\"]) == 0 {\n\t\treturn \"\", errors.New(\"missing or empty content\")\n\t}\n\n\tvar content = form[\"content\"][0]\n\tswitch true {\n\tcase len(content) > maxContentSize:\n\t\treturn \"\", errors.New(\"content too large\")\n\t}\n\n\treturn content, nil\n}", "title": "" }, { "docid": "96da1f7d04420d49b98af81b3c573439", "score": "0.47897393", "text": "func ParseSize(s string) (Size, error) {\n\torig := s\n\tvar mul Size = 1\n\tif strings.HasPrefix(s, \"-\") {\n\t\tmul = -1\n\t\ts = s[1:]\n\t}\n\n\tsep := -1\n\tfor i, c := range s {\n\t\tif sep == -1 {\n\t\t\tif c < '0' || c > '9' {\n\t\t\t\tsep = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif sep == -1 {\n\t\treturn 0, fmt.Errorf(\"missing unit in size %s (allowed units: B, KB, MB, GB)\", orig)\n\t}\n\n\tn, err := strconv.ParseInt(s[:sep], 10, 32)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"invalid size %s\", orig)\n\t}\n\tswitch strings.ToLower(s[sep:]) {\n\tcase \"gb\":\n\t\tmul = GByte\n\tcase \"mb\":\n\t\tmul = MByte\n\tcase \"kb\":\n\t\tmul = KByte\n\tcase \"b\":\n\tdefault:\n\t\tfor _, c := range s[sep:] {\n\t\t\tif unicode.IsSpace(c) {\n\t\t\t\treturn 0, fmt.Errorf(\"invalid character %q in size %s\", c, orig)\n\t\t\t}\n\t\t}\n\t\treturn 0, fmt.Errorf(\"invalid unit in size %s (allowed units: B, KB, MB, GB)\", orig)\n\t}\n\treturn mul * Size(n), nil\n}", "title": "" }, { "docid": "996c82d2e28ad276b94da2503d21969e", "score": "0.47403607", "text": "func parseFilesize(strSize string) (string, error) {\n\tunits := []struct {\n\t\tsuffix string\n\t\tmultiplier int64\n\t}{\n\t\t{\"kb\", 1e3},\n\t\t{\"mb\", 1e6},\n\t\t{\"gb\", 1e9},\n\t\t{\"tb\", 1e12},\n\t\t{\"kib\", 1 << 10},\n\t\t{\"mib\", 1 << 20},\n\t\t{\"gib\", 1 << 30},\n\t\t{\"tib\", 1 << 40},\n\t\t{\"b\", 1}, // must be after others else it'll match on them all\n\t}\n\n\tstrSize = strings.ToLower(strings.TrimSpace(strSize))\n\tfor _, unit := range units {\n\t\tif strings.HasSuffix(strSize, unit.suffix) {\n\t\t\t// Trim spaces after removing the suffix to allow spaces between the\n\t\t\t// value and the unit.\n\t\t\tvalue := strings.TrimSpace(strings.TrimSuffix(strSize, unit.suffix))\n\t\t\tr, ok := new(big.Rat).SetString(value)\n\t\t\tif !ok {\n\t\t\t\treturn \"\", ErrParseSizeAmount\n\t\t\t}\n\t\t\tr.Mul(r, new(big.Rat).SetInt(big.NewInt(unit.multiplier)))\n\t\t\tif !r.IsInt() {\n\t\t\t\tf, _ := r.Float64()\n\t\t\t\treturn fmt.Sprintf(\"%d\", int64(f)), nil\n\t\t\t}\n\t\t\treturn r.RatString(), nil\n\t\t}\n\t}\n\n\treturn \"\", ErrParseSizeUnits\n}", "title": "" }, { "docid": "db20f7ac9ad2c13cc19fd0f6310e22f3", "score": "0.4730937", "text": "func (ar artifactRoutes) getUploadFileSize(ctx *ArtifactContext) (int64, int64, error) {\n\tcontentLength := ctx.Req.ContentLength\n\txTfsLength, _ := strconv.ParseInt(ctx.Req.Header.Get(artifactXTfsFileLengthHeader), 10, 64)\n\tif xTfsLength > 0 {\n\t\treturn xTfsLength, contentLength, nil\n\t}\n\treturn contentLength, contentLength, nil\n}", "title": "" }, { "docid": "0e6376e024792cc3f4fadfd6a2e65a5a", "score": "0.47234288", "text": "func parseCLI(s string) (Size, error) {\n\ts = strings.ToLower(s)\n\tfor suffix, size := range suffixes {\n\t\tif strings.HasSuffix(s, suffix) {\n\t\t\tx, err := parseFloat(strings.TrimSuffix(s, suffix))\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn Size(x * float64(size)), nil\n\t\t}\n\t}\n\tx, err := strconv.ParseFloat(s, 64)\n\tif err != nil || math.IsInf(x, 0) || math.IsNaN(x) {\n\t\treturn 0, fmt.Errorf(\"cannot parse %q\", s)\n\t}\n\treturn Size(x), nil\n}", "title": "" }, { "docid": "2ee971d4174f2a6b178e490be86bb664", "score": "0.47176635", "text": "func ParseFloat64OrReturnBadRequest(w http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool) {\n\tif len(s) == 0 {\n\t\treturn defaultIfEmpty, true\n\t}\n\n\tn, err := strconv.ParseFloat(s, 64)\n\tif err != nil {\n\t\tWriteErrorResponse(w, http.StatusBadRequest, err.Error())\n\t\treturn n, false\n\t}\n\n\treturn n, true\n}", "title": "" }, { "docid": "1e61eabb2e3e0978bb7d4a2b15c9ebd3", "score": "0.46865198", "text": "func (utils *utils) parseLen(p []byte) (int, error) {\n\tif len(p) == 0 {\n\t\treturn -1, protocolError(\"malformed length\")\n\t}\n\n\tif p[0] == '-' && len(p) == 2 && p[1] == '1' {\n\t\t// handle $-1 and $-1 null replies.\n\t\treturn -1, nil\n\t}\n\n\tvar n int\n\tfor _, b := range p {\n\t\tn *= 10\n\t\tif b < '0' || b > '9' {\n\t\t\treturn -1, protocolError(\"illegal bytes in length\")\n\t\t}\n\t\tn += int(b - '0')\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "a5c37057400aa7df5348e1c7d41e324e", "score": "0.4684366", "text": "func checkFileSize(file multipart.File, maxSize int) (size int64, err error) {\n\n\t//file_len, _ := file.Seek(0, os.SEEK_END)\n\t//file.Seek(0, os.SEEK_SET)\n\t//return file_len, nil\n\tvar (\n\t\tok bool\n\t\tsr sizer\n\t\tfr *os.File\n\t\tfi os.FileInfo\n\t)\n\tif sr, ok = file.(sizer); ok {\n\t\tsize = sr.Size()\n\t} else if fr, ok = file.(*os.File); ok {\n\t\tif fi, err = fr.Stat(); err != nil {\n\t\t\tutils.LogErrorf(err, \"checkFileSize()\")\n\t\t\treturn\n\t\t}\n\t\tsize = fi.Size()\n\t}\n\tif maxSize > 0 && size > int64(maxSize) {\n\t\terr = fmt.Errorf(\"Upload file size > maxSize(%d)\", maxSize)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "7ba092c6a8043ed0a583377748b1d4be", "score": "0.4675744", "text": "func parseLen(p []byte) (int, error) {\n\tif len(p) == 0 {\n\t\treturn -1, protocolError(\"malformed length\")\n\t}\n\n\tif p[0] == '-' && len(p) == 2 && p[1] == '1' {\n\t\t// handle $-1 and $-1 null replies.\n\t\treturn -1, nil\n\t}\n\n\tvar n int\n\tfor _, b := range p {\n\t\tn *= 10\n\t\tif b < '0' || b > '9' {\n\t\t\treturn -1, protocolError(\"illegal bytes in length\")\n\t\t}\n\t\tn += int(b - '0')\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "612ebbc028ddfac1b4a9a3058f3ec797", "score": "0.46757218", "text": "func ParseFloat64OrReturnBadRequest(w http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool) {\n\tif len(s) == 0 {\n\t\treturn defaultIfEmpty, true\n\t}\n\tn, err := strconv.ParseFloat(s, 64)\n\tif err != nil {\n\t\tWriteErrorResponse(w, http.StatusBadRequest, err.Error())\n\t\treturn n, false\n\t}\n\treturn n, true\n}", "title": "" }, { "docid": "4bb96ea9c712f4931abde6423662a24c", "score": "0.4666555", "text": "func ParseSeek(str string) int {\n\tregex := regexp.MustCompile(`(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+)s?)?`)\n\tif regex.MatchString(str) {\n\t\t// TO DO: is it necessary to check length on groups if MustCompile?\n\t\tgroups := regex.FindAllStringSubmatch(str, -1)\n\n\t\thours, minutes, seconds := 0, 0, 0\n\n\t\tstrH, err := strconv.ParseInt(groups[0][1], 10, 64)\n\t\tif err == nil {\n\t\t\thours = int(strH)\n\t\t}\n\n\t\tstrM, err := strconv.ParseInt(groups[0][2], 10, 64)\n\t\tif err == nil {\n\t\t\tminutes = int(strM)\n\t\t}\n\n\t\tstrS, err := strconv.ParseInt(groups[0][3], 10, 64)\n\t\tif err == nil {\n\t\t\tseconds = int(strS)\n\t\t}\n\n\t\ttotalSeek := 0\n\t\ttotalSeek += seconds\n\t\ttotalSeek += minutes * 60\n\t\ttotalSeek += hours * 60 * 60\n\n\t\treturn totalSeek\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "a75ac868bd0e5eb0e8fc12866b6d7bcf", "score": "0.46529308", "text": "func (r *Request) ContentLength() int64 {\n\t// TODO(dfc) this should support anything with a Len() int64 method.\n\tif r.Body == nil {\n\t\treturn -1\n\t}\n\tswitch b := r.Body.(type) {\n\tcase *bytes.Buffer:\n\t\treturn int64(b.Len())\n\tcase *strings.Reader:\n\t\treturn int64(b.Len())\n\tdefault:\n\t\treturn -1\n\t}\n}", "title": "" }, { "docid": "721df422010b54e8372ed4e15a6d903a", "score": "0.46405324", "text": "func ParseQueryStringToInt(r *http.Request, queryStringKey string, defaultValue int) (int, errors.EdgeX) {\n\tvar result = defaultValue\n\tvar parsingErr error\n\tvalues, ok := r.URL.Query()[queryStringKey]\n\tif ok && len(values) > 0 {\n\t\tresult, parsingErr = strconv.Atoi(strings.TrimSpace(values[0]))\n\t\tif parsingErr != nil {\n\t\t\treturn 0, errors.NewCommonEdgeXWrapper(fmt.Errorf(\"failed to parse querystring %s's value %s into integer. Error:%s\", queryStringKey, values[0], parsingErr.Error()))\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9e9ee62a3a236359e14467f9a4656f1a", "score": "0.46378028", "text": "func parseLen(p []byte) (int, error) {\n if len(p) == 0 {\n return -1, protocolError(\"malformed length\")\n }\n\n if p[0] == '-' && len(p) == 2 && p[1] == '1' {\n // handle $-1 and $-1 null replies.\n return -1, nil\n }\n\n var n int\n for _, b := range p {\n n *= 10\n if b < '0' || b > '9' {\n return -1, protocolError(\"illegal bytes in length\")\n }\n n += int(b - '0')\n }\n\n return n, nil\n}", "title": "" }, { "docid": "47b81cb59723b384e347e302dc76f453", "score": "0.46346548", "text": "func ParseRange(s string, size int64) ([]HTTPRange, error) {\n\tif s == \"\" {\n\t\treturn nil, nil // header not present\n\t}\n\tconst b = \"bytes=\"\n\tif !strings.HasPrefix(s, b) {\n\t\treturn nil, errors.New(\"invalid range\")\n\t}\n\tranges := []HTTPRange{}\n\tnoOverlap := false\n\tfor _, ra := range strings.Split(s[len(b):], \",\") {\n\t\tra = textproto.TrimString(ra)\n\t\tif ra == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\ti := strings.Index(ra, \"-\")\n\t\tif i < 0 {\n\t\t\treturn nil, errors.New(\"invalid range\")\n\t\t}\n\t\tstart, end := textproto.TrimString(ra[:i]), textproto.TrimString(ra[i+1:])\n\t\tvar r HTTPRange\n\t\tif start == \"\" {\n\t\t\t// If no start is specified, end specifies the\n\t\t\t// range start relative to the end of the file.\n\t\t\ti, err := strconv.ParseInt(end, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.New(\"invalid range\")\n\t\t\t}\n\t\t\tif i > size {\n\t\t\t\ti = size\n\t\t\t}\n\t\t\tr.Start = size - i\n\t\t\tr.Length = size - r.Start\n\t\t} else {\n\t\t\ti, err := strconv.ParseInt(start, 10, 64)\n\t\t\tif err != nil || i < 0 {\n\t\t\t\treturn nil, errors.New(\"invalid range\")\n\t\t\t}\n\t\t\tif i >= size {\n\t\t\t\t// If the range begins after the size of the content,\n\t\t\t\t// then it does not overlap.\n\t\t\t\tnoOverlap = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tr.Start = i\n\t\t\tif end == \"\" {\n\t\t\t\t// If no end is specified, range extends to end of the file.\n\t\t\t\tr.Length = size - r.Start\n\t\t\t} else {\n\t\t\t\ti, err := strconv.ParseInt(end, 10, 64)\n\t\t\t\tif err != nil || r.Start > i {\n\t\t\t\t\treturn nil, errors.New(\"invalid range\")\n\t\t\t\t}\n\t\t\t\tif i >= size {\n\t\t\t\t\ti = size - 1\n\t\t\t\t}\n\t\t\t\tr.Length = i - r.Start + 1\n\t\t\t}\n\t\t}\n\t\tranges = append(ranges, r)\n\t}\n\tif noOverlap && len(ranges) == 0 {\n\t\t// The specified ranges did not overlap with the content.\n\t\treturn nil, ErrNoOverlap\n\t}\n\treturn ranges, nil\n}", "title": "" }, { "docid": "51b23794ab9b6ae737d801204c3b86cd", "score": "0.46319515", "text": "func ParseMessageLength(buffer []byte) int {\n\tvar resplength int32\n\tresplength_buff := bytes.NewBuffer(buffer[:4])\n\terr := binary.Read(resplength_buff, binary.BigEndian, &resplength)\n\tif err != nil {\n\t\tlog.Println(\"Error parsing message length: \", err)\n\t}\n\treturn int(resplength)\n}", "title": "" }, { "docid": "1bdcd1f7879ed5ff6ae5fab7826f14f5", "score": "0.46306148", "text": "func ParseLen(p []byte) (int, error) {\n\tif len(p) == 0 {\n\t\treturn -1, ProtocolError(\"malformed length\")\n\t}\n\n\tif p[0] == '-' && len(p) == 2 && p[1] == '1' {\n\t\t// handle $-1 and $-1 null replies.\n\t\treturn -1, nil\n\t}\n\n\tvar n int\n\tfor _, b := range p {\n\t\tn *= 10\n\t\tif b < '0' || b > '9' {\n\t\t\treturn -1, ProtocolError(\"illegal bytes in length\")\n\t\t}\n\t\tn += int(b - '0')\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "9077e2d92debef62d772fc1d059bc8cb", "score": "0.46172252", "text": "func ConditionContentLengthRange(start, end uint64) PostPolicyV4Condition {\n\treturn &contentLengthRangeCondition{start, end}\n}", "title": "" }, { "docid": "a4cf849d906749532a4dfab807b10f54", "score": "0.4604785", "text": "func ParseLength(dimen string) (px int, percent float64, err error) {\n\tif dimen != \"\" {\n\t\tif strings.HasSuffix(dimen, \"%\") {\n\t\t\tdimen = strings.TrimSpace(strings.TrimSuffix(dimen, \"%\"))\n\t\t\tvar d float64\n\t\t\tif d, err = strconv.ParseFloat(dimen, 64); err == nil {\n\t\t\t\tpercent = d / 100\n\t\t\t}\n\t\t} else {\n\t\t\tdimen = strings.TrimSpace(strings.TrimSuffix(dimen, \"px\"))\n\t\t\tvar d int\n\t\t\tif d, err = strconv.Atoi(dimen); err == nil {\n\t\t\t\tpx = d\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "773a08f8b8ef8111bb87802233b37154", "score": "0.4604632", "text": "func ParseInt(s string, v int) int {\n\tif s == \"\" {\n\t\treturn v\n\t}\n\ti, err := strconv.Atoi(s)\n\tif err != nil {\n\t\ti = v\n\t}\n\treturn i\n}", "title": "" }, { "docid": "f55f6464aa2f8abf5c01331c3959dcb5", "score": "0.45653188", "text": "func asInt(s string) (int, error) {\n\tif s == \"\" {\n\t\treturn 0, nil\n\t}\n\tnum, err := strconv.Atoi(s)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn num, nil\n}", "title": "" }, { "docid": "d63ac60226d952baa0ad9153c24e454c", "score": "0.45497093", "text": "func (r *Response) ContentLength() int64 {\n\tfor _, h := range r.Headers {\n\t\tif strings.EqualFold(h.Key, \"Content-Length\") {\n\t\t\tlength, err := strconv.ParseInt(h.Value, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn int64(length)\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "1b62b03e49172a786adcbb782d0845c1", "score": "0.45486325", "text": "func parseInt(s string, bitSize int) (int64, error) {\n\tif strings.HasPrefix(s, \"0b\") {\n\t\treturn strconv.ParseInt(s[2:], 2, bitSize)\n\t}\n\treturn strconv.ParseInt(s, 0, bitSize)\n}", "title": "" }, { "docid": "0f6484090bc9c97e4eb8af9058416f38", "score": "0.45459795", "text": "func parseMaxSize(config string) (maxsize int, err error) {\n\tpair := types.ParsePair(config, \"=\")\n\tif pair.NoKey() || pair.NoValue() || pair.Key != \"maxsize\" {\n\t\terr = ErrWrongFormat\n\t} else if maxsize, err = pair.IntValue(); err != nil || maxsize <= 0 {\n\t\terr = ErrWrongFormat\n\t}\n\treturn\n}", "title": "" }, { "docid": "66533f9c61a15738263ac447af7760c5", "score": "0.4540875", "text": "func (p ParametersObject) GetContentLength() int64 {\n\treturn p.r.ContentLength\n}", "title": "" }, { "docid": "51a34393f53df3ed1a8eeae6753448aa", "score": "0.45244366", "text": "func AddContentLengthMiddleware(stack *middleware.Stack) {\n\tstack.Build.Add(&ContentLengthMiddleware{}, middleware.After)\n}", "title": "" }, { "docid": "788ec54a020bff3f3b24a148a2209346", "score": "0.45229232", "text": "func extractVal(ts string) int {\n\tval, _ := strconv.Atoi(ts[0 : len(ts)-1])\n\treturn val\n}", "title": "" }, { "docid": "d80a21c69a5ca76a1d398dc4c527374a", "score": "0.45150036", "text": "func ParseInt(s string, defaultInt int) int {\n\tif len(s) < 1 {\n\t\treturn defaultInt\n\t}\n\t//strconv.Btoi64\n\tv, err := strconv.ParseUint(s, 0, 16)\n\tif err != nil {\n\t\tlog.Errorf(\"unable to parse int from %s: %v\", s, err)\n\t\treturn defaultInt\n\t}\n\treturn int(v)\n}", "title": "" }, { "docid": "b6dbe01af26295ecb07e1ebd4a921bc3", "score": "0.45080233", "text": "func (ra *Reader) getSize() (int64, error) {\n\t// stat remote file, make sure it's seekable\n\tresp, err := ra.client.Head(ra.url)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tcls := resp.Header.Get(\"Content-Length\")\n\tif cls == \"\" {\n\t\treturn 0, fmt.Errorf(\"unseekable content\")\n\t}\n\n\tvar n int64\n\tfmt.Sscan(cls, &n)\n\treturn n, nil\n}", "title": "" }, { "docid": "90a78e8c1f5b66cf785a86d04fcdb1d7", "score": "0.4506903", "text": "func (r *httpRange) parseRange(s string) *probe.Error {\n\tif s == \"\" {\n\t\treturn probe.NewError(errors.New(\"header not present\"))\n\t}\n\tif !strings.HasPrefix(s, b) {\n\t\treturn probe.NewError(donut.InvalidRange{})\n\t}\n\n\tras := strings.Split(s[len(b):], \",\")\n\tif len(ras) == 0 {\n\t\treturn probe.NewError(errors.New(\"invalid request\"))\n\t}\n\t// Just pick the first one and ignore the rest, we only support one range per object\n\tif len(ras) > 1 {\n\t\treturn probe.NewError(errors.New(\"multiple ranges specified\"))\n\t}\n\n\tra := strings.TrimSpace(ras[0])\n\tif ra == \"\" {\n\t\treturn probe.NewError(donut.InvalidRange{})\n\t}\n\treturn r.parse(ra)\n}", "title": "" }, { "docid": "ed55fdc1e9101a7ef971d984abb44c67", "score": "0.44935033", "text": "func Size(s string) int {\n\treturn len(s)\n}", "title": "" }, { "docid": "3e1ddfd161cdb392eecef9d892ce4469", "score": "0.44922322", "text": "func ParseInt(val string, def int) int {\n\tif val == \"\" {\n\t\treturn def\n\t}\n\tif result, err := strconv.Atoi(val); err == nil {\n\t\treturn result\n\t}\n\treturn def\n}", "title": "" }, { "docid": "245efbc6f94405d3b7f9d740c09e79dc", "score": "0.44786707", "text": "func TestGetPayloadToSign_ContentLength(t *testing.T) {\n\n\t// Assert\n\trequestBody := bytes.NewBufferString(\"GRUMBYCAT\")\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.secrethub.io/repos/jdoe/catpictures\", requestBody)\n\tassert.OK(t, err)\n\treq.Header.Set(\"Date\", \"Fri, 10 Mar 2017 16:25:54 CET\")\n\n\t// Act\n\t_, err = getMessage(req)\n\tassert.OK(t, err)\n\n\t// Assert\n\tbody, err := ioutil.ReadAll(req.Body)\n\tassert.OK(t, err)\n\n\tif len(body) != int(req.ContentLength) {\n\t\tt.Fatal(\"Content-Length should equal body length.\")\n\t}\n}", "title": "" }, { "docid": "8abc1d6731e3c52639c0d1f8ac793aac", "score": "0.4462983", "text": "func parseID(r *http.Request) (id int64, err error) {\n\tstr := r.FormValue(\"id\")\n\tif str == \"\" {\n\t\terr = fmt.Errorf(\"id field is empty\")\n\t\treturn\n\t}\n\tid, err = strconv.ParseInt(str, 10, 0)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"not a number: \" + str)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "c3d316df68bccfdbb209f5453b49f16f", "score": "0.44368902", "text": "func parseMemoryString(s string) (int, error) {\n\ts = strings.TrimSpace(s)\n\n\tswitch len(s) {\n\tcase 0:\n\t\treturn 0, errors.New(\"value cannot be empty\")\n\tcase 1:\n\t\tn, err := strconv.ParseInt(s, 10, 64)\n\t\treturn int(n), err\n\tdefault:\n\t}\n\n\tswitch num, suffix := s[:len(s)-1], s[len(s)-1]; suffix {\n\tcase 'G', 'g':\n\t\treturn applyFactor(num, 1073741824)\n\tcase 'M', 'm':\n\t\treturn applyFactor(num, 1048576)\n\tcase 'K', 'k':\n\t\treturn applyFactor(num, 1024)\n\tdefault:\n\t\treturn applyFactor(num, 1)\n\t}\n}", "title": "" }, { "docid": "3b30159955d1cd2f763e90cba99a0180", "score": "0.44232732", "text": "func parseInteger(value string) (uint, error) {\n\tinteger, err := strconv.ParseFloat(value, 64)\n\treturn uint(integer), err\n}", "title": "" }, { "docid": "acc7120c13dc3fa3fe5ea28c0520d42f", "score": "0.44159818", "text": "func (f *UploadableFile) GetContentLength() int64 {\n\treturn f.contentLength\n}", "title": "" }, { "docid": "050adf15c0f8541f452f0354588be1a6", "score": "0.440359", "text": "func parsePort(host string) int {\n\n\tsplitHost := strings.Split(host, \":\")\n\n\tif len(splitHost) < 2 {\n\t\treturn 80\n\t}\n\n\thostPort, _ := strconv.Atoi(splitHost[1])\n\n\treturn hostPort\n}", "title": "" }, { "docid": "6fa0bfdbfe77a37876fb8922e669ab61", "score": "0.4399671", "text": "func TestParseInt(t *testing.T) {\n\n s := bufio.NewScanner(bytes.NewReader([]byte{' ', '1', '2', '3', '\\t'}))\n s.Split(bufio.ScanWords)\n\n if n, err := parseInt(s); err != nil {\n panic(err)\n } else if n != 123 {\n t.Errorf(\"Expected 123, got %d.\", n)\n }\n}", "title": "" }, { "docid": "e15c812fbdf05990bf4e66fe8784f64c", "score": "0.43965846", "text": "func ParseStringInt(data string) (int, error) {\n\tv, err := strconv.ParseInt(data, 10, 32)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn int(v), nil\n}", "title": "" }, { "docid": "fb37105cfb7a24c3c94c0f142ab9b80a", "score": "0.43944842", "text": "func ParseDimensionsEmpty(s string) (int, int, error) {\n\tsplit := strings.Split(s, \"x\")\n\tif len(split) != 2 {\n\t\treturn -1, -1, fmt.Errorf(\"Invalid dimension format: %s. Expect \\\"AxB\\\"\", s)\n\t}\n\tfirst, second := strings.TrimSpace(split[0]), strings.TrimSpace(split[1])\n\tfirstInt, secondInt := -1, -1\n\tvar parseErr error\n\t// now parse both ints, but only if not empty\n\tif len(first) > 0 {\n\t\tfirstInt, parseErr = strconv.Atoi(first)\n\t\tif parseErr != nil {\n\t\t\treturn -1, -1, parseErr\n\t\t}\n\t\tif firstInt < 0 {\n\t\t\treturn -1, -1, fmt.Errorf(\"Dimensions must be positive, got %d\", firstInt)\n\t\t}\n\t}\n\n\tif len(second) > 0 {\n\t\tsecondInt, parseErr = strconv.Atoi(second)\n\t\tif parseErr != nil {\n\t\t\treturn -1, -1, parseErr\n\t\t}\n\t\tif secondInt < 0 {\n\t\t\treturn -1, -1, fmt.Errorf(\"Dimensions must be positive, got %d\", secondInt)\n\t\t}\n\t}\n\treturn firstInt, secondInt, nil\n}", "title": "" }, { "docid": "6037373ef7fe386efd9f4b54e97efedf", "score": "0.43786466", "text": "func FormGetParamAsInt(request *http.Request, name string, defaultValue int) int {\n \tv := request.Form.Get(name)\n \tif v != \"\" {\n \t\t// param found\n\t i, err := strconv.Atoi(v)\n\t\tif err != nil {\n\t\t panic(err)\n\t\t}\n\t return i\n \t} \n \treturn defaultValue\n}", "title": "" }, { "docid": "2455c65ebc23d7be2d78ff968544dad6", "score": "0.43771148", "text": "func argParse(arg string) int {\n\tres, err := strconv.Atoi(arg)\n\tcheck(err)\n\treturn res\n}", "title": "" }, { "docid": "53377bac303d011d6c88aea389d6c49e", "score": "0.4376111", "text": "func parseIOSizes(sizes string) ([]int, error) {\n\tvar res []int\n\tfor _, s := range strings.Split(sizes, \",\") {\n\t\tn, err := strconv.Atoi(s)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tioSize := n * 1024\n\t\tif ioSize > maxIOSize {\n\t\t\treturn nil, errors.Errorf(\"IO sizes over %d not supported\", maxIOSize)\n\t\t}\n\t\tif maxIOSize%ioSize != 0 {\n\t\t\treturn nil, errors.Errorf(\"IO size must be a divisor of %d\", maxIOSize)\n\t\t}\n\t\tres = append(res, ioSize)\n\t}\n\tif len(res) == 0 {\n\t\treturn nil, errors.Errorf(\"no IO sizes specified\")\n\t}\n\tsort.Ints(res)\n\treturn res, nil\n}", "title": "" }, { "docid": "823b8e79d14029bf790463e64ae50ce3", "score": "0.4364595", "text": "func ParseInt(fl string) (int, bool) {\n\tif intdigits.MatchString(fl) {\n\t\tfll, _ := strconv.Atoi(DigitsOnly(fl))\n\t\treturn fll, true\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "5ffc36bd444b4ace63a62ca1ebede666", "score": "0.4362776", "text": "func getPartSize(s string) string {\n\tvar (\n\t\tok bool\n\t\tsize = defaultPartSize\n\t\tsubstring string\n\t)\n\tsubstring = regexpMatchSize.FindString(s)\n\tsubstring = strings.ToLower(substring)\n\tok = (len(substring) > 0)\n\tif ok {\n\t\tsize = partShapeMap[substring]\n\t}\n\treturn size\n}", "title": "" }, { "docid": "b13ae1ab291e66c30f0c9f1e317da9ed", "score": "0.43574557", "text": "func parseResponseBody(resBody io.Reader) ([]byte, error) {\n\tcontent, err := ioutil.ReadAll(resBody)\n\tif err != nil {\n\t\treturn nil, err\t\n\t}\n\t\n\tlength := binary.BigEndian.Uint32(content[1:5])\n\tif length == 0 {\n\t\treturn nil, nil\n\t}\n\t\n\tif len(content) < int(length) {\n\t\tfmt.Printf(\"len(content)=%d, expected=%d\\n\", len(content), int(length))\n\t\treturn nil, io.ErrUnexpectedEOF\n\t}\n\t\n\treturn content[5:5+int(length)], nil\n\t/*\n\tvar h [5]byte\n\tif _, err := resBody.Read(h[:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlength := binary.BigEndian.Uint32(h[1:])\n\tif length == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// TODO: check message size\n\tcontent, err := ioutil.ReadAll(resBody)\n\tif len(content) != int(length) {\n\t\tfmt.Printf(\"len(content)=%d, expected=%d\\n\", len(content), int(length))\n\t\treturn nil, io.ErrUnexpectedEOF\n\t}\n\n\treturn content, err\n\t*/\n}", "title": "" }, { "docid": "ac68d8c7fc7e2d111778604fb37fc1b6", "score": "0.4356828", "text": "func getContentLengthFromHeadRangeRequest(origin_url string, port int) int64 {\n\n\tclient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\t//set compression off\n\t\t\tDisableCompression: true,\n\t\t\t//set keepalive on\n\t\t\tDisableKeepAlives: false,\n\t\t\tDial: func(netw, addr string) (net.Conn, error) {\n\t\t\t\t//localaddr := \"10.10.100.33\" + \":\" + strconv.Itoa(port) //Fixme\n\t\t\t\tlocaladdr := \"127.0.0.1\" + \":\" + strconv.Itoa(port) //Fixme\n\t\t\t\t//localaddr := \"127,0.0.1:80\" //Fixme\n\t\t\t\trAddr, err := net.ResolveTCPAddr(netw, localaddr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tconn, err := net.DialTCP(netw, nil, rAddr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tdeadline := time.Now().Add(5 * time.Second)\n\t\t\t\tconn.SetDeadline(deadline)\n\t\t\t\treturn conn, nil\n\t\t\t},\n\t\t},\n\t}\n\n\trequest, err := http.NewRequest(\"HEAD\", origin_url, nil)\n\t//Fixme\n\trequest.Header.Set(\"Range\", \"bytes=0-1048575\")\n\n\tif err != nil {\n\t\treturn int64(0)\n\t}\n\n\tresponse, _ := client.Do(request)\n\tif response == nil {\n\t\tlog.Println(\"HEAD response nil\")\n\t\treturn int64(0)\n\t}\n\tdefer response.Body.Close() //must close resp.Body\n\n\tif response.StatusCode == 206 {\n\t\tcr := response.Header.Get(\"Content-Range\")\n\t\tcl := cr[strings.Index(cr, \"/\")+1:]\n\t\tsourceSize, _ := strconv.Atoi(cl)\n\t\treturn int64(sourceSize)\n\t}\n\n\treturn int64(0)\n}", "title": "" }, { "docid": "605727143cf76877d96a947a18783198", "score": "0.43552443", "text": "func ParseMaxAge(header string) int64 {\n\tif header == \"\" {\n\t\treturn -1\n\t}\n\tm := maxAgeExp.FindStringSubmatch(header)\n\tif len(m) == 2 {\n\t\tif v, err := strconv.Atoi(m[1]); err == nil {\n\t\t\treturn int64(v)\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "9761c759835897e77aa54e25ff5f28d6", "score": "0.43552354", "text": "func parseCmdSize(rd *bufio.Reader, prefix uint8) (int, error) {\n\t// get command size\n\tcs, err := rd.ReadBytes('\\n')\n\tif err != nil {\n\t\tlog.Debug(\"received:%d %s\",rd.Buffered(),rd)\n\t\tlog.Error(\"tcp:rd.ReadBytes('\\\\n') error(%v)\", err)\n\t\treturn 0, err\n\t}\n\tcsl := len(cs)\n\tif csl <= 3 || cs[0] != prefix || cs[csl-2] != '\\r' {\n\t\tlog.Error(\"tcp:\\\"%v\\\"(%d) number format error, length error or prefix error or no \\\\r\", cs, csl)\n\t\treturn 0, ErrProtocol\n\t}\n\t// skip the \\r\\n\n\tcmdSize, err := strconv.Atoi(string(cs[1 : csl-2]))\n\tif err != nil {\n\t\tlog.Error(\"tcp:\\\"%v\\\" number parse int error(%v)\", cs, err)\n\t\treturn 0, ErrProtocol\n\t}\n\treturn cmdSize, nil\n}", "title": "" }, { "docid": "309b60e90a3e00794d4107e8a4f93ef7", "score": "0.43522525", "text": "func ParseRelativeSize(str string) (size RelativeSize, err error) {\n\t// Remove all the whitespace from the string\n\tstrMod := strings.Map(func(r rune) rune {\n\t\tif unicode.IsSpace(r) {\n\t\t\treturn -1\n\t\t}\n\t\treturn r\n\t}, str)\n\t// Convert the string to lowercase\n\tstrMod = strings.ToLower(strMod)\n\t// If the string is equal to \"match_parent\"\n\tif strMod == \"match_parent\" {\n\t\tsize.MatchParent = true\n\t\treturn size, nil\n\t}\n\t// If the string is equal to \"match_content\"\n\tif strMod == \"match_content\" {\n\t\tsize.MatchContent = true\n\t\treturn size, nil\n\t}\n\t// If the string is equal to \"match_bounds\"\n\tif strMod == \"match_bounds\" {\n\t\tsize.MatchBounds = true\n\t\treturn size, nil\n\t}\n\n\t// Otherwise convert it to a relative quantity\n\tquantity, err := ParseRelativeQuantity(strMod)\n\tif err != nil {\n\t\treturn RelativeSize{}, err\n\t}\n\treturn RelativeSize{RelativeQuantity: quantity}, nil\n}", "title": "" }, { "docid": "389afa8a1ffea0b5342f6a6f6447a745", "score": "0.434009", "text": "func parseInteger(part Ex) (value int64, isInteger bool) {\n\tinteger, isInteger := part.(*Integer)\n\tif isInteger {\n\t\treturn integer.Val.Int64(), true\n\t} else {\n\t\treturn 0, false\n\t}\n}", "title": "" }, { "docid": "b388240686b513e262cb6a26cabe476e", "score": "0.43394294", "text": "func parseRange(s string) (i int64, j int64, ok bool) {\n\tn := strings.Index(s, \"..\")\n\tif n < 0 {\n\t\treturn 0, 0, false\n\t}\n\n\tif n == 0 {\n\t\ti = -1\n\t} else if i = parseNumber(s[:n]); i < 0 {\n\t\treturn 0, 0, false\n\t}\n\n\t// Look for \"i..j\" versus \"i..=j\".\n\teq := 0\n\tif (n+2 < len(s)) && (s[n+2] == '=') {\n\t\teq = 1\n\t}\n\n\tif n+2+eq >= len(s) {\n\t\tif eq > 0 {\n\t\t\treturn 0, 0, false\n\t\t}\n\t\tj = -1\n\t} else if j = parseNumber(s[n+2+eq:]); j < 0 {\n\t\treturn 0, 0, false\n\t} else {\n\t\tj += int64(eq)\n\t\tif j < 0 {\n\t\t\treturn 0, 0, false\n\t\t}\n\t}\n\n\tif (i >= 0) && (j >= 0) && (i > j) {\n\t\treturn 0, 0, false\n\t}\n\treturn i, j, true\n}", "title": "" }, { "docid": "386bfad225c54872f2900c796d08d137", "score": "0.43386295", "text": "func getPartSize(config map[string]string) (val int64, err error) {\n\tpartSize, ok := config[MultiPartChunkSize]\n\tif !ok {\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = errors.Errorf(\"failed to parse '%s'\", partSize)\n\t\t}\n\t}()\n\n\td := resource.MustParse(partSize)\n\tval = d.Value()\n\n\tif val < s3manager.MinUploadPartSize {\n\t\terr = errors.Errorf(\"multiPartChunkSize should be more than %v\", s3manager.MinUploadPartSize)\n\t}\n\treturn\n}", "title": "" }, { "docid": "38aea8bf827ed28aa7273b3f202aa00e", "score": "0.43332797", "text": "func GetLength(string string) int {\n return (0)\n}", "title": "" }, { "docid": "99aef2090c9980bbf1edbf31c53f7bb1", "score": "0.4318545", "text": "func getSize(input io.Reader) (int, error) {\n\tvar buf [2]byte\n\t_, err := io.ReadFull(input, buf[0:2])\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tret := int(buf[0])<<8 + int(buf[1]) - 2\n\tif ret < 0 {\n\t\treturn ret, errors.New(\"invalid segment length\")\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "7108be44e673d5864dbf2c838c0c2184", "score": "0.43160895", "text": "func readLength(r io.ByteReader, max int) (int, error) {\n\tsize, _, err := readUvarint(r)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif size > maxInt {\n\t\treturn 0, errors.New(\"integer overflow\")\n\t}\n\n\tmsize := int(size)\n\tif max > 0 && msize > max {\n\t\treturn 0, errors.New(\"message too large\")\n\t}\n\treturn msize, nil\n}", "title": "" }, { "docid": "012c6175f167f644e967a7362fa23f4c", "score": "0.43141073", "text": "func ParseLengthAndMagic(bytes []byte, exptectedMagic uint32) (int, []byte, error) {\n\tlength := binary.LittleEndian.Uint32(bytes)\n\tmagic := binary.LittleEndian.Uint32(bytes[4:])\n\tif int(length) > len(bytes) {\n\t\treturn 0, bytes, fmt.Errorf(\"invalid length in header: %d but only received: %d bytes\", length, len(bytes))\n\t}\n\tif magic != exptectedMagic {\n\t\tunknownMagic := string(bytes[4:8])\n\t\treturn 0, nil, fmt.Errorf(\"unknown magic type:%s (0x%x), cannot parse value %s\", unknownMagic, magic, hex.Dump(bytes))\n\t}\n\treturn int(length), bytes[8:], nil\n}", "title": "" }, { "docid": "9234d8a252176b34395cafb901a3e4e3", "score": "0.4313353", "text": "func length(s string) time.Duration {\n\td, err := time.ParseDuration(s)\n\tif err != nil {\n\t\tpanic(s)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "7ae85b8660b13d585657cc4d5656485b", "score": "0.43046355", "text": "func ParseInt(v interface{}) (int64, bool) {\n\tswitch v0 := v.(type) {\n\tcase int:\n\t\treturn int64(v0), true\n\tcase int32:\n\t\treturn int64(v0), true\n\tcase int64:\n\t\treturn int64(v0), true\n\tcase uint:\n\t\treturn int64(v0), true\n\tcase uint32:\n\t\treturn int64(v0), true\n\tcase uint64:\n\t\treturn int64(v0), true\n\tcase float64:\n\t\treturn int64(v0), true\n\tcase float32:\n\t\treturn int64(v0), true\n\tdefault:\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "7ae85b8660b13d585657cc4d5656485b", "score": "0.43046355", "text": "func ParseInt(v interface{}) (int64, bool) {\n\tswitch v0 := v.(type) {\n\tcase int:\n\t\treturn int64(v0), true\n\tcase int32:\n\t\treturn int64(v0), true\n\tcase int64:\n\t\treturn int64(v0), true\n\tcase uint:\n\t\treturn int64(v0), true\n\tcase uint32:\n\t\treturn int64(v0), true\n\tcase uint64:\n\t\treturn int64(v0), true\n\tcase float64:\n\t\treturn int64(v0), true\n\tcase float32:\n\t\treturn int64(v0), true\n\tdefault:\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "7ae85b8660b13d585657cc4d5656485b", "score": "0.43046355", "text": "func ParseInt(v interface{}) (int64, bool) {\n\tswitch v0 := v.(type) {\n\tcase int:\n\t\treturn int64(v0), true\n\tcase int32:\n\t\treturn int64(v0), true\n\tcase int64:\n\t\treturn int64(v0), true\n\tcase uint:\n\t\treturn int64(v0), true\n\tcase uint32:\n\t\treturn int64(v0), true\n\tcase uint64:\n\t\treturn int64(v0), true\n\tcase float64:\n\t\treturn int64(v0), true\n\tcase float32:\n\t\treturn int64(v0), true\n\tdefault:\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "5b82b8e40d0f8a5dfd29e67b8aae9e2b", "score": "0.43045625", "text": "func (c *conn) parseTimeString(s0 string, x int) (interface{}, bool) {\n\ts := s0\n\tif x > 0 {\n\t\ts = s[:x] // \"2006-01-02 15:04:05.999999999 -0700 MST m=+9999\" -> \"2006-01-02 15:04:05.999999999 -0700 MST \"\n\t}\n\ts = strings.TrimSpace(s)\n\tif t, err := time.Parse(\"2006-01-02 15:04:05.999999999 -0700 MST\", s); err == nil {\n\t\treturn t, true\n\t}\n\n\treturn s0, false\n}", "title": "" }, { "docid": "c147295ec6e07605615f79d9f31cb74a", "score": "0.4300186", "text": "func GetSize(f multipart.File) (int, error) {\n\tcontent, err := ioutil.ReadAll(f)\n\n\treturn len(content), err\n}", "title": "" }, { "docid": "b0ab5d78b5a652a87b974caba252914d", "score": "0.42989215", "text": "func Size(s int) bool {\n\tif s >= 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d415233b8093185b3b517bda61125e7c", "score": "0.42979097", "text": "func parseDuration(input string) (int64, int32, bool) {\n\tb := []byte(input)\n\tsize := len(b)\n\tif size < 2 {\n\t\treturn 0, 0, false\n\t}\n\tif b[size-1] != 's' {\n\t\treturn 0, 0, false\n\t}\n\tb = b[:size-1]\n\n\t// Read optional plus/minus symbol.\n\tvar neg bool\n\tswitch b[0] {\n\tcase '-':\n\t\tneg = true\n\t\tb = b[1:]\n\tcase '+':\n\t\tb = b[1:]\n\t}\n\tif len(b) == 0 {\n\t\treturn 0, 0, false\n\t}\n\n\t// Read the integer part.\n\tvar intp []byte\n\tswitch {\n\tcase b[0] == '0':\n\t\tb = b[1:]\n\n\tcase '1' <= b[0] && b[0] <= '9':\n\t\tintp = b[0:]\n\t\tb = b[1:]\n\t\tn := 1\n\t\tfor len(b) > 0 && '0' <= b[0] && b[0] <= '9' {\n\t\t\tn++\n\t\t\tb = b[1:]\n\t\t}\n\t\tintp = intp[:n]\n\n\tcase b[0] == '.':\n\t\t// Continue below.\n\n\tdefault:\n\t\treturn 0, 0, false\n\t}\n\n\thasFrac := false\n\tvar frac [9]byte\n\tif len(b) > 0 {\n\t\tif b[0] != '.' {\n\t\t\treturn 0, 0, false\n\t\t}\n\t\t// Read the fractional part.\n\t\tb = b[1:]\n\t\tn := 0\n\t\tfor len(b) > 0 && n < 9 && '0' <= b[0] && b[0] <= '9' {\n\t\t\tfrac[n] = b[0]\n\t\t\tn++\n\t\t\tb = b[1:]\n\t\t}\n\t\t// It is not valid if there are more bytes left.\n\t\tif len(b) > 0 {\n\t\t\treturn 0, 0, false\n\t\t}\n\t\t// Pad fractional part with 0s.\n\t\tfor i := n; i < 9; i++ {\n\t\t\tfrac[i] = '0'\n\t\t}\n\t\thasFrac = true\n\t}\n\n\tvar secs int64\n\tif len(intp) > 0 {\n\t\tvar err error\n\t\tsecs, err = strconv.ParseInt(string(intp), 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, 0, false\n\t\t}\n\t}\n\n\tvar nanos int64\n\tif hasFrac {\n\t\tnanob := bytes.TrimLeft(frac[:], \"0\")\n\t\tif len(nanob) > 0 {\n\t\t\tvar err error\n\t\t\tnanos, err = strconv.ParseInt(string(nanob), 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, 0, false\n\t\t\t}\n\t\t}\n\t}\n\n\tif neg {\n\t\tif secs > 0 {\n\t\t\tsecs = -secs\n\t\t}\n\t\tif nanos > 0 {\n\t\t\tnanos = -nanos\n\t\t}\n\t}\n\treturn secs, int32(nanos), true\n}", "title": "" }, { "docid": "941a1e07db3aed1eb19821d7bfb3fe85", "score": "0.42944473", "text": "func ParseBytes(bytes int) (int, error) {\n\tif bytes < 0 {\n\t\treturn 0, errors.New(\"bytes can not be negative\")\n\t}\n\treturn bytes, nil\n}", "title": "" }, { "docid": "b60c2977479a3d0f5050df4ad1911750", "score": "0.42930913", "text": "func MustParseStringInt(data string) int {\n\tvalue, err := ParseStringInt(data)\n\tif err != nil {\n\t\tlogPanic(\"int\", data, err)\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "e156d6334c373f65212a973d1ce8899f", "score": "0.42869118", "text": "func getInt64RequestParam(r *http.Request, name string, defaultVal int64) (int64, bool) {\r\n\r\n\tv := r.URL.Query().Get(name)\r\n\tif v == \"\" {\r\n\t\tv = vestigo.Param(r, name)\r\n\t}\r\n\tif v == \"\" {\r\n\t\treturn defaultVal, true // no such parameter: return defult value\r\n\t}\r\n\tif nVal, err := strconv.ParseInt(v, 0, 64); err == nil {\r\n\t\treturn nVal, true // return result: value is integer\r\n\t}\r\n\treturn defaultVal, false // value is not integer\r\n}", "title": "" }, { "docid": "96d064e3a358f5c8e26debe08b9f89a9", "score": "0.42793906", "text": "func size(s string) (int, int) {\n\tmaxWidth := 0\n\tmaxHeight := 0\n\tlineCounter := 0\n\tfor _, line := range strings.Split(s, \"\\n\") {\n\t\tif len(line) > maxWidth {\n\t\t\tmaxWidth = len(line)\n\t\t}\n\t\tlineCounter++\n\t}\n\tif lineCounter > maxHeight {\n\t\tmaxHeight = lineCounter\n\t}\n\treturn maxWidth, maxHeight\n}", "title": "" }, { "docid": "cac28bdf422f7a7e58e1caba3a5d7b22", "score": "0.42776448", "text": "func parseToLen(p []byte) (int, error) {\n\tif len(p) == 0 {\n\t\treturn -1, protocolError(\"malformed length\")\n\t}\n\n\tif p[0] == '-' && len(p) == 2 && p[1] == '1' {\n\t\t// handle $-1 and $-1 null replies.\n\t\treturn -1, nil\n\t}\n\n\tvar n int\n\tfor _, b := range p {\n\t\tn *= 10\n\t\tif b < '0' || b > '9' {\n\t\t\treturn -1, protocolError(\"illegal bytes in length\")\n\t\t}\n\t\tn += int(b - '0')\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "bfb6e20b11ced1876abfde82ad0c9d34", "score": "0.42753658", "text": "func FindSafeTruncationSize(source io.ReaderAt, endOffset int64) (int64, error) {\n\t// Create a new iterator\n\tnext := NewEntryStreamIterator(source, 0, endOffset)\n\n\t// Iterate once to the first entry\n\titeratorResult, err := next()\n\n\t// If the stream ended unecpectedly\n\tif err == io.ErrUnexpectedEOF {\n\t\t// Return a truncation size of 0 with no error\n\t\treturn 0, nil\n\t} else if err != nil { // Othewise, if some other error occurred\n\t\t// Return the error with a truncation size of the end offset\n\t\treturn endOffset, err\n\t}\n\n\t// If the first entry is empty\n\tif iteratorResult == nil {\n\t\t// Return a truncation size of 0\n\t\treturn 0, nil\n\t}\n\n\t// Verify the head entry's checksums\n\terr = iteratorResult.VerifyAllChecksums()\n\n\t// If the checksum verification failed\n\tif err == ErrCorruptedEntry {\n\t\t// Return a truncation size of 0\n\t\treturn 0, nil\n\t} else if err != nil { // If some other error occurred\n\t\t// Return the error and the end offset as truncation size\n\t\treturn endOffset, err\n\t}\n\n\t// If the first entry isn't a valid head entry\n\t// (Note that since the checksum verification passed this failing would be a very strange situation)\n\terr = iteratorResult.VerifyValidHeadEntry()\n\n\tif err == ErrInvalidHeadEntry {\n\t\t// Return a truncation size of 0\n\t\treturn 0, nil\n\t} else if err != nil { // If some other error occurred\n\t\t// Return the error and the end offset as truncation size\n\t\treturn endOffset, err\n\t}\n\n\t// Read the head entry's value\n\theadEntryValueBytes, err := iteratorResult.ReadValue()\n\n\t// If reading the value failed\n\tif err != nil {\n\t\t// Return the error and the end offset as truncation size\n\t\treturn endOffset, err\n\t}\n\n\t// Deserialize the head entry's value\n\theadEntryValue := DeserializeHeadEntryValue(headEntryValueBytes)\n\n\t// The initial truncation size would now be set to the end of the head entry\n\ttruncationSize := int64(HeadEntrySize)\n\n\t// Iterate over the rest of the entries in the datastore\n\tfor {\n\t\t// Iterate to the next entry\n\t\titeratorResult, err = next()\n\n\t\t// If an error occurred while iterating\n\t\tif err != nil {\n\t\t\t// If the error was an unexpected end of stream\n\t\t\tif err == io.ErrUnexpectedEOF {\n\t\t\t\t// Return the current truncation size\n\t\t\t\treturn truncationSize, nil\n\t\t\t} else { // If some other error occurred\n\t\t\t\t// Return the error with the original end offset as truncation size\n\t\t\t\t// (there is no way to know what caused the error, it could be a disk or OS error)\n\t\t\t\treturn endOffset, err\n\t\t\t}\n\t\t}\n\n\t\t// If the iterator result is empty\n\t\tif iteratorResult == nil {\n\t\t\t// Return the current truncation size\n\t\t\treturn truncationSize, nil\n\t\t}\n\n\t\t// Verify the checksums for the entry\n\t\terr = iteratorResult.VerifyAllChecksums()\n\n\t\t// If the checksums failed\n\t\tif err == ErrCorruptedEntry {\n\t\t\t// Return the current truncation size\n\t\t\treturn truncationSize, nil\n\t\t} else if err != nil { // If some other error occurred\n\t\t\t// Return the error with the original end offset as truncation size\n\t\t\t// (there is no way to know what caused the error, it could be a disk or OS error)\n\t\t\treturn endOffset, err\n\t\t}\n\n\t\t// If the current entry either has a transaction end flag,\n\t\t// or happened before or at the time datastore was last compacted\n\t\tif iteratorResult.HasTransactionEndFlag() ||\n\t\t\titeratorResult.CommitTime() <= headEntryValue.LastCompactionTime {\n\t\t\t// Set the truncation size to its end offset\n\t\t\ttruncationSize = iteratorResult.EndOffset()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a4c09c4de9a7b7f1784d2423684f24d8", "score": "0.4274913", "text": "func TestParseSuccess(t *testing.T) {\n\tid, err := parsePathParamInt(\"/path/345\", \"/path/\")\n\tif err != nil || id != 345 {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "20ebcd82f584c936789f9eeb057bdb77", "score": "0.4273337", "text": "func mustParseInt(str string, base, bitSize int) int64 {\n\trv, err := strconv.ParseInt(str, base, bitSize)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn rv\n}", "title": "" }, { "docid": "c7ecbbeac7aadeb5f6cf5854b1789636", "score": "0.42539003", "text": "func sizeFromName(s string) uint64 {\n\tvar v datasize.ByteSize\n\text := path.Ext(s)\n\text = strings.TrimPrefix(ext, \".\")\n\tif err := v.UnmarshalText([]byte(ext)); err == nil {\n\t\tif v := v.Bytes(); v > 0 {\n\t\t\treturn v\n\t\t}\n\t}\n\n\ts = strings.TrimSuffix(path.Base(s), path.Ext(s))\n\n\tif err := v.UnmarshalText([]byte(s)); err == nil {\n\t\tif v := v.Bytes(); v > 0 {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn 1 << 10\n}", "title": "" }, { "docid": "9b4fb285013360e0b568c1ee679a4648", "score": "0.4253757", "text": "func (body *HTTPBody) Int() (int, error) {\n\ts, err := body.String()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tn, err := strconv.ParseInt(s, 0, 0)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn int(n), nil\n}", "title": "" }, { "docid": "fc70fb59cb7cf168ad64c893941dfa5d", "score": "0.4236109", "text": "func ParseInt(s string, base int, bitSize int) (i int64, err error) {\n\treturn strconv.ParseInt(FoldDigits(s), base, bitSize)\n}", "title": "" }, { "docid": "069774b3797d72069f9c624bbfbcf8fb", "score": "0.42326933", "text": "func GetLength(url string) (ret int64, err error) {\n\treturn DefaultFS.GetLength(url)\n}", "title": "" } ]
5468cbb3ce3852abd7bcc868d25c2b72
String implements the sql.Node interface.
[ { "docid": "a5235e444e2a3effb3d6f20e261f1c8f", "score": "0.0", "text": "func (s *ShowCreateEvent) String() string {\n\treturn fmt.Sprintf(\"SHOW CREATE EVENT %s\", s.Event.Name)\n}", "title": "" } ]
[ { "docid": "ff985492ba7db4ddd6cd9e271c187f3c", "score": "0.75438315", "text": "func (n *Node) String() string {\n\tvar l, r string\n\tif n.lChild != nil {\n\t\tl = (*n.lChild).String()\n\t}\n\tif n.rChild != nil {\n\t\tr = (*n.rChild).String()\n\t}\n\ts := fmt.Sprintf(\"{ %s %s %s }\", l, n.expression.String(), r)\n\treturn s\n}", "title": "" }, { "docid": "77eca2caf0470a271a6892f3b5b51516", "score": "0.7416405", "text": "func (t NodeID) String() string {\n\treturn string(t)\n}", "title": "" }, { "docid": "27c0b1f93289b894b360e9de8459f5a7", "score": "0.7357352", "text": "func (node *_Node) String() string {\n\treturn node.name\n}", "title": "" }, { "docid": "5ac72e5cd7a62ad52ef178ace69f241f", "score": "0.7334394", "text": "func (t TextNode) String() string { return fmt.Sprintf(\"%#v\", t) }", "title": "" }, { "docid": "fc1e4669592b46143e711c6ecc7e869e", "score": "0.7222289", "text": "func (n *Node) String() string {\n\treturn n.node.String()\n}", "title": "" }, { "docid": "2a02d8687556c949397819ad77b5403a", "score": "0.71639436", "text": "func (n *node) String() string {\n\treturn n.body\n}", "title": "" }, { "docid": "00e5caad1c868f42f95badf95af6fcce", "score": "0.711372", "text": "func (n Node) String() string {\n\treturn fmt.Sprintf(\"storage_name: %s, address: %s\", n.Storage, n.Address)\n}", "title": "" }, { "docid": "426160b8d74e5b076e3cde9f90ee1fac", "score": "0.7110457", "text": "func (n Node) String() string {\n\tb, _ := json.Marshal(&n)\n\treturn string(b)\n}", "title": "" }, { "docid": "8fd896616cfa8b4b7addc781e132a180", "score": "0.70890516", "text": "func (me TNodeType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "d4d6748370bfa367312a6c97d8a353f5", "score": "0.7028771", "text": "func (n *Nodes) String() string {\r\n\treturn fmt.Sprintf(\"%s\", *n)\r\n}", "title": "" }, { "docid": "15f245b7827677359bcf75f8daaadf5e", "score": "0.7019476", "text": "func (b BlockQuoteNode) String() string { return fmt.Sprintf(\"%#v\", b) }", "title": "" }, { "docid": "fdaf5a1528d9a5815af44d86e2b2e02c", "score": "0.70090544", "text": "func (node *Expression) String() string {\n\treturn fmt.Sprintf(\"Expr{Path:%s, Pos:%d}\", node.Path, node.Loc.Pos)\n}", "title": "" }, { "docid": "61daba3449c02f3f765e20ce493f3e83", "score": "0.69944936", "text": "func (n *Node) String() {\n\tfmt.Println(\"Stringify\")\n\tstringify(n, 0)\n}", "title": "" }, { "docid": "17dcf92d07c99b1a26ec95207c480fbc", "score": "0.6966441", "text": "func (node *Node) String() string {\n\tcolor := \"B\"\n\tif node.red == true {\n\t\tcolor = \"R\"\n\t}\n\n\treturn fmt.Sprintf(\"%v,%s\", node.Value, color)\n}", "title": "" }, { "docid": "d1540a33f023b6a20de99d9c300d476a", "score": "0.6966408", "text": "func (t TitleNode) String() string { return fmt.Sprintf(\"%#v\", t) }", "title": "" }, { "docid": "2b2679034d56240da2ba3da7b1e258fa", "score": "0.6961929", "text": "func (self *Statement) String() string {\n\treturn self.handle.sqlSql();\n}", "title": "" }, { "docid": "a63fa34cb24da58af83ad4036baf882e", "score": "0.69247836", "text": "func (a AdornmentNode) String() string { return fmt.Sprintf(\"%#v\", a) }", "title": "" }, { "docid": "38db6c9df282ed7fb751e0d083b803ff", "score": "0.68971455", "text": "func (vt NodeType) String() string {\n\treturn string(vt)\n}", "title": "" }, { "docid": "5f07a496c193aa9286d09c3803b8df9a", "score": "0.68788373", "text": "func (node *ContentStatement) String() string {\n\treturn fmt.Sprintf(\"Content{Value:'%s', Pos:%d}\", node.Value, node.Loc.Pos)\n}", "title": "" }, { "docid": "8590c4b58d042e0143fe9d2df313e243", "score": "0.6844096", "text": "func (c ColumnElem) String() string {\n\tcompiled, _ := c.Compile(&defaultDialect{}, Params())\n\treturn compiled\n}", "title": "" }, { "docid": "5d9a06db18d2798ba47661cd41af8378", "score": "0.6827447", "text": "func (node *StringLiteral) String() string {\n\treturn fmt.Sprintf(\"String{Value:'%s', Pos:%d}\", node.Value, node.Loc.Pos)\n}", "title": "" }, { "docid": "fad5cbc5ffc166b647191e5ec66d0414", "score": "0.6815133", "text": "func (n *Node) String() string {\n\ts := fmt.Sprintf(` <node id=\"%d\" timestamp=\"%s\" uid=\"%d\" user=\"%s\" visible=\"%t\" version=\"%d\" changeset=\"%d\" lat=\"%f\" lon=\"%f\"`,\n\t\tn.Id_, n.Timestamp_.Format(time.RFC3339), n.User_.Id, n.User_.Name, n.Visible_,\n\t\tn.Version_, n.Changeset_, n.Position_.Lat, n.Position_.Lon)\n\tt := n.Tags_.String()\n\tif t == \"\" {\n\t\treturn s + \" />\\n\"\n\t}\n\treturn s + \">\\n\" + t + \" </node>\\n\"\n}", "title": "" }, { "docid": "72e3a56b7348789fe5151c4caf1bd11d", "score": "0.68062097", "text": "func (s CodeGenNode) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f15f25e947196d65fdabb2db39e2e629", "score": "0.6777202", "text": "func (o *BSTNode) String() string {\n\tif o == nil {\n\t\treturn \"<nil>\"\n\t}\n\treturn fmt.Sprintf(\"%v -> (%v, %v)\", o.Value(), o.Left(), o.Right())\n}", "title": "" }, { "docid": "bd0d36dca50d762ef66d56b7bb134e4b", "score": "0.67767715", "text": "func (n *AssignmentNode) String() string {\n\tstr, _ := n.string()\n\treturn str\n}", "title": "" }, { "docid": "fcf04125ae21b042eaa1225737c86789", "score": "0.6764702", "text": "func (s Node) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cf2acb956eee5e25260ef02414b2ad0b", "score": "0.6763872", "text": "func (n *Node) String() string {\n\treturn fmt.Sprintf(\"%v\", n.Label)\n}", "title": "" }, { "docid": "68bcfc5739cc7b7e6430502e2b5d30e6", "score": "0.6756597", "text": "func (d *CatalogNodeQuery) String() string {\n\tname := d.name\n\tif d.dc != \"\" {\n\t\tname = name + \"@\" + d.dc\n\t}\n\n\tif name == \"\" {\n\t\treturn \"catalog.node\"\n\t}\n\treturn fmt.Sprintf(\"catalog.node(%s)\", name)\n}", "title": "" }, { "docid": "a3cde3534d2fd6f6fac57a24945c7010", "score": "0.6756388", "text": "func (s *Stmt) String() string {\n\treturn s.string()\n}", "title": "" }, { "docid": "7191926b40f326a8611f2f588c9c85a1", "score": "0.67447394", "text": "func (e *Expr) String() string {\n\tif e.IsLeaf() {\n\t\treturn strconv.Itoa(e.Const)\n\t}\n\n\tif e.Op == '(' {\n\t\treturn fmt.Sprintf(\"(%s)\", e.Left)\n\t}\n\n\treturn fmt.Sprintf(\"{%s %c %s}\", e.Left, e.Op, e.Right)\n}", "title": "" }, { "docid": "af4b59ee1f2cdc5ae16e32d1d1e67ea7", "score": "0.67397267", "text": "func (p *psql_expr_field) String() string {\n //--------------------------//\n // psql_expr_field::String //\n //--------------------------//\n if p == nil {\n return \"\"\n }\n return fmt.Sprintf(\"(table: \\\"%s\\\", field: \\\"%s\\\")\", p.tab, p.fld)\n}", "title": "" }, { "docid": "8e14ea589151bfecf8f4b8ba19cab07f", "score": "0.6733096", "text": "func (s InlineStrongNode) String() string { return fmt.Sprintf(\"%#v\", s) }", "title": "" }, { "docid": "055f793b9f296fce455d1d2c79a6cdc2", "score": "0.67140174", "text": "func (n *node) String() string {\n\treturn fmt.Sprintf(\"node: %q, dirty: %v, kids: %d\", n.entry.Name, n.dirty, len(n.kids))\n}", "title": "" }, { "docid": "add221bc6a303348eb5639516c9bd13e", "score": "0.6702834", "text": "func (n Node) String() string {\n\ts := fmt.Sprintf(\"%d %d \", n.ChildCount, len(n.MetaData))\n\tfor _, c := range n.Children {\n\t\ts += c.String()\n\t}\n\n\t// then print the meta data last\n\tfor i := 0; i < len(n.MetaData); i++ {\n\t\ts += fmt.Sprintf(\"%d \", n.MetaData[i])\n\t}\n\treturn s\n}", "title": "" }, { "docid": "6489b7d7582c864b62878635aa80733c", "score": "0.6685247", "text": "func (n *Node) String() string {\n\treturn n.This().PathUnique()\n}", "title": "" }, { "docid": "1748c1f23a5bebee3b99a8d1805c1f94", "score": "0.6679146", "text": "func (n *ExecAssignNode) String() string {\n\tstr, _ := n.string()\n\treturn str\n}", "title": "" }, { "docid": "209e33ca45c8ad1921d76c17637c74ba", "score": "0.6675864", "text": "func (nt NodeType) String() string {\n\tswitch nt {\n\tcase DocumentNode:\n\t\treturn \"DocumentNode\"\n\tcase ElementNode:\n\t\treturn \"ElementNode\"\n\tcase TextNode:\n\t\treturn \"TextNode\"\n\tcase AttributeNode:\n\t\treturn \"AttributeNode\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"(unknown NodeType: %d)\", nt)\n\t}\n}", "title": "" }, { "docid": "70b37f32f9dbd51ae25dfbb01c51aa7c", "score": "0.66517234", "text": "func (e *BinaryExpr) String() string {\n\treturn fmt.Sprintf(\"%s %s %s\", e.LHS.String(), e.Op.String(), e.RHS.String())\n}", "title": "" }, { "docid": "d49db9ef42774d0eab52c2b6de83d44e", "score": "0.6637347", "text": "func (t TaskNode) String() string {\n\tif t.ID != \"\" {\n\t\treturn t.ID\n\t}\n\n\treturn fmt.Sprintf(\"%s/%s\", t.Variant, t.Name)\n}", "title": "" }, { "docid": "116cfc0de753c76f5f5fba0446c480d8", "score": "0.6617205", "text": "func (t *Node) String() string {\n\tvar buf bytes.Buffer\n\n\t// walk prints out all the elements in the (sub)tree.\n\tvar walk func(n *Node)\n\twalk = func(n *Node) {\n\t\tif n != nil {\n\t\t\twalk(n.left)\n\t\t\tfmt.Fprintf(&buf, \"%v \", n.val)\n\t\t\twalk(n.right)\n\t\t}\n\t}\n\n\tfmt.Fprint(&buf, \"[\")\n\tif t != nil {\n\t\twalk(t)\n\n\t\t// remove the \", \" at the end\n\t\tbuf.Truncate(buf.Len() - 1)\n\t}\n\tfmt.Fprintf(&buf, \"]\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "eebd3e6e400b31b4f020f80f14eeb04a", "score": "0.66134137", "text": "func (j *JQL) String() string {\n\treturn j.compile()\n}", "title": "" }, { "docid": "af94e9da2d78f94e5054b55e672f7090", "score": "0.66028875", "text": "func (l InlineLiteralNode) String() string { return fmt.Sprintf(\"%#v\", l) }", "title": "" }, { "docid": "045e10762db51cc510b0190fa0645abd", "score": "0.65867096", "text": "func (l LiteralBlockNode) String() string { return fmt.Sprintf(\"%#v\", l) }", "title": "" }, { "docid": "3974495d782b2f0ede2d8ddf7662abf3", "score": "0.6575012", "text": "func (n *Node) String() string {\n\tif n == nil {\n\t\treturn \"<nil>\"\n\t}\n\treturn fmt.Sprintf(\"<ID: %d, Name: %s, VPP-IPs: %v, Mgmt-IPs: %v\",\n\t\tn.ID, n.Name, n.VppIPAddresses.String(), n.MgmtIPAddresses)\n}", "title": "" }, { "docid": "a0725864ae2c240df739f9d05577b798", "score": "0.65690005", "text": "func (node *PathExpression) String() string {\n\treturn fmt.Sprintf(\"Path{Original:'%s', Pos:%d}\", node.Original, node.Loc.Pos)\n}", "title": "" }, { "docid": "9f00547de61eefc3743a0ac4402140dd", "score": "0.6564744", "text": "func (c *Column) String() string {\n\tstatement := fmt.Sprintf(\"\\\"%s\\\" %s\", c.Name, c.Type)\n\tif c.NotNull {\n\t\tstatement = fmt.Sprintf(\"%s not null\", statement)\n\t}\n\treturn statement\n}", "title": "" }, { "docid": "8616dbbea26b697060a66e0be1448263", "score": "0.656349", "text": "func (n Node) String() string {\n\tswitch n.Token.Type {\n\tcase html.SelfClosingTagToken:\n\t\treturn fmt.Sprintf(\"<%s/>\", n.Token.Data)\n\tcase html.StartTagToken:\n\t\tb := new(bytes.Buffer)\n\t\tfmt.Fprintf(b, \"<%s>\", n.Token.Data)\n\t\tfor _, v := range n.List {\n\t\t\tfmt.Fprintf(b, \"%s\", v)\n\t\t}\n\t\tfmt.Fprintf(b, \"</%s>\", n.Token.Data)\n\t\treturn b.String()\n\tcase html.TextToken:\n\t\treturn n.Token.Data\n\t}\n\tpanic(fmt.Errorf(\"unexpected %T\", n.Token))\n}", "title": "" }, { "docid": "2af6440a1819cf54e433369a07cb69d8", "score": "0.65582764", "text": "func (node SNode) String() string {\n\tvar buff bytes.Buffer\n\n\tbuff.WriteString(\"Node FV [\")\n\tfor i := 0; i < node.fvSize; i++ {\n\t\tbuff.WriteString(fmt.Sprintf(\"%.2f, \", node.fv[i]))\n\t}\n\tbuff.WriteString(\"] PV [\")\n\tfor i := 0; i < node.pvSize; i++ {\n\t\tbuff.WriteString(fmt.Sprintf(\"%.2f, \", node.pv[i]))\n\t}\n\tbuff.WriteString(\"]\\n\")\n\treturn buff.String()\n}", "title": "" }, { "docid": "aa21696269982a2edc19ba35803b2ee2", "score": "0.6549532", "text": "func (r *Record) String() string {\n\treturn fmt.Sprintf(\"(ID: %d, Parent: %d)\", r.ID, r.Parent)\n}", "title": "" }, { "docid": "50e804a70364f2ccb3305c8c03958ed9", "score": "0.6546427", "text": "func (tree *RangeColumnExprTree) String() string {\n\tsb := strings.Builder{}\n\tsb.WriteString(\"RangeColumnExprTree\\n\")\n\tif tree.size > 0 {\n\t\ttree.root.string(\"\", true, &sb, tree.typ)\n\t}\n\treturn sb.String()\n}", "title": "" }, { "docid": "7daf6e23e300a100bcfb4992874a482a", "score": "0.6535693", "text": "func (n *CommentNode) String() string {\n\treturn n.val\n}", "title": "" }, { "docid": "6f0995a15b55665f655c70636b7d5fa2", "score": "0.6527679", "text": "func (n *BTNode) String() (s string) {\n\tvar p = n.Parent\n\n\t// add tab until it reached nil\n\tfor p != nil {\n\t\ts += \"\\t\"\n\t\tp = p.Parent\n\t}\n\n\ts += fmt.Sprintln(reflect.ValueOf(n.Value))\n\n\treturn s\n}", "title": "" }, { "docid": "4ac5f2f3eaa474a487bc72f81dbd4d5a", "score": "0.65014184", "text": "func (n *Node) String() string {\n\treturn n.This().Path()\n}", "title": "" }, { "docid": "e43aa287eed895b4f69b53d79fe52bcb", "score": "0.64968866", "text": "func (node *MustacheStatement) String() string {\n\treturn fmt.Sprintf(\"Mustache{Pos: %d}\", node.Loc.Pos)\n}", "title": "" }, { "docid": "118890dd1db66896cf4f4805312a5930", "score": "0.64953524", "text": "func (id NodeID) String() string {\n\treturn id.Key + string(id.VRFPublicKey)\n}", "title": "" }, { "docid": "d00b9bc048a49394be21a74d87547bfc", "score": "0.6471541", "text": "func (s SystemMessageNode) String() string { return fmt.Sprintf(\"%#v\", s) }", "title": "" }, { "docid": "564639c41d78588bbe8daed705dc3aa3", "score": "0.64647365", "text": "func (n *node) treeString() string {\n\treturn n.treeString_(-1, \"\")\n}", "title": "" }, { "docid": "0656f5b1f045f890a2b46b60e12a185a", "score": "0.64547235", "text": "func (tn *treeNode) String() string {\n\treturn fmt.Sprintf(\"%s[%d(%v)]\", tn.side, tn.key, tn.value)\n}", "title": "" }, { "docid": "e75c33e84a5b18ef3de2892d0f8a5a12", "score": "0.6453139", "text": "func (n Node) String() string {\n\tif n.info.IsDir() {\n\t\treturn fmt.Sprintf(\"Dir %s %s %v\", n.fc, n.info.Name(), n.info.ModTime())\n\t}\n\treturn fmt.Sprintf(\"File %s %s %.2fkb %v\", n.fc, n.info.Name(), float64(n.info.Size())/1024, n.info.ModTime())\n}", "title": "" }, { "docid": "d4b8d259fa84b87ece9fa52cfbb38267", "score": "0.6452158", "text": "func (t TransitionNode) String() string { return fmt.Sprintf(\"%#v\", t) }", "title": "" }, { "docid": "1af0d6107cb632fc3e058c3a5f7901b3", "score": "0.6443332", "text": "func String(t Tree) string {\n\tlines := toStrings(t, nil, nil)\n\treturn strings.Join(lines, \"\\n\")\n}", "title": "" }, { "docid": "4a37c31ed3e418ca809fb6137bf33e9d", "score": "0.6442801", "text": "func (node *CommentStatement) String() string {\n\treturn fmt.Sprintf(\"Comment{Value:'%s', Pos:%d}\", node.Value, node.Loc.Pos)\n}", "title": "" }, { "docid": "3d57cd809d59d472b59c75363e8745c8", "score": "0.6442304", "text": "func (t *Tree) String() string {\n\treturn fmt.Sprintf(\"|%d %d %d %d\\n|-l-%s\\n-r-%s|\\n\", t.R.Left, t.R.Top, t.R.Right, t.R.Bottom, t.lnode, t.rnode)\n}", "title": "" }, { "docid": "a710ec858f487a155c8953b7fa79ba46", "score": "0.64322114", "text": "func (s ReservedNode) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d1b239dbbc0463b90e913654362737ca", "score": "0.6405293", "text": "func (col *Column) String(d Dialect) string {\n\tsql := d.QuoteStr() + col.Name + d.QuoteStr() + \" \"\n\n\tsql += d.SqlType(col) + \" \"\n\n\tif col.IsPrimaryKey {\n\t\tsql += \"PRIMARY KEY \"\n\t\tif col.IsAutoIncrement {\n\t\t\tsql += d.AutoIncrStr() + \" \"\n\t\t}\n\t}\n\n\tif col.Nullable {\n\t\tsql += \"NULL \"\n\t} else {\n\t\tsql += \"NOT NULL \"\n\t}\n\n\tif col.Default != \"\" {\n\t\tsql += \"DEFAULT \" + col.Default + \" \"\n\t}\n\n\treturn sql\n}", "title": "" }, { "docid": "ef2cf53648347398f8e84800f84f0b4c", "score": "0.6388698", "text": "func (q *Query) String() string {\n\treturn makeSql(q)\n}", "title": "" }, { "docid": "2ff3480bc55999ff157e5e71b5fc364a", "score": "0.6386961", "text": "func (node *BlockStatement) String() string {\n\treturn fmt.Sprintf(\"Block{Pos: %d}\", node.Loc.Pos)\n}", "title": "" }, { "docid": "2a8c937e0634bee0319e10625b4fb05f", "score": "0.6386776", "text": "func (col *Column) String(d Dialect) string {\r\n\tsql := d.QuoteStr() + col.Name + d.QuoteStr() + \" \"\r\n\r\n\tsql += d.SqlType(col) + \" \"\r\n\r\n\tif col.IsPrimaryKey {\r\n\t\tsql += \"PRIMARY KEY \"\r\n\t\tif col.IsAutoIncrement {\r\n\t\t\tsql += d.AutoIncrStr() + \" \"\r\n\t\t}\r\n\t}\r\n\r\n\tif col.Default != \"\" {\r\n\t\tsql += \"DEFAULT \" + col.Default + \" \"\r\n\t}\r\n\r\n\tif d.ShowCreateNull() {\r\n\t\tif col.Nullable {\r\n\t\t\tsql += \"NULL \"\r\n\t\t} else {\r\n\t\t\tsql += \"NOT NULL \"\r\n\t\t}\r\n\t}\r\n\r\n\treturn sql\r\n}", "title": "" }, { "docid": "88c3e8fd8fcc6bff983a2c1f43b00bdd", "score": "0.6380141", "text": "func (m Node) String() string {\n\treturn m.Hostname\n}", "title": "" }, { "docid": "51ffdbf2fb041a12a6285dfbb65d3b39", "score": "0.63799953", "text": "func (d DefinitionNode) String() string { return fmt.Sprintf(\"%#v\", d) }", "title": "" }, { "docid": "ea96979ead5ddf37e77b4550cf4adc5f", "score": "0.63790774", "text": "func (c CommentNode) String() string { return fmt.Sprintf(\"%#v\", c) }", "title": "" }, { "docid": "9d0ed084446f821222a1784ffdd035a3", "score": "0.63762355", "text": "func (s *Statement) String() string {\n\tvar b string\n\tfor _, e := range s.Expressions {\n\t\tb = b + e.String()\n\t}\n\treturn b\n}", "title": "" }, { "docid": "13ec3937372f65cf5967bf7d96d8722e", "score": "0.6369623", "text": "func (node *SubExpression) String() string {\n\treturn fmt.Sprintf(\"Sexp{Path:%s, Pos:%d}\", node.Expression.Path, node.Loc.Pos)\n}", "title": "" }, { "docid": "fac6ddcf4f1f3e1b45e406017dfdcc47", "score": "0.63662356", "text": "func (d *DomainNode) String() string {\n\tif list {\n\t\treturn fmt.Sprintf(\"%s\", d.Domain)\n\t}\n\treturn fmt.Sprintf(\"%s\\t%d\\t%s\\t%s\\t%v\", d.Domain, d.Depth, d.Status, d.Fingerprint.Hex(), d.Neighbors)\n}", "title": "" }, { "docid": "12788e0b891d39156b2ee056876a925f", "score": "0.6356863", "text": "func (n *DListNode) String() string {\n\tif n == nil {\n\t\treturn \"\"\n\t}\n\n\tsb := strings.Builder{}\n\tsb.WriteString(\"nil\")\n\tcursor := n\n\tfor cursor != nil {\n\t\tsb.WriteString(fmt.Sprintf(\" <=> %v\", n.Value))\n\t\tcursor = cursor.Next\n\t}\n\tsb.WriteString(\" <=> nil\")\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "734c712c7ecbd0a305c69cb877e4f8ce", "score": "0.63419044", "text": "func (self *NodeSet) String() string {\n\tset := (*bit.Set)(self)\n\tresult := make([]byte, 1, set.Size()*3)\n\tresult[0] = '{'\n\tfor n, ok := set.Next(-1); ok; n, ok = set.Next(n) {\n\t\tresult = strconv.AppendInt(result, int64(n), 10)\n\t\tresult = append(result, ',')\n\t}\n\tresult[len(result)-1] = '}'\n\treturn string(result)\n}", "title": "" }, { "docid": "6f1203d687e3b7553474acd948a8b433", "score": "0.6329393", "text": "func (n *CommandNode) string() (string, bool) {\n\tif n.multi {\n\t\treturn n.multiString(), true\n\t}\n\n\tvar content []string\n\n\tcontent = append(content, n.name)\n\n\tfor i := 0; i < len(n.args); i++ {\n\t\tcontent = append(content, n.args[i].String())\n\t}\n\n\tfor i := 0; i < len(n.redirs); i++ {\n\t\tcontent = append(content, n.redirs[i].String())\n\t}\n\n\treturn strings.Join(content, \" \"), false\n}", "title": "" }, { "docid": "cd6cd84f30245647bcb6843cca329f8d", "score": "0.6321536", "text": "func (q *BaseQuery) String() string {\n\t_, builder := q.compile()\n\tsql, _, _ := builder.ToSql()\n\treturn sql\n}", "title": "" }, { "docid": "149397ecb4639b1fba3cd5eea305612c", "score": "0.63150454", "text": "func (n node) String() string {\n\treturn fmt.Sprintf(\n\t\t\"%q (%d binaries, %d systemd units)\",\n\t\tn.name,\n\t\tlen(n.binaries),\n\t\tlen(n.systemdUnits),\n\t)\n}", "title": "" }, { "docid": "1533972bcb2b512dc08f63185a34325a", "score": "0.6309496", "text": "func (id *ID) String() string {\n\treturn id.value.Text(16)\n}", "title": "" }, { "docid": "3c1a16974e76e1d61237fb5bec42f9b6", "score": "0.63056386", "text": "func (cql CQL) String() string {\n\treturn string(cql.PreparedCQL)\n}", "title": "" }, { "docid": "add50231015400e84bb925c2cc95169e", "score": "0.6304864", "text": "func (t *StringType) String() string {\n\treturn \"<string>\"\n}", "title": "" }, { "docid": "7da654f3cda6f7c16e79bc16193de731", "score": "0.6302195", "text": "func (e PackageExpr) String() string {\n\treturn fmt.Sprintf(\"(//%s)\", e.a)\n}", "title": "" }, { "docid": "30b45ec7131cf51da881df3fd8ec41e2", "score": "0.6296431", "text": "func str() string", "title": "" }, { "docid": "73dd8374199bf85b0e445a27fe580ccf", "score": "0.62922215", "text": "func (ast *AST) String() string {\n\tbuf := rbpool.Get()\n\tdefer rbpool.Release(buf)\n\n\tc := ast.Visit()\n\tk := 0\n\tfor v := range c {\n\t\tk++\n\t\tfmt.Fprintf(buf, \"%03d. %s\\n\", k, v)\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "b7e649757f426c8764e19cf2f7414ce9", "score": "0.62696075", "text": "func (p GrapheneID) String() string {\n\treturn p.id\n}", "title": "" }, { "docid": "fb4db8a9481ed5ab36d911f03995c360", "score": "0.6266796", "text": "func (tn *TreeNode) String() string {\n\treturnStr := \"\"\n\tUnFoldCount = 0\n\tUnFoldTN(tn, \"\", &returnStr)\n\treturn returnStr\n}", "title": "" }, { "docid": "ec3592e94cb472d4c4d3f445ee706e14", "score": "0.6247347", "text": "func (node *Discard) String() string {\n\treturn AsString(node)\n}", "title": "" }, { "docid": "53380773e164943e72ecc3343ce73558", "score": "0.62442195", "text": "func (tree *MutableTree) String() (string, error) {\n\treturn tree.ndb.String()\n}", "title": "" }, { "docid": "759bea22aca7ac9ce786ec4fca56b2cf", "score": "0.62405753", "text": "func (s *sqlite) String() string {\n\treturn fmt.Sprintf(\"type-%s file:%s\", s.Name(), s.file)\n}", "title": "" }, { "docid": "34165382fe5c073271fed547e5a60b95", "score": "0.62362784", "text": "func (b *InsertBuilder) String() string {\n\treturn makeSql(b)\n}", "title": "" }, { "docid": "b649eb4f830e18a550a8b55c48d769c0", "score": "0.62335503", "text": "func (s NodeInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b649eb4f830e18a550a8b55c48d769c0", "score": "0.62335503", "text": "func (s NodeInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b649eb4f830e18a550a8b55c48d769c0", "score": "0.62335503", "text": "func (s NodeInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7c03cdd0b6270aad0cabae2b02644c36", "score": "0.6233219", "text": "func (e *DArrowExpr) String() string {\n\treturn fmt.Sprintf(\"(%s => %s)\", e.lhs, e.fn)\n}", "title": "" }, { "docid": "415ddef64dd132534d5fc855e2ff77ed", "score": "0.62172353", "text": "func (x Expression) String() string {\n\tvar buf bytes.Buffer\n\tx.Save(&buf)\n\treturn buf.String()\n}", "title": "" }, { "docid": "79bbd6ae526319997546c102f76e90a9", "score": "0.62160075", "text": "func (ti *blobStringType) String() string {\n\treturn fmt.Sprintf(`BlobString(%v, %v)`, ti.sqlStringType.Collation().String(), ti.sqlStringType.MaxCharacterLength())\n}", "title": "" }, { "docid": "3920bbac421c060b78aa3603092fccda", "score": "0.6215653", "text": "func (e ExprSelector) String() string {\n\treturn string(e)\n}", "title": "" }, { "docid": "505333a0b35d2de427c1d24b4eef7afc", "score": "0.6213377", "text": "func (n *Node) String() string {\n\treturn fmt.Sprintf(\"Node %s, providing %s service at %s, memberlist port %s\",\n\t\tn.memberNode.Name, n.mmeta.Meta.Service, n.BaseUrl(), fmt.Sprint(n.memberNode.Port))\n}", "title": "" }, { "docid": "3aa2bc1b05033a8b4ea1d177502be796", "score": "0.62037086", "text": "func (s *SectionNode) String() string { return fmt.Sprintf(\"%#v\", s) }", "title": "" }, { "docid": "7d473832acc807f91acec11f0c469c34", "score": "0.62033105", "text": "func (t TokenID) String() string {\n\tswitch t {\n\tcase OpenGroup:\n\t\treturn \"(\"\n\tcase CloseGroup:\n\t\treturn \")\"\n\tcase LogicalOr:\n\t\treturn \"||\"\n\tcase LogicalRegex:\n\t\treturn \"=~\"\n\tcase LogicalLessThanOrEqual:\n\t\treturn \"<=\"\n\tcase LogicalLessThan:\n\t\treturn \"<\"\n\tcase LogicalGreaterThanOrEqual:\n\t\treturn \">=\"\n\tcase LogicalGreaterThan:\n\t\treturn \">\"\n\tcase LogicalAnd:\n\t\treturn \"&&\"\n\tcase LogicalEqual:\n\t\treturn \"==\"\n\tcase LogicalInvert:\n\t\treturn \"!=\"\n\tcase Match:\n\t\treturn \"MATCH\"\n\tcase Expr:\n\t\treturn \"EXPR\"\n\tcase EOF:\n\t\treturn \"END\"\n\tcase Entry:\n\t\treturn \"BEGIN\"\n\t}\n\n\treturn \"Unknown\"\n}", "title": "" } ]
0795a9c544585adb9f060670f3ca6c1f
Dial calls DialContext with the provided arguments and context.Background. Refer to DialContext's documentation for details.
[ { "docid": "684a1774549cc2c623ddb613bd78f266", "score": "0.6267047", "text": "func Dial(rawAddress string, connOpts []grpc.DialOption) (*grpc.ClientConn, error) {\n\treturn DialContext(context.Background(), rawAddress, connOpts)\n}", "title": "" } ]
[ { "docid": "b7621febdd1b46b4eb7c43a5667d5aa5", "score": "0.66620505", "text": "func (d *Dialer) DialContext(ctx context.Context, address string) (Conn, error) {\n\treturn d.dialContext(ctx, address)\n}", "title": "" }, { "docid": "4162188e05d706d684ee61d612f34fc7", "score": "0.66440827", "text": "func DialContext(ctx context.Context, rawAddress string, connOpts []grpc.DialOption) (*grpc.ClientConn, error) {\n\treturn client.Dial(ctx, rawAddress, connOpts, nil)\n}", "title": "" }, { "docid": "c9e48012d1d1fb390399cca7469aaa9a", "score": "0.66224664", "text": "func (d *dialer) DialContext(ctx context.Context, network, address string) (Conn, error) {\n\treturn d.GetDialer()(ctx, network, address)\n}", "title": "" }, { "docid": "10a151b864ee3c6d06d8668b1acc8c23", "score": "0.6507928", "text": "func (ot *OpenTok) DialContext(ctx context.Context, sessionID string, opts *DialOptions) (*SIPCall, error) {\n\tif sessionID == \"\" {\n\t\treturn nil, fmt.Errorf(\"SIP call cannot be initiated without a session ID\")\n\t}\n\n\tif opts.SIP.URI == \"\" {\n\t\treturn nil, fmt.Errorf(\"SIP call cannot be initiated without a SIP URI\")\n\t}\n\n\ttoken, err := ot.GenerateToken(sessionID, &TokenOptions{\n\t\tData: opts.TokenData,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\topts.SessionID = sessionID\n\topts.Token = token\n\n\tjsonStr, _ := json.Marshal(opts)\n\n\t// Create jwt token\n\tjwt, err := ot.genProjectJWT()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tendpoint := ot.apiHost + projectURL + \"/\" + ot.apiKey + \"/dial\"\n\treq, err := http.NewRequest(http.MethodPost, endpoint, bytes.NewBuffer(jsonStr))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"X-OPENTOK-AUTH\", jwt)\n\n\tres, err := ot.sendRequest(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != 200 {\n\t\treturn nil, parseErrorResponse(res)\n\t}\n\n\tsipCall := &SIPCall{}\n\tif err := json.NewDecoder(res.Body).Decode(sipCall); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn sipCall, nil\n}", "title": "" }, { "docid": "51331ffaf5fbdce42161ce479441468a", "score": "0.6464902", "text": "func (cc *CachingConnector) DialContext(ctx context.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {\n\tlogger.Debugf(\"DialContext: %s\", target)\n\n\tcc.lock.Lock()\n\n\tcreatedConn, err := cc.createConn(ctx, target, opts...)\n\tif err != nil {\n\t\tcc.lock.Unlock()\n\t\treturn nil, errors.WithMessage(err, \"connection creation failed\")\n\t}\n\tc := createdConn\n\n\tcc.lock.Unlock()\n\n\tif err := cc.openConn(ctx, c); err != nil {\n\t\tcc.lock.Lock()\n\t\tsetClosed(c)\n\t\tcc.removeConn(c)\n\t\tcc.lock.Unlock()\n\t\treturn nil, errors.WithMessagef(err, \"dialing connection on target [%s]\", target)\n\t}\n\treturn c.conn, nil\n}", "title": "" }, { "docid": "4bf80cdd33df624b60ab7320949a317a", "score": "0.63689214", "text": "func (fd *FakeDialer) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (ws.Conn, *http.Response, error) {\n\tfd.InDCctx = ctx\n\tfd.InDCUrl = urlStr\n\treturn fd.RetDCConn, fd.RetDCResp, fd.RetDCErr\n}", "title": "" }, { "docid": "0b1ee96e0ead642b47d0c4bf80d01ae5", "score": "0.6362582", "text": "func (d *LazyDialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {\n\treal, err := d.getReal()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif real == nil {\n\t\tpanic(\"no real dialer\")\n\t}\n\treturn real.DialContext(ctx, network, addr)\n}", "title": "" }, { "docid": "81147a1020e1ba8e1186f7f69e748a92", "score": "0.6356533", "text": "func (d *Dialer) DialContext(ctx context.Context, network, address string) (Conn, error) {\n\tif ctx == nil {\n\t\tpanic(\"nil context\")\n\t}\n\tdeadline := d.deadline(ctx, time.Now())\n\tif !deadline.IsZero() {\n\t\tif d, ok := ctx.Deadline(); !ok || deadline.Before(d) {\n\t\t\tsubCtx, cancel := context.WithDeadline(ctx, deadline)\n\t\t\tdefer cancel()\n\t\t\tctx = subCtx\n\t\t}\n\t}\n\tif oldCancel := d.Cancel; oldCancel != nil {\n\t\tsubCtx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tgo func() {\n\t\t\tselect {\n\t\t\tcase <-oldCancel:\n\t\t\t\tcancel()\n\t\t\tcase <-subCtx.Done():\n\t\t\t}\n\t\t}()\n\t\tctx = subCtx\n\t}\n\n\t// Shadow the nettrace (if any) during resolve so Connect events don't fire for DNS lookups.\n\tresolveCtx := ctx\n\tif trace, _ := ctx.Value(nettrace.TraceKey{}).(*nettrace.Trace); trace != nil {\n\t\tshadow := *trace\n\t\tshadow.ConnectStart = nil\n\t\tshadow.ConnectDone = nil\n\t\tresolveCtx = context.WithValue(resolveCtx, nettrace.TraceKey{}, &shadow)\n\t}\n\n\taddrs, err := d.resolver().resolveAddrList(resolveCtx, \"dial\", network, address, d.LocalAddr)\n\tif err != nil {\n\t\treturn nil, &OpError{Op: \"dial\", Net: network, Source: nil, Addr: nil, Err: err}\n\t}\n\n\tsd := &sysDialer{\n\t\tDialer: *d,\n\t\tnetwork: network,\n\t\taddress: address,\n\t}\n\n\tvar primaries, fallbacks addrList\n\tif d.dualStack() && network == \"tcp\" {\n\t\tprimaries, fallbacks = addrs.partition(isIPv4)\n\t} else {\n\t\tprimaries = addrs\n\t}\n\n\tvar c Conn\n\tif len(fallbacks) > 0 {\n\t\tc, err = sd.dialParallel(ctx, primaries, fallbacks)\n\t} else {\n\t\tc, err = sd.dialSerial(ctx, primaries)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif tc, ok := c.(*TCPConn); ok && d.KeepAlive >= 0 {\n\t\tsetKeepAlive(tc.fd, true)\n\t\tka := d.KeepAlive\n\t\tif d.KeepAlive == 0 {\n\t\t\tka = defaultTCPKeepAlive\n\t\t}\n\t\tsetKeepAlivePeriod(tc.fd, ka)\n\t\ttestHookSetKeepAlive(ka)\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "0de597c58e4da84234701ac5d76416fe", "score": "0.63500583", "text": "func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {\n\tconn, err := d.dial(ctx, network, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn d.ConnectionTracker.Track(conn), nil\n}", "title": "" }, { "docid": "9ff7f5e6b1c3eb9deae5c24df552d806", "score": "0.6332412", "text": "func (d *dialer) DialContext(ctx context.Context) (net.Conn, error) {\n\treturn d.conn, nil\n}", "title": "" }, { "docid": "3696a71d1ea062936bbf723c2a9a68b1", "score": "0.6302454", "text": "func Dial(target string, opts ...DialOption) (*ClientConn, error) {\n\treturn DialContext(context.Background(), target, opts...)\n}", "title": "" }, { "docid": "0296920a6ee15c2797abcaca5593bc54", "score": "0.6294666", "text": "func Dial(url string, cfg ConnectionConfig) (ClientConnection, error) {\n\treturn DialContext(stdContext.Background(), url, cfg)\n}", "title": "" }, { "docid": "1700c3f7c167e24d0831128842156f39", "score": "0.62857145", "text": "func (c *Client) Dial(host, port string, opts ...grpc.DialOption) error {\n\treturn c.DialWithContext(context.Background(), host, port, opts...)\n}", "title": "" }, { "docid": "a200d983d72db9af9a0d4533cd780eec", "score": "0.62465715", "text": "func dialContext(ctx context.Context, network, addr string) (net.Conn, error) {\n\td := &net.Dialer{KeepAlive: tcpKeepAliveInterval}\n\treturn d.DialContext(ctx, network, addr)\n}", "title": "" }, { "docid": "40e69ede414cf1bdb5a62da7189fb473", "score": "0.6169975", "text": "func (client *client) Dial(ctx context.Context) error {\n\tif err := client.pool.Dial(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to dial pool\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c99f05791aeb21904992c88c4697712", "score": "0.61207134", "text": "func Dial(ctx Ctx, addr, service string, metrics *grpc_prometheus.ClientMetrics, ca *x509.CertPool) (*grpc.ClientConn, error) {\n\topts := append(DialOptions(ca),\n\t\tgrpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient(\n\t\t\tmetrics.UnaryClientInterceptor(),\n\t\t\tMakeUnaryClientLogger(service, 1),\n\t\t\tUnaryClientAccessLog,\n\t\t)),\n\t\tgrpc.WithStreamInterceptor(grpc_middleware.ChainStreamClient(\n\t\t\tmetrics.StreamClientInterceptor(),\n\t\t\tMakeStreamClientLogger(service, 1),\n\t\t\tStreamClientAccessLog,\n\t\t)),\n\t)\n\treturn grpc.DialContext(ctx, addr, opts...)\n}", "title": "" }, { "docid": "98bb95264746e91883299571aaf06d56", "score": "0.6096384", "text": "func DialContext(ctx context.Context, network string, addr string) (net.Conn, error) {\n\treturn dial.Load().(func(context.Context, string, string) (net.Conn, error))(ctx, network, addr)\n}", "title": "" }, { "docid": "126d314c92889c3bf0eb73c992e388c6", "score": "0.60743815", "text": "func (d *Dialer) Dial(address string) (Conn, error) {\n\treturn d.DialContext(context.Background(), address)\n}", "title": "" }, { "docid": "7625e39d25ef1e241736c68ba7e1acb5", "score": "0.6049833", "text": "func (c *Client) DialWithContext(ctx context.Context, host, port string, opts ...grpc.DialOption) (err error) {\n\tconn, err := grpc.DialContext(ctx, host+\":\"+port, opts...)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tc.conn = conn\n\tc.api = pas_api.NewPointAlarmStatusClient(conn)\n\treturn\n}", "title": "" }, { "docid": "3984e12e18635fbc1293bbe1d79f05ba", "score": "0.6036574", "text": "func (c Connector) DialContext(ctx context.Context, tlsConfig *tls.Config, address string) (_ rpc.ConnectorConn, err error) {\n\tdefer mon.Task()(&ctx)(&err)\n\n\tif tlsConfig == nil {\n\t\treturn nil, Error.New(\"tls config is not set\")\n\t}\n\ttlsConfigCopy := tlsConfig.Clone()\n\ttlsConfigCopy.NextProtos = []string{tlsopts.StorjApplicationProtocol}\n\n\tsess, err := quic.DialAddr(ctx, address, tlsConfigCopy, c.config)\n\tif err != nil {\n\t\treturn nil, Error.Wrap(err)\n\t}\n\n\tstream, err := sess.OpenStreamSync(ctx)\n\tif err != nil {\n\t\t_ = sess.CloseWithError(0, \"\")\n\t\treturn nil, Error.Wrap(err)\n\t}\n\n\tconn := &Conn{\n\t\tsession: sess,\n\t\tstream: stream,\n\t}\n\n\treturn &timedConn{\n\t\tConnectorConn: TrackClose(conn),\n\t\trate: c.transferRate,\n\t}, nil\n}", "title": "" }, { "docid": "e5a9b21f100c0e3631fe9358023a703f", "score": "0.6035779", "text": "func Dial() (*grpc.ClientConn, context.CancelFunc, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)\n\tconn, err := grpc.DialContext(ctx, addr(), grpc.WithInsecure())\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, nil, errors.Wrap(err, \"GRPC dial\")\n\t}\n\treturn conn, cancel, nil\n}", "title": "" }, { "docid": "27d881db014905cc751bc39234570435", "score": "0.60284764", "text": "func (w *Worker) Dial(o DialOptions) {\n\t// Execute in a task\n\tw.NewTask().Do(func() {\n\t\t// Dial\n\t\tgo func() {\n\t\t\tconst sleepError = 5 * time.Second\n\t\t\tfor {\n\t\t\t\t// Check context error\n\t\t\t\tif w.ctx.Err() != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\t// Dial\n\t\t\t\tastilog.Infof(\"astiworker: dialing %s\", o.Addr)\n\t\t\t\tif err := o.Client.DialWithHeaders(o.Addr, o.Header); err != nil {\n\t\t\t\t\tastilog.Error(errors.Wrapf(err, \"astiworker: dialing %s failed\", o.Addr))\n\t\t\t\t\ttime.Sleep(sleepError)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Custom callback\n\t\t\t\tif o.OnDial != nil {\n\t\t\t\t\tif err := o.OnDial(); err != nil {\n\t\t\t\t\t\tastilog.Error(errors.Wrapf(err, \"astiworker: custom on dial callback on %s failed\", o.Addr))\n\t\t\t\t\t\ttime.Sleep(sleepError)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Read\n\t\t\t\tif err := o.Client.Read(); err != nil {\n\t\t\t\t\tif o.OnReadError != nil {\n\t\t\t\t\t\to.OnReadError(err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tastilog.Error(errors.Wrapf(err, \"astiworker: reading on %s failed\", o.Addr))\n\t\t\t\t\t}\n\t\t\t\t\ttime.Sleep(sleepError)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\t// Wait for context to be done\n\t\t<-w.ctx.Done()\n\t})\n\n}", "title": "" }, { "docid": "e6e1beb9c174b547c08f3038bbbc0881", "score": "0.6011294", "text": "func Dial(opts ...ClientOption) (client.XClient, error) {\n\treturn dial(false, opts...)\n}", "title": "" }, { "docid": "d1f32049cc4d5f4700270e2d7aafe56c", "score": "0.60015666", "text": "func Dial(addr Addr, service string) X {\n\treturn get().Dial(addr, service)\n}", "title": "" }, { "docid": "6807dc949792b6e6cda96e0eddd80ea9", "score": "0.5991818", "text": "func (b *Builder) Dial(ctx context.Context, opts ...grpc.DialOption) (*grpc.ClientConn, error) {\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\n\tdns, port, err := b.GetConnInfo()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"target connection parameter missing: dns and/or port not set\")\n\t}\n\n\taddr := net.JoinHostPort(dns, strconv.Itoa(int(port)))\n\n\toptions := b.joinOptions(opts...)\n\n\tcc, err := grpc.DialContext(ctx, addr, options...)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to connect to client %s. error = %+v\", addr, err)\n\t}\n\treturn cc, nil\n}", "title": "" }, { "docid": "9e22c28d1dffa4a163d46ebaff4e57ff", "score": "0.59760225", "text": "func (s *Session) DialContext(ctx context.Context, opts *DialOptions) (*SIPCall, error) {\n\treturn s.OpenTok.DialContext(ctx, s.SessionID, opts)\n}", "title": "" }, { "docid": "d38fdda82d72801ac3d43b15d0edfa63", "score": "0.59649295", "text": "func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {\n\tif d.Timeout != 0 {\n\t\tctx, _ = context.WithTimeout(ctx, d.Timeout)\n\t}\n\t// ensure that our aux dialer is up-to-date; copied from http/transport.go\n\td.Dialer.Timeout = d.getTimeout(d.ConnectTimeout)\n\td.Dialer.KeepAlive = d.Timeout\n\n\t// Copy over the source IP if set, or nil\n\td.Dialer.LocalAddr = config.localAddr\n\n\tdialContext, cancelDial := context.WithTimeout(ctx, d.Dialer.Timeout)\n\tdefer cancelDial()\n\tconn, err := d.Dialer.DialContext(dialContext, network, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret := NewTimeoutConnection(ctx, conn, d.Timeout, d.ReadTimeout, d.WriteTimeout, d.BytesReadLimit)\n\tret.BytesReadLimit = d.BytesReadLimit\n\tret.ReadLimitExceededAction = d.ReadLimitExceededAction\n\treturn ret, nil\n}", "title": "" }, { "docid": "2eda5a3904dc554c216ae4d48b0c6e37", "score": "0.5962239", "text": "func Dial(ip string, options ...grpc.DialOption) (*grpc.ClientConn, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\t// return benchmark.NewClientConnWithContext(ctx, ip, options...), nil\n\n\t// return grpc.Dial(ip, options...)\n\treturn grpc.DialContext(ctx,\n\t\tip,\n\t\toptions...,\n\t)\n}", "title": "" }, { "docid": "7853c6b5887d1b1d6754d1ceeb015cc0", "score": "0.59523004", "text": "func DialWithContext(ctx context.Context) DialOption {\n\treturn DialOption{func(do *dialOptions) {\n\t\tdo.context = ctx\n\t}}\n}", "title": "" }, { "docid": "a6de40959f399abfe960103a13f37431", "score": "0.59476465", "text": "func execDial(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret, ret1 := rpc.Dial(args[0].(string), args[1].(string))\n\tp.Ret(2, ret, ret1)\n}", "title": "" }, { "docid": "1459ed4a57c2ec80d5e241c9f351046e", "score": "0.5903687", "text": "func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) {\n\tcc := &ClientConn{\n\t\ttarget: target,\n\t\tcsMgr: &ConnectivityStateManager{},\n\t\tconns: make(map[string]*connDial),\n\t}\n\tcc.csEvltr = &ConnectivityStateEvaluator{CsMgr: cc.csMgr}\n\tcc.ctx, cc.cancel = context.WithCancel(context.Background())\n\topts = append(defaultDialOpts, opts...)\n\tfor _, opt := range opts {\n\t\topt(&cc.dopts)\n\t}\n\n\tdefer func() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tconn, err = nil, ctx.Err()\n\t\tdefault:\n\t\t}\n\n\t\tif err != nil {\n\t\t\tcc.Close()\n\t\t}\n\t}()\n\n\tscSet := false\n\tif cc.dopts.scChan != nil {\n\t\t// Try to get an initial service config.\n\t\tselect {\n\t\tcase sc, ok := <-cc.dopts.scChan:\n\t\t\tif ok {\n\t\t\t\tcc.sc = sc\n\t\t\t\tscSet = true\n\t\t\t}\n\t\tdefault:\n\t\t}\n\t}\n\n\twaitC := make(chan error, 1)\n\tgo func() {\n\t\tdefer close(waitC)\n\t\tif cc.dopts.balancer != nil {\n\t\t\tconfig := BalancerConfig{}\n\t\t\tif err := cc.dopts.balancer.Start(target, config); err != nil {\n\t\t\t\twaitC <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tch := cc.dopts.balancer.Notify()\n\t\t\tif ch != nil {\n\t\t\t\tif cc.dopts.block {\n\t\t\t\t\tdoneChan := make(chan struct{})\n\t\t\t\t\tgo cc.lbWatcher(doneChan)\n\t\t\t\t\t<-doneChan\n\t\t\t\t} else {\n\t\t\t\t\tgo cc.lbWatcher(nil)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t// No balancer, or no resolver within the balancer. Connect directly.\n\t\tif err := cc.resetAddrConn(target, cc.dopts.block); err != nil {\n\t\t\twaitC <- err\n\t\t\treturn\n\t\t}\n\t}()\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tcase err := <-waitC:\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif cc.dopts.scChan != nil && !scSet {\n\t\t// Blocking wait for the initial service config.\n\t\tselect {\n\t\tcase sc, ok := <-cc.dopts.scChan:\n\t\t\tif ok {\n\t\t\t\tcc.sc = sc\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ctx.Err()\n\t\t}\n\t}\n\tif cc.dopts.scChan != nil {\n\t\tgo cc.scWatcher()\n\t}\n\n\treturn cc, nil\n}", "title": "" }, { "docid": "c50234cdbf6d0e866de596877836de2b", "score": "0.59019387", "text": "func (ot *OpenTok) Dial(sessionID string, opts *DialOptions) (*SIPCall, error) {\n\treturn ot.DialContext(context.Background(), sessionID, opts)\n}", "title": "" }, { "docid": "6e01d6bdd51f9170138e45c809e45d6b", "score": "0.5894983", "text": "func Dial(addr string, opts ...amqp.ConnOption) (Client, error) {\n\tc, err := amqp.Dial(addr, opts...)\n\treturn &client{\n\t\tclient: c,\n\t}, err\n}", "title": "" }, { "docid": "7b3613b4ece82c0ca244c37b37b52c59", "score": "0.5874777", "text": "func (d *Dialer) Dial(network, address string) (net.Conn, error) {\n\treturn d.DialContext(context.Background(), network, address)\n}", "title": "" }, { "docid": "7b3613b4ece82c0ca244c37b37b52c59", "score": "0.5874777", "text": "func (d *Dialer) Dial(network, address string) (net.Conn, error) {\n\treturn d.DialContext(context.Background(), network, address)\n}", "title": "" }, { "docid": "416fb0840cdf990c6705ed04063aae9a", "score": "0.5868337", "text": "func (flowConn *TapdanceFlowConn) DialContext(ctx context.Context) error {\n\tif flowConn.tdRaw.tlsConn == nil {\n\t\t// if still hasn't dialed\n\t\terr := flowConn.tdRaw.DialContext(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// don't lose initial msg from station\n\t// strip off state transition and push protobuf up for processing\n\tflowConn.tdRaw.initialMsg.StateTransition = nil\n\terr := flowConn.processProto(flowConn.tdRaw.initialMsg)\n\tif err != nil {\n\t\tflowConn.closeWithErrorOnce(err)\n\t\treturn err\n\t}\n\n\tswitch flowConn.flowType {\n\tcase flowUpload:\n\t\tfallthrough\n\tcase flowBidirectional:\n\t\tflowConn.reconnectSuccess = make(chan bool, 1)\n\t\tflowConn.reconnectStarted = make(chan struct{})\n\t\tflowConn.writeSliceChan = make(chan []byte)\n\t\tflowConn.writeResultChan = make(chan ioOpResult)\n\t\tgo flowConn.spawnReaderEngine()\n\t\tgo flowConn.spawnWriterEngine()\n\tcase flowReadOnly:\n\t\tgo flowConn.spawnReaderEngine()\n\tcase flowRendezvous:\n\tdefault:\n\t\tpanic(\"Not implemented\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a48b934ae6eca10ca9ae2da759445d86", "score": "0.5837108", "text": "func contextDialer(ctx context.Context) *net.Dialer {\n\tdialer := &net.Dialer{Cancel: ctx.Done(), KeepAlive: tcpKeepAliveInterval}\n\tif deadline, ok := ctx.Deadline(); ok {\n\t\tdialer.Deadline = deadline\n\t} else {\n\t\tdialer.Deadline = time.Now().Add(defaultDialTimeout)\n\t}\n\treturn dialer\n}", "title": "" }, { "docid": "84d545e4f66262591e62940889418291", "score": "0.5827704", "text": "func (f *RPCClient) Dial() (err error) {\n\tif f.conn == nil {\n\t\t// WARN: no concurrent control for performance concern\n\t\tf.conn, err = rpc.DialHTTPPath(\"tcp\", f.addr, f.path)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bac9888024f0ac2cd864017072d0d279", "score": "0.58145434", "text": "func (d *Dialer) Dial(network, address string) (Conn, error) {\n\treturn d.DialContext(context.Background(), network, address)\n}", "title": "" }, { "docid": "02a0a6b997eb8bb0a67632ff5eb28e8a", "score": "0.57710207", "text": "func Dial(ctx context.Context) (*Client, error) {\n\tconn, err := dbus.SystemBus()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn initClient(ctx, &Client{\n\t\t// Wrap the *dbus.Conn completely to abstract away all of the low-level\n\t\t// D-Bus logic for ease of unit testing.\n\t\tclose: conn.Close,\n\t\tcall: makeCall(conn),\n\t\tget: makeGet(conn),\n\t\tgetAll: makeGetAll(conn),\n\t})\n}", "title": "" }, { "docid": "577e98aa721e79131e6f3177aac6c5dc", "score": "0.5763819", "text": "func (s *Session) Dial(opts *DialOptions) (*SIPCall, error) {\n\treturn s.DialContext(context.Background(), opts)\n}", "title": "" }, { "docid": "8be4cc369744d396e28542c10500a85a", "score": "0.5752855", "text": "func (t *TunnelAuthDialer) DialContext(ctx context.Context, network string, addr string) (net.Conn, error) {\n\t// Connect to the reverse tunnel server.\n\tdialer := proxy.DialerFromEnvironment(t.ProxyAddr)\n\tsconn, err := dialer.Dial(\"tcp\", t.ProxyAddr, t.ClientConfig)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// Build a net.Conn over the tunnel. Make this an exclusive connection:\n\t// close the net.Conn as well as the channel upon close.\n\tconn, _, err := connectProxyTransport(sconn.Conn, &dialReq{\n\t\tAddress: RemoteAuthServer,\n\t\tExclusive: true,\n\t})\n\tif err != nil {\n\t\terr2 := sconn.Close()\n\t\treturn nil, trace.NewAggregate(err, err2)\n\t}\n\treturn conn, nil\n}", "title": "" }, { "docid": "25584b9eaef6827e9a2c9203bfeb57f7", "score": "0.5751573", "text": "func OptionDialContext(dialCtx func(ctx context.Context, network, addr string) (net.Conn, error)) Option {\n\treturn func(t *http.Transport) *http.Transport {\n\t\tt.DialContext = dialCtx\n\t\treturn t\n\t}\n}", "title": "" }, { "docid": "5072dc003c3cfc8fab6056f37a14cbea", "score": "0.572882", "text": "func (t *Transport) Dial(_ transport.Mode) error {\n\tt.rwMutex.Lock()\n\tdefer t.rwMutex.Unlock()\n\n\tt.refCount++\n\treturn nil\n}", "title": "" }, { "docid": "0536db1b09d307c2252e64e3e9c108c6", "score": "0.5724519", "text": "func Dial(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {\n\tvar o internal.DialSettings\n\tfor _, opt := range opts {\n\t\topt.Apply(&o)\n\t}\n\tif o.HTTPClient != nil {\n\t\treturn nil, errors.New(\"unsupported HTTP client specified\")\n\t}\n\tif o.GRPCConn != nil {\n\t\treturn o.GRPCConn, nil\n\t}\n\tif o.ServiceAccountJSONFilename != \"\" {\n\t\tts, err := internal.ServiceAcctTokenSource(ctx, o.ServiceAccountJSONFilename, o.Scopes...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\to.TokenSource = ts\n\t}\n\tif o.TokenSource == nil {\n\t\tvar err error\n\t\to.TokenSource, err = google.DefaultTokenSource(ctx, o.Scopes...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"google.DefaultTokenSource: %v\", err)\n\t\t}\n\t}\n\tgrpcOpts := []grpc.DialOption{\n\t\tgrpc.WithPerRPCCredentials(oauth.TokenSource{o.TokenSource}),\n\t\tgrpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, \"\")),\n\t}\n\tif appengineDialerHook != nil {\n\t\t// Use the Socket API on App Engine.\n\t\tgrpcOpts = append(grpcOpts, appengineDialerHook(ctx))\n\t}\n\tgrpcOpts = append(grpcOpts, o.GRPCDialOpts...)\n\tif o.UserAgent != \"\" {\n\t\tgrpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))\n\t}\n\treturn grpc.DialContext(ctx, o.Endpoint, grpcOpts...)\n}", "title": "" }, { "docid": "bed3d24116311b2f25dde59c5a1ff78c", "score": "0.56598485", "text": "func DialContext(ctx context.Context, network, address string, options ...interface{}) (redis.Conn, error) {\n\tdialOpts, cfg := parseOptions(options...)\n\tlog.Debug(\"contrib/gomodule/redigo: Dialing with context %s %s, %#v\", network, address, cfg)\n\tc, err := redis.DialContext(ctx, network, address, dialOpts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thost, port, err := net.SplitHostPort(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttc := wrapConn(c, &params{cfg, network, host, port})\n\treturn tc, nil\n}", "title": "" }, { "docid": "e9c33848559acede45cbf95ef42a55b2", "score": "0.56564516", "text": "func (cd *CacheDial) DialContext(\n\tctx context.Context, network string, address string,\n) (conn net.Conn, err error) {\n\tseparator := strings.LastIndex(address, \":\")\n\tips, err := cd.Resolver.Fetch(address[:separator])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, ip := range ips {\n\t\tconn, err = cd.Dialer.Dial(network, ip.String()+address[separator:])\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "4c48591008ef71d298bc76fd58eda808", "score": "0.56429535", "text": "func Dial(ctx context.Context, protocol, addr string) (*Conn, error) {\n\treturn DialTimeout(ctx, protocol, addr, 0)\n}", "title": "" }, { "docid": "3c5d360fd43750ab12b83009758b4f50", "score": "0.56416297", "text": "func Dial(ctx context.Context, c *cli.Context) (root client.Client, err error) {\n\tvar d boot.Strategy\n\tswitch {\n\tcase c.StringSlice(\"join\") != nil:\n\t\td, err = Join(c)\n\tcase c.String(\"discover\") != \"\":\n\t\td, err = Bootstrap(c)\n\tdefault:\n\t\terr = errors.New(\"must specify either -join or -discover address\")\n\t}\n\n\tif err == nil {\n\t\troot, err = client.Dial(ctx, client.WithStrategy(d))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "ccba798545261638bc09ffee367baad9", "score": "0.5632567", "text": "func (vtctld *ClientProxy) Dial(ctx context.Context) error {\n\tspan, ctx := trace.NewSpan(ctx, \"VtctldClientProxy.Dial\")\n\tdefer span.Finish()\n\n\tvtadminproto.AnnotateClusterSpan(vtctld.cluster, span)\n\n\tif vtctld.VtctldClient != nil {\n\t\tif !vtctld.closed {\n\t\t\tspan.Annotate(\"is_noop\", true)\n\t\t\tspan.Annotate(\"vtctld_host\", vtctld.host)\n\n\t\t\treturn nil\n\t\t}\n\n\t\tspan.Annotate(\"is_stale\", true)\n\n\t\t// close before reopen. this is safe to call on an already-closed client.\n\t\tif err := vtctld.Close(); err != nil {\n\t\t\treturn fmt.Errorf(\"error closing possibly-stale connection before re-dialing: %w\", err)\n\t\t}\n\t}\n\n\taddr, err := vtctld.discovery.DiscoverVtctldAddr(ctx, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error discovering vtctld to dial: %w\", err)\n\t}\n\n\tspan.Annotate(\"vtctld_host\", addr)\n\tspan.Annotate(\"is_using_credentials\", vtctld.creds != nil)\n\n\topts := []grpc.DialOption{\n\t\t// TODO: make configurable. right now, omitting this and attempting\n\t\t// to not use TLS results in:\n\t\t//\t\tgrpc: no transport security set (use grpc.WithInsecure() explicitly or set credentials)\n\t\tgrpc.WithInsecure(),\n\t}\n\n\tif vtctld.creds != nil {\n\t\topts = append(opts, grpc.WithPerRPCCredentials(vtctld.creds))\n\t}\n\n\tclient, err := vtctld.DialFunc(addr, grpcclient.FailFast(false), opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvtctld.host = addr\n\tvtctld.VtctldClient = client\n\tvtctld.closed = false\n\n\treturn nil\n}", "title": "" }, { "docid": "06ac19d21b513fe808ebfcc050f10266", "score": "0.56237525", "text": "func (d *dialerResolverWithTracing) DialContext(ctx context.Context, network, address string) (net.Conn, error) {\n\t// QUIRK: this routine and the related routines in quirks.go cannot\n\t// be changed easily until we use events tracing to measure.\n\t//\n\t// Reference issue: TODO(https://github.com/ooni/probe/issues/1779).\n\tonlyhost, onlyport, err := net.SplitHostPort(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taddrs, err := d.lookupHost(ctx, onlyhost)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taddrs = quirkSortIPAddrs(addrs)\n\tvar errorslist []error\n\ttrace := ContextTraceOrDefault(ctx)\n\tfor _, addr := range addrs {\n\t\ttarget := net.JoinHostPort(addr, onlyport)\n\t\tstarted := trace.TimeNow()\n\t\tconn, err := d.Dialer.DialContext(ctx, network, target)\n\t\tfinished := trace.TimeNow()\n\t\t// TODO(bassosimone): to make the code robust to future refactoring we have\n\t\t// moved error wrapping inside this type. This change opens up the possibility\n\t\t// of simplifying the dialing chain by removing dialerErrWrapper. We'll be\n\t\t// able to implement this refactoring once netx is gone. We cannot complete\n\t\t// this refactoring _before_ because WrapDialer inserts extra wrappers\n\t\t// provided by netx in the dialers chain _before_ this dialer and the dialers\n\t\t// that netx insert assume that they wrap a dialer with error wrapping.\n\t\t//\n\t\t// Because error wrapping should be idempotent, it should not be a problem\n\t\t// to have two error wrapping dialers in the chain except that, of course, it\n\t\t// would be less efficient than just having a single wrapper.\n\t\terr = MaybeNewErrWrapper(ClassifyGenericError, ConnectOperation, err)\n\t\ttrace.OnConnectDone(started, network, onlyhost, target, err, finished)\n\t\tif err == nil {\n\t\t\tconn = &dialerErrWrapperConn{conn}\n\t\t\treturn trace.MaybeWrapNetConn(conn), nil\n\t\t}\n\t\terrorslist = append(errorslist, err)\n\t}\n\treturn nil, quirkReduceErrors(errorslist)\n}", "title": "" }, { "docid": "d793f9959ce9ef0f798964a3da76cd7b", "score": "0.5622153", "text": "func Dial(hosts ...string) (*Client, error) {\n\treturn DialConfig(Config{}, hosts...)\n}", "title": "" }, { "docid": "9f98a4ca852435eb2fc97123b4ea8c25", "score": "0.5620112", "text": "func DialContextFunc(dial func(context.Context, string, string) (net.Conn, error)) func(context.Context, string, string) (net.Conn, error) {\n\treturn DialContextFuncWith(events.DefaultLogger, dial)\n}", "title": "" }, { "docid": "766c4752c594f2e9c2cc94f6dff72c02", "score": "0.5587059", "text": "func (ed *EthDialer) Dial(urlString string) (eth.CallerSubscriber, error) {\n\treturn newLazyRPCWrapper(urlString, ed.limiter)\n}", "title": "" }, { "docid": "20f32d141b9267d20be9551d28df4799", "score": "0.5565215", "text": "func Dial(ctx context.Context, p string) (io.ReadWriteCloser, error) {\n\tu, err := parseDialAddr(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch u.Scheme {\n\tcase \"tcp\":\n\t\tc, err := toTCP(u)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\td := net.Dialer{Timeout: c.timeout, KeepAlive: c.keepAlive}\n\t\treturn d.DialContext(ctx, \"tcp\", c.addr)\n\tcase \"serial\":\n\t\tc, err := toSerial(u)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn serial.OpenPort(c)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"schema not support: %s\", u.Scheme)\n\t}\n}", "title": "" }, { "docid": "dd793bf52cb845aa8a89fec966e702c9", "score": "0.55528516", "text": "func Dial(addr string, opts ...grpc.DialOption) (*Client, error) {\n\tc, err := grpc.Dial(addr, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\taddr: addr,\n\t\tconn: c,\n\t\tSample: apipb.NewSamplesClient(c),\n\t}, nil\n}", "title": "" }, { "docid": "5f07be1060f8cd8f0da00e3eb8c3a3ce", "score": "0.55439305", "text": "func (s *server) Dial(config upspin.Config, e upspin.Endpoint) (upspin.Service, error) {\n\tconst op errors.Op = \"dir/inprocess.Dial\"\n\tif e.Transport != upspin.InProcess {\n\t\treturn nil, errors.E(op, errors.Invalid, \"unrecognized transport\")\n\t}\n\tthis := *s // Make a copy.\n\tthis.config = config\n\treturn &this, nil\n}", "title": "" }, { "docid": "108bdc9fe502381c9b7c593c40c60634", "score": "0.554205", "text": "func DialContext(ctx stdContext.Context, url string, cfg ConnectionConfig) (ClientConnection, error) {\n\tif ctx == nil {\n\t\tctx = stdContext.Background()\n\t}\n\n\tif !strings.HasPrefix(url, \"ws://\") || !strings.HasPrefix(url, \"wss://\") {\n\t\turl = \"ws://\" + url\n\t}\n\n\tconn, _, err := websocket.DefaultDialer.DialContext(ctx, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclientConn := WrapConnection(conn, cfg)\n\tgo clientConn.Wait()\n\n\treturn clientConn, nil\n}", "title": "" }, { "docid": "1286bf4239392acf00d12f0ed4d8c862", "score": "0.554025", "text": "func (c *Client) DialReadContext(ctx context.Context, address string) (*ClientConn, error) {\n\tu, err := base.ParseURL(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconn, err := c.Dial(u.Scheme, u.Host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctxHandlerDone := make(chan struct{})\n\tdefer func() { <-ctxHandlerDone }()\n\n\tctxHandlerTerminate := make(chan struct{})\n\tdefer close(ctxHandlerTerminate)\n\n\tgo func() {\n\t\tdefer close(ctxHandlerDone)\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tconn.Close()\n\t\tcase <-ctxHandlerTerminate:\n\t\t}\n\t}()\n\n\t_, err = conn.Options(u)\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\ttracks, baseURL, _, err := conn.Describe(u)\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\tfor _, track := range tracks {\n\t\t_, err := conn.Setup(headers.TransportModePlay, baseURL, track, 0, 0)\n\t\tif err != nil {\n\t\t\tconn.Close()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t_, err = conn.Play(nil)\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "d4bd3acd8c33ab1222e75b5c9c0c6447", "score": "0.55072653", "text": "func (c *Client) Dial(scheme string, host string) (*ClientConn, error) {\n\treturn newClientConn(c, scheme, host)\n}", "title": "" }, { "docid": "c58900efd3c36b77ca2003aaa83a6559", "score": "0.5502843", "text": "func Dial(ctx context.Context, endpoint string, params DialParams) (*grpc.ClientConn, AuthType, error) {\n\tvar authUsed AuthType\n\n\tvar opts []grpc.DialOption\n\topts = append(opts, params.DialOpts...)\n\n\tif params.MaxConcurrentRequests == 0 {\n\t\tparams.MaxConcurrentRequests = DefaultMaxConcurrentRequests\n\t}\n\tif params.MaxConcurrentStreams == 0 {\n\t\tparams.MaxConcurrentStreams = DefaultMaxConcurrentStreams\n\t}\n\tif params.NoSecurity {\n\t\tauthUsed = NoAuth\n\t\topts = append(opts, grpc.WithInsecure())\n\t} else if params.NoAuth {\n\t\tauthUsed = NoAuth\n\t\t// Set the ServerName and RootCAs fields, if needed.\n\t\ttlsConfig, err := createTLSConfig(params)\n\t\tif err != nil {\n\t\t\treturn nil, authUsed, fmt.Errorf(\"could not create TLS config: %v\", err)\n\t\t}\n\t\topts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))\n\t} else if params.UseExternalAuthToken {\n\t\tauthUsed = ExternalTokenAuth\n\t\tif params.ExternalPerRPCCreds == nil {\n\t\t\treturn nil, authUsed, fmt.Errorf(\"ExternalPerRPCCreds unspecified when using external auth token mechanism\")\n\t\t}\n\t\topts = append(opts, grpc.WithPerRPCCredentials(params.ExternalPerRPCCreds.Creds))\n\t\t// Set the ServerName and RootCAs fields, if needed.\n\t\ttlsConfig, err := createTLSConfig(params)\n\t\tif err != nil {\n\t\t\treturn nil, authUsed, fmt.Errorf(\"could not create TLS config: %v\", err)\n\t\t}\n\t\topts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))\n\t} else {\n\t\tcredFile := params.CredFile\n\t\tif strings.Contains(credFile, HomeDirMacro) {\n\t\t\tauthUsed = CredsFileAuth\n\t\t\tusr, err := user.Current()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, authUsed, fmt.Errorf(\"could not fetch home directory because of error determining current user: %v\", err)\n\t\t\t}\n\t\t\tcredFile = strings.Replace(credFile, HomeDirMacro, usr.HomeDir, -1 /* no limit */)\n\t\t}\n\n\t\tif !params.TransportCredsOnly {\n\t\t\tvar (\n\t\t\t\trpcCreds credentials.PerRPCCredentials\n\t\t\t\terr error\n\t\t\t)\n\t\t\trpcCreds, authUsed, err = getRPCCreds(ctx, credFile, params.UseApplicationDefault, params.UseComputeEngine)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, authUsed, fmt.Errorf(\"couldn't create RPC creds for %s: %v\", scopes, err)\n\t\t\t}\n\n\t\t\tif params.ActAsAccount != \"\" {\n\t\t\t\trpcCreds = getImpersonatedRPCCreds(ctx, params.ActAsAccount, rpcCreds)\n\t\t\t}\n\n\t\t\topts = append(opts, grpc.WithPerRPCCredentials(rpcCreds))\n\t\t}\n\t\ttlsConfig, err := createTLSConfig(params)\n\t\tif err != nil {\n\t\t\treturn nil, authUsed, fmt.Errorf(\"could not create TLS config: %v\", err)\n\t\t}\n\t\topts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))\n\t}\n\tgrpcInt := createGRPCInterceptor(params)\n\topts = append(opts, grpc.WithDisableServiceConfig())\n\topts = append(opts, grpc.WithDefaultServiceConfig(fmt.Sprintf(`{\"loadBalancingConfig\": [{\"%s\":{}}]}`, balancer.Name)))\n\topts = append(opts, grpc.WithUnaryInterceptor(grpcInt.GCPUnaryClientInterceptor))\n\topts = append(opts, grpc.WithStreamInterceptor(grpcInt.GCPStreamClientInterceptor))\n\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn nil, authUsed, fmt.Errorf(\"couldn't dial gRPC %q: %v\", endpoint, err)\n\t}\n\treturn conn, authUsed, nil\n}", "title": "" }, { "docid": "3561e2409363be068d0a3f4e4f812cc5", "score": "0.5490712", "text": "func (q *Sessions) DialTLSContext(ctx context.Context, network, addr string) (net.Conn, error) {\n\treturn q.DialContext(ctx, network, addr)\n}", "title": "" }, { "docid": "c6aef4c47bffc02cd12019a9201b0421", "score": "0.5489557", "text": "func (d *Dialer) Dial(network, address string) (Conn, error) {\n\tra, err := resolveAddr(\"dial\", network, address, d.deadline())\n\tif err != nil {\n\t\treturn nil, &OpError{Op: \"dial\", Net: network, Addr: nil, Err: err}\n\t}\n\tdialer := func(deadline time.Time) (Conn, error) {\n\t\treturn dialSingle(network, address, d.LocalAddr, ra.toAddr(), deadline)\n\t}\n\tif ras, ok := ra.(addrList); ok && d.DualStack && network == \"tcp\" {\n\t\tdialer = func(deadline time.Time) (Conn, error) {\n\t\t\treturn dialMulti(network, address, d.LocalAddr, ras, deadline)\n\t\t}\n\t}\n\tc, err := dial(network, ra.toAddr(), dialer, d.deadline())\n\tif d.KeepAlive > 0 && err == nil {\n\t\tif tc, ok := c.(*TCPConn); ok {\n\t\t\ttc.SetKeepAlive(true)\n\t\t\ttc.SetKeepAlivePeriod(d.KeepAlive)\n\t\t\ttestHookSetKeepAlive()\n\t\t}\n\t}\n\treturn c, err\n}", "title": "" }, { "docid": "2a4982d26993fb41914acdb7cb6a3abd", "score": "0.54785204", "text": "func Dial(scheme string, host string) (*ClientConn, error) {\n\treturn DefaultClient.Dial(scheme, host)\n}", "title": "" }, { "docid": "d7e8fdd37167ec10423132c028f2941a", "score": "0.5476552", "text": "func Dial(host, name string, opts ...Option) (*Client, error) {\n\tc := &Client{name: name}\n\tfor _, opt := range opts {\n\t\topt(c)\n\t}\n\n\tvar err error\n\tc.conn, err = amqp.Dial(\"amqps://\"+host, c.opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "9c425ad498f496ef53987e7e7061db52", "score": "0.546019", "text": "func dial(_ int, _ *Config) (*conn, uint32, error) { return nil, 0, errUnimplemented }", "title": "" }, { "docid": "d95e74dfc1d36ad28f8e523cf01fe1c5", "score": "0.5455219", "text": "func WithDial(dial func(protocol string, u *url.URL, timeout time.Duration) (conn, error)) ClientOption {\n\treturn func(os *clientOptions) {\n\t\tos.Dial = dial\n\t}\n}", "title": "" }, { "docid": "bbcfc426912bdda87cfdcf5a40b08fa0", "score": "0.5453731", "text": "func Dial(host string, tls bool) (c Client, err error) {\n\n\tc = Client{\n\t\tLedger: make(chan *Ledger),\n\t\tResponse: make(chan *Response),\n\t}\n\n\tscheme := \"ws\"\n\n\tif tls {\n\t\tscheme = \"wss\"\n\t}\n\n\tu := url.URL{\n\t\tScheme: scheme,\n\t\tHost: host,\n\t\tPath: \"/\",\n\t}\n\n\tconn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)\n\n\tif err != nil {\n\t\tlog.Fatal(\"go-xrp dial: \", err)\n\t\treturn\n\t}\n\n\tc.conn = conn\n\n\terr = c.Ping()\n\n\tif err != nil {\n\t\tlog.Fatal(\"go-xrp ping: \", err)\n\t\treturn\n\t}\n\n\tgo c.handleMessage()\n\n\treturn\n\n}", "title": "" }, { "docid": "b09a84f86c451ced72c20edb32216ced", "score": "0.5452594", "text": "func (r *RabbitMQ) Dial() error {\n\t// if config is nil do not continue\n\tif r.config == nil {\n\t\treturn errors.New(\"config is nil\")\n\t}\n\n\tconf := amqp.URI{\n\t\tScheme: \"amqp\",\n\t\tHost: r.config.Host,\n\t\tPort: r.config.Port,\n\t\tUsername: r.config.Username,\n\t\tPassword: r.config.Password,\n\t\tVhost: r.config.Vhost,\n\t}.String()\n\n\tvar err error\n\t// Connects opens an AMQP connection from the credentials in the URL.\n\tr.conn, err = amqp.Dial(conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.handleErrors(r.conn)\n\n\treturn nil\n}", "title": "" }, { "docid": "56fc5d9469d93cbb7b54a67691d73d9c", "score": "0.54521877", "text": "func Dial(network, address string, framed bool, protocol ProtocolBuilder, supportOnewayRequests bool) (*rpc.Client, error) {\n\tconn, err := net.Dial(network, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar c io.ReadWriteCloser = conn\n\tif framed {\n\t\tc = NewFramedReadWriteCloser(conn, DefaultMaxFrameSize)\n\t}\n\tcodec := &clientCodec{\n\t\tconn: NewTransport(c, protocol),\n\t}\n\tif supportOnewayRequests {\n\t\tcodec.enableOneway = true\n\t\tcodec.onewayRequests = make(chan pendingRequest, maxPendingRequests)\n\t\tcodec.twowayRequests = make(chan pendingRequest, maxPendingRequests)\n\t}\n\treturn rpc.NewClientWithCodec(codec), nil\n}", "title": "" }, { "docid": "393f3d346b38b484a94cf49962273fa4", "score": "0.5449201", "text": "func (d *Dialer) Dial(ctx context.Context, addr string) (Driver, error) {\n\tconfig := d.DriverConfig.withDefaults()\n\tgrpcKeepalive := d.Keepalive\n\tif grpcKeepalive == 0 {\n\t\tgrpcKeepalive = DefaultKeepaliveInterval\n\t} else if grpcKeepalive < MinKeepaliveInterval {\n\t\tgrpcKeepalive = MinKeepaliveInterval\n\t}\n\ttlsConfig := d.TLSConfig\n\tif tlsConfig != nil {\n\t\ttlsConfig.RootCAs = WithYdbCA(tlsConfig.RootCAs)\n\t}\n\treturn (&dialer{\n\t\tnetDial: d.NetDial,\n\t\ttlsConfig: tlsConfig,\n\t\tkeepalive: grpcKeepalive,\n\t\ttimeout: d.Timeout,\n\t\tconfig: config,\n\t\tmeta: &meta{\n\t\t\ttrace: config.Trace,\n\t\t\tdatabase: config.Database,\n\t\t\tcredentials: config.Credentials,\n\t\t\trequestsType: config.RequestsType,\n\t\t},\n\t}).dial(ctx, addr)\n}", "title": "" }, { "docid": "765c1fbb45ba002cf70a7a78ef24c9b9", "score": "0.5412752", "text": "func (q *Sessions) Dial(network, addr string) (net.Conn, error) {\n\treturn q.DialContext(context.Background(), network, addr)\n}", "title": "" }, { "docid": "f26d846bd0991307f8ea774473aaceb4", "score": "0.5405393", "text": "func dialContextFactory(mode Mode, server string) func(context.Context, string, string) (net.Conn, error) {\n\tvar ret func(context.Context, string, string) (net.Conn, error)\n\tswitch mode {\n\tcase MODE_IPv4:\n\t\tret = func(ctx context.Context, network, address string) (net.Conn, error) {\n\t\t\tswitch network {\n\t\t\tcase \"tcp\", \"tcp4\", \"tcp6\":\n\t\t\t\tnetwork = \"tcp4\"\n\t\t\tcase \"udp\", \"udp4\", \"udp6\":\n\t\t\t\tnetwork = \"udp4\"\n\t\t\t}\n\n\t\t\treturn (&net.Dialer{}).DialContext(ctx, network, server)\n\t\t}\n\tcase MODE_IPv6:\n\t\tret = func(ctx context.Context, network, address string) (net.Conn, error) {\n\t\t\tswitch network {\n\t\t\tcase \"tcp\", \"tcp4\", \"tcp6\":\n\t\t\t\tnetwork = \"tcp6\"\n\t\t\tcase \"udp\", \"udp4\", \"udp6\":\n\t\t\t\tnetwork = \"udp6\"\n\t\t\t}\n\t\t\treturn (&net.Dialer{}).DialContext(ctx, network, server)\n\t\t}\n\tdefault:\n\t\tret = func(ctx context.Context, network, address string) (net.Conn, error) {\n\t\t\treturn (&net.Dialer{DualStack: true}).DialContext(ctx, network, server)\n\t\t}\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "76522d2af670e0e25020405070abc41a", "score": "0.539027", "text": "func Dial(addr string) (*Client, error) {\n\treturn DialSize(addr, 0)\n}", "title": "" }, { "docid": "46fe42cca74d8703dba7d0d33f3fdd98", "score": "0.53899574", "text": "func (fd *FakeDialer) Dial(urlStr string, requestHeader http.Header) (ws.Conn, *http.Response, error) {\n\tfd.InDUrl = urlStr\n\treturn fd.RetDConn, fd.RetDResp, fd.RetDErr\n}", "title": "" }, { "docid": "2ccc6507f96e8529b068a6fbbbdd9a73", "score": "0.53820986", "text": "func (c *Client) DialPublishContext(ctx context.Context, address string, tracks Tracks) (*ClientConn, error) {\n\tu, err := base.ParseURL(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconn, err := c.Dial(u.Scheme, u.Host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctxHandlerDone := make(chan struct{})\n\tdefer func() { <-ctxHandlerDone }()\n\n\tctxHandlerTerminate := make(chan struct{})\n\tdefer close(ctxHandlerTerminate)\n\n\tgo func() {\n\t\tdefer close(ctxHandlerDone)\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tconn.Close()\n\t\tcase <-ctxHandlerTerminate:\n\t\t}\n\t}()\n\n\t_, err = conn.Options(u)\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\t_, err = conn.Announce(u, tracks)\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\tfor _, track := range tracks {\n\t\t_, err := conn.Setup(headers.TransportModeRecord, u, track, 0, 0)\n\t\tif err != nil {\n\t\t\tconn.Close()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t_, err = conn.Record()\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "2a9e6da3a7ceb5e774bddf4220d3ffad", "score": "0.53658444", "text": "func (scan *scan) dialContext(ctx context.Context, network string, addr string) (net.Conn, error) {\n\tdialer := zgrab2.GetTimeoutConnectionDialer(scan.scanner.config.Timeout)\n\n\tswitch network {\n\tcase \"tcp\", \"tcp4\", \"tcp6\", \"udp\", \"udp4\", \"udp6\":\n\t\t// If the scan is for a specific IP, and a domain name is provided, we\n\t\t// don't want to just let the http library resolve the domain. Create\n\t\t// a fake resolver that we will use, that always returns the IP we are\n\t\t// given to scan.\n\t\tif scan.target.IP != nil && scan.target.Domain != \"\" {\n\t\t\thost, _, err := net.SplitHostPort(addr)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"http/scanner.go dialContext: unable to split host:port '%s'\", addr)\n\t\t\t\tlog.Errorf(\"No fake resolver, IP address may be incorrect: %s\", err)\n\t\t\t} else {\n\t\t\t\t// In the case of redirects, we don't want to blindly use the\n\t\t\t\t// IP we were given to scan, however. Only use the fake\n\t\t\t\t// resolver if the domain originally specified for the scan\n\t\t\t\t// target matches the current address being looked up in this\n\t\t\t\t// DialContext.\n\t\t\t\tif host == scan.target.Domain {\n\t\t\t\t\tresolver, err := zgrab2.NewFakeResolver(scan.target.IP.String())\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\tdialer.Dialer.Resolver = resolver\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\ttimeoutContext, _ := context.WithTimeout(context.Background(), scan.scanner.config.Timeout)\n\n\tconn, err := dialer.DialContext(scan.withDeadlineContext(timeoutContext), network, addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tscan.connections = append(scan.connections, conn)\n\treturn conn, nil\n}", "title": "" }, { "docid": "c32158a808051a4aac39a50c98f86cfc", "score": "0.53478503", "text": "func Dial(dest Host) (*Client, error) {\n\tsingleEntry.Lock()\n\tdefer singleEntry.Unlock()\n\treturn dial(dest, map[string]struct{}{})\n}", "title": "" }, { "docid": "15a47fd640ca5b878ec4e455f545e36b", "score": "0.53439647", "text": "func (d *Dialer) Dial(proto string, target string) (net.Conn, error) {\n\treturn DialTimeoutConnectionEx(proto, target, d.ConnectTimeout, d.Timeout, d.ReadTimeout, d.WriteTimeout, 0)\n}", "title": "" }, { "docid": "49a8168341be1aec344f903330d88146", "score": "0.53379774", "text": "func (h *protocolHandler) Dial(\n\turl *urlpkg.URL,\n\tprompter,\n\tsession string,\n\tversion session.Version,\n\tconfiguration *session.Configuration,\n\talpha bool,\n) (session.Endpoint, error) {\n\t// Verify that the URL is of the correct protocol.\n\tif url.Protocol != urlpkg.Protocol_Local {\n\t\tpanic(\"non-local URL dispatched to local protocol handler\")\n\t}\n\n\t// Create a local endpoint.\n\tendpoint, err := NewEndpoint(url.Path, session, version, configuration, alpha)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to create local endpoint\")\n\t}\n\n\t// Success.\n\treturn endpoint, nil\n}", "title": "" }, { "docid": "d5f03506d90f7fab8304c52f9e80521f", "score": "0.533551", "text": "func Dial(addr *net.TCPAddr) (*API, error) {\n\tconn, err := DialConnection(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &API{Connection: conn, buffer: &bytes.Buffer{}}, nil\n}", "title": "" }, { "docid": "74e9adf29f2564711aa42c2667a5731d", "score": "0.5334684", "text": "func (EthDialer) Dial(url string) (CallerSubscriber, error) {\n\tdialed, err := rpc.Dial(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn rpcSubscriptionWrapper{dialed}, nil\n}", "title": "" }, { "docid": "fa73f8b996ae7ba0d3fdc3f7b00e3aba", "score": "0.53194535", "text": "func dial() {\n\tvar err error\n\tconn, err = doozer.DialUri(*uri, *buri)\n\tif err != nil {\n\t\tfatal(err)\n\t}\n\tsetid()\n}", "title": "" }, { "docid": "f930da7d81f8908304debd7b64db5ee9", "score": "0.53161216", "text": "func Dial(url string) (Conner, error) {\n\tc, err := amqp.Dial(url)\n\treturn &connWrapper{conn: c}, err\n}", "title": "" }, { "docid": "26e7955ed465f1cc9720e5bbc5ca69f6", "score": "0.5293205", "text": "func Dial(freq *Request) (*Conn, error) {\n\tclient := &http.Client{\n\t\tTransport: &transport{},\n\t}\n\tresp, err := client.Do(makeHTTPRequest(freq))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Conn{\n\t\tresp: resp,\n\t\tr: textproto.NewReader(bufio.NewReader(resp.Body)),\n\t}, nil\n}", "title": "" }, { "docid": "9267019b2855815569f18403d1595e71", "score": "0.5291869", "text": "func ExampleDial() {\n\tconn, err := Dial(\"irc.quakenet.org:6667\")\n\tif err != nil {\n\t\tlog.Fatalln(\"Could not connect to IRC server\")\n\t}\n\n\tconn.Close()\n}", "title": "" }, { "docid": "003952ad69ba52987f8a75da382e3e0f", "score": "0.52812177", "text": "func DialContextFuncWith(logger *events.Logger, dial func(context.Context, string, string) (net.Conn, error)) func(context.Context, string, string) (net.Conn, error) {\n\treturn dialContextFunc(0, logger, dial)\n}", "title": "" }, { "docid": "7c3592847e5d01202498360dd08334bf", "score": "0.5268909", "text": "func Dial(ctx context.Context, node *config.Node, registry *protoregistry.Registry, errorTracker tracker.ErrorTracker, handshaker client.Handshaker, sidechannelRegistry *sidechannel.Registry) (*grpc.ClientConn, error) {\n\tstreamInterceptors := []grpc.StreamClientInterceptor{\n\t\tgrpcprometheus.StreamClientInterceptor,\n\t\tsidechannel.NewStreamProxy(sidechannelRegistry),\n\t}\n\n\tif errorTracker != nil {\n\t\tstreamInterceptors = append(streamInterceptors, middleware.StreamErrorHandler(registry, errorTracker, node.Storage))\n\t}\n\n\tunaryInterceptors := []grpc.UnaryClientInterceptor{\n\t\tgrpcprometheus.UnaryClientInterceptor,\n\t\tsidechannel.NewUnaryProxy(sidechannelRegistry),\n\t}\n\n\tdialOpts := []grpc.DialOption{\n\t\tgrpc.WithDefaultCallOptions(grpc.ForceCodec(proxy.NewCodec())),\n\t\tgrpc.WithPerRPCCredentials(gitalyauth.RPCCredentialsV2(node.Token)),\n\t\tgrpc.WithChainStreamInterceptor(streamInterceptors...),\n\t\tgrpc.WithChainUnaryInterceptor(unaryInterceptors...),\n\t}\n\n\treturn client.Dial(ctx, node.Address, dialOpts, handshaker)\n}", "title": "" }, { "docid": "d9e87c4cb8c840ef9754705d6e1d2cad", "score": "0.52669716", "text": "func Dial(remote ma.Multiaddr) (Conn, error) {\n\n\tmatchers.Lock()\n\tdefer matchers.Unlock()\n\n\tchain, split, err := matchers.buildChain(remote, S_Client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx := Context{}\n\tsctx := ctx.Special()\n\n\t// apply context mutators\n\tfor i, mch := range chain {\n\n\t\terr := mch.Apply(split[i], S_Client, ctx)\n\t\tif err != nil {\n\t\t\tif sctx.CloseFn != nil {\n\t\t\t\tsctx.CloseFn()\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif sctx.PreAddr == nil {\n\t\t\tsctx.PreAddr = split[i]\n\t\t} else {\n\t\t\tsctx.PreAddr = sctx.PreAddr.Encapsulate(split[i])\n\t\t}\n\n\t}\n\n\tif sctx.NetConn == nil {\n\t\tif sctx.CloseFn != nil {\n\t\t\tsctx.CloseFn()\n\t\t}\n\t\treturn nil, fmt.Errorf(\"insufficient address for a connection: %s\", remote)\n\t}\n\n\treturn &conn{\n\t\tConn: sctx.NetConn,\n\t\traddr: remote,\n\t\tcloseFn: sctx.CloseFn,\n\t}, nil\n}", "title": "" }, { "docid": "1dd904abc96d646ab661ae71aead4d9a", "score": "0.5266855", "text": "func Dial() (*websocket.Conn, *http.Response, error) {\n\tif clientID == \"\" || clientSecret == \"\" {\n\t\treturn nil, nil, fmt.Errorf(`abort: check \"CLIENT_ID\" and \"CLIENT_SECRET\" envvars`)\n\t}\n\tvar token string\n\tvar err error\n\tif token, err = getAccessToken(clientID, clientSecret); err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn websocket.DefaultDialer.Dial(\"wss://api.cybervox.ai/ws?access_token=\"+token, nil)\n}", "title": "" }, { "docid": "c3226768a557ad7954b29d3366a761a5", "score": "0.52663773", "text": "func Dial(addr string) (*Client, error) {\n\treturn DialSize(addr, maxBufSize)\n}", "title": "" }, { "docid": "78712bdb45089bf0411614e1ed7c0333", "score": "0.52627426", "text": "func (s *Aimbot) Dial(ctx *Context, network string, address string) (io.ReadWriteCloser, error) {\n\tvar (\n\t\tdst string\n\t\terr error\n\t\trwc io.ReadWriteCloser\n\t\ttag Road\n\t)\n\tlog.Printf(\"conn: %08x dial network=%s address=%s\", ctx.Cid, network, address)\n\tdst, _, err = net.SplitHostPort(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttag = s.Router.Road(ctx, dst)\n\tlog.Printf(\"conn: %08x route road=%s\", ctx.Cid, tag)\n\tswitch tag {\n\tcase RoadLocale:\n\t\trwc, err = s.Locale.Dial(ctx, network, address)\n\tcase RoadRemote:\n\t\trwc, err = s.Remote.Dial(ctx, network, address)\n\tcase RoadFucked:\n\t\terr = fmt.Errorf(\"conn: %s has been blocked\", dst)\n\tcase RoadPuzzle:\n\t\trwc, err = s.Remote.Dial(ctx, network, address)\n\t}\n\tif err == nil {\n\t\tlog.Printf(\"conn: %08x estab\", ctx.Cid)\n\t}\n\treturn rwc, err\n}", "title": "" }, { "docid": "efa903ef28d83cbe960061f9561dc2aa", "score": "0.52615005", "text": "func (y *YamuxDialer) Dial(addr string, d time.Duration) (net.Conn, error) {\n\ty.mu.Lock()\n\tdefer y.mu.Unlock()\n\tif y.session == nil || y.session.IsClosed() {\n\t\treturn nil, errors.New(\"not connected\")\n\t}\n\treturn y.session.Open()\n}", "title": "" }, { "docid": "1dea99c1464101fc5f1f28ea465e47ac", "score": "0.5255057", "text": "func WithContext(ctx context.Context) DialOption {\n\treturn func(cfg *mongoConfig) {\n\t\tcfg.ctx = ctx\n\t}\n}", "title": "" }, { "docid": "924f51ccf568eec69ec6eec03f2cb759", "score": "0.5249945", "text": "func (f *Client) Dial() (net.Conn, error) {\n\treturn f.DialNetwork(f.Network())\n}", "title": "" }, { "docid": "c9889357bc79c342942af3de467c2322", "score": "0.5247027", "text": "func execDialHTTP(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret, ret1 := rpc.DialHTTP(args[0].(string), args[1].(string))\n\tp.Ret(2, ret, ret1)\n}", "title": "" }, { "docid": "0c8bb5f0d92383216feae1d739409a35", "score": "0.5233775", "text": "func (t *TcpTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (transport.CapableConn, error) {\n\tconn, err := t.maDial(ctx, raddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Set linger to 0 so we never get stuck in the TIME-WAIT state. When\n\t// linger is 0, connections are _reset_ instead of closed with a FIN.\n\t// This means we can immediately reuse the 5-tuple and reconnect.\n\ttryLinger(conn, 0)\n\treturn t.Upgrader.UpgradeOutbound(ctx, t, conn, p)\n}", "title": "" }, { "docid": "46006dbe1e8ff5009261410726fc351b", "score": "0.52135277", "text": "func (b *Broker) Dial(url string) (RBConnection, error) {\n\treturn amqp.Dial(url)\n}", "title": "" }, { "docid": "faf37f3a83e94a370349896dd83a5395", "score": "0.52107364", "text": "func OverrideDial(dialFN func(ctx context.Context, net string, addr string) (net.Conn, error)) {\n\tdial.Store(dialFN)\n}", "title": "" }, { "docid": "fce9b2ec47a59b5817bbc7abbf3e73f8", "score": "0.5210536", "text": "func OptionDial(dial func(network, addr string) (net.Conn, error)) Option {\n\treturn func(t *http.Transport) *http.Transport {\n\t\tt.Dial = dial // nolint:go-lint,staticcheck\n\t\treturn t\n\t}\n}", "title": "" } ]
95c9f15c11e4a6beff8ad51c4b797aa2
runAll calls Run for each Node, and times out after RunTime.
[ { "docid": "dd215366c1e4d6fdde13f37ab685872e", "score": "0.7461159", "text": "func runAll(nodes []*Node) {\n\n\textendChannelCaps(nodes)\n\n\t// builds node internals after edges attached\n\tfor _, v := range nodes {\n\t\tv.Init()\n\t}\n\n\tif GmlOutput || DotOutput {\n\t\tif GmlOutput {\n\t\t\tOutputGml(nodes)\n\t\t} else {\n\t\t\tOutputDot(nodes)\n\t\t}\n\t\tTraceLevel = QQ\n\t\treturn\n\t}\n\n\tclearUpstreamAcks(nodes)\n\n\tif TraceLevel >= VVVV {\n\t\tsummarizing = true\n\t\tfor _, n := range nodes {\n\t\t\tn.TraceValRdy()\n\t\t}\n\t\tStdoutLog.Printf(\"<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>\\n\")\n\t\tsummarizing = false\n\t}\n\tStartTime = time.Now()\n\tvar wg sync.WaitGroup\n\twg.Add(len(nodes))\n\tfor i := range nodes {\n\t\tnode := nodes[i]\n\t\tgo func() {\n\t\t\tdefer func() {\n\t\t\t\twg.Done()\n\t\t\t}()\n\t\t\tnode.Run()\n\t\t}()\n\t}\n\n\ttimeout := RunTime\n\tif timeout > 0 {\n\t\ttime.Sleep(timeout)\n\t\tif TraceLevel > QQ {\n\t\t\tdefer StdoutLog.Printf(\"\\n\")\n\t\t}\n\t} else {\n\t\twg.Wait()\n\t}\n\n\tif TraceLevel >= VVV {\n\t\ttime.Sleep(time.Second)\n\t\tif TraceLevel >= VVVV {\n\t\t\tsummarizing = true\n\t\t}\n\t\tStdoutLog.Printf(\"<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>\\n\")\n\t\tfor i := 0; i < len(nodes); i++ {\n\t\t\tnodes[i].traceValRdy(false)\n\t\t}\n\t\t/*\n\t\t\tfor i := 0; i < len(nodes); i++ {\n\t\t\t\tnodes[i].showCases(\"\")\n\t\t\t}\n\t\t*/\n\n\t\tsummarizing = false\n\t}\n\n}", "title": "" } ]
[ { "docid": "a3006e74047b962ff109a06115d4a9b5", "score": "0.7299606", "text": "func RunAll(nodes []Node) {\n\t// build slice of pointers\n\tpnodes := make([]*Node, len(nodes))\n\tfor i := range nodes {\n\t\tpnodes[i] = &nodes[i]\n\t}\n\n\trunAll(pnodes)\n}", "title": "" }, { "docid": "cfca1b3ffda3886de0ec22039ba72569", "score": "0.69557774", "text": "func (s *Scheduler) RunAll() {\n\ts.RunAllwithDelay(0)\n}", "title": "" }, { "docid": "284e1228e7a0d2406a31d56df901111c", "score": "0.6878573", "text": "func (ss *Sim) RunTestAll() {\n\tss.StopNow = false\n\tss.TestAll()\n\tss.Stopped()\n}", "title": "" }, { "docid": "26896ef447b381e4c3bd19c1cdb22057", "score": "0.68417656", "text": "func (ss Steps) RunAll() error {\n\treturn ss.Run(0)\n}", "title": "" }, { "docid": "9612600f8577c642e83ba067c8bb3069", "score": "0.65288335", "text": "func (a Updater) Run() {\n\tfor {\n\t\tvar nodes []*Node\n\t\tvar snap cache.Snapshot\n\t\tproviderEndpoints, err := a.provider.GetClusters()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"error fetching globalCluster: %s\", err)\n\t\t\tgoto Wait\n\t\t}\n\t\tnodes, err = transform(providerEndpoints)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"error transforming data: %s\", err)\n\t\t}\n\t\tfor _, node := range nodes {\n\t\t\tsnap = cache.NewSnapshot(\n\t\t\t\tcomputeVersion(node.Endpoints()),\n\t\t\t\tnode.Endpoints(),\n\t\t\t\tnode.Clusters(),\n\t\t\t\tnode.Routes(),\n\t\t\t\tnode.Listeners(),\n\t\t\t)\n\t\t\ta.cache.SetSnapshot(node.Name, snap)\n\t\t}\n\n\tWait:\n\t\t<-time.After(time.Second * 10)\n\t}\n}", "title": "" }, { "docid": "f7b033e9518a647e1112440368103623", "score": "0.64887834", "text": "func (tl *TaskRunner) RunAll(ctx context.Context) TaskGroupErrors {\n\tfor i, tGroup := range tl.taskGroups {\n\t\tklog.V(2).Infof(\"processing task group %d of %d\", i+1, len(tl.taskGroups))\n\t\ttErrors := tGroup.RunConcurrently(ctx)\n\t\tif len(tErrors) > 0 {\n\t\t\treturn tErrors\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb6fc511581dc2dcf74e09440ef713e1", "score": "0.6369368", "text": "func (seq Sequence) RunAll(stat status.Interface) status.Interface {\n\tseq.isRunning <- true\n\tdefer func(){\n\t\t<-seq.isRunning\n\t}()\n\treturn seq.runAll(stat)\n}", "title": "" }, { "docid": "e592ff8a12ad49bbe09c676bcae695c7", "score": "0.6199385", "text": "func (n *Node) Run(gossip bool) {\n\t// The ControlTimer allows the background routines to control the heartbeat\n\t// timer when the node is in the Babbling state. The timer should only be\n\t// running when there are uncommitted transactions in the system.\n\tgo n.controlTimer.Run(n.config.P2P.FlushThrottleTimeout)\n\n\t// Execute some background work regardless of the state of the node.\n\tgo n.doBackgroundWork()\n\n\t//Execute Node State Machine\n\tfor {\n\t\t//Run different routines depending on node state\n\t\tstate := n.getState()\n\n\t\tn.logger.Debug(\"Run loop\", \"state\", state.String())\n\n\t\tswitch state {\n\t\tcase Babbling:\n\t\t\tn.babble(gossip)\n\t\tcase Shutdown:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ce181280adda735b8cba771ad96f7bde", "score": "0.61457944", "text": "func (n Node) Run(force bool, kill bool) error {\n\tif force {\n\t\tif err := n.Remove(force, kill); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\terr := n.ForAll(func(e *list.Element) error {\n\t\tcnt := e.Value.(Container)\n\t\treturn cnt.run()\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "36c939724bbafb1a79b883f4faadd029", "score": "0.6141049", "text": "func (r *CommandGenerators) RunAll() *Command {\n\tc := &Command{}\n\tfor _, x := range *r {\n\t\tx(c)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "ca865201fb4432f4120c3958bfbf8674", "score": "0.61075556", "text": "func (t *TestBehaviour) RunAllTests() {\n\tt.RunIsUserHaveRoleScope()\n}", "title": "" }, { "docid": "f5f441cab4d0c9a438bba96576d95d24", "score": "0.610485", "text": "func (tc *Controller) Run(stopCh <-chan struct{}) {\n\tfor _, podController := range tc.podController {\n\t\tgo podController.Run(stopCh)\n\t\t// wait for cache sync up\n\t\terr := wait.Poll(100*time.Millisecond, 60*time.Second, func() (bool, error) {\n\t\t\treturn podController.HasSynced(), nil\n\t\t})\n\t\tif err != nil || !podController.HasSynced() {\n\t\t\truntime.HandleError(fmt.Errorf(\"timed out waiting for caches to sync pod controller, err: %s\", err))\n\t\t\treturn\n\t\t}\n\t}\n\tgo tc.nodeController.Run(stopCh)\n\t// wait for cache sync up\n\terr := wait.Poll(100*time.Millisecond, 60*time.Second, func() (bool, error) {\n\t\treturn tc.nodeController.HasSynced(), nil\n\t})\n\tif err != nil || !tc.nodeController.HasSynced() {\n\t\truntime.HandleError(fmt.Errorf(\"timed out waiting for caches to sync node controller\"))\n\t\treturn\n\t}\n\t// This will run the func every 1 second until stopCh is sent\n\tgo wait.Until(\n\t\tfunc() {\n\t\t\t// Runs processNextItem in a loop, if it returns false it will\n\t\t\t// be restarted by wait.Until unless stopCh is sent.\n\t\t\tfor tc.processNextPod() {\n\t\t\t}\n\t\t},\n\t\ttime.Second,\n\t\tstopCh)\n\t// This will run the func every 1 second until stopCh is sent\n\tgo wait.Until(\n\t\tfunc() {\n\t\t\t// Runs processNextItem in a loop, if it returns false it will\n\t\t\t// be restarted by wait.Until unless stopCh is sent.\n\t\t\tfor tc.processNextNode() {\n\t\t\t}\n\t\t},\n\t\ttime.Second,\n\t\tstopCh)\n\t<-stopCh\n\tlog.Infof(\"stop taint readiness controller\")\n}", "title": "" }, { "docid": "4ef0907bf9ffb5fa06bcea12ca5686ae", "score": "0.60694176", "text": "func (c *Circuit) Run() {\n\tfor i := range c.computers {\n\t\tc.computers[i].Run()\n\t}\n}", "title": "" }, { "docid": "9d897e9ee497cbc6dbc90ddfa6dd9726", "score": "0.6067109", "text": "func (node *ActiveNode) Run() {\n\tdefer func() {\n\t\tPool().Unregister <- node\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-node.Ping:\n\t\t\tnode.conn.SetReadLimit(maxPongSize)\n\n\t\t\t// send the check ping\n\t\t\t_ = node.conn.SetWriteDeadline(time.Now().Add(pingWait))\n\t\t\tif err := node.conn.WriteMessage(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\tlogger.File().Infof(\"Error sending ping to node, %s\", err)\n\t\t\t\tPool().pingWaitGroup.Done()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// receive the check pong\n\t\t\t_ = node.conn.SetReadDeadline(time.Now().Add(pongWait))\n\t\t\tif err := node.conn.ReadJSON(node.Status); err != nil {\n\t\t\t\tlogger.File().Infof(\"Error receiving pong data from node, %s\", err)\n\t\t\t\tPool().pingWaitGroup.Done()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// TODO: need to update RTT\n\n\t\t\tnode.Status.lastCheckedAt = time.Now() // update last ping time\n\t\t\tnode.Status.isOld = false\n\t\t\tPool().pingWaitGroup.Done()\n\t\tcase shards := <-node.Save:\n\t\t\t_ = node.conn.SetWriteDeadline(time.Now().Add(saveWait))\n\n\t\t\t// byte array data are send as base64 encoded format\n\t\t\tif err := node.conn.WriteJSON(DataMsg{Type: uploadType, Contents: shards}); err != nil {\n\t\t\t\tlogger.File().Errorf(\"Error saving file to node, %s\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase loadChan := <-node.Load:\n\t\t\tnode.conn.SetReadLimit(maxLoadSize)\n\n\t\t\t// make download list\n\t\t\tshardsToDown := make([]*shardToDown, 0)\n\t\t\tfor _, shard := range loadChan.Shards {\n\t\t\t\tshardsToDown = append(\n\t\t\t\t\tshardsToDown,\n\t\t\t\t\t&shardToDown{Name: shard.Model.Name},\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// send the download list\n\t\t\t_ = node.conn.SetWriteDeadline(time.Now().Add(msgSendWait))\n\t\t\tif err := node.conn.WriteJSON(DataMsg{Type: downloadType, Contents: shardsToDown}); err != nil {\n\t\t\t\tlogger.File().Infof(\"Error sending download list to node, %s\", err)\n\t\t\t\tloadChan.WG.Done()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\treceivedShards := make([]*model.ShardToSave, 0)\n\n\t\t\t// receive the shards data\n\t\t\t_ = node.conn.SetReadDeadline(time.Now().Add(loadWait))\n\t\t\tif err := node.conn.ReadJSON(&receivedShards); err != nil {\n\t\t\t\tlogger.File().Infof(\"Error downloading data from node, %s\", err)\n\t\t\t\tloadChan.WG.Done()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// if count of shards is different\n\t\t\tif len(loadChan.Shards) != len(receivedShards) {\n\t\t\t\tlogger.File().Infof(\"Count of shards is different, maybe malformed data\")\n\t\t\t\tloadChan.WG.Done()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// copy shard data\n\t\t\tfor idx, receivedShard := range receivedShards {\n\t\t\t\t// check if whether received data name is same\n\t\t\t\tif loadChan.Shards[idx].Model.Name != receivedShard.Name {\n\t\t\t\t\tlogger.File().Infof(\"Shard name is different, maybe malformed data\")\n\t\t\t\t\tloadChan.WG.Done()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tloadChan.Shards[idx].Data = receivedShard.Data\n\t\t\t}\n\n\t\t\tloadChan.WG.Done()\n\t\tcase shards := <-node.Delete:\n\t\t\t_ = node.conn.SetWriteDeadline(time.Now().Add(msgSendWait))\n\n\t\t\t// send the deletion list\n\t\t\tif err := node.conn.WriteJSON(DataMsg{Type: deleteType, Contents: shards}); err != nil {\n\t\t\t\t// record to database for later deletion because currently cannot delete\n\t\t\t\tfor _, shard := range shards {\n\t\t\t\t\tdatabase.Conn().\n\t\t\t\t\t\tCreate(&model.DeletedShard{Name: shard.Name, MachineID: node.Model.MachineID})\n\t\t\t\t}\n\n\t\t\t\tlogger.File().Errorf(\"Error sending deletion list to node, %s\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-node.Flush:\n\t\t\t_ = node.conn.SetWriteDeadline(time.Now().Add(msgSendWait))\n\n\t\t\tflushList := make([]*model.DeletedShard, 0)\n\n\t\t\t// get flush list from the database\n\t\t\tdatabase.Conn().\n\t\t\t\tWhere(\"machine_id = ?\", node.Model.MachineID).\n\t\t\t\tFind(&flushList)\n\n\t\t\t// if flush list is not empty\n\t\t\tif len(flushList) != 0 {\n\t\t\t\t// make deletion list\n\t\t\t\tshards := make([]*model.ShardToDelete, 0)\n\t\t\t\tfor _, delShard := range flushList {\n\t\t\t\t\tshards = append(shards, &model.ShardToDelete{Name: delShard.Name})\n\t\t\t\t}\n\n\t\t\t\t// send the deletion list to the node\n\t\t\t\tif err := node.conn.WriteJSON(DataMsg{Type: deleteType, Contents: shards}); err != nil {\n\t\t\t\t\tlogger.File().Errorf(\"Error flushing deletion list to node, %s\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// at this point, deletion is success\n\t\t\t\t// so delete records of deletion list\n\t\t\t\tfor _, flushedShard := range flushList {\n\t\t\t\t\tdatabase.Conn().\n\t\t\t\t\t\tDelete(flushedShard)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ddcce692a240e33f7cada80d4e3debcc", "score": "0.6051444", "text": "func (ss *Sim) TestAll() {\n\tss.SetParams(\"Network\", false)\n\tss.TestEnv.Init(ss.TrainEnv.Run.Cur)\n\tfor {\n\t\tss.TestTrial(true) // return on chg, don't present\n\t\t_, _, chg := ss.TestEnv.Counter(env.Epoch)\n\t\tif chg || ss.StopNow {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8635571f607f8ec0623469c9365146e8", "score": "0.60298103", "text": "func (c *Check) Run(ctx context.Context, cluster *bee.Cluster, opts interface{}) (err error) {\n\tfmt.Println(\"running pingpong\")\n\to, ok := opts.(Options)\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid options type\")\n\t}\n\n\tif o.MetricsPusher != nil {\n\t\to.MetricsPusher.Collector(rttGauge)\n\t\to.MetricsPusher.Collector(rttHistogram)\n\t\to.MetricsPusher.Format(expfmt.FmtText)\n\t}\n\n\tnodeGroups := cluster.NodeGroups()\n\tfor _, ng := range nodeGroups {\n\t\tnodesClients, err := ng.NodesClients(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"get nodes clients: %w\", err)\n\t\t}\n\n\t\tfor n := range nodeStream(ctx, nodesClients) { // TODO: confirm use case for nodeStream(ctx, ng.NodesClientsAll(ctx))\n\t\t\tfor t := 0; t < 5; t++ {\n\t\t\t\ttime.Sleep(2 * time.Duration(t) * time.Second)\n\n\t\t\t\tif n.Error != nil {\n\t\t\t\t\tif t == 4 {\n\t\t\t\t\t\treturn fmt.Errorf(\"node %s: %w\", n.Name, n.Error)\n\t\t\t\t\t}\n\t\t\t\t\tfmt.Printf(\"node %s: %v\\n\", n.Name, n.Error)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfmt.Printf(\"Node %s: %s Peer: %s RTT: %s\\n\", n.Name, n.Address, n.PeerAddress, n.RTT)\n\n\t\t\t\trtt, err := time.ParseDuration(n.RTT)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif t == 4 {\n\t\t\t\t\t\treturn fmt.Errorf(\"node %s: %w\", n.Name, err)\n\t\t\t\t\t}\n\t\t\t\t\tfmt.Printf(\"node %s: %v\\n\", n.Name, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\trttGauge.WithLabelValues(n.Address.String(), n.PeerAddress.String()).Set(rtt.Seconds())\n\t\t\t\trttHistogram.Observe(rtt.Seconds())\n\n\t\t\t\tif o.MetricsPusher != nil {\n\t\t\t\t\tif err := o.MetricsPusher.Push(); err != nil {\n\t\t\t\t\t\tfmt.Printf(\"node %s: %v\\n\", n.Name, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"pingpong check completed successfully\")\n\treturn\n}", "title": "" }, { "docid": "4f5635cd3ab7e4aaf6eed0219434c7ae", "score": "0.597516", "text": "func (a *Agent) Run() {\n\ta.store.Initialize()\n\n\topts := &nomad.QueryOptions{WaitTime: 5 * time.Minute} // TODO: set context to cancel\n\tfor {\n\t\tallocs, meta, err := a.client.Allocations(a.NodeID, opts)\n\t\tif err != nil {\n\t\t\t// TODO: log error\n\t\t\ttime.Sleep(5 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tselect {\n\t\tcase <-a.shutdownCh:\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\n\t\t// If no change in index we just cycle again\n\t\tif opts.WaitIndex == meta.LastIndex {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, alloc := range allocs {\n\t\t\t// If the allocation hasn't changed do nothing\n\t\t\tif opts.WaitIndex >= alloc.ModifyIndex {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgo a.modifiedAllocation(alloc)\n\t\t}\n\t\topts.WaitIndex = meta.LastIndex\n\t}\n}", "title": "" }, { "docid": "962f067dd9ba55948eb5d82357c0d4d4", "score": "0.5918801", "text": "func (c *Cell) RunAll() *Cell {\n\tif valid := c.validate(); !valid {\n\t\treturn c\n\t}\n\n\tc.Total()\n\tc.StandardDeviation()\n\tc.Variance()\n\tc.Range()\n\tc.MaxWithIndices()\n\tc.MinWithIndices()\n\tc.Median(true)\n\tc.Median(false)\n\tc.Mean()\n\tc.Modes()\n\treturn c\n}", "title": "" }, { "docid": "81a40c4b3f458549c1a8c2833835ac26", "score": "0.58638805", "text": "func (n * NodeClient)Run(pendingTasks chan *Task){\n // Reserve a slot on node (chanel), get next task and treat\n for {\n n.limit <- struct{}{}\n if n.emergencyStop {\n break\n }\n task := <- pendingTasks\n task.key = fmt.Sprintf(\"%d_%d_%d\",task.idTaskControl,n.localId,n.localCounter)\n n.localCounter++\n go n.Treat(task)\n }\n // End of loop (surely cause by error), reinject running tasks into main chanel\n for _,task := range n.RunningTasks {\n pendingTasks <- task\n }\n}", "title": "" }, { "docid": "d0bee6113df8e85c9bdf8e76797d6b31", "score": "0.5862297", "text": "func (r *RPCCall) Run() error {\n\t// Send all the RPC calls in go routines.\n\tvar sendTime time.Time\n\tif showRunTimes {\n\t\tsendTime = time.Now()\n\t}\n\terr := r.send()\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Error starting RPC calls.\")\n\t\tlog.Error(msg)\n\t\treturn errors.New(msg)\n\t}\n\n\t// Collect responses via the \"r.results\" channel.\n\tif r.processes > 0 {\n\t\tvar timedout bool\n\t\ttimeout := common.TimeoutChan(rpcTimeout)\n\t\tfor !timedout {\n\t\t\tselect {\n\t\t\tcase answer := <-r.results:\n\t\t\t\tr.adpList[answer.adapter.ID] = answer\n\t\t\t\tr.processes--\n\t\t\t\tif answer.err != nil {\n\t\t\t\t\tr.errs = append(r.errs, answer.err)\n\t\t\t\t\tlog.Errorf(\"RPC call to: %q failed - %s\", answer.adapter.ID, answer.err)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// log.Debug(\"Answer: %s\", answer.response)\n\t\t\t\tr.process(answer.response)\n\n\t\t\tcase timedout = <-timeout:\n\t\t\t}\n\n\t\t\tif r.processes == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif timedout {\n\t\t\tfor k, v := range r.adpList {\n\t\t\t\tif v == nil {\n\t\t\t\t\tlog.Errorf(\"Adapter: %q timed out\", k)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif showRunTimes {\n\t\tlog.Info(\"RPC Call: %q took: %s\", r.service, time.Since(sendTime))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed9406bf4dddde53b32e09969120e2fd", "score": "0.5861415", "text": "func (p *SimplePipeline) Run(ctx context.Context) error {\n\tg, ctx := errgroup.WithContext(ctx)\n\tfor _, n := range p.nodes {\n\t\tnode := n\n\t\tg.Go(func() error {\n\t\t\treturn node.Start(ctx)\n\t\t})\n\t}\n\treturn g.Wait()\n}", "title": "" }, { "docid": "1a4d20c328f89a566beffdc07167a497", "score": "0.5859333", "text": "func (r *Runner) Run() (err error, success bool) {\n\tlog.Println(\"start testing...\")\n\tdefer log.Println(\"end of testing\")\n\n\t// stop all nodes after all\n\tdefer r.stopAll()\n\n\t// for every enabled set\n\tfor _, set := range r.conf.Sets {\n\t\tif !r.conf.IsEnabled(&set) {\n\t\t\tcontinue\n\t\t}\n\t\tlog.Print(\"...........................................................\")\n\t\tlog.Print(\"start set \", set.Name)\n\t\tlog.Print(\"...........................................................\")\n\n\tcases:\n\t\tfor i, testCase := range r.conf.TestsOfSet(&set) {\n\t\t\tvar report reportTestCase\n\t\t\treport.name = testCase.Name\n\t\t\treport.s = time.Now()\n\n\t\t\tlog.Print(\"=======================================================\")\n\t\t\tlog.Printf(\"Test case %d: %s\", i, testCase.Name)\n\t\t\tfor j, d := range testCase.Flow {\n\t\t\t\tlog.Print(\"---------------------------------------------------\")\n\t\t\t\tlog.Printf(\" %d/%d step\", i, j)\n\n\t\t\t\terr, mustFail := d.Execute(r)\n\t\t\t\tif err == nil {\n\t\t\t\t\terr = r.proceedWaiting()\n\t\t\t\t}\n\n\t\t\t\tif err != nil {\n\t\t\t\t\t// this is a failure, but might be an expected one\n\t\t\t\t\treport.directives = append(report.directives, reportFlowDirective{\n\t\t\t\t\t\tsuccess: mustFail,\n\t\t\t\t\t\terr: err,\n\t\t\t\t\t})\n\n\t\t\t\t\treport.e = time.Now()\n\t\t\t\t\tr.report = append(r.report, report) // add to report\n\t\t\t\t\tr.stopAll()\n\t\t\t\t\tr.resetWaiters()\n\n\t\t\t\t\tlog.Printf(\"[ERR] at the end of %d test case: %v\", i, err)\n\t\t\t\t\tif mustFail {\n\t\t\t\t\t\tlog.Printf(\"[The error is expected result of the test case]\")\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue cases\n\t\t\t\t}\n\n\t\t\t\t// test case succeeded\n\t\t\t\treport.directives = append(report.directives, reportFlowDirective{\n\t\t\t\t\tsuccess: !mustFail,\n\t\t\t\t\terr: err,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treport.e = time.Now()\n\t\t\tr.report = append(r.report, report)\n\t\t\tlog.Printf(\"end of %d %s test case\", i, testCase.Name)\n\t\t}\n\t}\n\n\tsuccess = r.processReport()\n\treturn err, success\n}", "title": "" }, { "docid": "290830c906eead5c2152d8fa427cabf7", "score": "0.58570874", "text": "func (ed *ECSDiscovery) Run(ctx context.Context) {\n\tticker := time.NewTicker(ed.interval)\n\tdefer ticker.Stop()\n\n\tp := func() {\n\t\ttargetGroups, err := ed.refresh()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\ttargetGroupsMarshalled, err := json.MarshalIndent(targetGroups, \"\", \" \")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlog.Debugf(\"Writing to %s\", ed.path)\n\t\terr = ioutil2.WriteFileAtomic(ed.path, targetGroupsMarshalled, 0644)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\t// Get an initial set right away.\n\tp()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tp()\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a1071608672796e81ca6a3760b79eca3", "score": "0.5842138", "text": "func (t *test) run(c chan result) {\n\tfor _, target := range t.targets {\n\t\ttarget.test(t, c)\n\t}\n}", "title": "" }, { "docid": "264556aa6d4c8811dcc31d8ce202b143", "score": "0.5836632", "text": "func (r *Runtime) Run(ctx context.Context) {\n\tvar wg sync.WaitGroup\n\tr.ctx = ctx\n\tfor i, job := range r.Conf.Jobs {\n\t\twg.Add(1)\n\t\t// TODO: Write a test that all jobs are started.\n\t\tgo func(job ConfigJob) {\n\t\t\tr.runWithInterval(job)\n\t\t\tlog.Printf(\"Job #%d finished\", i)\n\t\t\twg.Done()\n\t\t}(job)\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "5826ffd15a6603c4f1f48fe7ccdd33c7", "score": "0.5817142", "text": "func (this *Spider) Run() {\n quit := make(chan bool)\n go this.RunForever(quit)\n\n // check finish\n for {\n // if all tasks are finished, we can go out of the loop\n if this.IsFinished() {\n quit <- true\n log.Println(\"[INFO] Spider finished\")\n break\n } else {\n time.Sleep(10 * time.Millisecond)\n }\n }\n}", "title": "" }, { "docid": "a43a0cf5b6b2073ce23bc1f4cce83acc", "score": "0.580948", "text": "func (c *cluster) stopAll() {\n\tc.t.Helper()\n\tfor _, s := range c.servers {\n\t\ts.Shutdown()\n\t}\n}", "title": "" }, { "docid": "06bab8fef07463c53f2c1a9cb77679c1", "score": "0.5769514", "text": "func (col Collection) Run() {\n\tfor i := range col {\n\t\tcol[i].Run()\n\t}\n}", "title": "" }, { "docid": "4478cc5c911ae93933ffcd443e06ae20", "score": "0.5737306", "text": "func (s *Scheduler) RunAllwithDelay(d time.Duration) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\tfor _, job := range s.jobs {\n\t\tgo job.run()\n\t\tif 0 != d {\n\t\t\ttime.Sleep(d)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "68f96c930ca7df136d516cbe53515564", "score": "0.57235104", "text": "func Run() error {\n\tif len(roots) == 0 {\n\t\treturn nil\n\t}\n\t//roots, err := SortRoots()\n\t//if err != nil {\n\t//\t\treturn err\n\t//\t}\n\tErrors = nil\n\texecuted := 0\n\trecurred := 0\n\tfor executed < len(roots) {\n\t\trecurred++\n\t\tstart := executed\n\t\texecuted = len(roots)\n\t\tfor _, root := range roots[start:] {\n\t\t\troot.IterateSets(runSet)\n\t\t}\n\t\tif recurred > 100 {\n\t\t\t// Let's cross that bridge once we get there\n\t\t\treturn fmt.Errorf(\"too many generated roots, infinite loop?\")\n\t\t}\n\t}\n\tif Errors != nil {\n\t\treturn Errors\n\t}\n\n\t/*\n\t\tfor _, root := range roots {\n\t\t\troot.IterateSets(validateSet)\n\t\t}\n\t\tif Errors != nil {\n\t\t\treturn Errors\n\t\t}\n\t\tfor _, root := range roots {\n\t\t\troot.IterateSets(finalizeSet)\n\t\t}\n\t*/\n\treturn nil\n}", "title": "" }, { "docid": "f903a4bfe8cfb0c398227856c3debc4c", "score": "0.57178843", "text": "func (g *generalScheduler) Run() error {\n\tvar taskinfo []*framework.BindTaskInfo\n\n\tfor _, pidstr := range strings.Split(g.pids, \",\") {\n\t\tif strings.Contains(pidstr, \"-\") {\n\t\t\tpidRange := strings.Split(pidstr, \"-\")\n\t\t\tminPid, _ := strconv.ParseUint(pidRange[0], utils.DecimalBase, utils.Uint64Bits)\n\t\t\tmaxPid, _ := strconv.ParseUint(pidRange[1], utils.DecimalBase, utils.Uint64Bits)\n\t\t\tfor pid := minPid; pid <= maxPid; pid++ {\n\t\t\t\tvar ti framework.BindTaskInfo\n\t\t\t\tti.Pid = pid\n\t\t\t\tti.Node = topology.DefaultSelectNode()\n\t\t\t\ttaskinfo = append(taskinfo, &ti)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tvar ti framework.BindTaskInfo\n\t\tpid, err := strconv.ParseUint(pidstr, utils.DecimalBase, utils.Uint64Bits)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"pids error : %s\", err)\n\t\t}\n\t\tti.Pid = pid\n\t\tti.Node = topology.DefaultSelectNode()\n\t\ttaskinfo = append(taskinfo, &ti)\n\t}\n\n\tticker := time.NewTicker(time.Second * period)\n\n\tg.plugin.Preprocessing(&taskinfo)\n\tsendChanToAdm(g.ch, \"Preprocessing\", utils.SUCCESS, \"\")\n\tbindFlag := false\n\tfor {\n\t\tselect {\n\t\tcase <-g.ctx.Done():\n\t\t\treturn g.ctx.Err()\n\t\tcase <-ticker.C:\n\t\t\tsysload.Sysload.Update()\n\t\t\tupdateNodeLoad()\n\n\t\t\tif !bindFlag {\n\t\t\t\tg.plugin.PickNodesforPids(&taskinfo)\n\t\t\t\tsendChanToAdm(g.ch, \"PickNodesforPids Results:\", utils.SUCCESS, \"\")\n\n\t\t\t\tfor _, ti := range taskinfo {\n\t\t\t\t\tsendChanToAdm(g.ch, strconv.FormatUint(ti.Pid, utils.DecimalBase), utils.INFO, fmt.Sprintf(\n\t\t\t\t\t\t\"type:%v id:%v\", ti.Node.Type(), ti.Node.ID()))\n\t\t\t\t}\n\n\t\t\t\tbindTaskToTopoNode(&taskinfo)\n\t\t\t\tbindFlag = true\n\n\t\t\t\tfor _, task := range taskinfo {\n\t\t\t\t\tsysload.Sysload.AddTask(task.Pid)\n\t\t\t\t}\n\t\t\t\tsendChanToAdm(g.ch, \"bindTaskToTopoNode finished\", utils.SUCCESS, \"\")\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tg.plugin.Postprocessing(&taskinfo)\n\t\t\tbindTaskToTopoNode(&taskinfo)\n\t\t\tsendChanToAdm(g.ch, \"Postprocessing\", utils.SUCCESS, \"\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3ab643364b34d00a16c166eda301a767", "score": "0.5717139", "text": "func (r Requests) DoAll(server string) error {\n\tfor _, v := range r {\n\t\t_, err := v.Do(server)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "852164ea4d52ef3007b66de0347514b2", "score": "0.5713139", "text": "func (c *Computer) Run() {\n\tvar err error\n\tfor err == nil {\n\t\terr = c.Next()\n\t}\n}", "title": "" }, { "docid": "93af6c75c39cc42a1918da3cf0bbc7c2", "score": "0.5703824", "text": "func (m *mainStruct) mainLoop() {\n\n\t// lets do a limit of threads, 1k should be more than enough, it means 20 per second per downed server\n\tmax_goroutines := 1000\n\tgoroutines := make(chan int, max_goroutines)\n\n\t// to infinity, and beyond\n\tfor {\n\t\tm.connect() // will only connect if not yet connected, logic is there\n\t\tnodes := m.client.GetNodes() // get a list of nodes\n\n\t\t// execute for each node\n\t\tfor _, nnode := range nodes {\n\n\t\t\t// useful to know\n\t\t\tif len(goroutines) == max_goroutines {\n\t\t\t\tlogger.Warn(\"Something is hanging, we have %d threads running. Going to wait for an available thread before continuing.\",max_goroutines)\n\t\t\t}\n\n\t\t\t// this chan stuff is cool, basically, if we try to put more in than we can, it will just hang there and wait, auto-throttling\n\t\t\tgoroutines <- 1\n\n\t\t\t// wrap around in a goroutine to run async - in case one node needs a timeout as it hangs\n\t\t\tgo func(node *as.Node, nodesCount int, goroutines chan int) {\n\n\t\t\t\t// lets handle panics\n\t\t\t\tdefer func() {\n\t\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\t\tlogger.Critical(\"Recovered in f: %s\", r)\n\t\t\t\t\t}\n\t\t\t\t}()\n\n\t\t\t\t// we want the routine to note it exited once it is done, so the main thread know - for throttling, you see\n\t\t\t\tdefer func(goroutines chan int) {\n\t\t\t\t\t<-goroutines\n\t\t\t\t}(goroutines)\n\n\t\t\t\t// we will need them later, cluster size, tx pending and rx pending\n\t\t\t\t// yes, we want to declare them this way, because if something wrong goes on, we should still have them and print what we got\n\t\t\t\tcs := \"\"\n\t\t\t\ttx := \"\"\n\t\t\t\trx := \"\"\n\n\t\t\t\t// some basic stuff we can log, because we can\n\t\t\t\tnodeName := node.GetName()\n\t\t\t\tnodeHost := node.GetHost().String()\n\t\t\t\tnodeActive := node.IsActive()\n\n\t\t\t\t// lets issue actual Info()\n\t\t\t\tinfo, err := node.RequestInfo(fmt.Sprintf(\"namespace/%s\", m.ns))\n\t\t\t\tif err != nil {\n\t\t\t\t\t// wops, log that Info() failed, reason and anything else we gathered\n\t\t\t\t\tlogger.Error(\"InfoGetError,node=%s,host=%s,nodeActive=%t,clientNodesConnected=%d,err=%s,ThreadCount=%d\", nodeName, nodeHost, nodeActive, len(nodes), err, len(goroutines))\n\t\t\t\t} else {\n\n\t\t\t\t\t// now some play with strings, separate results\n\t\t\t\t\tndts := strings.Split(info[fmt.Sprintf(\"namespace/%s\", m.ns)], \";\")\n\n\t\t\t\t\t// go through each separate result and find the 3 we care about (cs, tx, rx)\n\t\t\t\t\t// if we found all 3 already, break out of this loop, no point wasting precious milliseconds\n\t\t\t\t\tfound := 0\n\t\t\t\t\tfor _, ndt := range ndts {\n\t\t\t\t\t\tif strings.HasPrefix(ndt, \"ns_cluster_size=\") {\n\t\t\t\t\t\t\tcs = ndt\n\t\t\t\t\t\t\tfound = found + 1\n\t\t\t\t\t\t} else if strings.HasPrefix(ndt, \"migrate_tx_partitions_remaining=\") {\n\t\t\t\t\t\t\ttx = ndt\n\t\t\t\t\t\t\tfound = found + 1\n\t\t\t\t\t\t} else if strings.HasPrefix(ndt, \"migrate_rx_partitions_remaining=\") {\n\t\t\t\t\t\t\trx = ndt\n\t\t\t\t\t\t\tfound = found + 1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif found == 3 {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// lets log success and all the data we got\n\t\t\t\t\tlogger.Info(\"InfoGetSuccess,node=%s,host=%s,nodeActive=%t,clientNodesConnected=%d,%s,%s,%s,ThreadCount=%d\", nodeName, nodeHost, nodeActive, len(nodes), cs, tx, rx, len(goroutines))\n\t\t\t\t}\n\t\t\t}(nnode, len(nodes), goroutines)\n\t\t}\n\n\t\t// short snooze before the loop ;)\n\t\ttime.Sleep(50 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "2afa201824963270cade6374a0190372", "score": "0.57030356", "text": "func (cc *NodeController) Run(workers int, stopCh <-chan struct{}) {\n defer utilruntime.HandleCrash()\n defer cc.queue.ShutDown()\n\n logrus.Infof(\"Starting node controller\")\n defer logrus.Infof(\"Shutting down node controller\")\n\n if !cache.WaitForCacheSync(stopCh, cc.nodesSynced) {\n return\n }\n\n for i := 0; i < workers; i++ {\n go wait.Until(cc.runWorker, time.Second, stopCh)\n }\n\n <-stopCh\n}", "title": "" }, { "docid": "be541af1e4a876590e589ece1a50965d", "score": "0.5691832", "text": "func (dd *Discovery) Run(ctx context.Context, ch chan<- []*TargetGroup) {\n\tdefer close(ch)\n\n\tticker := time.NewTicker(dd.interval)\n\tdefer ticker.Stop()\n\n\t// Get an initial set right away.\n\tdd.refreshAll(ctx, ch)\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tdd.refreshAll(ctx, ch)\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "becfcd347f1aa22f4936fbdb8133dbd6", "score": "0.5690044", "text": "func RunGraph(nodes []*Node) {\n\trunAll(nodes)\n}", "title": "" }, { "docid": "c4a3f336774df92747a62720227a6cbd", "score": "0.5679083", "text": "func (r *Replicator) Run() {\n\tfor policy, theRing := range r.Rings {\n\t\tdevices, err := theRing.LocalDevices(r.port)\n\t\tif err != nil {\n\t\t\tr.logger.Error(\"Error getting local devices from ring\", zap.Error(err))\n\t\t\treturn\n\t\t}\n\t\tfor _, dev := range devices {\n\t\t\trd := newReplicationDevice(dev, policy, r)\n\t\t\tkey := rd.Key()\n\t\t\tr.runningDevices[key] = rd\n\t\t\tr.onceWaiting++\n\t\t\tgo func(rd *replicationDevice) {\n\t\t\t\trd.Replicate()\n\t\t\t\tr.onceDone <- struct{}{}\n\t\t\t}(rd)\n\t\t}\n\t}\n\tfor r.onceWaiting > 0 {\n\t\tr.runLoopCheck(make(chan time.Time))\n\t}\n\tr.reportStats()\n}", "title": "" }, { "docid": "f174008471e13466e287c4ff78688033", "score": "0.56712884", "text": "func (t *TestBehaviour) RunAllTests() {\n\t// Need our authentication tokens for each persona/user\n\tt.RunGetCLAProjectManagerToken()\n\tt.RunValidateCLAGroupValid(\"functional-test\", \"functional test description\")\n\tt.RunValidateCLAGroupInvalid(\"fu\", \"functional test description\")\n\tt.RunValidateCLAGroupInvalid(\"fu\", \"functional test description\")\n\tt.RunValidateCLAGroupInvalid(\"functional-test\", \"fu\")\n\tt.RunValidateCLAGroupInvalid(\" \", \" \")\n\tt.RunValidateCLAGroupInvalid(\" \", \"functional test description\")\n\tt.RunValidateCLAGroupInvalid(\"functional-test\", \" \")\n\t// This CLA Group name is already in the DB - should trigger a duplicate violation\n\tt.RunValidateCLAGroupInvalidDuplicate(\"CLA group name QA\", \"doesn't matter\")\n}", "title": "" }, { "docid": "c15e753c68a5fd64e50cb07d61ac970b", "score": "0.5665476", "text": "func (s *Service) RunAllChecks() error {\n\tawsConfigs, err := s.ListClusters()\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\tclusterIDs, err := s.ListClusterIDs(awsConfigs)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\terr = s.FindDuplicateMasterNodes(clusterIDs)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\terr = s.OrphanResourcesAlert(clusterIDs)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\terr = s.OrphanClustersAlert(awsConfigs)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a8f02d1bf008152e7b563dd449546f9e", "score": "0.5656616", "text": "func (dagExec *DagExecution) Run() {\n\tlog.Printf(\"Starting %s pipeline - execution id: %s\", dagExec.Dag.Name, dagExec.ExecutionID) // TODO add to a dag log\n\n\tfor next := runNodes(dagExec.Root); len(next) > 0; next = runNodes(next) {\n\t}\n}", "title": "" }, { "docid": "0991c5676abb946c5cba62397c90e8a4", "score": "0.5656057", "text": "func (a *Agent) Run(shutdown chan struct{}) error {\n\tvar wg sync.WaitGroup\n\n\tfor _, plugin := range a.plugins {\n\t\tif plugin.config.Interval != 0 {\n\t\t\twg.Add(1)\n\t\t\tgo func(plugin *runningPlugin) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tif err := a.crankSeparate(shutdown, plugin); err != nil {\n\t\t\t\t\tlog.Printf(err.Error())\n\t\t\t\t}\n\t\t\t}(plugin)\n\t\t}\n\t}\n\n\tdefer wg.Wait()\n\n\tticker := time.NewTicker(a.Interval.Duration)\n\n\tfor {\n\t\tif err := a.crankParallel(); err != nil {\n\t\t\tlog.Printf(err.Error())\n\t\t}\n\n\t\tselect {\n\t\tcase <-shutdown:\n\t\t\treturn nil\n\t\tcase <-ticker.C:\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d3cb21d9178fb3ad640e59d5060cab50", "score": "0.5649529", "text": "func Run(suites ...*Suite) {\n\tvar wg sync.WaitGroup\n\twg.Add(len(suites))\n\n\tfor _, suite := range suites {\n\t\trunSuite(suite, &wg)\n\t}\n\n\twg.Wait()\n}", "title": "" }, { "docid": "9f169de68783bcefcbb17f3909cc5779", "score": "0.5639461", "text": "func (g *Group) ExecuteAll(args []string) (n int) {\n\tfor _, p := range *g {\n\t\tif _, err := p.Cmd.Execute(args, p.Fn); err == nil {\n\t\t\tn++\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6e69673ed609b5686ec784d441b776f6", "score": "0.5635941", "text": "func (i *InternalCollector) Run() {\n\ttick := time.Tick(defaultRefreshInterval)\n\ti.RefreshPollers()\n\t// refresh pollers forever\n\tfor {\n\t\tselect {\n\t\tcase <-tick:\n\t\t\ti.RefreshPollers()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ad4f4a4b585863bb45d0208b3a829d70", "score": "0.56212366", "text": "func (s *Server) Run() error {\n\t//l := s.logger.WithField(\"function\", \"Run\")\n\tif s.runners == nil || len(s.runners) == 0 {\n\t\treturn errors.New(\"no runners\")\n\t}\n\n\t// interrupt handler.\n\terrc := make(chan error)\n\tgo func() {\n\t\tc := make(chan os.Signal, 1)\n\t\tsignal.Notify(c, syscall.SIGINT, syscall.SIGTERM)\n\t\terrc <- fmt.Errorf(\"%s\", <-c)\n\t}()\n\n\t// run all defined runners\n\tfor _, v := range s.runners {\n\t\tgo func(r Runner) {\n\t\t\terrc <- r.Run()\n\t\t}(v)\n\t}\n\n\t// wait for event\n\tvar err = <-errc\n\n\t// cleanup\n\ts.Close()\n\n\treturn err\n}", "title": "" }, { "docid": "1cdd877f4bcc0177f3dc64f9c2a22773", "score": "0.56207675", "text": "func (s *Service) Run(ctx context.Context) {\n\ts.Log.Info(\"Started.\")\n\n\twg := sync.WaitGroup{}\n\n\tfor _, runner := range s.runners {\n\t\tohigo := runner\n\t\twg.Add(1)\n\n\t\tgo func() {\n\t\t\tohigo(ctx)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\twg.Wait()\n}", "title": "" }, { "docid": "143a37385310c830b83592ddc14a5a29", "score": "0.5611424", "text": "func (ts *TestSuite) Run(ctx context.Context) {\n\tfor _, test := range ts.Tests {\n\t\tts.TestResults = append(ts.TestResults, *test.Run(ctx))\n\t}\n}", "title": "" }, { "docid": "6463e163c209153ef5927f21318a0302", "score": "0.56069875", "text": "func (b Brain) Run() {\n\tfor b.isRunning {\n\t\tstate := retrieveState()\n\t\tb.makeStep(state)\n\t}\n}", "title": "" }, { "docid": "c7051c3f2bda3946d93396262e92abae", "score": "0.55562335", "text": "func (net *Network) StopAll() error {\n\tfor _, node := range net.Nodes {\n\t\tif !node.Up {\n\t\t\tcontinue\n\t\t}\n\t\tif err := net.Stop(node.ID()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c2742208b42072b77d937fd859be25f4", "score": "0.555515", "text": "func All(stopables ...*task.Task) {\n\tfor _, stopable := range stopables {\n\t\tstopable.Stop()\n\t}\n}", "title": "" }, { "docid": "1939d01ba033292285aa92f010e63618", "score": "0.5554719", "text": "func (m *Monitor) Run() {\n\tdone := make(chan bool)\n\tfinedNodeChan := make(chan node)\n\tgo m.fetchFinedNodes(finedNodeChan)\n\tgo m.sendNotifications(finedNodeChan, FINED)\n\tgo m.checkTanBalance()\n\tgo m.checkEthBalance()\n\t<-done\n}", "title": "" }, { "docid": "e2140d40eb00203cb01e68dd14769afa", "score": "0.5551629", "text": "func Run(seed ...Request) {\n\tvar requests []Request\n\tfor _, req := range seed {\n\t\trequests = append(requests, req)\n\t}\n\n\tfor len(requests) > 0 {\n\t\tr := requests[0]\n\t\trequests = requests[1:]\n\t\tlog.Printf(\"fetching:%s\", r.Url)\n\t\tparseResult, err := work(r)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\trequests = append(requests, parseResult.Requests...)\n\t\ttime.Sleep(time.Millisecond * 1200)\n\t}\n}", "title": "" }, { "docid": "361be38d0a5fb019e49df6a536727da5", "score": "0.55471766", "text": "func (n *NodeRelevanceService) Run(ctx context.Context) {\n\tgo func() {\n\t\tlog.Info(\"Node relevance monitoring started\")\n\t\tfor {\n\t\t\trelevance, err := n.checkNodeRelevance(ctx)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithFields(log.Fields{\"type\": consts.BCRelevanceError, \"err\": err}).Error(\"checking blockchain relevance\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif !relevance && !IsNodePaused() {\n\t\t\t\tlog.Info(\"Node Relevance Service is pausing node activity\")\n\t\t\t\tn.pauseNodeActivity()\n\t\t\t}\n\n\t\t\tif relevance && IsNodePaused() {\n\t\t\t\tlog.Info(\"Node Relevance Service is resuming node activity\")\n\t\t\t\tn.resumeNodeActivity()\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-time.After(n.checkingInterval):\n\t\t\tcase <-updatingEndWhilePaused:\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "d12c525ceae83ad5d2d29b495d11fffb", "score": "0.55454236", "text": "func (s *ChallSrv) Run() {\n\ts.log.Printf(\"Starting challenge servers\")\n\n\t// Start each server in their own dedicated Go routine\n\tfor _, srv := range s.servers {\n\t\tgo func(srv challengeServer) {\n\t\t\terr := srv.ListenAndServe()\n\t\t\tif err != nil && !strings.Contains(err.Error(), \"Server closed\") {\n\t\t\t\ts.log.Print(err)\n\t\t\t}\n\t\t}(srv)\n\t}\n}", "title": "" }, { "docid": "ac78e4726fb68b3efe537c237d7264b0", "score": "0.5526814", "text": "func (indexer *ContentIndexer) Run(ctx context.Context) {\n\tlastRunTimestamp := time.Time{}\n\tindexIntervalSeconds := time.Duration(indexer.indexInterval) * time.Second\n\n\t// main loop\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Info(\"Bye\")\n\t\t\treturn\n\t\tdefault:\n\t\t\tawakeIndexer := time.Now().Sub(lastRunTimestamp) > indexIntervalSeconds\n\t\t\tif awakeIndexer {\n\t\t\t\terr := indexer.runEpoch(ctx)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\t\tlastRunTimestamp = time.Now()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "865d3c177608eef747ead0576edcbbd3", "score": "0.5520817", "text": "func (env *TestEnv) KillAllRaidenNodes() {\n\tvar pstr2 []string\n\t//kill the old process\n\tif runtime.GOOS == \"windows\" {\n\t\tpstr2 = append(pstr2, \"-F\")\n\t\tpstr2 = append(pstr2, \"-IM\")\n\t\tpstr2 = append(pstr2, \"smartraiden*\")\n\t\tExecShell(\"taskkill\", pstr2, \"./log/killall.log\", true)\n\t} else {\n\t\tpstr2 = append(pstr2, \"smartraiden\")\n\t\tExecShell(\"killall\", pstr2, \"./log/killall.log\", true)\n\t}\n\tLogger.Println(\"Kill all raiden nodes SUCCESS\")\n}", "title": "" }, { "docid": "6b427571399e83d2ef35d2bbc33f99e8", "score": "0.5518538", "text": "func (net *Network) StartAll() error {\n\tfor _, node := range net.Nodes {\n\t\tif node.Up {\n\t\t\tcontinue\n\t\t}\n\t\tif err := net.Start(node.ID()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "65c4488169b1715219c161b97851af7c", "score": "0.5504086", "text": "func (n *Node) Run() {\n\t// Packets onto the network\n\tn.packetsOut = make(chan packet, 1024)\n\n\t// Create a slab for allocation\n\tbyteSlab := newSlab(8192, 10)\n\n\tn.log.Debug(\"starting packet writer\")\n\tgo n.packetWriter()\n\n\t// Find neighbours\n\tgo n.makeNeighbours()\n\n\tn.log.Debug(\"starting packet reader\")\n\tfor {\n\t\tb := byteSlab.alloc()\n\t\tc, addr, err := n.conn.ReadFrom(b)\n\t\tif err != nil {\n\t\t\tn.log.Warn(\"UDP read error\", \"error\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// Chop and process\n\t\tn.processPacket(packet{\n\t\t\tdata: b[0:c],\n\t\t\traddr: addr,\n\t\t})\n\t\tbyteSlab.free(b)\n\t}\n}", "title": "" }, { "docid": "b4e2d4c8a34cefca6553f31272e1c2a6", "score": "0.54962474", "text": "func (r *Replicator) RunForever() {\n\tgo r.startWebServer()\n\treportTimer := time.NewTimer(StatsReportInterval)\n\tr.verifyRunningDevices()\n\tfor {\n\t\tr.runLoopCheck(reportTimer.C)\n\t}\n}", "title": "" }, { "docid": "3cfbbe7fc2549cd519a4236bcdf749d1", "score": "0.54925656", "text": "func (m *impl) stopAll() {\n\tfor _, t := range m.scheduledTasks {\n\t\tm.unscheduleAndRemoveFromScheduledTasksState(t)\n\t}\n}", "title": "" }, { "docid": "14ca29508e4c0560bbbb2eea6ff5d699", "score": "0.5491735", "text": "func Run(fnc ...func()) {\n\tglobal.Run(fnc...)\n}", "title": "" }, { "docid": "1c954cb74e579882213613b3e3154a19", "score": "0.54670906", "text": "func (p *Node) Run() {\n\n\tp.nodeConn = make([]net.Conn, p.nodeCount)\n\n\tif p.myRole == ROLE_CLIENT {\n\t\ttime.Sleep(time.Millisecond * 3000)\n\t\tp.initConnectionsAsClient()\n\t\treturn\n\n\t} else if p.myRole == ROLE_PEER_FOLLOWER || p.myRole == ROLE_PEER_LEADER {\n\t\tgo p.openAndListen(PORT_CLIENT)\n\t\tgo p.openAndListen(PORT_PEER)\n\t\tgo p.openAndListen(PORT_COORD)\n\n\t\ttime.Sleep(time.Millisecond * 2000)\n\n\t\tgo p.initConnectionsAsPeer()\n\n\t\twaitingFor := p.peerCount + p.clientCount\n\t\tif p.coordPresent {\n\t\t\twaitingFor++\n\t\t}\n\t\tfor waitingFor > 0 {\n\t\t\t<-p.chConEvent\n\t\t\t//fmt.Printf(\"Connection on port %d\\n\", conPort)\n\t\t\twaitingFor--\n\t\t}\n\n\t\tp.RunPeerLoop()\n\n\t} else if p.myRole == ROLE_COORDINATOR {\n\n\t\tgo p.openAndListen(PORT_COORD)\n\n\t\ttime.Sleep(time.Millisecond * 2000)\n\n\t\tgo p.initConnectionsAsPeer()\n\n\t\twaitingFor := p.peerCount + 1\n\t\tfor waitingFor > 0 {\n\t\t\t<-p.chConEvent\n\t\t\t//fmt.Printf(\"Connection on port %d\\n\", conPort)\n\t\t\twaitingFor--\n\t\t}\n\n\t\tp.RunCoordLoop()\n\n\t}\n\n}", "title": "" }, { "docid": "3e914d01c187f05c601170f730ea5069", "score": "0.5462789", "text": "func (p *Plan) Run() {\n\tfmt.Printf(\"Running plan on %s:%d\\n\", p.Host, p.Port)\n\twg := sync.WaitGroup{}\n\tfor _, thread := range p.Threads {\n\t\twg.Add(1)\n\t\tgo func(t *Thread) {\n\t\t\tdefer wg.Done()\n\t\t\tfmt.Printf(\"Running %d threads sending a new request each %dms during %dms on route %s\\n\", t.Count, t.Gap, t.Duration, t.Route)\n\t\t\tt.Run(p.Host, p.Port, p.Https)\n\t\t}(thread)\n\t}\n\twg.Wait()\n\tfmt.Printf(\"Ending plan, computing results\\n\")\n\tp.DisplayResult()\n}", "title": "" }, { "docid": "d725c60933a081d2a7cc47dd98d8848d", "score": "0.5459633", "text": "func (e *ecuStats) run() {\n\te.runOnce()\n\tfor range time.Tick(e.ecu.cfg.UpdateInterval) {\n\t\te.runOnce()\n\t}\n}", "title": "" }, { "docid": "c4733e6d9b029644db2573d93de4aa59", "score": "0.5458775", "text": "func (s *server) run() error {\n\tfor {\n\t\ts.step()\n\t}\n}", "title": "" }, { "docid": "65105e7701a50ec195da0359fdce735f", "score": "0.5453382", "text": "func (p *Pool) Run(handler ResponseHandler) {\n\tfor _, worker := range p.workers {\n\t\tgo worker.Run(handler, &p.wg)\n\t}\n}", "title": "" }, { "docid": "0dfd80e2db2bef1d3157d721e9945655", "score": "0.54512465", "text": "func RunAllMonitoring(ctx context.Context, settings *evergreen.Settings) error {\n\t// initialize the notifier\n\tnotifier := &Notifier{\n\t\tnotificationBuilders: defaultNotificationBuilders,\n\t}\n\n\t// send notifications\n\terr := notifier.Notify(settings)\n\tgrip.Error(message.WrapError(err, message.Fields{\n\t\t\"runner\": RunnerName,\n\t\t\"message\": \"Error sending notifications\",\n\t}))\n\n\t// Do alerts for spawnhosts - collect all hosts expiring in the next 12 hours.\n\t// The trigger logic will filter out any hosts that aren't in a notification window, or have\n\t// already have alerts sent.\n\tnow := time.Now()\n\tthresholdTime := now.Add(12 * time.Hour)\n\texpiringSoonHosts, err := host.Find(host.ByExpiringBetween(now, thresholdTime))\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tfor _, h := range expiringSoonHosts {\n\t\tif err = alerts.RunSpawnWarningTriggers(&h); err != nil {\n\t\t\tgrip.Error(message.WrapError(err, message.Fields{\n\t\t\t\t\"runner\": RunnerName,\n\t\t\t\t\"message\": \"Error queuing alert\",\n\t\t\t\t\"host\": h.Id,\n\t\t\t}))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4ca410b01adb41f60bef9d24a853851f", "score": "0.544888", "text": "func (n Nodes) pingAll() {\n\tc := make(chan bool, len(n))\n\tfor _, node := range n {\n\t\tgo func(tgt *Node) { tgt.pingAndSet(); c <- true }(node)\n\t}\n\tfor i := 0; i < cap(c); i++ {\n\t\t<-c\n\t}\n}", "title": "" }, { "docid": "92a001cfb602599f7e660473e463a685", "score": "0.54434127", "text": "func (c *ChainlinkProfileTest) Run() {\n\tprofileGroup := new(errgroup.Group)\n\tfor ni, cl := range c.Inputs.ChainlinkNodes {\n\t\tchainlinkNode := cl\n\t\tnodeIndex := ni\n\t\tprofileGroup.Go(func() error {\n\t\t\tprofileResults, err := chainlinkNode.Profile(c.Inputs.ProfileDuration, c.Inputs.ProfileFunction)\n\t\t\tprofileResults.NodeIndex = nodeIndex\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tc.TestReporter.Results = append(c.TestReporter.Results, profileResults)\n\t\t\treturn nil\n\t\t})\n\t}\n\tExpect(profileGroup.Wait()).ShouldNot(HaveOccurred(), \"Error while gathering chainlink Profile tests\")\n}", "title": "" }, { "docid": "a1bc2418524b9344b5a9cfb626fa34c9", "score": "0.543503", "text": "func (self *TaskRunner) Run() error {\n\tgrip.Info(\"Finding hosts available to take a task...\")\n\n\t// find all hosts available to take a task\n\tavailableHosts, err := self.FindAvailableHosts()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error finding available hosts: %v\", err)\n\t}\n\tgrip.Infof(\"Found %d host(s) available to take a task\", len(availableHosts))\n\thostsByDistro := self.splitHostsByDistro(availableHosts)\n\n\t// assign the free hosts for each distro to the tasks they need to run\n\tfor distroId := range hostsByDistro {\n\t\tdistroStartTime := time.Now()\n\t\tif err := self.processDistro(distroId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdistroRunTime := time.Now().Sub(distroStartTime)\n\t\tgrip.Infof(\"It took %s to schedule tasks on %s\", distroRunTime, distroId)\n\t\t// most of the time, processDistro should take less than distroSleep seconds, but\n\t\t// if it takes longer, sleep longer to give other locks a chance to preempt this one\n\t\tif distroRunTime > distroSleep {\n\t\t\tgrip.Info(\"Sleeping to give other locks a chance\")\n\t\t\ttime.Sleep(distroSleep)\n\t\t}\n\t\t// always sleep one second\n\t\ttime.Sleep(time.Second)\n\t}\n\tgrip.Info(\"Finished kicking off all pending tasks\")\n\treturn nil\n}", "title": "" }, { "docid": "de9bd0930d4bf8a976400e576b273e74", "score": "0.5433986", "text": "func (s *fakeProxyServerLongRun) Run() error {\n\tfor {\n\t\ttime.Sleep(2 * time.Second)\n\t}\n}", "title": "" }, { "docid": "02b85bc223206eb855a82c08993173a3", "score": "0.54267603", "text": "func TestRunManyTasks(t *testing.T) {\n\tagent := RunAgent(t, nil)\n\tdefer agent.Cleanup()\n\n\tnumToRun := 15\n\ttasks := []*TestTask{}\n\tattemptsTaken := 0\n\tfor numRun := 0; len(tasks) < numToRun; attemptsTaken++ {\n\t\tstartNum := 10\n\t\tif numToRun-len(tasks) < 10 {\n\t\t\tstartNum = numToRun - len(tasks)\n\t\t}\n\t\tstartedTasks, err := agent.StartMultipleTasks(t, \"simple-exit\", startNum)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\ttasks = append(tasks, startedTasks...)\n\t\tnumRun += 10\n\t}\n\n\tt.Logf(\"Ran %v containers; took %v tries\\n\", numToRun, attemptsTaken)\n\tfor _, task := range tasks {\n\t\terr := task.WaitStopped(10 * time.Minute)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tif code, ok := task.ContainerExitcode(\"exit\"); !ok || code != 42 {\n\t\t\tt.Error(\"Wrong exit code\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "36c2c60c1438a74d7244ad80b8d13a48", "score": "0.54245526", "text": "func (em *Emulator) Run(cycles uint) {\n\tfor !em.Halted && cycles != 0 {\n\t\tem.Step()\n\t\tcycles--\n\t}\n}", "title": "" }, { "docid": "64b1fd4bb962057a19a5797fca085b71", "score": "0.5421455", "text": "func (s *Simulator) Run(maxSteps int, maxTime float64) {\n\tvar time float64\n\tfor i := 0; i < maxSteps; i++ {\n\t\tfmt.Println(s)\n\t\ttime += s.Step()\n\t\tfmt.Println(\"time: \", time)\n\t\tif time > maxTime {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "98f818081b8e7cc13beaa9aa1639645b", "score": "0.5407186", "text": "func (oc *Controller) Run() error {\n\toc.syncPeriodic()\n\tklog.Infof(\"Starting all the Watchers...\")\n\tstart := time.Now()\n\t// WatchNodes must be started first so that its initial Add will\n\t// create all node logical switches, which other watches may depend on.\n\t// https://github.com/ovn-org/ovn-kubernetes/pull/859\n\tif err := oc.WatchNodes(); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, f := range []func() error{oc.WatchNamespaces, oc.WatchPods, oc.WatchServices,\n\t\toc.WatchEndpoints, oc.WatchNetworkPolicy} {\n\t\tif err := f(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tklog.Infof(\"Completing all the Watchers took %v\", time.Since(start))\n\n\tif config.Kubernetes.OVNEmptyLbEvents {\n\t\tgo oc.ovnControllerEventChecker()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fb6adc0f72d8b84c11bfb504d03144e7", "score": "0.54006267", "text": "func (t *StorageQueueManager) Run() {\n\tfor i := 0; i < t.cfg.Shards; i++ {\n\t\tgo t.runShard(i)\n\t}\n\tt.wg.Wait()\n}", "title": "" }, { "docid": "2492a3dec7565df9ac6cc23b4cced1b3", "score": "0.53952384", "text": "func (c *Checker) Run(ctx context.Context) {\n\tc.logger.Info(\"starting checker\")\n\tdefer c.logger.Info(\"stopping checker\")\n\n\tfor {\n\t\trand.Shuffle(len(c.operations), func(i, j int) {\n\t\t\tc.operations[i], c.operations[j] = c.operations[j], c.operations[i]\n\t\t})\n\t\tfor _, operation := range c.operations {\n\t\t\terr := c.cooldown(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr = c.check(ctx, operation)\n\t\t\tif err != nil && ctx.Err() != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "77636b2a01572ba6e29dfd8e30d54c71", "score": "0.5388807", "text": "func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {\n\tticker := time.NewTicker(d.interval)\n\tdefer ticker.Stop()\n\n\t// Get an initial set right away.\n\ttg, err := d.refresh()\n\tif err != nil {\n\t\tlevel.Error(d.logger).Log(\"msg\", \"refreshing targets failed\", \"err\", err)\n\t} else {\n\t\tselect {\n\t\tcase ch <- []*targetgroup.Group{tg}:\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\ttg, err := d.refresh()\n\t\t\tif err != nil {\n\t\t\t\tlevel.Error(d.logger).Log(\"msg\", \"refreshing targets failed\", \"err\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase ch <- []*targetgroup.Group{tg}:\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7bd189eb975a5fc4c565d4740480543d", "score": "0.5385434", "text": "func TestRunAll(t *testing.T) {\n\tsuite.Run(t, new(UserSuite))\n}", "title": "" }, { "docid": "f81d9bd5798614f8dae0021da6e437b3", "score": "0.5376356", "text": "func Run(functions ...func() error) chan error {\n\terrs := make(chan error, len(functions))\n\n\tfor _, fn := range functions {\n\t\tgo func(fn func() error) {\n\t\t\terrs <- fn()\n\t\t}(fn)\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "582e004de7269977f00ec7c28c67c125", "score": "0.5368946", "text": "func (r *Reflector) Run() {\n\tblog.V(3).Infof(\"%s ready to start, begin to cache data\", r.name)\n\t//sync all data object from remote event storage\n\t//r.listAllData()\n\twatchCxt, _ := context.WithCancel(r.cxt)\n\tgo r.handleWatch(watchCxt)\n\tblog.V(3).Infof(\"%s first resynchronization & watch success, register all ticker\", r.name)\n\t//create ticker for data object resync\n\tsyncTick := time.NewTicker(r.syncPeriod)\n\tdefer syncTick.Stop()\n\t//create ticker check stable watcher\n\twatchTick := time.NewTicker(time.Second * 2)\n\tdefer watchTick.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-r.cxt.Done():\n\t\t\tblog.Warnf(\"%s running exit, lister & watcher stopped\", r.name)\n\t\t\treturn\n\t\tcase <-syncTick.C:\n\t\t\t//fully resync all datas in period\n\t\t\tblog.Infof(\"%s trigger all data synchronization\", r.name)\n\t\t\tr.ListAllData()\n\t\tcase <-watchTick.C:\n\t\t\t//check watch is running\n\t\t\tif r.underWatch {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t//watch is out, recovery watch loop\n\t\t\tblog.Warnf(\"%s long watch is out, start watch loop to recovery.\", r.name)\n\t\t\tgo r.handleWatch(watchCxt)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ecb07ef9ba6785a0d8f2c14f0d86dba2", "score": "0.5363188", "text": "func (a *Agent) Run(ctx context.Context) {\n\ta.log(\"Agent starting\")\n\tfor {\n\t\tif draining.IsDraining(ctx) || ctx.Err() != nil {\n\t\t\ta.log(\"Agent exited\")\n\t\t\treturn\n\t\t}\n\t\tif err := a.runOnce(ctx); err != nil {\n\t\t\ta.log(\"Lost drone assignment: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "98b0f6439ac9a91067e7d8abcad54974", "score": "0.5361571", "text": "func (c *Machine) Run() {\n\tfor {\n\t\tswitch opcode(c.mem[c.ip]) {\n\t\tcase opAdd:\n\t\t\tc.executeAdd()\n\t\tcase opMult:\n\t\t\tc.executeMultiply()\n\t\tcase opHalt:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2b0264100474cb21e065061af8c0cf7e", "score": "0.5357543", "text": "func (r *serverFive) Run() {\n\tr.state = RstateRunning\n\n\trxcallback := func(ev EventInterface) int {\n\t\tswitch ev.(type) {\n\t\tcase *ReplicaDataEvent:\n\t\t\ttioevent := ev.(*ReplicaDataEvent)\n\t\t\tlog(LogVV, \"rxcallback: replica data\", r.String(), tioevent.String())\n\t\t\tr.receiveReplicaData(tioevent)\n\t\tdefault:\n\t\t\ttio := ev.GetTio()\n\t\t\tlog(LogV, \"rxcallback\", r.String(), tio.String())\n\t\t\t// ev.GetSize() == configNetwork.sizeControlPDU\n\t\t\tr.addBusyDuration(configNetwork.sizeControlPDU, configNetwork.linkbpsControl, NetControlBusy)\n\t\t\ttio.doStage(r)\n\t\t}\n\n\t\treturn ev.GetSize()\n\t}\n\n\tgo func() {\n\t\tnumflows := r.flowsfrom.count()\n\t\tfor r.state == RstateRunning {\n\t\t\tr.receiveEnqueue()\n\t\t\tr.processPendingEvents(rxcallback)\n\n\t\t\t// two alternative CCPi-implementing methods below,\n\t\t\t// one simply dividing the server's bandwidth equally between\n\t\t\t// all incoming flows, another - trying the weighted approach,\n\t\t\t// with weights inverse proportional to the remaining bytes\n\t\t\t// to send..\n\t\t\tnflows := r.flowsfrom.count()\n\t\t\tif numflows != nflows && nflows > 0 {\n\t\t\t\tr.rerate(nflows)\n\t\t\t\t// r.rerateInverseProportional()\n\t\t\t}\n\t\t\tnumflows = nflows\n\t\t}\n\n\t\tr.closeTxChannels()\n\t}()\n}", "title": "" }, { "docid": "440a0d5782e65736e15467025f39fde2", "score": "0.5354525", "text": "func (s *Scheduler) Run() {\n\tfor i := 0; i < s.Len(); i++ {\n\t\tschedule := (*s)[i]\n\t\tticker := schedule.ticker\n\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ticker.C:\n\t\t\t\t\tschedule.work()\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "cd5e43bac69297f7292a46c5f8c35551", "score": "0.53511953", "text": "func (r Runner) Run() {\n\tch := make(chan Task)\n\ttaskWriters := make(map[string]WriterWithIdentifier)\n\n\tfor _, job := range r.Jobs {\n\t\tfor _, payload := range job.Payloads {\n\t\t\tpayload.Identifier = fmt.Sprintf(\"%s_%s\", job.Identifier, payload.Identifier)\n\t\t\ttaskWriters[payload.Identifier] = WriterWithIdentifier{Identifier: payload.Identifier, Writer: r.Writer}\n\n\t\t\tif payload.Interval < minInterval {\n\t\t\t\tpayload.Interval = minInterval\n\t\t\t}\n\n\t\t\tgo func(payload TaskPayload) {\n\t\t\t\t// initial randomised interval\n\t\t\t\ttime.Sleep(getRandomisedInterval(payload.Interval) * time.Second)\n\t\t\t\tgo runTask(job.Task, payload, taskWriters[payload.Identifier], ch)\n\n\t\t\t\tfor task := range ch {\n\t\t\t\t\tgo runTask(task, payload, taskWriters[payload.Identifier], ch)\n\t\t\t\t}\n\t\t\t}(payload)\n\t\t}\n\t}\n\n\t// block indefinitely to allow runTask() goroutines to run within per-payload goroutines\n\t// if any of the task runs return an apperrors.FatalError, current program will exit\n\tfunc() { select {} }()\n}", "title": "" }, { "docid": "630ca86e7808b96f8b413fee51bdcff0", "score": "0.53487223", "text": "func (p *Pool) Run() {\n\tgo p.gain2cast()\n\tfor i := 0; i < p.count; i++ {\n\t\tgo p.flow()\n\t}\n}", "title": "" }, { "docid": "f77ebf4959dbcbc1e9375dc435abdf6e", "score": "0.53479934", "text": "func (stage *Stage) Run() error {\n\tfor _, stageRune := range stage.Runes {\n\t\tstageRuneRunErr := stageRune.Run()\n\t\tif stageRuneRunErr != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"Could not complete Stage execution\\n%v\",\n\t\t\t\tstageRuneRunErr,\n\t\t\t)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5c2d831daf3b1c8c6c55b3a0342a4d0", "score": "0.53469485", "text": "func (p *RoundRobin) Run(ctx context.Context) {\n\n}", "title": "" }, { "docid": "e5d02974bcbdbbd56cc9d0f92596a854", "score": "0.5344565", "text": "func runAllTests() {\n\tinodeTableTest()\n\tstreamTest()\n\t// sleep here so the file system has time be initialized\n\ttime.Sleep(5 * time.Second)\n\tmkdirTest()\n\tsmallWriteTest() // tests file that fits in inode buffer\n\tmediumWriteTest() // tests file that fits in a few data blocks\n\tlargeWriteTest() // tests file that fits in the singly indirect block\n\t// veryLargeWriteTest() // tests bigger file in singly indirect. ~8MB, so ~250 put/get/delete reqs\n\n\t// doing a test to check writes to the doubly indirect block takes something like ~4000 puts\n\t// it's probably easier to manually lower the BLOCK_SIZE to check it\n\n\t// would be nice to do explicit testing of dynamodb and s3, but not sure how\n\tfmt.Println(\"All tests completed.\")\n}", "title": "" }, { "docid": "fade8cc92a3250cbb39502c4b60b1c90", "score": "0.53440917", "text": "func (b *BenchmarkSuite) Run() *BenchmarkSuite {\n\tfor _, name := range b.names {\n\t\tlog.Println(\"Running\", name)\n\t\tresult := b.benchmarks[name]()\n\t\tif result == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif b.sanitize {\n\t\t\tresult = result.Sanitized()\n\t\t}\n\t\tb.results[name] = result\n\t}\n\treturn b\n}", "title": "" }, { "docid": "7890e4f6d91d3d01f40b23036383985c", "score": "0.5341823", "text": "func AllWithTimeout(timeout time.Duration, stopables ...*task.Task) {\n\tfor _, stopable := range stopables {\n\t\tstopable.StopWithTimeout(timeout)\n\t}\n}", "title": "" }, { "docid": "a773f11e7f1c83e67875fb48bba56d85", "score": "0.5340486", "text": "func (o *Orchestrator) Run(interval time.Duration) {\n\tfor range time.Tick(interval) {\n\t\tfreshBindings, blacklisted, err := o.reader.FetchBindings()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"fetch bindings failed with error: %s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\to.health.SetCounter(map[string]int{\n\t\t\t\"drainCount\": len(freshBindings),\n\t\t\t\"blacklistedOrInvalidUrlCount\": blacklisted,\n\t\t})\n\t\to.drainGauge.Set(int64(len(freshBindings)))\n\n\t\tactual := o.service.List()\n\n\t\t// The length of actual will be the number of adapters that responded.\n\t\to.adapterGauge.Set(int64(len(actual)))\n\n\t\tdesired := desiredState(freshBindings, pullActiveAddrs(actual, o.addrs))\n\t\to.service.Transition(actual, desired)\n\t}\n}", "title": "" }, { "docid": "d91fb80de3b21cbc1d248c1464d1c481", "score": "0.53348124", "text": "func (s *State) Run() {\n\tgo s.ProcessIncoming()\n\tgo s.ProcessOutgoing()\n\tgo s.ProcessExecute()\n\tgo s.listener.Listen()\n\t//go s.Status()\n\tfor {\n\t\tm := s.listener.Get()\n\t\t//fmt.Println(m)\n\t\ts.AddCommands(m)\n\t}\n}", "title": "" }, { "docid": "466b6402103153b53dff9a2ff550103e", "score": "0.5328985", "text": "func (c *Client) Run() {\n\tc.ctx.UpdateInvalidTask(len(c.invalidTasks))\n\topenRoutinesHandleTaskAndWaitForFinish := func() {\n\t\twg := sync.WaitGroup{}\n\t\tfor i := 0; i < c.routineNum; i++ {\n\t\t\twg.Add(1)\n\t\t\tgo func(tid int) {\n\t\t\t\tc.ctx.UpdateCurrentConn(1)\n\t\t\t\tdefer wg.Done()\n\t\t\t\tdefer c.ctx.UpdateCurrentConn(-1)\n\t\t\t\tfor {\n\t\t\t\t\ttask, empty := c.GetATask()\n\t\t\t\t\tc.ctx.UpdateWaitTask(c.taskList.Len())\n\t\t\t\t\t// no more tasks need to handle\n\t\t\t\t\tif empty {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif err := task.Run(tid); err != nil {\n\t\t\t\t\t\terrLog := I18n.Sprintf(\"Task failed with %v\", err)\n\t\t\t\t\t\tc.ctx.Error(errLog)\n\t\t\t\t\t\tc.PutAFailedTask(task)\n\t\t\t\t\t\ttask.Callback(false, errLog)\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttask.Callback(true, task.Status())\n\t\t\t\t\t}\n\t\t\t\t\tc.ctx.UpdateFailedTask(c.failedTaskList.Len())\n\t\t\t\t\tif c.ctx.Cancel() {\n\t\t\t\t\t\tc.ctx.Error(I18n.Sprintf(\"User cancelled...\"))\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}(i)\n\t\t}\n\t\twg.Wait()\n\t}\n\n\tc.ctx.Info(I18n.Sprintf(\"Start processing taks, total %v ...\", c.taskList.Len()))\n\n\t// generate goroutines to handle tasks\n\topenRoutinesHandleTaskAndWaitForFinish()\n\n\tfor times := 0; times < c.retries; times++ {\n\t\tif c.failedTaskList.Len() != 0 {\n\t\t\tc.taskList.PushBackList(c.failedTaskList)\n\t\t\tc.failedTaskList.Init()\n\t\t}\n\n\t\tif c.taskList.Len() != 0 {\n\t\t\t// gzRetries to handle task\n\t\t\tc.ctx.Info(I18n.Sprintf(\"Start Retry failed tasks\"))\n\t\t\topenRoutinesHandleTaskAndWaitForFinish()\n\t\t}\n\t}\n\n\tc.ctx.Info(I18n.Sprintf(\"Task completed, total %v tasks with %v failed\", c.ctx.totalTask, c.failedTaskList.Len()))\n\tif c.failedTaskList.Len() >0 {\n\t\tvar failListText string\n\t\tfor e := c.failedTaskList.Front(); e != nil; e = e.Next() {\n\t\t\tt := e.Value.(Task)\n\t\t\tfailListText = failListText + t.Name() + \"\\r\\n\"\n\t\t}\n\t\tc.ctx.Info(I18n.Sprintf(\"Failed tasks:\\r\\n%s\", failListText))\n\t}\n\tif len(c.invalidTasks) > 0 {\n\t\tc.ctx.Info(I18n.Sprintf(\"WARNING: there are %v images failed with invalid url(ex:image not exists)\", len(c.invalidTasks)))\n\t\tc.ctx.Info(I18n.Sprintf(\"Invalid url list:\\r\\n%s\", strings.Join(c.invalidTasks, \"\\r\\n\")))\n\t}\n}", "title": "" }, { "docid": "6f96d3675908a86848dad943ced61188", "score": "0.5317829", "text": "func (s *Scheduler) Run() {\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(s.tickRate):\n\t\t\ts.tick(time.Now())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c6eacd4689dd1b03c5321a8f2a254f41", "score": "0.5312751", "text": "func (e *SimpleEngine) Run(requests ...Request) {\n\t//log.Println(\"simple engine running...\")\n\tvar queue []Request\n\tfor _, req := range requests {\n\t\tqueue = append(queue, req)\n\t}\n\n\tcount := 0\n\tfor len(queue) > 0 {\n\t\tq := queue[0]\n\t\tqueue = queue[1:]\n\n\t\tresult, err := Worker(q)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tqueue = append(queue, result.Requests...)\n\n\t\tfor _, item := range result.Items {\n\t\t\tcount++\n\t\t\tlog.Printf(\"Got item #%d: %v\", count, item)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cc4fdfac01af2c45800f228f9bbaffdd", "score": "0.53062016", "text": "func (n *node) Run() error {\n\tdefer func() {\n\t\tclose(n.doneC)\n\t\tfor i := range n.oPkts {\n\t\t\tn.oPkts[i].snk.Close()\n\t\t}\n\t\tfor i := range n.iPkts {\n\t\t\tn.iPkts[i].src.Close()\n\t\t}\n\t}()\n\tif err := n.checkConns(); err != nil {\n\t\treturn err\n\t}\n\tn.serve()\n\tvar err error\n\tfor {\n\t\terr = n.process()\n\t\tif err == io.EOF {\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "822320b53454245acf9d285e41607f15", "score": "0.53055006", "text": "func (d *Definition) Run() error {\n\twg := sync.WaitGroup{}\n\tsema := make(chan struct{}, runtime.NumCPU()*4)\n\terrChan := make(chan error)\n\n\tfor i := 0; i < d.runs; i++ {\n\t\twg.Add(1)\n\t\tsema <- struct{}{}\n\t\tgo func() {\n\t\t\terr := d.oneRun()\n\t\t\tif err != nil {\n\t\t\t\terrChan <- err\n\t\t\t}\n\n\t\t\twg.Done()\n\t\t\t<-sema\n\t\t}()\n\t}\n\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(errChan)\n\t}()\n\treturn <-errChan\n}", "title": "" } ]
dbad71174b8e0f639152bb7907782272
MarshalJSON supports json.Marshaler interface
[ { "docid": "d227c630c77522f9514df284a16ba7b8", "score": "0.0", "text": "func (v MapInt32String) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson794297d0EncodeGithubComMailruEasyjsonTests27(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" } ]
[ { "docid": "dda72c5cbce11e9a9649eb3300175064", "score": "0.7904881", "text": "func JSONMarshal(i interface{}) ([]byte, error) {\n\treturn jsonMarshal(i, json.Marshal)\n}", "title": "" }, { "docid": "4270e33d22f63055b2b0fe9042e900a9", "score": "0.7824149", "text": "func (*TestMarshaller) Marshal(v interface{}) ([]byte, error) { return json.Marshal(v) }", "title": "" }, { "docid": "daf7cd930506beb3be87952008ed5d83", "score": "0.780285", "text": "func Marshal(in interface{}) ([]byte, error) {\n\treturn json.Marshal(in)\n}", "title": "" }, { "docid": "7eded41821d420c7203b62813dd229e5", "score": "0.75339603", "text": "func (j *JSON) Marshal(target interface{}) ([]byte, error) {\n\treturn json.Marshal(target)\n}", "title": "" }, { "docid": "4bfd90ad42a146ad3f6521e2638f68d9", "score": "0.7512239", "text": "func (jsonMarshalerUnmarshaler) Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "bf404c151b6b703af2192b56bfb723be", "score": "0.74367803", "text": "func marshal(i interface{}) (r []byte) {\n\tvar err error\n\tif m, ok := i.(easyjson.Marshaler); ok {\n\t\tr, err = easyjson.Marshal(m)\n\t} else {\n\t\tr, err = json.Marshal(i)\n\t}\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "b7d319588e8941175049259ea0e9841b", "score": "0.73379004", "text": "func (js *JsonStruct) Marshal() ([]byte, error) {\n return json.Marshal(&js.raw)\n}", "title": "" }, { "docid": "914431cf5e325bdbe2342914638a716e", "score": "0.7319794", "text": "func marshal(in interface{}) (string, error) {\n\treturn jsoniter.MarshalToString(in)\n}", "title": "" }, { "docid": "09cb9e02c854b823f10ce63e7a73d6ff", "score": "0.7304026", "text": "func marshalJSON(i encoding.TextMarshaler) ([]byte, error) {\n\ttext, err := i.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn json.Marshal(string(text))\n}", "title": "" }, { "docid": "09cb9e02c854b823f10ce63e7a73d6ff", "score": "0.7304026", "text": "func marshalJSON(i encoding.TextMarshaler) ([]byte, error) {\n\ttext, err := i.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn json.Marshal(string(text))\n}", "title": "" }, { "docid": "f7cfa717211bdf5f2fab60bf016fd2f8", "score": "0.7278286", "text": "func Marshal(d interface{}) ([]byte, error) {\n\tjdata, err := json.Marshal(d)\n\tjdata = JSONAddSpaces(jdata)\n\n\treturn jdata, err\n}", "title": "" }, { "docid": "899224cc81039f3969aaa21a5ee5fca2", "score": "0.72750646", "text": "func jsonMarshal(t interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(EscapeHTML)\n\terr := encoder.Encode(t)\n\treturn bytes.TrimRight(buffer.Bytes(), \"\\n\"), err\n}", "title": "" }, { "docid": "b045445eb007b02af63cddd5d41180cb", "score": "0.7255039", "text": "func JSONEncoder() Encoder { return jsonEncoder }", "title": "" }, { "docid": "be774b4a9c27e965242dcf9280282f4a", "score": "0.7221593", "text": "func jsonMarshal(v interface{}) string {\n\tbytes, _ := json.Marshal(v)\n\treturn string(bytes)\n}", "title": "" }, { "docid": "7036bb4b01058b43fd87941540821d1c", "score": "0.72044635", "text": "func marshal(v interface{}) ([]byte, error) {\n\tbuf := bytes.NewBuffer([]byte{})\n\te := json.NewEncoder(buf)\n\tif IndentOutput {\n\t\te.SetIndent(\"\", \" \")\n\t}\n\tif EscapeHTML {\n\t\te.SetEscapeHTML(false)\n\t}\n\n\terr := e.Encode(v)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "738f0171232747688dc38db00f5c51ba", "score": "0.7188076", "text": "func JSONMarshal(t interface{}) ([]byte, error) { // generic func to marshal with <,>,? as it is i.e., SetEscapeHTML false\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(t)\n\treturn buffer.Bytes(), err\n\n}", "title": "" }, { "docid": "acc184426b2431ecb6898a0ecfdd06d1", "score": "0.71834636", "text": "func MarshallToJson(v interface{}, w io.Writer) error{\n\tjEncoder := json.NewEncoder(w)\n\treturn jEncoder.Encode(v)\n}", "title": "" }, { "docid": "8d46b99026fd4bff63b7377ec2ba1941", "score": "0.7171749", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tstringified, err := Stringify(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn json.Marshal(stringified)\n}", "title": "" }, { "docid": "6ad73eefb1d6dc64fa283430f9c8f689", "score": "0.7171322", "text": "func (j *Serializer) Marshal(d interface{}) ([]byte, error) {\n\treturn json.Marshal(d)\n}", "title": "" }, { "docid": "7f322c52fe9fa79d027aabf1c833cd49", "score": "0.7145709", "text": "func JsonEncode(v interface{}) ([]byte, error) {\n\tvar parser = jsoniter.ConfigCompatibleWithStandardLibrary\n\n\treturn parser.Marshal(v)\n}", "title": "" }, { "docid": "ceebb7457106a77ffdb298396a091079", "score": "0.7128831", "text": "func TestJSON_Marshal(t *testing.T) {\n\tj := serialization.JSON(`{\"foo\":4}`)\n\tb, err := json.Marshal(j)\n\tassert.NoError(t, err)\n\tassert.Equal(t, []byte(j), b)\n}", "title": "" }, { "docid": "fe127f594f00adbeefd2614d22fe08ab", "score": "0.70997953", "text": "func Marshal(in interface{}) ([]byte, error) {\n\tiv := reflect.Indirect(reflect.ValueOf(in))\n\n\tif iv.Kind() != reflect.Struct {\n\t\treturn nil, fmt.Errorf(`the input must be a struct, not \"%s\"`, iv.Kind())\n\t}\n\n\tm, err := marshalStruct(iv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn json.Marshal(m)\n}", "title": "" }, { "docid": "4bcf223207f7f57a2a5141229e51abab", "score": "0.70681477", "text": "func marshal(v interface{}) ([]byte, error) {\n\treturn json.MarshalIndent(v, \"\", \" \")\n}", "title": "" }, { "docid": "e860ea70a6e9a6df297309f5d68027c6", "score": "0.7061023", "text": "func Marshal(m Metadata) (jsonBytes []byte, err error) {\n\tjsonBytes, err = json.Marshal(m)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "bae97381c89ed1ec06deaa4d650c6f11", "score": "0.7057525", "text": "func (c *JSONCodec) Marshal(buf []byte, v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "00552f30c2d22414c75975fd5f52ff95", "score": "0.7049712", "text": "func marshal(from interface{}, pretty bool) ([]byte, error) {\n\tif pretty {\n\t\treturn json.MarshalIndent(from, \"\", \" \")\n\t}\n\treturn json.Marshal(from)\n}", "title": "" }, { "docid": "e0c0faea2c45693593ee3a40c249acf9", "score": "0.70301306", "text": "func Marshal(obj interface{}) (string, error) {\n\tb, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}", "title": "" }, { "docid": "6e432847645141215454d525f787df4a", "score": "0.7006295", "text": "func JSONMarshaler() Marshaler {\n\treturn sharedJSONMarshaler\n}", "title": "" }, { "docid": "b4347dc14b2fbcc8ee7c4d49a2d664e9", "score": "0.6997134", "text": "func Marshal(v interface{}) ([]byte, error) {\n\n\tmarshaler := conjson.NewMarshaler(v, transform.ConventionalKeys())\n\tencoded, err := json.Marshal(marshaler)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn encoded, nil\n\n}", "title": "" }, { "docid": "392895fa9ab07ce7037d4a61e1141bb6", "score": "0.69965035", "text": "func JsonMarshal(v interface{}) (string, error) {\n\tif a, err := json.Marshal(v); err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\treturn string(a), nil\n\t}\n}", "title": "" }, { "docid": "eaf9336d9bd829bea1715126824a2e4d", "score": "0.69941753", "text": "func MarshalJSON(v interface{}) ([]byte, error) {\n\treturn jSON.Marshal(v)\n}", "title": "" }, { "docid": "84c89fd08e7806cd7685d79795236144", "score": "0.6986429", "text": "func Marshal(t interface{}) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(t)\n\treturn buffer.Bytes(), err\n}", "title": "" }, { "docid": "54e12c728d7e03d32a69e4c07a324218", "score": "0.6974147", "text": "func (c canonicalJSON) Marshal(from interface{}) ([]byte, error) {\n\treturn json.Marshal(from)\n}", "title": "" }, { "docid": "bb6536c1eb6690d55d58a6bada549e74", "score": "0.6964088", "text": "func (v StdMarshaler) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson794297d0EncodeGithubComMailruEasyjsonTests7(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "90d428288f925f61188b94954e3c1fb9", "score": "0.6961502", "text": "func MarshalJSON(v interface{}) (native.JSON, error) {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn \"\", replacePrefix(err, \"json\", \"marshalJSON\")\n\t}\n\treturn native.JSON(b), nil\n}", "title": "" }, { "docid": "46709a4c09c69043dc5fe9e8cccb3f81", "score": "0.6954586", "text": "func (m *jsonMarshaler) Marshal(v interface{}) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tif err := yaml.NewEncoder(&buf, yaml.JSON()).Encode(v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "9c805e63c24ea89aa59e369c137cc458", "score": "0.6953151", "text": "func JSONMarshal(v interface{}, safeEncoding bool) ([]byte, error) {\n\t// b, err := json.Marshal(v)\n\tb, err := jsonMarshal(v)\n\n\tif safeEncoding {\n\t\tb = bytes.Replace(b, []byte(\"\\\\u003c\"), []byte(\"<\"), -1)\n\t\tb = bytes.Replace(b, []byte(\"\\\\u003e\"), []byte(\">\"), -1)\n\t\tb = bytes.Replace(b, []byte(\"\\\\u0026\"), []byte(\"&\"), -1)\n\t}\n\treturn b, err\n}", "title": "" }, { "docid": "a430bf2370a63e3268645bbae51d25f6", "score": "0.693509", "text": "func jsonMarshal(data interface{}) (string, error) {\n\tvar buffer bytes.Buffer\n\tvar indentedBuffer bytes.Buffer\n\tencoder := json.NewEncoder(&buffer)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(data)\n\terr = json.Indent(&indentedBuffer, buffer.Bytes(), \"\", \" \")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(indentedBuffer.Bytes()), nil\n}", "title": "" }, { "docid": "56830cc73f08685a85b02e4617d4d220", "score": "0.69244015", "text": "func JSONMarshal(data interface{}, safeEncoding bool) ([]byte, error) {\n\tvar b []byte\n\tvar err error\n\tif IndentJSON {\n\t\tb, err = json.MarshalIndent(data, \"\", \" \")\n\t} else {\n\t\tb, err = json.Marshal(data)\n\t}\n\n\tif safeEncoding {\n\t\tb = bytes.Replace(b, []byte(\"\\\\u003c\"), []byte(\"<\"), -1)\n\t\tb = bytes.Replace(b, []byte(\"\\\\u003e\"), []byte(\">\"), -1)\n\t\tb = bytes.Replace(b, []byte(\"\\\\u0026\"), []byte(\"&\"), -1)\n\t}\n\treturn b, err\n}", "title": "" }, { "docid": "586dca521c181c113e0993a680a97a75", "score": "0.6915971", "text": "func JSONMarshal(v interface{}) StringOutput {\n\treturn JSONMarshalWithContext(context.Background(), v)\n}", "title": "" }, { "docid": "26a337ab302c205e1337689717881404", "score": "0.6889253", "text": "func JSONEncode(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "8b75eb58266ed73d26a48525423e6ea0", "score": "0.6878403", "text": "func MarshalJSON(o interface{}) ([]byte, error) {\n\tdata, err := json.MarshalIndent(o, exportedJSONPrefix, exportedJSONIndent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata = append(data, \"\\n\"...)\n\treturn data, nil\n}", "title": "" }, { "docid": "5a04a5a42edf2ae41bc2b89ef72edd26", "score": "0.6877087", "text": "func encodeJSON(object interface{}) ([]byte, error) {\n\treturn json.Marshal(object)\n}", "title": "" }, { "docid": "c71e2fcefc3e465e7b130013646c3f3b", "score": "0.68600374", "text": "func marshalJson(v interface{}) string {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t\treturn \"\"\n\t}\n\n\treturn string(b)\n}", "title": "" }, { "docid": "28881f28e810eafc08c4f873830723e0", "score": "0.6856586", "text": "func (sj *SerializerJSON) Marshal(message proto.Message) ([]byte, error) {\n\tif message == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\tb, err := DefaultMarshaler.Marshal(message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "5bb95a8af6299cc60bf20acd0cce99eb", "score": "0.68521905", "text": "func main() {\n\ta := sample{Prop: \"hello world!\"}\n\tval, _ := json.Marshal(a)\n\tfmt.Println(string(val))\n}", "title": "" }, { "docid": "34c49642c237466218a3128919f7e855", "score": "0.68499494", "text": "func MarshalToJson(obj runtime.Object, gv schema.GroupVersion) ([]byte, error) {\n\tmediaType := \"application/json\"\n\tinfo, ok := runtime.SerializerInfoForMediaType(clientsetscheme.Codecs.SupportedMediaTypes(), mediaType)\n\tif !ok {\n\t\treturn []byte{}, errors.Errorf(\"unsupported media type %q\", mediaType)\n\t}\n\n\tencoder := clientsetscheme.Codecs.EncoderForVersion(info.Serializer, gv)\n\treturn runtime.Encode(encoder, obj)\n}", "title": "" }, { "docid": "ac74e90bb3c7b47f2f499c1e442bfbbb", "score": "0.6817772", "text": "func JSONMarshal(content interface{}, escape bool) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tenc := json.NewEncoder(&buf)\n\tenc.SetEscapeHTML(escape)\n\tif err := enc.Encode(content); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "1667a2829c197badb4e2fcc293ab9ed0", "score": "0.68136466", "text": "func Marshal(object interface{}) ([]byte, error) {\n\tbytes, err := json.MarshalIndent(object, \"\", \"\\t\")\n\tif err != nil {\n\t\tLog.WithFields(map[string]interface{}{\n\t\t\t\"error\": err,\n\t\t}).Error(\"sleepwalker.Marshal\")\n\t\treturn nil, err\n\t}\n\treturn bytes, nil\n}", "title": "" }, { "docid": "c63fa7cb78b7d7bcc59ab73f7e3059cb", "score": "0.67941475", "text": "func JSON(in interface{}) jsonEncoder {\n\tb, err := json.MarshalIndent(in, \"\", \" \")\n\tif err != nil {\n\t\treturn jsonEncoder{Reader: errReader{err: fmt.Errorf(\"unable to marshal to JSON: %v: %w\", in, err)}}\n\t}\n\n\treturn jsonEncoder{Reader: bytes.NewBuffer(b)}\n}", "title": "" }, { "docid": "e01d3f1de94a5f950786519ec5197658", "score": "0.6764877", "text": "func (v StructWithInterface) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson794297d0EncodeGithubComMailruEasyjsonTests6(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "b2ccc0a45e0b12a5475e3a80fcacd5e3", "score": "0.67547536", "text": "func (sc *Contract) Marshal() ([]byte, error) {\n\treturn json.Marshal(sc)\n}", "title": "" }, { "docid": "a51eea2ae047e3126fe2c0a6e1c713ce", "score": "0.67379177", "text": "func (v Klout) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonDb0593a3EncodeGithubComAminMirJsonperfoptPerson4(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "9898816d3795bd167a6a6b98c43ed300", "score": "0.67001355", "text": "func (m *JsonMarshaler) Marshal(out io.Writer, pb proto.Message) error {\n\tv := reflect.ValueOf(pb)\n\tif pb == nil || (v.Kind() == reflect.Ptr && v.IsNil()) {\n\t\treturn errors.New(\"Marshal called with nil\")\n\t}\n\t// Check for unset required fields first.\n\tif err := checkRequiredFields(pb); err != nil {\n\t\treturn err\n\t}\n\twriter := &errWriter{writer: out}\n\treturn m.marshalObject(writer, pb, \"\")\n}", "title": "" }, { "docid": "3d265055dfc0bd9c291ae2f0de48dc32", "score": "0.6690115", "text": "func jsonifyWhateverToBytes(i interface{}) []byte {\n\tjsonb, err := json.Marshal(i)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\treturn jsonb\n}", "title": "" }, { "docid": "c84a355c653edee0d00c6e2a6457bbab", "score": "0.6689591", "text": "func (f *Formatter) Marshal(v interface{}) ([]byte, error) {\n\tdata, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn f.Format(data)\n}", "title": "" }, { "docid": "370e3599cc44fd92c1b17e42d7e86d55", "score": "0.6667511", "text": "func (j grpcJson) Marshal(v interface{}) (out []byte, err error) {\n\tif pm, ok := v.(proto.Message); ok {\n\t\tb := new(bytes.Buffer)\n\t\terr := j.Marshaler.Marshal(b, pm)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn b.Bytes(), nil\n\t}\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "b27e383ef4f301ba706dbec5e4247919", "score": "0.66653335", "text": "func NewJSONMarshaler() Marshaler {\n\treturn newJSONMarshaler()\n}", "title": "" }, { "docid": "5f52d0e2778c194329884328f6855bc9", "score": "0.66463375", "text": "func (w SeqWriter) Marshal(data interface{}) error {\n\tx, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn w.WriteRaw(x)\n}", "title": "" }, { "docid": "e5378fc87bd7b916e36567aa16ff97bc", "score": "0.6632778", "text": "func TestMarshal(t *testing.T) {\n\tassert := assert.New(t)\n\tj := &jsonMarshaler{}\n\tmessage := &message{ID: \"foo\", Channel: \"bar\", Body: \"baz\", Timestamp: 1412003438}\n\n\tmessageJSON, err := j.marshal(message)\n\n\tassert.Equal(`{\"id\":\"foo\",\"channel\":\"bar\",\"body\":\"baz\",\"timestamp\":1412003438}`,\n\t\tstring(messageJSON))\n\tassert.Nil(err)\n}", "title": "" }, { "docid": "ad14467ef870533fc0dfa8e7782b3f9b", "score": "0.6631631", "text": "func (v Scrapper) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson9311120dEncodeGithubComAhmdaeyzMbcApi1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "b3add4a90ecb589832099801e1f6dbcb", "score": "0.66100967", "text": "func (j jsonSerializer) Marshal(r *pbgo.ProcessStatRequest) ([]byte, error) {\n\twriter := new(bytes.Buffer)\n\n\terr := j.marshaler.Marshal(writer, r)\n\treturn writer.Bytes(), err\n}", "title": "" }, { "docid": "b68b199bc800984a43f21914448f8223", "score": "0.6604801", "text": "func (*noncacheableTestObject) MarshalJSON() ([]byte, error) {\n\treturn []byte(\"\\\"json-result\\\"\"), nil\n}", "title": "" }, { "docid": "445edea166ca8d43e213c020fbf44137", "score": "0.6600023", "text": "func MarshalAndWriteJSON(handler string, w http.ResponseWriter, v interface{}, statusCode int) []byte {\n\tj, err := json.Marshal(v)\n\tif err != nil {\n\t\tLogAndReturnError(handler, http.StatusInternalServerError, err, w)\n\t\treturn nil\n\t}\n\n\tWriteJSON(handler, w, j, statusCode)\n\treturn j\n}", "title": "" }, { "docid": "b0cc2b2a4953decfb0edd3d21581ecaa", "score": "0.6591366", "text": "func (v CopyToParams) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoDom86(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "e6a72941b5ce35eed76426599a4f5873", "score": "0.65825576", "text": "func (s *Server) MarshalToJson(obj runtime.Object, gv schema.GroupVersion) ([]byte, error) {\n\treturn s.MarshalToJsonForCodecs(obj, gv, s.codecFactory)\n}", "title": "" }, { "docid": "fed9e4e43cdc2cb87c89445704fb16ba", "score": "0.65653944", "text": "func (v Person) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonDb0593a3EncodeGithubComAminMirJsonperfoptPerson1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "54bf8fe98918caa4e95f2a7ce3ee7e8d", "score": "0.65641487", "text": "func (b *FooJSONBuilder) Marshal(orig *Foo) ([]byte, error) {\n\tret, err := b.Convert(orig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(ret)\n}", "title": "" }, { "docid": "105cce0a72221a33b57024479e6da953", "score": "0.65606296", "text": "func (c CosmosDbMongoDbAPISink) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulateAny(objectMap, \"disableMetricsCollection\", c.DisableMetricsCollection)\n\tpopulateAny(objectMap, \"maxConcurrentConnections\", c.MaxConcurrentConnections)\n\tpopulateAny(objectMap, \"sinkRetryCount\", c.SinkRetryCount)\n\tpopulateAny(objectMap, \"sinkRetryWait\", c.SinkRetryWait)\n\tobjectMap[\"type\"] = \"CosmosDbMongoDbApiSink\"\n\tpopulateAny(objectMap, \"writeBatchSize\", c.WriteBatchSize)\n\tpopulateAny(objectMap, \"writeBatchTimeout\", c.WriteBatchTimeout)\n\tpopulateAny(objectMap, \"writeBehavior\", c.WriteBehavior)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3ecff96df63d13b162f33d1ad880a063", "score": "0.65570164", "text": "func (c *OldCipher) Marshal(s interface{}) (string, error) {\n\t// encode json value\n\tplaintext, err := json.Marshal(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// encrypt the JSON\n\tciphertext, err := c.Encrypt(plaintext)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// base64-encode the result\n\tencoded := base64.URLEncoding.EncodeToString(ciphertext)\n\treturn encoded, nil\n}", "title": "" }, { "docid": "19722eb0f6711e5278fe5d98850d562e", "score": "0.6554652", "text": "func (v ProtocolMapperRepresentation) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson5c8673aaEncodeGithubComAzukaKeycloakAdminGoKeycloak3(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "36584dba60d09b1c7c2e654c73e2f28f", "score": "0.6548147", "text": "func Marshal() ([]byte, error) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\treturn json.Encode(serviceInfo)\n}", "title": "" }, { "docid": "90bca2c6332e8b3201b6aad909cc0d11", "score": "0.65476614", "text": "func MarshalToJSONString(in interface{}) (string, error) {\n\tbytes, err := json.Marshal(in)\n\treturn string(bytes), err\n}", "title": "" }, { "docid": "bf5c4b6e6d1cc31771889630ea9a89d0", "score": "0.65466106", "text": "func NewJSONMarshaler() Marshaler {\n\treturn &jsonMarshaler{delegate: jsonpb.Marshaler{}}\n}", "title": "" }, { "docid": "19e9d44d92d6930684fd027243a40704", "score": "0.6545476", "text": "func (j JSONFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulateAny(objectMap, \"deserializer\", j.Deserializer)\n\tpopulateAny(objectMap, \"encodingName\", j.EncodingName)\n\tpopulateAny(objectMap, \"filePattern\", j.FilePattern)\n\tpopulateAny(objectMap, \"jsonNodeReference\", j.JSONNodeReference)\n\tpopulateAny(objectMap, \"jsonPathDefinition\", j.JSONPathDefinition)\n\tpopulateAny(objectMap, \"nestingSeparator\", j.NestingSeparator)\n\tpopulateAny(objectMap, \"serializer\", j.Serializer)\n\tobjectMap[\"type\"] = \"JsonFormat\"\n\tif j.AdditionalProperties != nil {\n\t\tfor key, val := range j.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2f20e3b29110674ace5b3b36d03b0494", "score": "0.6542485", "text": "func JSON(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tCheckErrPanic(err)\n\treturn b\n}", "title": "" }, { "docid": "0396ec1ad09b234cf37f893c82869e0b", "score": "0.6535301", "text": "func (o StoredObject) MarshalJSON() ([]byte, error) {\n\ttest := struct {\n\t\tID *string `json:\"id,omitempty\"`\n\t\tAppServiceKey *string `json:\"appServiceKey,omitempty\"`\n\t\tPayload []byte `json:\"payload,omitempty\"`\n\t\tRetryCount int `json:\"retryCount,omitempty\"`\n\t\tPipelineId string `json:\"pipelineId,omitempty\"`\n\t\tPipelinePosition int `json:\"pipelinePosition,omitempty\"`\n\t\tVersion *string `json:\"version,omitempty\"`\n\t\tCorrelationID *string `json:\"correlationID,omitempty\"`\n\t\tEventID *string `json:\"eventID,omitempty\"`\n\t\tEventChecksum *string `json:\"eventChecksum,omitempty\"`\n\t\tContextData map[string]string `json:\"contextData,omitempty\"`\n\t}{\n\t\tPayload: o.Payload,\n\t\tRetryCount: o.RetryCount,\n\t\tPipelineId: o.PipelineId,\n\t\tPipelinePosition: o.PipelinePosition,\n\t\tContextData: o.ContextData,\n\t}\n\n\t// Empty strings are null\n\tif o.ID != \"\" {\n\t\ttest.ID = &o.ID\n\t}\n\tif o.AppServiceKey != \"\" {\n\t\ttest.AppServiceKey = &o.AppServiceKey\n\t}\n\tif o.Version != \"\" {\n\t\ttest.Version = &o.Version\n\t}\n\tif o.CorrelationID != \"\" {\n\t\ttest.CorrelationID = &o.CorrelationID\n\t}\n\n\treturn json.Marshal(test)\n}", "title": "" }, { "docid": "5a49e85c0e87ea650a4655247b406743", "score": "0.65300375", "text": "func (v Structs) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson794297d0EncodeGithubComMailruEasyjsonTests4(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "0723c5a64eb37810181d36a6159439bb", "score": "0.6528162", "text": "func marshalJson(data interface{}) string {\n\tj, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn strings.Replace(string(j), \"\\\\u003c\", \"<\", -1)\n}", "title": "" }, { "docid": "a659dd30abf4424dc47f4e1a2d446b08", "score": "0.6526089", "text": "func (c CosmosDbMongoDbAPISink) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"disableMetricsCollection\", c.DisableMetricsCollection)\n\tpopulate(objectMap, \"maxConcurrentConnections\", c.MaxConcurrentConnections)\n\tpopulate(objectMap, \"sinkRetryCount\", c.SinkRetryCount)\n\tpopulate(objectMap, \"sinkRetryWait\", c.SinkRetryWait)\n\tobjectMap[\"type\"] = \"CosmosDbMongoDbApiSink\"\n\tpopulate(objectMap, \"writeBatchSize\", c.WriteBatchSize)\n\tpopulate(objectMap, \"writeBatchTimeout\", c.WriteBatchTimeout)\n\tpopulate(objectMap, \"writeBehavior\", c.WriteBehavior)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2e5395dea2f4af5b57110d7603200cd2", "score": "0.65227956", "text": "func (d DataFlowStagingInfo) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulateAny(objectMap, \"folderPath\", d.FolderPath)\n\tpopulate(objectMap, \"linkedService\", d.LinkedService)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6757c3be20f21b1ffc9ee50875b289a8", "score": "0.65198827", "text": "func JSON(in any) string {\n\tbs, err := json.Marshal(in)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn BinaryString(bs)\n}", "title": "" }, { "docid": "cdfbddd297fe68d3dfc706c2cddef383", "score": "0.6517215", "text": "func (g WSJSONMessage) Marshal() []byte {\n\tif g.Obj == nil {\n\t\tb, _ := json.Marshal(g.value)\n\t\traw := json.RawMessage(b)\n\t\tg.Obj = &raw\n\t}\n\n\tj, _ := json.Marshal(g)\n\treturn j\n}", "title": "" }, { "docid": "030c478ca6675faa71503de9d45971a1", "score": "0.6516373", "text": "func (v Sender) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson619ac83dEncodeGithubComLissteronDeployerPkgGithub(w, v)\n}", "title": "" }, { "docid": "ef332a21af3a9fc08f06ce66f32011f2", "score": "0.65150493", "text": "func (j JSONSink) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulateAny(objectMap, \"disableMetricsCollection\", j.DisableMetricsCollection)\n\tpopulate(objectMap, \"formatSettings\", j.FormatSettings)\n\tpopulateAny(objectMap, \"maxConcurrentConnections\", j.MaxConcurrentConnections)\n\tpopulateAny(objectMap, \"sinkRetryCount\", j.SinkRetryCount)\n\tpopulateAny(objectMap, \"sinkRetryWait\", j.SinkRetryWait)\n\tpopulate(objectMap, \"storeSettings\", j.StoreSettings)\n\tobjectMap[\"type\"] = \"JsonSink\"\n\tpopulateAny(objectMap, \"writeBatchSize\", j.WriteBatchSize)\n\tpopulateAny(objectMap, \"writeBatchTimeout\", j.WriteBatchTimeout)\n\tif j.AdditionalProperties != nil {\n\t\tfor key, val := range j.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "fd563483d0ac4d27c0a37edc29d71251", "score": "0.6513757", "text": "func (s AnyJSON) MarshalJSON() ([]byte, error) {\n\treturn s.RawMessage.MarshalJSON()\n}", "title": "" }, { "docid": "6c0c6b3663be173517ed612e091cb63a", "score": "0.6511893", "text": "func MarshalJSON(jsonData map[string]interface{}) (string, error) {\n\tjson, err := json.Marshal(jsonData)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(json), nil\n}", "title": "" }, { "docid": "1c3d06ce5c790dbe2e9ed764e24474f7", "score": "0.65112484", "text": "func (v Facebook) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonDb0593a3EncodeGithubComAminMirJsonperfoptPerson11(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "1aad0405ac1e0cd8aea77a029025508e", "score": "0.64928913", "text": "func (v VisitJson) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonEada991cEncodeGitNulanaComBobrnorHlcup1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "bd43ecd14ecf11f00b040c9b2d034403", "score": "0.6492746", "text": "func (j JSONSerialization) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tj.Serialization.marshalInternal(objectMap, EventSerializationTypeJSON)\n\tpopulate(objectMap, \"properties\", j.Properties)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ca6bf365af97aa57099720bbe6922559", "score": "0.64917904", "text": "func (v Ints) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson794297d0EncodeGithubComMailruEasyjsonTests28(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "3adee630caaca35cfb53b29b38e628bc", "score": "0.64911366", "text": "func (v Pusher) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson619ac83dEncodeGithubComLissteronDeployerPkgGithub2(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "f2e2771b00dbd910af9ce1176b7ba65c", "score": "0.6486906", "text": "func (j JSONB) MarshalJSON() ([]byte, error) {\n\tif j == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn j, nil\n}", "title": "" }, { "docid": "0ce216f146a21063e3444e554253a6da", "score": "0.6486822", "text": "func (jb JSONBuffer) MarshalJSON() (result []byte, err error) {\n\treturn json.Marshal(base64.RawURLEncoding.EncodeToString(jb))\n}", "title": "" }, { "docid": "fa8eb9b7d96008498ace52bbda521873", "score": "0.6479394", "text": "func (v IntKeyedMapStruct) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson794297d0EncodeGithubComMailruEasyjsonTests29(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "61a43c8215773e1880cc4fb9a2cde877", "score": "0.64731693", "text": "func (j JSONSink) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"disableMetricsCollection\", j.DisableMetricsCollection)\n\tpopulate(objectMap, \"formatSettings\", j.FormatSettings)\n\tpopulate(objectMap, \"maxConcurrentConnections\", j.MaxConcurrentConnections)\n\tpopulate(objectMap, \"sinkRetryCount\", j.SinkRetryCount)\n\tpopulate(objectMap, \"sinkRetryWait\", j.SinkRetryWait)\n\tpopulate(objectMap, \"storeSettings\", j.StoreSettings)\n\tobjectMap[\"type\"] = \"JsonSink\"\n\tpopulate(objectMap, \"writeBatchSize\", j.WriteBatchSize)\n\tpopulate(objectMap, \"writeBatchTimeout\", j.WriteBatchTimeout)\n\tif j.AdditionalProperties != nil {\n\t\tfor key, val := range j.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c37a3ed07cf51a27c233552cfdbb1b5f", "score": "0.6472401", "text": "func (a ApplicationPatchable) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"identity\", a.Identity)\n\tpopulate(objectMap, \"kind\", a.Kind)\n\tpopulate(objectMap, \"location\", a.Location)\n\tpopulate(objectMap, \"managedBy\", a.ManagedBy)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"plan\", a.Plan)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"sku\", a.SKU)\n\tpopulate(objectMap, \"tags\", a.Tags)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "868ce2432a17b3308bef55ee8157df81", "score": "0.64722216", "text": "func (t *Template) Marshal() ([]byte, error) {\n\treturn json.Marshal(t)\n}", "title": "" }, { "docid": "db5fe9e229928a7e9825ccdc4e7d88c6", "score": "0.64666355", "text": "func testJSONMarshal(t *testing.T, v interface{}, want string) {\n\tj, err := json.Marshal(v)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %v\", v)\n\t}\n\n\tw := new(bytes.Buffer)\n\terr = json.Compact(w, []byte(want))\n\tif err != nil {\n\t\tt.Errorf(\"String is not valid json: %s\", want)\n\t}\n\n\tif w.String() != string(j) {\n\t\tt.Errorf(\"json.Marshal(%q) returned %s, want %s\", v, j, w)\n\t}\n\n\t// now go the other direction and make sure things unmarshal as expected\n\tu := reflect.ValueOf(v).Interface()\n\tif err := json.Unmarshal([]byte(want), u); err != nil {\n\t\tt.Errorf(\"Unable to unmarshal JSON for %v: %v\", want, err)\n\t}\n\n\tif !reflect.DeepEqual(v, u) {\n\t\tt.Errorf(\"json.Unmarshal(%q) returned %s, want %s\", want, u, v)\n\t}\n}", "title": "" }, { "docid": "026bfda2b3926a8a0a18ea07994df0b4", "score": "0.6466464", "text": "func DefaultJSONMarshal(v interface{}) ([]byte, error) {\n\treturn json.MarshalIndent(v, \"\", \" \")\n}", "title": "" }, { "docid": "b56c1748b7731ec7465a7637cb59f133", "score": "0.64649343", "text": "func MarshalRaw(i interface{}) json.RawMessage {\n\tb, err := json.Marshal(i)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn json.RawMessage(b)\n}", "title": "" } ]
433aefab9fb093b5d6e5e5b7e3207340
Close terminates the iteration process, releasing any pending underlying resources.
[ { "docid": "1390d40471203bbde9b98f90fade521e", "score": "0.0", "text": "func (it *ContainerVersionDeleteIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" } ]
[ { "docid": "ee03bca096f8d08f2a345971d89b2779", "score": "0.74695426", "text": "func (it *PlasmaMVPFinalizedExitIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "93de2723deb1590618ae370ace021a12", "score": "0.738389", "text": "func (it *HtlcReleaseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "16aa8c97a415a5d29f013ad79efe174a", "score": "0.7360186", "text": "func (it *PlasmaMVPChallengedExitIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "c33b2e1dbffad9ea5f37072fc754bc6e", "score": "0.7333476", "text": "func (it *ModularLongOnReLoadAndDistributeIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ebb957c079a0b1ee6fedc4e0a8fa28c9", "score": "0.7332101", "text": "func (it *ChallengeContinuedExecutionProvenIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "a08fb5b5831e96a9162b2f825a0a5e90", "score": "0.729371", "text": "func (it *KittyCorePregnantIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "3abc3ee54d3f5f4dc9b2c7be6975db66", "score": "0.72780436", "text": "func (i *ResourceIter) Close() {}", "title": "" }, { "docid": "eec9243fbe4df269c5fa060b78af90a7", "score": "0.72554874", "text": "func (it *EscrowFundedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "c63e4f0f9677c66e079982fdcd63b190", "score": "0.72277397", "text": "func (it *AccessControlledAggregatorNewRoundIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "f987e0c215f72482828bd95940aa53de", "score": "0.72035855", "text": "func (it *PolyNFTWrapperPolyWrapperSpeedUpIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "a8f6dfda15b88cbd0007f5ca1b96a7fe", "score": "0.7201209", "text": "func (iter StopReferenceIter) Close() {\n\titer.iter.Close()\n}", "title": "" }, { "docid": "6f6f218e7a346af5952fe33a692c3423", "score": "0.719487", "text": "func (it *EscrowExecutedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "9a4dd5ad513c4847edd5ab11cc9888ec", "score": "0.7170842", "text": "func (it *L1ERC721BridgeERC721BridgeFinalizedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "8c6597393805dfea90dbc0ff860f8f32", "score": "0.7158463", "text": "func (it *SigmacoreTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "1561eaa839435791a06a14934d325a12", "score": "0.7152901", "text": "func (it *ModularLongOnBuyAndDistributeIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "dbcb6c12e2ec35f1f8a6b03f02f37cff", "score": "0.71394366", "text": "func (it *AggregatorV2V3InterfaceNewRoundIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "73e5d9cb6d9cc2b68a2e30216ef88064", "score": "0.71294814", "text": "func (it *DataRegistryPunishedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "26e92333dbf29848c2e319489caef8aa", "score": "0.71234", "text": "func (it *WizardNFTApprovalIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "b955943e0f588b59b8dc71aaa3661d0f", "score": "0.71188486", "text": "func (it *SigmacoreLOGEXITIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "aafec627cd17b22d91b20ab345ac7259", "score": "0.710074", "text": "func (it *OptimismMintableERC20FactoryOptimismMintableERC20CreatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "c19ab9b76a50ed0bf89c686ca3e30dd0", "score": "0.7096451", "text": "func (it *VoterManagerVoteProcessedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "48521178570746771ed1f90da43829e2", "score": "0.70960236", "text": "func (it *AggregatorInterfaceNewRoundIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "6a44761cb754d9a7f140dd9f168851b3", "score": "0.70899504", "text": "func (it *ContentRunKillIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "a550ca8fdbb450915cd785d57410472a", "score": "0.7083426", "text": "func (it *FoMo3DlongOnReLoadAndDistributeIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "493def85e1311ec776535787c68628b2", "score": "0.70780635", "text": "func (it *HighlimitOnDelIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "8b70a834000138b1609e8e58386c1c5a", "score": "0.7069647", "text": "func (it *PolyNFTWrapperUnpausedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "417b2e6a97cfae078e829a1ed3d994d7", "score": "0.706448", "text": "func (it *ERC777BurnedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "dde0be7e885bc73fd4b9f6a8fd64e022", "score": "0.7055026", "text": "func (it *YtmFreezedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e70292dc71ff31bf4737bc4439226da4", "score": "0.7048449", "text": "func (iter *Iterator) Close() error {\n\treturn iter.close()\n}", "title": "" }, { "docid": "359eb892d424a47d444e200fb29f1499", "score": "0.7040816", "text": "func (ci *cIterator) Close() error {\n\tci.Release()\n\tci.fdPool = nil\n\tci.buf = nil\n\treturn nil\n}", "title": "" }, { "docid": "30b382e2ac72208c593e6474e8e2e38e", "score": "0.704067", "text": "func (it *OracleLogProphecyProcessedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "23f506d74c6e18316449414f3a05a093", "score": "0.70379543", "text": "func (it *ERC20AtomicSwapperRefundedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "aa588daadf9ba88b140da7df3eb42288", "score": "0.7032985", "text": "func (it *WizardNFTApprovalForAllIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "5f345baf739ec966f5cfeb32593fb83b", "score": "0.7028678", "text": "func (it *ExecutorContractBatchExecutedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "13d1b67d43d868a3868f93b37e4ebb1a", "score": "0.7023768", "text": "func (iter *Iterator) Close() {\n\tC.rocksdb_iter_destroy(iter.c)\n\titer.c = nil\n}", "title": "" }, { "docid": "f6aaf778f025d1d6b7435be965953d11", "score": "0.7023339", "text": "func (it *MStableMintedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "8e87d810aee6018043b67565f0f3a694", "score": "0.70232964", "text": "func (it *SingleGomokuIntendSettleIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "626be8551e5721b750404b9f77684184", "score": "0.70231676", "text": "func (it *CounterObjectCounterIncrementedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "d68300d563f5265c5c2cd1a674c22bf3", "score": "0.701939", "text": "func (it *SigmacoreLOGMAXTOKENSUPDATEDIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "af5c0c26079e82d93b23e0e72a9ac326", "score": "0.70192385", "text": "func (it *BaseContentSpaceVersionDeleteIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "48ae8d61a44bc6e6b3a7d15c10e7e188", "score": "0.7018967", "text": "func (it *PausableOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e87a9fe59c753149d0d5ece837fca5f7", "score": "0.7015892", "text": "func (it *ERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e87a9fe59c753149d0d5ece837fca5f7", "score": "0.7015892", "text": "func (it *ERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "56635bd003f8344a11eaa5672850ca4e", "score": "0.7015837", "text": "func (i *Iterator) Close() error {\n\tif i.ent != nil {\n\t\ti.ent.Release()\n\t\ti.ent = nil\n\t}\n\n\treturn i.tr.Close()\n}", "title": "" }, { "docid": "d2d210e8f6ef2f37e8480091d1caad70", "score": "0.7012936", "text": "func (it *ChallengeBisectedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "17dab7df9a53feb34ff80750cf0dde38", "score": "0.700866", "text": "func (it *ModularLongOnWithdrawAndDistributeIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "fb13a671dd6a8d1cdc10e9b38ac9288b", "score": "0.7005477", "text": "func (it *ERCTwentyTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "870d8aca6cb2fa9d3413f3f691c39939", "score": "0.7004252", "text": "func (it *ContentRunFinalizeIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "a4a6cfedf3657fde22d74ef78613a089", "score": "0.7002866", "text": "func (it *KittyMintingPregnantIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "b18c9ddb40c3163cf722a6c61f314774", "score": "0.70016056", "text": "func (it *OptimismMintableERC20FactoryInitializedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "086519bcde82044ea46a19a41d6b422e", "score": "0.6997845", "text": "func (it *PolyNFTWrapperOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "55bc7b5f9cb87b61f526c4dcfe3e3a3e", "score": "0.699763", "text": "func (it *MainSyncIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "edd4c8d90a022fe102856b9fb0218816", "score": "0.6995312", "text": "func (it *MainBurnIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "1a3d1447ac5a8d2eb9289f79ed8fcb4e", "score": "0.69946635", "text": "func (it *PolyNFTWrapperPausedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "3d36988bbaa46b5ac5935be1d5370c8b", "score": "0.6992036", "text": "func (it *CZRXRedeemIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ddd6256ceecea7428e9842d7f959d813", "score": "0.69918823", "text": "func (it *PausableUnpauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ddd6256ceecea7428e9842d7f959d813", "score": "0.69918823", "text": "func (it *PausableUnpauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ddd6256ceecea7428e9842d7f959d813", "score": "0.69918823", "text": "func (it *PausableUnpauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "7882cea312c5ade6884c9e5583c68d10", "score": "0.6987215", "text": "func (it *KittyCoreTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "cef507b30d547b9a16151942198f7312", "score": "0.69863605", "text": "func (it *AccessControlledAggregatorRoundDetailsUpdatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ee2bb8c690cf88af9d25b56238f873af", "score": "0.6978884", "text": "func (it *CZRXReservesReducedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2e6a7c34278a6fe437b19449812f0d9a", "score": "0.69779474", "text": "func (it *BaseTenantSpaceCounterIncrementedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "c91dca413fbd30fb578538eca21be860", "score": "0.69739044", "text": "func (it *ChallengeChallengerTimedOutIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "c12ef2dba91f811e8405468d88570596", "score": "0.6970699", "text": "func (it *FoMo3DlongOnBuyAndDistributeIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "4b1c4b031e471091d327aa3f782fb89b", "score": "0.6969775", "text": "func (it *BridgeOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "826164d1962289e6daec1d64f9cdc807", "score": "0.6968843", "text": "func (it *GameNewRoundStartedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e354d41ec04dcf2b0b304b8059d3e3bf", "score": "0.6961324", "text": "func (it *L1StandardBridgeERC20WithdrawalFinalizedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2a4f2ce3ba9c592420276de903212884", "score": "0.6958832", "text": "func (i *mergingIter) Close() {\n\tfor _, it := range i.iters {\n\t\tit.Close()\n\t}\n}", "title": "" }, { "docid": "1def0247a691131a0138bd8d07f4331e", "score": "0.69573766", "text": "func (it *LendingPoolCoreReserveUpdatedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "f392f00ad15bf490eb7c1fa08c79a40a", "score": "0.6953662", "text": "func (it *VaiTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "6931ec6dff55b5c9a9e3a67dc489f20b", "score": "0.695143", "text": "func (it *BaseLibraryVersionDeleteIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "9db326381486afee9268df6552ff37de", "score": "0.69498104", "text": "func (it *VestingTokensReleasedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "8009c39ad77fdeb38ee30e2805cb3cac", "score": "0.6946963", "text": "func (it *CZRXMintIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "f6886c7f341648fa0b382deacdf192fb", "score": "0.6945718", "text": "func (it *L1StandardBridgeETHWithdrawalFinalizedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "2bbe5eeb4d6e73a2af50e73e864ac425", "score": "0.6945192", "text": "func (i indexIterator) Close() error {\n\ti.it.Close()\n\treturn nil\n}", "title": "" }, { "docid": "d9edc9ffd9b78432c0823360d4c34ee7", "score": "0.6943429", "text": "func (it *IBEP20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "0a66e6d528193e0bd3dfd1c64f646a4d", "score": "0.694251", "text": "func (it *MStableRedeemedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "fe4ee74e8c99fc545cb248d3335644df", "score": "0.69389164", "text": "func (it *PausablePauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "fe4ee74e8c99fc545cb248d3335644df", "score": "0.69389164", "text": "func (it *PausablePauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "fe4ee74e8c99fc545cb248d3335644df", "score": "0.69389164", "text": "func (it *PausablePauseIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "bc7f56ff35f16495a2b4746b159f909f", "score": "0.6933944", "text": "func (it *BatcherContractOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "62b2849500ade3d74de68f24d0ecb04f", "score": "0.6933704", "text": "func (iter *TextIterator) Close() error { return iter.impl.Close() }", "title": "" }, { "docid": "2102cd9f64bae6a4db4e015612f0d770", "score": "0.6933494", "text": "func (it *ERC20BasicTransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "53a60575c928d567d21caa160626aa20", "score": "0.69320387", "text": "func (it *SaleAuctionFinalizedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ef8dca643aed3b9d1bb60283ff16d50e", "score": "0.6930304", "text": "func (it *IERC777BurnedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "4eb0a02d5b179cecb37f569f3f7ca118", "score": "0.69271886", "text": "func (it *MStableSwappedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "5e12abe8d7c799ca93c71fe6145d26c9", "score": "0.6926818", "text": "func (it *OptimismPortalWithdrawalFinalizedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "27c0308aa35ba0b5f59c340aa70e1e71", "score": "0.6919721", "text": "func (it *MStablePausedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "d37461700818177b6084a37ed5259722", "score": "0.691971", "text": "func (it *IPancakePairBurnIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "5abfef6daef2b295d67e231097587f82", "score": "0.69179153", "text": "func (it *PlasmaMVPStartedTransactionExitIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "bd3d90df3e92c5c50b46f7eadb2f1569", "score": "0.6916959", "text": "func (it *Iterator) Close() {\n\tif !it.closed {\n\t\tit.closed = true\n\t\tit.done <- true\n\t}\n}", "title": "" }, { "docid": "7d1c139b64beadbca69b5f7f4ccc6dfa", "score": "0.69156927", "text": "func (it *PlasmaMVPBlockSubmittedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "aa4d4ce50ac3be5f020cfe5328249d9f", "score": "0.69134367", "text": "func (it *Iterator) Close() {\n\tif it.closed {\n\t\treturn\n\t}\n\tit.closed = true\n\tif it.iitr == nil {\n\t\tit.txn.numIterators.Add(-1)\n\t\treturn\n\t}\n\n\tit.iitr.Close()\n\t// It is important to wait for the fill goroutines to finish. Otherwise, we might leave zombie\n\t// goroutines behind, which are waiting to acquire file read locks after DB has been closed.\n\twaitFor := func(l list) {\n\t\titem := l.pop()\n\t\tfor item != nil {\n\t\t\titem.wg.Wait()\n\t\t\titem = l.pop()\n\t\t}\n\t}\n\twaitFor(it.waste)\n\twaitFor(it.data)\n\n\t// TODO: We could handle this error.\n\t_ = it.txn.db.vlog.decrIteratorCount()\n\tit.txn.numIterators.Add(-1)\n}", "title": "" }, { "docid": "806b5b53576edfae7702c4d11b79d9f7", "score": "0.6913152", "text": "func (it *OracleOwnershipTransferredIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "895f4414a555e2307db1e8b78d0214ab", "score": "0.69131064", "text": "func (it *BlockManagerProposedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "d38aa6ebf718c4cccd15364250950077", "score": "0.6911558", "text": "func (it *ERC20AtomicSwapperClaimedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ef191e7cef16dc913ef267189ab3d832", "score": "0.69097936", "text": "func (it *IERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "e90f8ad2f5c67a9149ea583cf4a41eb7", "score": "0.69090855", "text": "func (it *HashDiceDepositedIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ef191e7cef16dc913ef267189ab3d832", "score": "0.6908941", "text": "func (it *IERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ef191e7cef16dc913ef267189ab3d832", "score": "0.6908941", "text": "func (it *IERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" }, { "docid": "ef191e7cef16dc913ef267189ab3d832", "score": "0.6908941", "text": "func (it *IERC20TransferIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "title": "" } ]
df1603ffdc7f32d66dcc925987c9261a
WithDecider customizes the function for deciding if the gRPC interceptor logs should log.
[ { "docid": "76ca93aa0a766c39e7f4cde97388a0e2", "score": "0.8122307", "text": "func WithDecider(f grpc_logging.Decider) Option {\n\treturn func(o *options) {\n\t\to.shouldLog = f\n\t}\n}", "title": "" } ]
[ { "docid": "61dfe97616640cdb6fb93f227ee16bdd", "score": "0.7505926", "text": "func WithDecider(f Decider) Option {\n\treturn func(o *options) {\n\t\to.shouldLog = f\n\t}\n}", "title": "" }, { "docid": "02e2a37559f8b5fa88c94c223fa1dabd", "score": "0.58063", "text": "func (i *AppServerInterceptor) Logger(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n\tif methodIgnore(info.FullMethod) {\n\t\treturn handler(ctx, req)\n\t}\n\tincomeTime := time.Now()\n\trequestMeta := rpc_helper.GetRequestMetadata(ctx)\n\tvar outcomeTime time.Time\n\tvar resp interface{}\n\tvar err error\n\tdefer func() {\n\t\toutcomeTime = time.Now()\n\t\ti.echoStatistics(ctx, incomeTime, outcomeTime)\n\t\t// unary interceptor record req resp err\n\t\tif err != nil {\n\t\t\ts, _ := status.FromError(err)\n\t\t\tif i.errLogger != nil {\n\t\t\t\ti.errLogger.Errorf(\n\t\t\t\t\tctx,\n\t\t\t\t\t\"grpc access response err:%s, grpc method: %s, requestMeta: %v, outcomeTime: %v, handleTime: %f/s, req: %s, response:%s, details: %s\",\n\t\t\t\t\ts.Err().Error(),\n\t\t\t\t\tinfo.FullMethod,\n\t\t\t\t\tjson.MarshalToStringNoError(requestMeta),\n\t\t\t\t\toutcomeTime.Format(kelvins.ResponseTimeLayout),\n\t\t\t\t\toutcomeTime.Sub(incomeTime).Seconds(),\n\t\t\t\t\tjson.MarshalToStringNoError(req),\n\t\t\t\t\tjson.MarshalToStringNoError(resp),\n\t\t\t\t\tjson.MarshalToStringNoError(s.Details()),\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tif i.debug && i.accessLogger != nil {\n\t\t\t\ti.accessLogger.Infof(\n\t\t\t\t\tctx,\n\t\t\t\t\t\"grpc access response ok, grpc method: %s, requestMeta: %v, outcomeTime: %v, handleTime: %f/s, req: %s, response: %s\",\n\t\t\t\t\tinfo.FullMethod,\n\t\t\t\t\tjson.MarshalToStringNoError(requestMeta),\n\t\t\t\t\toutcomeTime.Format(kelvins.ResponseTimeLayout),\n\t\t\t\t\toutcomeTime.Sub(incomeTime).Seconds(),\n\t\t\t\t\tjson.MarshalToStringNoError(req),\n\t\t\t\t\tjson.MarshalToStringNoError(resp),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}()\n\n\tresp, err = handler(ctx, req)\n\treturn resp, err\n}", "title": "" }, { "docid": "c49230b2260607cd567b99c8e84fa5f6", "score": "0.55680215", "text": "func WithLogger(log logrus.FieldLogger) Middleware {\n\treturn Preprocess(func(ctx context.Context, fullMethod string, req interface{}) (context.Context, error) {\n\t\tctx, names := withNames(ctx, fullMethod)\n\t\tlog := log.WithFields(logrus.Fields{\n\t\t\ttelemetry.Service: names.Service,\n\t\t\ttelemetry.Method: names.Method,\n\t\t})\n\t\treturn rpccontext.WithLogger(ctx, log), nil\n\t})\n}", "title": "" }, { "docid": "8b545d29bef18a267f0b568298c38305", "score": "0.54684067", "text": "func GRPCLogInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n\tt := time.Now()\n\n\t_, requestID := FromContext(ctx)\n\n\tInfoWithTracing(\n\t\tctx,\n\t\tFields{\n\t\t\t\"Method\": info.FullMethod,\n\t\t\t\"Request\": req,\n\t\t\t\"RequestID\": requestID,\n\t\t},\n\t)\n\n\tresp, err := handler(ctx, req)\n\n\tpayload := Fields{\n\t\t\"Method\": info.FullMethod,\n\t\t\"Response\": resp,\n\t\t\"RequestID\": requestID,\n\t\t\"ResponseTime\": time.Since(t).Seconds(),\n\t}\n\n\tif err != nil {\n\t\tpayload[\"Error\"] = err.Error()\n\t}\n\n\tInfoWithTracing(ctx, payload)\n\n\treturn resp, err\n}", "title": "" }, { "docid": "a0db1a6f1a09fce7d3db287e8250e126", "score": "0.54086906", "text": "func interceptorLogrusLogger(l logrus.FieldLogger) logging.Logger {\n\treturn logging.LoggerFunc(func(ctx context.Context, lvl logging.Level, msg string, fields ...any) {\n\t\tf := make(map[string]any, len(fields)/2)\n\t\ti := logging.Fields(fields).Iterator()\n\t\tif i.Next() {\n\t\t\tk, v := i.At()\n\t\t\tf[k] = v\n\t\t}\n\t\tl := l.WithFields(f)\n\t\tif lvl < logging.LevelInfo {\n\t\t\tl.Debug(msg)\n\t\t} else if lvl < logging.LevelWarn {\n\t\t\tl.Info(msg)\n\t\t} else if lvl < logging.LevelError {\n\t\t\tl.Warn(msg)\n\t\t} else {\n\t\t\tl.Error(msg)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "37e40d72fff3e0425699776de35bfe31", "score": "0.5380556", "text": "func interceptorLogger(l zerolog.Logger) logging.Logger {\n\treturn logging.LoggerFunc(func(ctx context.Context, lvl logging.Level, msg string, fields ...any) {\n\t\tl = l.With().Fields(fields).Logger()\n\n\t\tswitch lvl {\n\t\tcase logging.LevelDebug:\n\t\t\tl.Debug().Msg(msg)\n\t\tcase logging.LevelInfo:\n\t\t\tl.Info().Msg(msg)\n\t\tcase logging.LevelWarn:\n\t\t\tl.Warn().Msg(msg)\n\t\tcase logging.LevelError:\n\t\t\tl.Error().Msg(msg)\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unknown level %v\", lvl))\n\t\t}\n\t})\n}", "title": "" }, { "docid": "56992da8dbec5846dc7b5d55959e0b91", "score": "0.53214186", "text": "func WithLogging(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlrw := newLoggingResponseWriter(w)\n\t\tnext.ServeHTTP(lrw, r)\n\t\tstatusCode := lrw.statusCode\n\t\tlog.Printf(\"Received Request %s %s - %d %s\", r.Method, r.URL.Path, statusCode, http.StatusText(statusCode))\n\t}\n}", "title": "" }, { "docid": "2627ca01ec3dbb30d7c650f2e822eb63", "score": "0.5310743", "text": "func serverLoggerInterceptor(logger *logrus.Logger) []grpc.ServerOption {\n\t// Create new logrus entry for logger interceptor.\n\tlogrusEntry := logrus.NewEntry(logger)\n\n\tignorePayload := ilogger.IgnoreServerMethodsDecider(\n\t\tstrings.Split(viper.GetString(configElasticAPMIgnoreURLS), \",\")...,\n\t)\n\n\tignoreInitialRequest := ilogger.IgnoreServerMethodsDecider(\n\t\tstrings.Split(viper.GetString(configElasticAPMIgnoreURLS), \",\")...,\n\t)\n\n\t// Shared options for the logger, with a custom gRPC code to log level function.\n\tloggerOpts := []grpc_logrus.Option{\n\t\tgrpc_logrus.WithDecider(func(fullMethodName string, err error) bool {\n\t\t\treturn ignorePayload(fullMethodName)\n\t\t}),\n\t\tgrpc_logrus.WithLevels(grpc_logrus.DefaultCodeToLevel),\n\t}\n\n\treturn ilogger.ElasticsearchLoggerServerInterceptor(\n\t\tlogrusEntry,\n\t\tignorePayload,\n\t\tignoreInitialRequest,\n\t\tloggerOpts...,\n\t)\n}", "title": "" }, { "docid": "2af49fe88ac3941cbac75a561550dfc1", "score": "0.5279061", "text": "func serverLoggerInterceptor(logger *logrus.Logger) []grpc.ServerOption {\n\t// Create new logrus entry for logger interceptor.\n\tlogrusEntry := logrus.NewEntry(logger)\n\n\tignorePayload := ilogger.IgnoreServerMethodsDecider(\n\t\tappend(\n\t\t\tstrings.Split(viper.GetString(configElasticAPMIgnoreURLS), \",\"),\n\t\t)...,\n\t)\n\n\tignoreInitialRequest := ilogger.IgnoreServerMethodsDecider(\n\t\tstrings.Split(viper.GetString(configElasticAPMIgnoreURLS), \",\")...,\n\t)\n\n\t// Shared options for the logger, with a custom gRPC code to log level function.\n\tloggerOpts := []grpc_logrus.Option{\n\t\tgrpc_logrus.WithDecider(func(fullMethodName string, err error) bool {\n\t\t\treturn ignorePayload(fullMethodName)\n\t\t}),\n\t\tgrpc_logrus.WithLevels(grpc_logrus.DefaultClientCodeToLevel),\n\t}\n\n\treturn ilogger.ElasticsearchLoggerServerInterceptor(\n\t\tlogrusEntry,\n\t\tignorePayload,\n\t\tignoreInitialRequest,\n\t\tloggerOpts...,\n\t)\n}", "title": "" }, { "docid": "f3d16303f0334028fd6a2ff9796e7905", "score": "0.5256345", "text": "func WithCustomLog(h http.Handler, fn LogFunc) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(&loggingResponseWriter{w: w, log: fn(r)}, r)\n\t})\n}", "title": "" }, { "docid": "9df12d1c4bdd96da6f8e61a0158a292f", "score": "0.52372026", "text": "func (l *Logger) With(fields ...string) logging.Logger {\n\tvals := make([]interface{}, 0, len(fields))\n\tfor _, v := range fields {\n\t\tvals = append(vals, v)\n\t}\n\treturn InterceptorLogger(log.With(l.Logger, vals...))\n}", "title": "" }, { "docid": "3aba3bf2e3e415f80b58b757dd7d3f91", "score": "0.5199898", "text": "func LogsWith(l Logger) Option {\n\treturn func(s *defaultServer) {\n\t\ts.logger = l\n\t}\n}", "title": "" }, { "docid": "790b10cb30483a5532f7835211016d5e", "score": "0.51677114", "text": "func TracingAndLoggingMiddlewareHook(opts TracingAndMetricsOptions) echo.MiddlewareFunc {\n\topts.Validate()\n\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\tzlm := &traceAndLogMiddleware{\n\t\t\topts: opts,\n\t\t\tnext: next,\n\t\t}\n\t\treturn zlm.instrumentRequest\n\t}\n}", "title": "" }, { "docid": "39e283310e68fb73c27314b16843b0c8", "score": "0.512473", "text": "func WithLog(h http.Handler, l Logger) http.Handler {\n\tfn := func(r *http.Request) func(int) {\n\t\treturn func(code int) {\n\t\t\tl.Printf(\"%s %s %d %q\", r.Method, r.URL, code, r.UserAgent())\n\t\t}\n\t}\n\treturn WithCustomLog(h, fn)\n}", "title": "" }, { "docid": "3ccdc688c6c059e65555767dd598e470", "score": "0.5087447", "text": "func AddLogging(logger *zap.Logger, opts []grpc.ServerOption) []grpc.ServerOption {\n\t// Shared options for the logger, with a custom gRPC code to log level function.\n\to := []grpc_zap.Option{\n\t\tgrpc_zap.WithLevels(codeToLevel),\n\t}\n\t// Make sure that log statements internal to gRPC library are logged using the zapLogger as well.\n\tgrpc_zap.ReplaceGrpcLogger(logger)\n\n\t// Add unary interceptor\n\topts = append(opts, grpc_middleware.WithUnaryServerChain(\n\t\tgrpc_ctxtags.UnaryServerInterceptor(grpc_ctxtags.WithFieldExtractor(grpc_ctxtags.CodeGenRequestFieldExtractor)),\n\t\tgrpc_zap.UnaryServerInterceptor(logger, o...),\n\t\tgrpc.UnaryServerInterceptor(unaryInterceptor),\n\t))\n\n\t// Add stream interceptor (added as an example here)\n\topts = append(opts, grpc_middleware.WithStreamServerChain(\n\t\tgrpc_ctxtags.StreamServerInterceptor(grpc_ctxtags.WithFieldExtractor(grpc_ctxtags.CodeGenRequestFieldExtractor)),\n\t\tgrpc_zap.StreamServerInterceptor(logger, o...),\n\t))\n\n\treturn opts\n}", "title": "" }, { "docid": "a6947c62afa18d7cddf562103ce32420", "score": "0.5074405", "text": "func withLogging(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tstart := time.Now()\n\t\tnext.ServeHTTP(w, r)\n\t\tend := time.Now()\n\t\ttracer.Tracef(\"[%s] %q %v\\n\", r.Method, r.URL.String(), end.Sub(start))\n\t}\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "f80cd006c341eacb0b89be100d63228c", "score": "0.5068276", "text": "func withLog(fn http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tc := httptest.NewRecorder()\n\t\tfn(c, r)\n\t\tlog.Printf(\"[%d] %-4s %s\\n\", c.Code, r.Method, r.URL.Path)\n\n\t\tfor k, v := range c.HeaderMap {\n\t\t\tw.Header()[k] = v\n\t\t}\n\t\tw.WriteHeader(c.Code)\n\t\tc.Body.WriteTo(w)\n\t}\n}", "title": "" }, { "docid": "7ec74d5d990296dfcecbd01283ce2f6b", "score": "0.5066382", "text": "func LoggerMiddleware() grpc.UnaryServerInterceptor {\n\treturn func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n\t\tstartTime := time.Now()\n\n\t\thandlerName := \"unknown\"\n\n\t\tctx = context.WithValue(ctx, HandlerNameKey, &handlerName)\n\t\tresp, err := handler(ctx, req)\n\n\t\terrorString := \"\"\n\t\tif err != nil {\n\t\t\terrorString = err.Error()\n\t\t}\n\t\tduration := ((time.Since(startTime).Nanoseconds()) / 1000000)\n\t\tphdlog.GRPCHandlerSummary(errorString,\n\t\t\tint64(duration),\n\t\t\tphdcid.GetCIDFromContext(ctx),\n\t\t\thandlerName)\n\n\t\t// re-extract logger from newCtx, as it may have extra fields that changed in the holder.\n\t\t// ctx_zap.Extract(newCtx).Check(level, \"finished unary call with code \"+code.String()).Write(\n\t\t// \tzap.Error(err),\n\t\t// \tzap.String(\"grpc.code\", code.String()),\n\t\t// \to.durationFunc(time.Since(startTime)),\n\t\t// )\n\n\t\treturn resp, err\n\t}\n}", "title": "" }, { "docid": "5f40e1585c1437b47a1043d706959dba", "score": "0.5008391", "text": "func InterceptorLogger(logger log.Logger) *Logger {\n\treturn &Logger{logger}\n}", "title": "" }, { "docid": "95a78a2eda38c068c49aede7032b647b", "score": "0.4951861", "text": "func (l *Logger) With(fields ...string) logging.Logger {\n\tvals := make([]zap.Field, 0, len(fields)/2)\n\tfor i := 0; i < len(fields); i += 2 {\n\t\tvals = append(vals, zap.String(fields[i], fields[i+1]))\n\t}\n\treturn InterceptorLogger(l.Logger.With(vals...))\n}", "title": "" }, { "docid": "0736a006c957519c4e2bdcbe837492cf", "score": "0.49369764", "text": "func InterceptorLogger(logger *zap.Logger) *Logger {\n\treturn &Logger{logger}\n}", "title": "" }, { "docid": "af172ef681b1a23097741f1ac087481d", "score": "0.49251068", "text": "func LoggerWithWriter(out io.Writer) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// Start timer\n\t\tstart := time.Now()\n\n\t\t// Replace context writer\n\t\twriter := &bodyLogWriter{\n\t\t\tResponseWriter: c.Writer,\n\t\t\tbody: bytes.NewBufferString(\"\"),\n\t\t}\n\t\tc.Writer = writer\n\n\t\t// Process request\n\t\tc.Next()\n\n\t\t// Not logged\n\t\tif _, ok := NotLoggedPaths[c.Request.URL.Path]; ok {\n\t\t\treturn\n\t\t}\n\n\t\t// New log\n\t\tlog := &Log{\n\t\t\tTimestamp: start.Format(time.RFC3339),\n\t\t\tLevel: httpex.GetLogLevel(c.Writer.Status()),\n\t\t\tStatus: c.Writer.Status(),\n\t\t\tMethod: c.Request.Method,\n\t\t\tPath: c.Request.URL.Path,\n\t\t\tLatency: fmt.Sprintf(\"%v\", time.Now().UTC().Sub(start)),\n\t\t\tQueryStringParameters: make(url.Values),\n\t\t\tPathParameters: make(map[string]string),\n\t\t\tClientIP: c.ClientIP(),\n\t\t}\n\t\t// Set request id\n\t\tif requestID, exists := c.Get(\"request_id\"); exists {\n\t\t\tlog.RequestID = requestID.(string)\n\t\t}\n\t\t// Set query string parameters\n\t\tlog.QueryStringParameters = c.Request.URL.Query()\n\t\t// Set path parameters\n\t\tfor _, param := range c.Params {\n\t\t\tlog.PathParameters[param.Key] = param.Value\n\t\t}\n\t\t// Set request body\n\t\tif body, err := c.GetRawData(); err == nil {\n\t\t\tlog.Body = string(body)\n\t\t}\n\t\t// Set error\n\t\tif log.Status >= http.StatusBadRequest {\n\t\t\tlog.Error = json.RawMessage(writer.body.Bytes())\n\t\t}\n\t\t// Set location\n\t\tif log.Status == http.StatusFound {\n\t\t\tlog.Location = c.Writer.Header().Get(\"Location\")\n\t\t}\n\t\t// Marshal log\n\t\tdata, err := jsonex.Marshal(log)\n\t\t// Print log\n\t\tif err == nil {\n\t\t\tfmt.Fprintln(out, string(data))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "33117fa81eaf5be2a6d50a933f05a726", "score": "0.48999846", "text": "func interceptorGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {\n\n\t// Get a new context with a list of loggers request specific.\n\tnewContext := utils.GetNewContext(ctx)\n\n\t// Calls the handler\n\tutils.GetLogCSID(newContext, 4).Println(\"Request submitted\", \"method:\", info.FullMethod)\n\tstart := time.Now()\n\trsp, err := handler(newContext, req)\n\tutils.GetLogCSID(newContext, 4).Println(\"Request completed\", \"method:\", info.FullMethod,\n\t\t\"duration:\", time.Since(start), \"error\", err)\n\n\treturn rsp, err\n}", "title": "" }, { "docid": "233e4846205f520a878b79ab01b14467", "score": "0.48911637", "text": "func WithLog(f func(string, ...interface{})) OptionFunc {\n\treturn func(ctx context.Context) chromedp.Option {\n\t\treturn chromedp.WithLog(f)\n\t}\n}", "title": "" }, { "docid": "06bbc59feef854d24587705781047e27", "score": "0.48609793", "text": "func HandleRequestInfoLogging() Middleware {\n\treturn func(inner HandlerFunc) HandlerFunc {\n\n\t\treturn func(rw http.ResponseWriter, req *http.Request) error {\n\t\t\tbefore := time.Now()\n\n\t\t\twrapped := &wrappedResponseWritter{\n\t\t\t\tinner: rw,\n\t\t\t}\n\n\t\t\terr := inner(wrapped, req)\n\t\t\tif wrapped.code == 0 && err == nil {\n\t\t\t\twrapped.code = 200\n\t\t\t}\n\n\t\t\tdur := time.Since(before)\n\n\t\t\t// logging\n\t\t\tRequestLogger(req).Infof(\"[%d][%s] %s %s\", wrapped.code, req.Method, req.RequestURI, dur)\n\n\t\t\t// rpc metric\n\t\t\trpcMetricAdd(req.URL.Path, wrapped.code, dur)\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d731367e0a0cc608b198d90c0b576a12", "score": "0.4855346", "text": "func withSpanAndLogger(t tracedHandler) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tspan, _ := tracer.SpanFromContext(r.Context())\n\t\ttraceID := span.Context().TraceID()\n\t\tspanID := span.Context().SpanID()\n\t\tentry := log.WithFields(log.Fields{\n\t\t\t\"dd.trace_id\": traceID,\n\t\t\t\"dd.span_id\": spanID,\n\t\t})\n\t\tt(span, entry, w, r)\n\t}\n}", "title": "" }, { "docid": "7552857832dc1947ff2af91d5dd721a5", "score": "0.48482373", "text": "func (d *DefaultContext) OnLog() {}", "title": "" }, { "docid": "ad9e05031e9f91f5b25a99f1c89ecee3", "score": "0.48170644", "text": "func WithLogger(v *log.Logger) Option { return withLogger{v} }", "title": "" }, { "docid": "35e1861cb57d60c9fe95ce191d03f406", "score": "0.47924727", "text": "func (l *logger) With(ctx context.Context, args ...interface{}) Logger {\n\tif ctx != nil {\n\t\tif id, ok := ctx.Value(requestIDKey).(string); ok {\n\t\t\targs = append(args, zap.String(\"request_id\", id))\n\t\t}\n\t\tif id, ok := ctx.Value(correlationIDKey).(string); ok {\n\t\t\targs = append(args, zap.String(\"correlation_id\", id))\n\t\t}\n\t}\n\tif len(args) > 0 {\n\t\treturn &logger{l.SugaredLogger.With(args...)}\n\t}\n\treturn l\n}", "title": "" }, { "docid": "63a072dac83f7d6c2f6d965cc2a09717", "score": "0.47789484", "text": "func DefaultDeciderMethod() Decision {\n\treturn LogStartAndFinishCall\n}", "title": "" }, { "docid": "4c5b7bb53cd770a995d8d997192e8b98", "score": "0.4762737", "text": "func Logger() Middleware {\n\treturn func(next ship.Handler) ship.Handler {\n\t\treturn func(ctx *ship.Context) (err error) {\n\t\t\tstart := time.Now()\n\t\t\terr = next(ctx)\n\t\t\tcost := time.Since(start)\n\n\t\t\tcode := ctx.StatusCode()\n\t\t\tif err != nil && !ctx.IsResponded() {\n\t\t\t\tif hse, ok := err.(ship.HTTPServerError); ok {\n\t\t\t\t\tcode = hse.Code\n\t\t\t\t} else {\n\t\t\t\t\tcode = http.StatusInternalServerError\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar logf func(string, ...interface{})\n\t\t\tif code < 400 {\n\t\t\t\tlogf = ctx.Infof\n\t\t\t} else if code < 500 {\n\t\t\t\tlogf = ctx.Warnf\n\t\t\t} else {\n\t\t\t\tlogf = ctx.Errorf\n\t\t\t}\n\n\t\t\treq := ctx.Request()\n\t\t\tlogf(logfmt, req.RemoteAddr, req.Method, req.URL.RequestURI(),\n\t\t\t\tcode, start.Unix(), cost, err)\n\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c6f5fa37695b38da5194749dec3fe747", "score": "0.47403678", "text": "func Logger(logger logrus.FieldLogger, notLogged ...string) gin.HandlerFunc {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\thostname = \"unknown\"\n\t}\n\n\tvar skip map[string]struct{}\n\n\tif length := len(notLogged); length > 0 {\n\t\tskip = make(map[string]struct{}, length)\n\n\t\tfor _, p := range notLogged {\n\t\t\tskip[p] = struct{}{}\n\t\t}\n\t}\n\n\treturn func(context *gin.Context) {\n\t\t// other handler can change context.Path so:\n\t\tpath := context.Request.URL.Path\n\t\tstart := time.Now()\n\t\tcontext.Next()\n\t\tstop := time.Since(start)\n\t\tlatency := int(math.Ceil(float64(stop.Nanoseconds()) / 1000000.0))\n\t\tstatusCode := context.Writer.Status()\n\t\tclientIP := context.ClientIP()\n\t\tclientUserAgent := context.Request.UserAgent()\n\t\treferer := context.Request.Referer()\n\t\tdataLength := context.Writer.Size()\n\t\tif dataLength < 0 {\n\t\t\tdataLength = 0\n\t\t}\n\n\t\tif _, ok := skip[path]; ok {\n\t\t\treturn\n\t\t}\n\n\t\tentry := logger.WithFields(logrus.Fields{\n\t\t\t//\"timestamp\": time.Now().Format(TimestampFormat),\n\t\t\t\"addr\": clientIP,\n\t\t\t// Other fields not required FCB Kubernetes\n\t\t\t//\"hostname\": hostname,\n\t\t\t//\"statusCode\": statusCode,\n\t\t\t//\"latency\": latency, // time to process\n\t\t\t//\"method\": context.Request.Method,\n\t\t\t//\"path\": path,\n\t\t\t//\"referer\": referer,\n\t\t\t//\"dataLength\": dataLength,\n\t\t\t//\"userAgent\": clientUserAgent,\n\t\t})\n\n\t\tif len(context.Errors) > 0 {\n\t\t\tentry.Error(context.Errors.ByType(gin.ErrorTypePrivate).String())\n\t\t} else {\n\t\t\tmsg := fmt.Sprintf(\"%s \\\"%s %s\\\" %d %d \\\"%s\\\" \\\"%s\\\" (%dms)\", // %s - %s [%s]\n\t\t\t\t//clientIP,\n\t\t\t\thostname,\n\t\t\t\t//time.Now().Format(TimestampFormat),\n\t\t\t\tcontext.Request.Method,\n\t\t\t\tpath,\n\t\t\t\tstatusCode,\n\t\t\t\tdataLength,\n\t\t\t\treferer,\n\t\t\t\tclientUserAgent,\n\t\t\t\tlatency,\n\t\t\t)\n\t\t\tif statusCode >= http.StatusInternalServerError {\n\t\t\t\tentry.Error(msg)\n\t\t\t} else if statusCode >= http.StatusBadRequest {\n\t\t\t\tentry.Warn(msg)\n\t\t\t} else {\n\t\t\t\tentry.Info(msg)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6c6515981fd1d0a41dd619dc7b9a3c4e", "score": "0.47243345", "text": "func LogAndInstrumentation(kitLogger log.Logger, namespace, subsystem, action, domain string) endpoint.Middleware {\n\tvar logObj logger.Logger\n\n\tkey := fmt.Sprintf(\"%s_%s\", namespace, subsystem)\n\n\tif val, ok := loggers[key]; ok {\n\t\tlogObj = *val\n\t} else {\n\t\tlock.Lock()\n\t\tlogObj = logger.New(nil, nil,\n\t\t\tkitLogger,\n\t\t)\n\n\t\tloggers[key] = &logObj\n\t\tlock.Unlock()\n\t}\n\n\treturn func(f endpoint.Endpoint) endpoint.Endpoint {\n\t\tkeyvals := make([]interface{}, 0)\n\t\tkeyvals = append(keyvals,\n\t\t\t\"function\", action,\n\t\t\t\"domain\", domain,\n\t\t)\n\t\treturn logObj.Instrumentation(logObj.Log(f, keyvals...), keyvals...)\n\t}\n}", "title": "" }, { "docid": "b63b3f5de3bd91e0375b54a09f07e2d0", "score": "0.4694301", "text": "func LogWrapper(fn server.HandlerFunc) server.HandlerFunc {\n\treturn func (ctx context.Context, req server.Request, rsp interface{}) error {\n\t\tlog.Printf(\"[Log Wrapper] Before serving request method: %v\", req.Method())\n\t\terr := fn(ctx, req, rsp)\n\t\tlog.Printf(\"[Log Wrapper] After serving request\")\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "4a14e569b4bf4f68572c4a2ccba69c28", "score": "0.46809193", "text": "func (d *defaultLogger)Trace(v ...interface{}){\n\n}", "title": "" }, { "docid": "0c1f7f02aed201d1a07ed2191a5d5561", "score": "0.467874", "text": "func TestOptionsWithInterceptors(t *testing.T) {\n\topts := Options()\n\n\tlogger := NewLogger()\n\tlogger.interceptors = nil\n\n\tinterceptors := []Interceptor{\n\t\tfunc(ctx context.Context, log *Log) {},\n\t\tfunc(ctx context.Context, log *Log) {},\n\t\tfunc(ctx context.Context, log *Log) {},\n\t}\n\n\topts.WithInterceptors(interceptors...).Apply(logger)\n\tif len(logger.interceptors) != len(interceptors) {\n\t\tt.Errorf(\"len(logger.interceptors) %d != len(interceptors) %d\", len(logger.interceptors), len(interceptors))\n\t}\n\n\tlogger.interceptors = nil\n\n\topts.WithInterceptors()\n\tif len(logger.interceptors) != 0 {\n\t\tt.Errorf(\"len(logger.interceptors) %d != 0\", len(logger.interceptors))\n\t}\n}", "title": "" }, { "docid": "946b4aa74a41a059d9f6430f79851d9c", "score": "0.46718", "text": "func ServWithLog(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Println(r.RemoteAddr, r.RequestURI)\n\n\t\tswitch {\n\t\tcase AllowAddrMap[ipValidator(r.RemoteAddr)]:\n\t\t\t// pass\n\t\tdefault:\n\t\t\tlog.Println(\"rejected \", r.RemoteAddr)\n\t\t\thttp.Error(w, \"Blocked\", 403)\n\t\t\treturn\n\t\t}\n\n\t\thandler.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "e01cd1298866261c0c13140141e0591a", "score": "0.46685648", "text": "func LoggingUnaryClientInterceptor(l log.Logger) grpc.UnaryClientInterceptor {\n\tif !envLoggingEnabled {\n\t\t// Just return the default invoker if logging is disabled.\n\t\treturn func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {\n\t\t\treturn invoker(ctx, method, req, reply, cc, opts...)\n\t\t}\n\t}\n\n\tlogger := l.Scoped(logScope, logDescription)\n\tlogger = logger.Scoped(\"unaryMethod\", \"errors that originated from a unary method\")\n\n\treturn func(ctx context.Context, fullMethod string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {\n\t\terr := invoker(ctx, fullMethod, req, reply, cc, opts...)\n\t\tif err != nil {\n\t\t\tserviceName, methodName := grpcutil.SplitMethodName(fullMethod)\n\n\t\t\tvar initialRequest proto.Message\n\t\t\tif m, ok := req.(proto.Message); ok {\n\t\t\t\tinitialRequest = m\n\t\t\t}\n\n\t\t\tdoLog(logger, serviceName, methodName, &initialRequest, req, err)\n\t\t}\n\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "cdf5de143c9711bbcea327feaa399533", "score": "0.46271896", "text": "func withLogging(action string, output io.Writer, next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tl := &logData{Action: action}\n\n\t\tif id, ok := mux.Vars(r)[\"id\"]; ok {\n\t\t\tl.ActionID = id\n\t\t}\n\n\t\tt := time.Now()\n\n\t\tsw := &statusWriter{ResponseWriter: w}\n\t\tctx := context.WithValue(r.Context(), contextKeyLogData, l)\n\t\tnext.ServeHTTP(sw, r.WithContext(ctx))\n\n\t\tl.Result = sw.Status\n\t\tl.Time = time.Now()\n\t\tl.Duration = l.Time.Sub(t)\n\n\t\tj, err := json.Marshal(l)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Unable to marshal JSON:\", err)\n\t\t}\n\t\t_, err = fmt.Fprintln(output, string(j))\n\t\tif err != nil {\n\t\t\tlog.Println(\"Unable to output log:\", err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "57afe40046a3922230737965b463e73c", "score": "0.46238434", "text": "func WithLogger(log func(...interface{})) Option {\n\treturn option(func(d *Dance) {\n\t\td.logger = log\n\t})\n}", "title": "" }, { "docid": "393cf6c4442ea6fb84e796b3e0041c04", "score": "0.46127245", "text": "func enableJaegerTracing() bool {\n switch strings.ToLower(os.Getenv(\"ENABLE_JAEGER_TRACING\")) {\n case \"f\", \"false\":\n return false\n default:\n return true\n }\n}", "title": "" }, { "docid": "0ca2cb5371fb9e30f76756f3c634201d", "score": "0.4604932", "text": "func Middleware(logger logrus.FieldLogger, notlogged ...string) gin.HandlerFunc {\n\tvar skip map[string]struct{}\n\n\tif length := len(notlogged); length > 0 {\n\t\tskip = make(map[string]struct{}, length)\n\n\t\tfor _, path := range notlogged {\n\t\t\tskip[path] = struct{}{}\n\t\t}\n\t}\n\n\treturn func(c *gin.Context) {\n\t\t// start timer\n\t\tstart := time.Now()\n\n\t\t// prevent middlewares from faking the request path\n\t\tpath := c.Request.URL.Path\n\t\traw := c.Request.URL.RawQuery\n\n\t\tc.Next()\n\n\t\t// Log only when path is not being skipped\n\t\tif _, ok := skip[path]; !ok {\n\t\t\tend := time.Now()\n\t\t\tlatency := end.Sub(start)\n\n\t\t\tif raw != \"\" {\n\t\t\t\tpath = path + \"?\" + raw\n\t\t\t}\n\n\t\t\tfields := logrus.Fields{\n\t\t\t\t\"status\": c.Writer.Status(),\n\t\t\t\t\"method\": c.Request.Method,\n\t\t\t\t\"path\": path,\n\t\t\t\t\"ip\": c.ClientIP(),\n\t\t\t\t\"latency\": latency,\n\t\t\t\t\"user-agent\": c.Request.UserAgent(),\n\t\t\t}\n\n\t\t\tif cid := c.GetString(correlationid.ContextKey); cid != \"\" {\n\t\t\t\tfields[correlationIdField] = cid\n\t\t\t}\n\n\t\t\tentry := logger.WithFields(fields)\n\n\t\t\tif len(c.Errors) > 0 {\n\t\t\t\t// Append error field if this is an erroneous request.\n\t\t\t\tentry.Error(c.Errors.String())\n\t\t\t} else {\n\t\t\t\tentry.Info()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "afa7acb02bd404d7e0628ccd86dccc19", "score": "0.4601116", "text": "func (l *Logger) With(key string, value interface{}) *Logger {\n\treturn &ZapLogger{l.Log.With(zap.Any(key, value))}\n}", "title": "" }, { "docid": "568f345ff7c92a26c0f80e87f5c3c2a5", "score": "0.45990464", "text": "func logging(logger log.Logger) endpoint.Middleware {\n\treturn func(next endpoint.Endpoint) endpoint.Endpoint {\n\t\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t\tlogger.Log(\"msg\", \"calling endpoint\")\n\t\t\tdefer logger.Log(\"msg\", \"called endpoint\")\n\t\t\treturn next(ctx, request)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e395fe5b7882c93dc5e321c6d8785335", "score": "0.45950896", "text": "func logWrapper(logFormat string, logger *logrus.Logger, inner http.Handler) http.Handler {\n\tvar reqLog requestlog.Logger\n\t// See the following documentation for more information on formats:\n\t// https://godoc.org/github.com/google/go-cloud/requestlog\n\tswitch logFormat {\n\tcase \"ncsa\":\n\t\t// Combined Log Format, as used by Apache.\n\t\treqLog = requestlog.NewNCSALogger(os.Stdout, func(err error) {\n\t\t\tlogger.WithError(err).Error(\"error writing NCSA log\")\n\t\t})\n\n\tcase \"stackdriver\":\n\t\t// As expected by Stackdriver Logging.\n\t\treqLog = requestlog.NewStackdriverLogger(os.Stdout, func(err error) {\n\t\t\tlogger.WithError(err).Error(\"error writing Stackdriver log\")\n\t\t})\n\n\tdefault:\n\t\tlogger.WithField(\"format\", logFormat).Fatal(\"unrecognized log format\")\n\t}\n\n\treturn requestlog.NewHandler(reqLog, inner)\n}", "title": "" }, { "docid": "ca0b15d97a58c753a02ee4e710477b23", "score": "0.4593642", "text": "func (svc attachment) log(fields ...zapcore.Field) *zap.Logger {\n\treturn logger.AddRequestID(svc.ctx, svc.logger).With(fields...)\n}", "title": "" }, { "docid": "d86ef89931e424b1f8764c36bf3866e4", "score": "0.4592722", "text": "func (cl *ConsoleLogger)Warn(format string, v ...interface {}) {\n\n if levelWarn <= cl.level {\n cl.logger.Printf(format, v...)\n }\n\n}", "title": "" }, { "docid": "2f1b9ca32c587bbeeec551293a8302fc", "score": "0.45869234", "text": "func (_m *mockApp) Logwarnf(_a0 string, _a1 ...interface{}) {\n\t_m.Called(_a0, _a1)\n}", "title": "" }, { "docid": "1eb56178b22d08c0cb147127568ac93f", "score": "0.4584998", "text": "func TestOptionsWithCaller(t *testing.T) {\n\topts := Options()\n\n\tlogger := NewLogger()\n\tlogger.withCaller = false\n\n\topts.WithCaller().Apply(logger)\n\tif logger.withCaller != true {\n\t\tt.Errorf(\"logger's withCaller %+v is wrong\", logger.withCaller)\n\t}\n}", "title": "" }, { "docid": "a26259e22f617e965a8d683eaa6492e3", "score": "0.45847592", "text": "func LogWrapper(h func(http.ResponseWriter, *http.Request)) http.Handler {\n return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n cookie, err := r.Cookie(\"clientId\")\n if err != nil {\n\thttp.Error(w, err.Error(), 400)\n\treturn\n } else {\n\tallowed := accesslib.AccessRateControl(cookie.Value)\n\tif !allowed {\n http.Error(w, \"Too many requests\", 400)\n return\n\t}\n }\n h(w, r) // call original\n })\n}", "title": "" }, { "docid": "19d1160d77def92b6b84094aabcbc295", "score": "0.45786095", "text": "func Logged(logf func(string, ...interface{}), trigger func() bool) Decorator {\n\tif trigger == nil {\n\t\ttrigger = func() bool { return true }\n\t}\n\n\treturn func(c Client) Client {\n\t\treturn ClientFunc(func(r *http.Request) (res *http.Response, err error) {\n\t\t\tif !trigger() {\n\t\t\t\treturn c.Do(r)\n\t\t\t}\n\n\t\t\tdefer func(begin time.Time) {\n\t\t\t\ttook := time.Since(begin)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogf(\n\t\t\t\t\t\t\"cmhttp client error\",\n\t\t\t\t\t\t\"method\", r.Method,\n\t\t\t\t\t\t\"url\", r.URL,\n\t\t\t\t\t\t\"proto\", r.Proto,\n\t\t\t\t\t\t\"request_content_length\", r.Header.Get(\"Content-Length\"),\n\t\t\t\t\t\t\"took_ms\", int64(took/time.Millisecond),\n\t\t\t\t\t\t\"error\", err.Error(),\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tlogf(\n\t\t\t\t\t\t\"cmhttp client response\",\n\t\t\t\t\t\t\"method\", r.Method,\n\t\t\t\t\t\t\"url\", r.URL,\n\t\t\t\t\t\t\"proto\", r.Proto,\n\t\t\t\t\t\t\"request_content_length\", r.Header.Get(\"Content-Length\"),\n\t\t\t\t\t\t\"response_content_length\", res.Header.Get(\"Content-Length\"),\n\t\t\t\t\t\t\"response_status\", res.Status,\n\t\t\t\t\t\t\"took_ms\", int64(took/time.Millisecond),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}(time.Now())\n\n\t\t\tres, err = c.Do(r)\n\t\t\treturn res, err\n\t\t})\n\t}\n}", "title": "" }, { "docid": "5dc7f641363cab51a8889b6499f8a3ce", "score": "0.45730725", "text": "func Log(l *zap.Logger) Option {\n\treturn func() ([]grpc.ServerOption, error) {\n\t\tif l == nil {\n\t\t\tl = zap.NewExample()\n\t\t}\n\t\topts := []grpc.ServerOption{\n\t\t\tgrpc_middleware.WithUnaryServerChain(\n\t\t\t\tgrpc_ctxtags.UnaryServerInterceptor(grpc_ctxtags.WithFieldExtractor(grpc_ctxtags.CodeGenRequestFieldExtractor)),\n\t\t\t\tgrpc_zap.UnaryServerInterceptor(l),\n\t\t\t\tgrpc_recovery.UnaryServerInterceptor(),\n\t\t\t),\n\t\t\tgrpc_middleware.WithStreamServerChain(\n\t\t\t\tgrpc_ctxtags.StreamServerInterceptor(grpc_ctxtags.WithFieldExtractor(grpc_ctxtags.CodeGenRequestFieldExtractor)),\n\t\t\t\tgrpc_zap.StreamServerInterceptor(l),\n\t\t\t\tgrpc_recovery.StreamServerInterceptor(),\n\t\t\t)}\n\t\treturn opts, nil\n\t}\n}", "title": "" }, { "docid": "a85e6f13c0b66a7ebefbdc4137bb3981", "score": "0.4552248", "text": "func WithLogger(l logging.Logger) ReconcilerOption {\n\treturn func(r *Reconciler) {\n\t\tr.log = l\n\t}\n}", "title": "" }, { "docid": "a85e6f13c0b66a7ebefbdc4137bb3981", "score": "0.4552248", "text": "func WithLogger(l logging.Logger) ReconcilerOption {\n\treturn func(r *Reconciler) {\n\t\tr.log = l\n\t}\n}", "title": "" }, { "docid": "a85e6f13c0b66a7ebefbdc4137bb3981", "score": "0.4552248", "text": "func WithLogger(l logging.Logger) ReconcilerOption {\n\treturn func(r *Reconciler) {\n\t\tr.log = l\n\t}\n}", "title": "" }, { "docid": "a85e6f13c0b66a7ebefbdc4137bb3981", "score": "0.4552248", "text": "func WithLogger(l logging.Logger) ReconcilerOption {\n\treturn func(r *Reconciler) {\n\t\tr.log = l\n\t}\n}", "title": "" }, { "docid": "a85e6f13c0b66a7ebefbdc4137bb3981", "score": "0.4552248", "text": "func WithLogger(l logging.Logger) ReconcilerOption {\n\treturn func(r *Reconciler) {\n\t\tr.log = l\n\t}\n}", "title": "" }, { "docid": "6cf36d80fea24f8af504352dc6cb2946", "score": "0.45520985", "text": "func (c *DriverTracer) Log(lvl zapcore.Level, msg string, fields ...zap.Field) {\n\tif !c.config.IsLoggingEnabled() {\n\t\treturn\n\t}\n\tswitch lvl {\n\tcase DebugLevel:\n\t\tc.logger.Debug(msg, fields...)\n\tcase WarnLevel:\n\t\tc.logger.Warn(msg, fields...)\n\tcase InfoLevel:\n\t\tc.logger.Info(msg, fields...)\n\tcase ErrorLevel, zap.DPanicLevel, zap.PanicLevel, zap.FatalLevel:\n\t\tc.logger.Error(msg, fields...)\n\n\t}\n}", "title": "" }, { "docid": "f89a9f3254fd2c03f642755f8006ebfc", "score": "0.4537977", "text": "func OptSetLogger(log log.Modular) func(Type) {\n\treturn func(t Type) {\n\t\tt.SetLogger(log)\n\t}\n}", "title": "" }, { "docid": "fda02164e0182f6b8e0d88d0dea4566c", "score": "0.453681", "text": "func (l Logger) Hook() echo.MiddlewareFunc {\n\treturn l.logger\n}", "title": "" }, { "docid": "770d529380f0ef78eeb96aa1d94f583c", "score": "0.45150223", "text": "func logger(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(wr http.ResponseWriter, r *http.Request) {\n\t\tnext.ServeHTTP(wr, r)\n\t\tlogg.Println(\"call middleware logger\")\n\t})\n}", "title": "" }, { "docid": "51d10b4061fe01641925a769088b1516", "score": "0.45094183", "text": "func (client *clientInfo) logReq(id uint64, f func(comms.Link, *msgjson.Message), expireTime time.Duration, expire func()) {\n\tclient.mtx.Lock()\n\tdefer client.mtx.Unlock()\n\tdoExpire := func() {\n\t\t// Delete the response handler, and call the provided expire function if\n\t\t// (*clientInfo).respHandler has not already retrieved the handler\n\t\t// function for execution.\n\t\tif client.expire(id) {\n\t\t\texpire()\n\t\t}\n\t}\n\tclient.respHandlers[id] = &respHandler{\n\t\tf: f,\n\t\texpire: time.AfterFunc(expireTime, doExpire),\n\t}\n}", "title": "" }, { "docid": "f3a21a78a319b4e1f65f467de227c156", "score": "0.4506065", "text": "func LogRPCWithFields(ctx context.Context, log *logrus.Logger) *logrus.Entry {\n\tmd, ok := metadata.FromIncomingContext(ctx)\n\tif !ok {\n\t\treturn logrus.NewEntry(log)\n\t}\n\treturn log.WithFields(MetadataToFields(md))\n}", "title": "" }, { "docid": "05615f7bee389fcad120b0d1ab845efd", "score": "0.45007232", "text": "func WithLogger(log logging.Logger) ReconcilerOption {\n\treturn func(r *Reconciler) {\n\t\tr.log = log\n\t}\n}", "title": "" }, { "docid": "fd8f3cd0abbd8e41d868e4575fd2b095", "score": "0.44999024", "text": "func UnaryInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {\n\tstart := time.Now()\n\terr := invoker(ctx, method, req, reply, cc, opts...)\n\telapsed := time.Since(start)\n\tif err != nil {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\"Request\": req,\n\t\t\t\"Error\": err,\n\t\t\t\"Elapsed\": elapsed,\n\t\t}).Errorln(\"Interceptor Log\")\n\t} else {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\"Request\": req,\n\t\t\t\"Response\": reply,\n\t\t\t\"Elapsed\": elapsed,\n\t\t}).Infoln(\"Interceptor Log\")\n\t}\n\treturn err\n}", "title": "" }, { "docid": "bc9b279f28a71b8e0000c898ede11a20", "score": "0.44980448", "text": "func Middleware(opts ...Option) func(*web.C, http.Handler) http.Handler {\n\tvar (\n\t\tcfg config\n\t\twarnonce sync.Once\n\t)\n\tdefaults(&cfg)\n\tfor _, fn := range opts {\n\t\tfn(&cfg)\n\t}\n\tif !math.IsNaN(cfg.analyticsRate) {\n\t\tcfg.spanOpts = append(cfg.spanOpts, tracer.Tag(ext.EventSampleRate, cfg.analyticsRate))\n\t}\n\tcfg.spanOpts = append(cfg.spanOpts, tracer.Tag(ext.Component, componentName))\n\tcfg.spanOpts = append(cfg.spanOpts, tracer.Tag(ext.SpanKind, ext.SpanKindServer))\n\n\tlog.Debug(\"contrib/zenazn/goji.v1/web: Configuring Middleware: %#v\", cfg)\n\treturn func(c *web.C, h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tresource := r.Method\n\t\t\tp := web.GetMatch(*c).RawPattern()\n\t\t\tif p != nil {\n\t\t\t\tresource += fmt.Sprintf(\" %s\", p)\n\t\t\t} else {\n\t\t\t\twarnonce.Do(func() {\n\t\t\t\t\tlog.Warn(\"contrib/zenazn/goji.v1/web: routes are unavailable. To enable them add the goji Router middleware before the tracer middleware.\")\n\t\t\t\t})\n\t\t\t}\n\t\t\thttptrace.TraceAndServe(h, w, r, &httptrace.ServeConfig{\n\t\t\t\tService: cfg.serviceName,\n\t\t\t\tResource: resource,\n\t\t\t\tFinishOpts: cfg.finishOpts,\n\t\t\t\tSpanOpts: cfg.spanOpts,\n\t\t\t})\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e55ae60dd83bf24b061f04f0d17510b5", "score": "0.44970652", "text": "func withLogger(logger log.Logger) func(c *zk.Conn) {\n\treturn func(c *zk.Conn) {\n\t\tc.SetLogger(wrapLogger{logger})\n\t}\n}", "title": "" }, { "docid": "4ca208cc16c1a0287164317bfb04c3a9", "score": "0.44901833", "text": "func WithLogger(l *zap.Logger) Option {\n\treturn func(m *instrumented) {\n\t\tm.log = l\n\t}\n}", "title": "" }, { "docid": "b7e97ee457a4a5ff008b76e8cea3c3dd", "score": "0.4489801", "text": "func SetMiddlewareLogger() gin.HandlerFunc {\n\t//return func(c *gin.Context) {\n\t// Disable Console Color, you don't need console color when writing the logs to file.\n\t// gin.DisableConsoleColor()\n\n\t// Logging to a file.\n\tf, _ := os.Create(\"walletapi\")\n\tgin.DefaultWriter = io.MultiWriter(f)\n\n\t// // Use the following code if you need to write the logs to file and console at the same time.\n\t// gin.DefaultWriter = io.MultiWriter(f, os.Stdout)\n\t// c.Next()\n\n\t// write file\n\tfileName := \"walletapi\"\n\tsrc, err := os.OpenFile(fileName, os.O_APPEND|os.O_WRONLY, os.ModeAppend)\n\tif err != nil {\n\t\tfmt.Println(\"err\", err)\n\t}\n\t// instantiation\n\tlogger := logrus.New()\n\t// Set output\n\tlogger.Out = src\n\t// Set log level\n\tlogger.SetLevel(logrus.DebugLevel)\n\t// Set rotatelogs\n\tlogWriter, _ := rotatelogs.New(\n\t\t// Split file name\n\t\tfileName+\".%Y%m%d.log\",\n\t\t// Generate soft chain, point to the latest log file\n\t\trotatelogs.WithLinkName(fileName),\n\t\t// Set maximum save time (7 days)\n\t\trotatelogs.WithMaxAge(7*24*time.Hour),\n\t\t// Set log cutting interval (1 day)\n\t\trotatelogs.WithRotationTime(24*time.Hour),\n\t)\n\twriteMap := lfshook.WriterMap{\n\t\tlogrus.InfoLevel: logWriter,\n\t\tlogrus.FatalLevel: logWriter,\n\t\tlogrus.DebugLevel: logWriter,\n\t\tlogrus.WarnLevel: logWriter,\n\t\tlogrus.ErrorLevel: logWriter,\n\t\tlogrus.PanicLevel: logWriter,\n\t}\n\tlfHook := lfshook.NewHook(writeMap, &logrus.JSONFormatter{\n\t\tTimestampFormat: \"2006-01-02 15:04:05\",\n\t})\n\t// Add Hook\n\tlogger.AddHook(lfHook)\n\treturn func(c *gin.Context) {\n\t\t// start time\n\t\tstartTime := time.Now()\n\t\t// Processing request\n\t\tc.Next()\n\t\t// End time\n\t\tendTime := time.Now()\n\t\t// execution time\n\t\tlatencyTime := endTime.Sub(startTime)\n\t\t// Request mode\n\t\treqMethod := c.Request.Method\n\t\t// Request routing\n\t\treqURI := c.Request.RequestURI\n\t\t// Status code\n\t\tstatusCode := c.Writer.Status()\n\t\t// Request IP\n\t\tclientIP := c.ClientIP()\n\t\t// Log format\n\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\"status_code\": statusCode,\n\t\t\t\"latency_time\": latencyTime,\n\t\t\t\"client_ip\": clientIP,\n\t\t\t\"req_method\": reqMethod,\n\t\t\t\"req_uri\": reqURI,\n\t\t}).Info()\n\t}\n}", "title": "" }, { "docid": "da4cd628741d3c094345d55537ffcc29", "score": "0.44803146", "text": "func LoggingUnaryServerInterceptor(l log.Logger) grpc.UnaryServerInterceptor {\n\tif !envLoggingEnabled {\n\t\t// Just return the default handler if logging is disabled.\n\t\treturn func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) {\n\t\t\treturn handler(ctx, req)\n\t\t}\n\t}\n\n\tlogger := l.Scoped(logScope, logDescription)\n\tlogger = logger.Scoped(\"unaryMethod\", \"errors that originated from a unary method\")\n\n\treturn func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) {\n\t\tresponse, err := handler(ctx, req)\n\t\tif err != nil {\n\t\t\tserviceName, methodName := grpcutil.SplitMethodName(info.FullMethod)\n\n\t\t\tvar initialRequest proto.Message\n\t\t\tif m, ok := req.(proto.Message); ok {\n\t\t\t\tinitialRequest = m\n\t\t\t}\n\n\t\t\tdoLog(logger, serviceName, methodName, &initialRequest, response, err)\n\t\t}\n\n\t\treturn response, err\n\t}\n}", "title": "" }, { "docid": "e566e84980a06a1425f5dd71ba7c85b0", "score": "0.44792297", "text": "func Logging(logger logger) func(inner http.Handler) http.Handler {\n\treturn func(inner http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tdefer panicRecovery(w, logger)\n\t\t\tstart := time.Now()\n\t\t\tsrw := &StatusResponseWriter{ResponseWriter: w}\n\n\t\t\tdefer func(res *StatusResponseWriter, req *http.Request) {\n\t\t\t\tl := LogLine{\n\t\t\t\t\tID: trace.SpanFromContext(r.Context()).SpanContext().TraceID.String(),\n\t\t\t\t\tStartTime: start.Format(\"2006-01-02T15:04:05.999999999-07:00\"),\n\t\t\t\t\tResponseTime: time.Since(start).Nanoseconds() / 1000,\n\t\t\t\t\tMethod: req.Method,\n\t\t\t\t\tUserAgent: req.UserAgent(),\n\t\t\t\t\tIP: getIPAddress(req),\n\t\t\t\t\tURI: req.RequestURI,\n\t\t\t\t\tResponse: res.status,\n\t\t\t\t}\n\t\t\t\tif logger != nil {\n\t\t\t\t\tlogger.Log(l)\n\t\t\t\t}\n\t\t\t}(srw, r)\n\n\t\t\tinner.ServeHTTP(srw, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "24599ddc73da1fce12594b8ba9e047a1", "score": "0.4471364", "text": "func (l *Logger) WithField(key string, value interface{}) *Logger {\n\treturn &ZapLogger{l.Log.With(zap.Any(key, value))}\n}", "title": "" }, { "docid": "630c4b8df5ec486a481b92ce9c743377", "score": "0.4470301", "text": "func Log(v ...interface {}) {\n\tif *debug == true {\n\t\tret := fmt.Sprint(v...);\n\t\tlog.Printf(\"CLIENT: %s\", ret);\n\t}\n}", "title": "" }, { "docid": "9f9890fd47ec46dd67bb106a0a2279ca", "score": "0.44663933", "text": "func SetLogger(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Printf(\"\\n%s %s%s %s\", r.Method, r.Host, r.RequestURI, r.Proto)\n\t\tnext(w, r)\n\t}\n}", "title": "" }, { "docid": "9046db7b46c786a9417d976372a8be2b", "score": "0.44547066", "text": "func WithField(k string, v interface{}) *logger { return global.WithField(k, v) }", "title": "" }, { "docid": "9c82064994ba88ba8fc78836c190faab", "score": "0.44434527", "text": "func (il IfLogger) With(values ...interface{}) ContextLogger {\n\tif len(values) == 1 {\n\t\treturn &contextLogger{isTrue: il.ok(), data: values[0]}\n\t}\n\treturn &contextLogger{isTrue: il.ok(), data: values}\n}", "title": "" }, { "docid": "2270a7ae94fc7a2c8a7a9bd4ea6056fb", "score": "0.44410697", "text": "func PayloadStreamServerInterceptor(logger *zap.Logger, decider grpc_logging.ServerPayloadLoggingDecider) grpc.StreamServerInterceptor {\n\treturn func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\t\tif !decider(stream.Context(), info.FullMethod, srv) {\n\t\t\treturn handler(srv, stream)\n\t\t}\n\t\tlogEntry := logger.With(append(serverCallFields(info.FullMethod), ctxzap.TagsToFields(stream.Context())...)...)\n\t\tnewStream := &loggingServerStream{ServerStream: stream, logger: logEntry}\n\t\treturn handler(srv, newStream)\n\t}\n}", "title": "" }, { "docid": "6e4016873ece67d4fc485754105ef922", "score": "0.44395316", "text": "func WithLogr(log logr.Logger) SyncOpt {\n\treturn func(ctx *syncContext) {\n\t\tctx.log = log\n\t}\n}", "title": "" }, { "docid": "76fef686f1cdeba555b7fe59a040a049", "score": "0.4434459", "text": "func logDetails(ctx context.Context, methodName string, req proto.Message) (context.Context, error) {\n\tlogging.Debugf(ctx, \"%q called %q with request %s\", auth.CurrentIdentity(ctx), methodName, proto.MarshalTextString(req))\n\treturn ctx, nil\n}", "title": "" }, { "docid": "ac858b4e1c41f311a1dfa26502be58da", "score": "0.44309837", "text": "func LogrusWithConfig(cfg LogrusConfig) echo.MiddlewareFunc {\n\t// Defaults\n\tif cfg.Skipper == nil {\n\t\tcfg.Skipper = DefaultLogrusConfig.Skipper\n\t}\n\n\tif cfg.Logger == nil {\n\t\tcfg.Logger = DefaultLogrusConfig.Logger\n\t}\n\n\tif len(cfg.FieldMap) == 0 {\n\t\tcfg.FieldMap = DefaultLogrusConfig.FieldMap\n\t}\n\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(ctx echo.Context) (err error) {\n\t\t\tif cfg.Skipper(ctx) {\n\t\t\t\treturn next(ctx)\n\t\t\t}\n\n\t\t\tlogFields, err := mapFields(ctx, next, cfg.FieldMap)\n\t\t\tcfg.Logger.WithFields(logFields).Print(\"handle request\")\n\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f3119daa055a0573ca44f120b0fb6eb0", "score": "0.44264904", "text": "func (l *Logger) I(format string, v ...interface{}) {\n\tif loggingEnable {\n\t\tl.Infof(format, v...)\n\t}\n}", "title": "" }, { "docid": "a0da198b89f0510eb22bb2e0ce898075", "score": "0.44179353", "text": "func Logger(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Printf(\"Hit at: %s, Request type = %s, Cookie = %s\", r.URL.Path, r.Method, logCookie(r))\n\t\tnext(w, r)\n\t}\n}", "title": "" }, { "docid": "fe4ab1e2a6be9db74502f8d88dc11610", "score": "0.4416043", "text": "func LogRequest(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (response interface{}, err error) {\n\n\tfmt.Printf(\"Unary Request for : %s\\n\", info.FullMethod)\n\n\tif info.FullMethod == \"/todoapp.TodoService/Read\" {\n\n\t}\n\n\t// Last but super important, execute the handler so that the actualy gRPC request is also performed\n\t// return handler(ctx, req)\n\n\tauthorize(ctx)\n\n\tresponse, err = handler(ctx, req)\n\n\treturn\n}", "title": "" }, { "docid": "670fc0b4c7dc29188f062534ddea20e9", "score": "0.4414754", "text": "func (*HCLogAdapter) With(args ...any) hclog.Logger {\n\treturn &HCLogAdapter{}\n}", "title": "" }, { "docid": "9538c88587dc900761494641998a0cae", "score": "0.44101033", "text": "func WithLogger(logger *zerolog.Logger) HandlerFunc {\n\treturn func(c *Context) {\n\t\tlogger.Debug().\n\t\t\tStr(\"subject\", c.Msg.Subject).\n\t\t\tMsg(\"received\")\n\n\t\tlatency := c.NextWithLatencyDuration()\n\n\t\tif c.Err != nil {\n\t\t\tlogger.Error().\n\t\t\t\tStr(\"subject\", c.Msg.Subject).\n\t\t\t\tDur(\"latency\", latency).\n\t\t\t\tStr(\"replyChan\", c.Msg.Reply).\n\t\t\t\tErr(c.Err).\n\t\t\t\tMsg(fmt.Sprintf(\"%+v\", c.Err))\n\t\t\treturn\n\t\t}\n\n\t\tlogger.Info().\n\t\t\tStr(\"subject\", c.Msg.Subject).\n\t\t\tDur(\"latency\", latency).\n\t\t\tStr(\"replyChan\", c.Msg.Reply).\n\t\t\tMsg(\"processed\")\n\t}\n}", "title": "" }, { "docid": "352812aa6416abd519b651b34c1fbda2", "score": "0.4408264", "text": "func With(key string, value interface{}) Logger {\n\treturn baseLogger.With(key, value)\n}", "title": "" }, { "docid": "d54e38c5d1ce06a474a64bdae1a224d1", "score": "0.44029927", "text": "func Decorate(handle middleware.HandleWithError, ds ...middleware.Decorator) httprouter.Handle {\n\treturn middleware.HTTP(middleware.ApplyDecorators(handle, ds...))\n}", "title": "" }, { "docid": "6a75c3c6817b006b1f1c296b22d40eb6", "score": "0.4397175", "text": "func WithFields(fields F) *logger { return global.WithFields(fields) }", "title": "" }, { "docid": "623872ed8deed4d75706025198433b6f", "score": "0.43953", "text": "func Withf(key string, value interface{}) Logger {\n\treturn baseLogger.With(key, value)\n}", "title": "" }, { "docid": "bd5161b736555293185996f6a0fc5d06", "score": "0.43942055", "text": "func LoggerWithNotLogged(paths ...string) gin.HandlerFunc {\n\t// Set not logged\n\tif length := len(paths); length > 0 {\n\t\tNotLoggedPaths = make(map[string]struct{}, length)\n\t\tfor _, path := range paths {\n\t\t\tNotLoggedPaths[path] = struct{}{}\n\t\t}\n\t}\n\n\treturn LoggerWithWriter(gin.DefaultWriter)\n}", "title": "" }, { "docid": "44f191c1064a9d87808ca7df8ec3c880", "score": "0.438701", "text": "func (service LoggingHandler) Middleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tservice.Log.AddField(\"ip\", ipAddress(r))\n\t\tservice.Log.Info(api.WebRequest, api.LogFields{\n\t\t\t\"method\": r.Method,\n\t\t\t\"url\": r.URL.String(),\n\t\t\t\"remote\": r.RemoteAddr,\n\t\t})\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "cd49172ee1c83831516fb15fbff42cd0", "score": "0.4385289", "text": "func (i *AppServerInterceptor) StreamLogger(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\tif methodIgnore(info.FullMethod) {\n\t\treturn handler(srv, ss)\n\t}\n\tincomeTime := time.Now()\n\trequestMeta := rpc_helper.GetRequestMetadata(ss.Context())\n\tvar err error\n\tdefer func() {\n\t\toutcomeTime := time.Now()\n\t\ti.echoStatistics(ss.Context(), incomeTime, outcomeTime)\n\t\tif err != nil {\n\t\t\ts, _ := status.FromError(err)\n\t\t\tif i.errLogger != nil {\n\t\t\t\t// stream interceptor only record error\n\t\t\t\ti.errLogger.Errorf(\n\t\t\t\t\tss.Context(),\n\t\t\t\t\t\"grpc access stream handle err:%s, grpc method: %s, requestMeta: %v, outcomeTime: %v, handleTime: %f/s, details: %s\",\n\t\t\t\t\ts.Err().Error(),\n\t\t\t\t\tinfo.FullMethod,\n\t\t\t\t\tjson.MarshalToStringNoError(requestMeta),\n\t\t\t\t\toutcomeTime.Format(kelvins.ResponseTimeLayout),\n\t\t\t\t\toutcomeTime.Sub(incomeTime).Seconds(),\n\t\t\t\t\tjson.MarshalToStringNoError(s.Details()),\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tif i.debug && i.accessLogger != nil {\n\t\t\t\ti.accessLogger.Infof(\n\t\t\t\t\tss.Context(),\n\t\t\t\t\t\"grpc access stream handle ok, grpc method: %s, requestMeta: %v, outcomeTime: %v, handleTime: %f/s\",\n\t\t\t\t\tinfo.FullMethod,\n\t\t\t\t\tjson.MarshalToStringNoError(requestMeta),\n\t\t\t\t\toutcomeTime.Format(kelvins.ResponseTimeLayout),\n\t\t\t\t\toutcomeTime.Sub(incomeTime).Seconds(),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = handler(srv, NewStreamWrapper(ss.Context(), i.accessLogger, i.errLogger, ss, info, requestMeta, i.debug))\n\treturn err\n}", "title": "" }, { "docid": "aa5ec345bffd02863f8c85740a6bb47a", "score": "0.43823674", "text": "func Logging(l *log.Logger) Decorator {\n\treturn func(d Doer) Doer {\n\t\treturn DoerFunc(func(r *http.Request) (*http.Response, error) {\n\t\t\tl.Printf(\"%s: %s %s\", r.UserAgent(), r.Method, r.URL)\n\t\t\treturn d.Do(r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "891237cf060f573b794cbdf134f1f76b", "score": "0.43796912", "text": "func LoggingStreamServerInterceptor(l log.Logger) grpc.StreamServerInterceptor {\n\tif !envLoggingEnabled {\n\t\t// Just return the default handler if logging is disabled.\n\t\treturn func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\t\t\treturn handler(srv, ss)\n\t\t}\n\t}\n\n\tlogger := l.Scoped(logScope, logDescription)\n\tlogger = logger.Scoped(\"streamingMethod\", \"errors that originated from a streaming method\")\n\n\treturn func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\t\tserviceName, methodName := grpcutil.SplitMethodName(info.FullMethod)\n\n\t\tstream := newLoggingServerStream(ss, logger, serviceName, methodName)\n\t\treturn handler(srv, stream)\n\t}\n}", "title": "" }, { "docid": "0a3b91ce3f7cb13303f061c5005d8d6f", "score": "0.43743113", "text": "func TestChaincodeLogging(t *testing.T) {\n\n\t// From start() - We can't call start() from this test\n\tformat := logging.MustStringFormatter(\"%{time:15:04:05.000} [%{module}] %{level:.4s} : %{message}\")\n\tbackend := logging.NewLogBackend(os.Stderr, \"\", 0)\n\tbackendFormatter := logging.NewBackendFormatter(backend, format)\n\tlogging.SetBackend(backendFormatter).SetLevel(logging.Level(shimLoggingLevel), \"shim\")\n\n\tfoo := NewLogger(\"foo\")\n\tbar := NewLogger(\"bar\")\n\n\tfoo.Debugf(\"Foo is debugging: %d\", 10)\n\tbar.Infof(\"Bar is informational? %s.\", \"Yes\")\n\tfoo.Noticef(\"NOTE NOTE NOTE\")\n\tbar.Warningf(\"Danger, Danger %s %s\", \"Will\", \"Robinson!\")\n\tfoo.Errorf(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tbar.Criticalf(\"PI is not equal to 3.14, we computed it as %.2f\", 4.13)\n\n\tbar.Debug(\"Foo is debugging:\", 10)\n\tfoo.Info(\"Bar is informational?\", \"Yes.\")\n\tbar.Notice(\"NOTE NOTE NOTE\")\n\tfoo.Warning(\"Danger, Danger\", \"Will\", \"Robinson!\")\n\tbar.Error(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tfoo.Critical(\"PI is not equal to\", 3.14, \", we computed it as\", 4.13)\n\n\tfoo.SetLevel(LogWarning)\n\tif foo.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'foo' should not be enabled for LogDebug\")\n\t}\n\tif !foo.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'foo' should be enabled for LogCritical\")\n\t}\n\tbar.SetLevel(LogCritical)\n\tif bar.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'bar' should not be enabled for LogDebug\")\n\t}\n\tif !bar.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'bar' should be enabled for LogCritical\")\n\t}\n}", "title": "" }, { "docid": "0a3b91ce3f7cb13303f061c5005d8d6f", "score": "0.43743113", "text": "func TestChaincodeLogging(t *testing.T) {\n\n\t// From start() - We can't call start() from this test\n\tformat := logging.MustStringFormatter(\"%{time:15:04:05.000} [%{module}] %{level:.4s} : %{message}\")\n\tbackend := logging.NewLogBackend(os.Stderr, \"\", 0)\n\tbackendFormatter := logging.NewBackendFormatter(backend, format)\n\tlogging.SetBackend(backendFormatter).SetLevel(logging.Level(shimLoggingLevel), \"shim\")\n\n\tfoo := NewLogger(\"foo\")\n\tbar := NewLogger(\"bar\")\n\n\tfoo.Debugf(\"Foo is debugging: %d\", 10)\n\tbar.Infof(\"Bar is informational? %s.\", \"Yes\")\n\tfoo.Noticef(\"NOTE NOTE NOTE\")\n\tbar.Warningf(\"Danger, Danger %s %s\", \"Will\", \"Robinson!\")\n\tfoo.Errorf(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tbar.Criticalf(\"PI is not equal to 3.14, we computed it as %.2f\", 4.13)\n\n\tbar.Debug(\"Foo is debugging:\", 10)\n\tfoo.Info(\"Bar is informational?\", \"Yes.\")\n\tbar.Notice(\"NOTE NOTE NOTE\")\n\tfoo.Warning(\"Danger, Danger\", \"Will\", \"Robinson!\")\n\tbar.Error(\"I'm sorry Dave, I'm afraid I can't do that.\")\n\tfoo.Critical(\"PI is not equal to\", 3.14, \", we computed it as\", 4.13)\n\n\tfoo.SetLevel(LogWarning)\n\tif foo.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'foo' should not be enabled for LogDebug\")\n\t}\n\tif !foo.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'foo' should be enabled for LogCritical\")\n\t}\n\tbar.SetLevel(LogCritical)\n\tif bar.IsEnabledFor(LogDebug) {\n\t\tt.Errorf(\"'bar' should not be enabled for LogDebug\")\n\t}\n\tif !bar.IsEnabledFor(LogCritical) {\n\t\tt.Errorf(\"'bar' should be enabled for LogCritical\")\n\t}\n}", "title": "" }, { "docid": "25e60d8cdb6c01d5b8b4812b858be44a", "score": "0.43725762", "text": "func noOpLog(format string, v ...interface{}) {}", "title": "" }, { "docid": "c177032b9d99ae17162fd671fed58526", "score": "0.4365463", "text": "func InjectLogger(log logger.LoggerInterface) httpware.Tripperware {\n\treturn func(next http.RoundTripper) http.RoundTripper {\n\t\treturn httpware.RoundTripFunc(func(req *http.Request) (resp *http.Response, err error) {\n\t\t\tctx := req.Context()\n\t\t\tif logger.FromContext(ctx, nil) == nil {\n\t\t\t\treq = req.WithContext(logger.InjectInContext(ctx, log))\n\t\t\t}\n\t\t\treturn next.RoundTrip(req)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "ec03af6b0db5e60ef0923b033458458f", "score": "0.43572316", "text": "func WithLogger(ctx context.Context, logger Adapter) context.Context {\n\treturn context.WithValue(ctx, logKey, logger)\n}", "title": "" } ]
dc822891448996ac429d11be4f97e57d
GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise and a boolean to check if the value has been set.
[ { "docid": "c1f62a9f200ff8816af19ca8fb68622f", "score": "0.7986467", "text": "func (o *UpdatableActivity) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" } ]
[ { "docid": "37500938d603c53a5e624758dc02ee2b", "score": "0.8158811", "text": "func (o *ConnectorType) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "001b0a6b35ea1b63320bca687ce71e30", "score": "0.8143528", "text": "func (o *CustomfieldCustomField) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "0535ad341824bf15958a3d64db3fc479", "score": "0.80550605", "text": "func (o *EmbeddedPropertyModel) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "65f4b8c8ed47112e5755f0067c0f4b99", "score": "0.8036982", "text": "func (o *DAG) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description.Get(), o.Description.IsSet()\n}", "title": "" }, { "docid": "b1ee0faa24b8fe2bf61d21ce19a3b984", "score": "0.8026537", "text": "func (o *FindingMute) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "fd9224fbdae03ede224725859f3402a7", "score": "0.80257", "text": "func (o *SchemaType) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "897ffe62c70c4b5f1b0d377fa8baad18", "score": "0.8023942", "text": "func (o *PublicFormViewFieldOptions) GetDescriptionOk() (*string, bool) {\n\tif o == nil || IsNil(o.Description) {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "dd94d539a9fd6dcfd564c5b00e487273", "score": "0.79997957", "text": "func (o *RiskChoiceQuestionCode) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description.Get(), o.Description.IsSet()\n}", "title": "" }, { "docid": "92e07a72390b43a6a55cfedabbd75e7c", "score": "0.79714537", "text": "func (o *VersionedFlowDTO) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "ba8428e5471b4f176a7cf0ab9bd280bd", "score": "0.7971092", "text": "func (o *PaymentRequestResponsePaymentRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description.Get(), o.Description.IsSet()\n}", "title": "" }, { "docid": "651c75a9f4fd4ea0b89ef5d083670872", "score": "0.79547435", "text": "func (o *Pipeline) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "a27e821382294f046c9e73b866f8a726", "score": "0.79466444", "text": "func (o *DetailedGearAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "736a41472efb356a7c96659a54ba6aaa", "score": "0.793389", "text": "func (o *BgpConfigReadDetailed) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "304c676fd2e538098f4798123083659a", "score": "0.791319", "text": "func (o *ProductType) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "dc8777f4d23fbe0c171b23a2ff497511", "score": "0.78801006", "text": "func (o *JiraNotificationConfigAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "9410769ce3dd2af76cab11aaf2899b15", "score": "0.786373", "text": "func (o *Group) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "7278a4c2aae7031e9887e106c0d441be", "score": "0.7852439", "text": "func (o *Ogp) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "title": "" }, { "docid": "354a807438b8d02143c1c7d8487094c8", "score": "0.78468615", "text": "func (o *MutualFundProfileData) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "de9433358ec41d87941ef2f21a880649", "score": "0.78416795", "text": "func (o *PatchClientRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "b8a549c59caf49625702ec3bb65c309a", "score": "0.78365", "text": "func (o *ClientProvidedTransaction) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "title": "" }, { "docid": "e18e07a4088afd1d6fb82028ae15b593", "score": "0.7836485", "text": "func (o *EquipmentChassisAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "8bc19fcb6d69c87caac02befad241932", "score": "0.78215486", "text": "func (o *PluginConfig) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "title": "" }, { "docid": "2a15306204a3464db31427a4a48e279a", "score": "0.78155476", "text": "func (o *Ga4ghFusionDetection) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "75a087eb31ee1478c97487ed05a55cbf", "score": "0.7778253", "text": "func (o *OrganizationAttributes) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "e5b6a0fa6f702faacb995e3e0d1c2cd3", "score": "0.7769069", "text": "func (o *Subscriptions) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "9828ca26a994a6c6010df50fe9cc40ab", "score": "0.7762526", "text": "func (o *Policy) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "a359e4a6487dc34579804c18b490cb9c", "score": "0.77577627", "text": "func (o *EndpointIn) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "dfa5a056108fd956656b2259e4993703", "score": "0.775034", "text": "func (o *ViewApp) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "37bdf852c8bda5d6da88297a3a85d056", "score": "0.7747354", "text": "func (o *Permission) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "19a093fe72a7ac20478fa4d9ba7e69a7", "score": "0.7746429", "text": "func (o *CreateIntegrationRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil || IsNil(o.Description) {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "f4ccf867b22499ee08d710e2720aceeb", "score": "0.7726575", "text": "func (o *Ga4ghEnrollment) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "2ed396f56a42ecfdab802d9abb0c22fe", "score": "0.7725248", "text": "func (o *CapabilityIoCardManufacturingDef) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "9a02e4ed4d8166fbe9fc4d133eb37b0c", "score": "0.77202916", "text": "func (o *LoraGatewayInfo) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "dd67932270b6dab9641c329b59045304", "score": "0.7716258", "text": "func (o *SiteMapCreate) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "4cd48ab94fc66cb398600970df7bdcff", "score": "0.7695752", "text": "func (o *AssetUpdateReqWeb) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "09165ab137df0848d3817cea4ab07d7b", "score": "0.7690597", "text": "func (o *RoleIn) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "a3b702c9c5156964129a70df371d8c79", "score": "0.76887447", "text": "func (o *CapabilityFexManufacturingDefAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "8a606b5e743207f6c0310edfe0f839fc", "score": "0.7687044", "text": "func (o *StackPatchRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "6920163c4d43bd73dd4fad703ecb1fa3", "score": "0.7676278", "text": "func (o *ServiceConfigurationSpec) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "61d947829e0970a9301de51639764510", "score": "0.7673355", "text": "func (o *MetricEvent) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "title": "" }, { "docid": "8387fc23be338e7d52bdabbe2e77cdba", "score": "0.7668387", "text": "func (o *LaunchpadAppearance) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "66036507d4090ff31711815d7ea42ceb", "score": "0.7663703", "text": "func (o *ProjectInformationDto) GetDescriptionOk() (*string, bool) {\n\tif o == nil || IsNil(o.Description) {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "bd7a1beed3dd45bbc38235835189a537", "score": "0.76626956", "text": "func (o *ModelsBuildConfigResponse) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "af278a1d90b64de9a8100ed3ac6ef804", "score": "0.7659463", "text": "func (o *Ga4ghReadGroup) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "ff2e2a0b1d227cc5a800398082f9bfa3", "score": "0.76571196", "text": "func (o *Ga4ghDiagnosis) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "d356cfbbde4ae55af92db2d092628999", "score": "0.76044476", "text": "func (o *GroupUpdateRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "4561ef8d7f60a6f5c4af40d26305adbe", "score": "0.7591705", "text": "func (o *QuotationIndexResponseQuotations) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description.Get(), o.Description.IsSet()\n}", "title": "" }, { "docid": "a455370359b21c3c3ab0c4a82a5d7a91", "score": "0.7580149", "text": "func (o *Scope) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "title": "" }, { "docid": "9448ea2dada897067fb143ca485f6f18", "score": "0.755352", "text": "func (o *ApplianceGroupStatusAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "5ccd9b9942163c964580af10fdef661d", "score": "0.75516343", "text": "func (o *TransferAuthorizationDecisionRationale) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "title": "" }, { "docid": "fca34932e720a4b8eff2ff87fc721a58", "score": "0.75460416", "text": "func (o *ThingCreateResponse) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "33eabd522b6a193cf716a396a7b727a7", "score": "0.7544747", "text": "func (o *UpdateApiAccessRuleRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "7c2a9c9fba79284d42e350e6f939ee51", "score": "0.75399613", "text": "func (o *Route) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "d024cc16359488470d4107e1c7c0c744", "score": "0.75270945", "text": "func (o *MicrosoftGraphIosUpdateConfiguration) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "8f87e61fd4a4d95768e4c1e4f2f60c9b", "score": "0.75152785", "text": "func (o *GroupCreateRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "90b84047e27b801d222b24af46032bf2", "score": "0.75076777", "text": "func (o *CapabilityServerUpgradeSupportMeta) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "fc80f69811c7697a1070c8bffa71cc4b", "score": "0.7502867", "text": "func (o *FilesIdJsonFile) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "97163b0961ffaa3eb3632842397ed3bf", "score": "0.7501385", "text": "func (o *ModelsResourcesResponseList) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "d38c5d3f87beab4fa4944de3ab6057c4", "score": "0.74723244", "text": "func (o *CreateCronjobParams) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "4030645cc6f3621fa165d94ba81a1481", "score": "0.74679494", "text": "func (o *MicrosoftGraphDeviceEnrollmentPlatformRestrictionsConfiguration) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "93e7f5e35f3410c6ce32ce1325737193", "score": "0.7464862", "text": "func (o *StockSymbol) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "3d0f1aa3f18c2499bc125bdc03affd41", "score": "0.74564344", "text": "func (o *InlineResponse200122Activity) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "e46c94077cff0e487a8b272b2b030085", "score": "0.7447867", "text": "func (o *UpdateRoleRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil || IsNil(o.Description) {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "b077a68fccd9f5c8af9c7b3d55d15ee1", "score": "0.7419918", "text": "func (o *InlineResponse20017Expenses) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "ece7a53212a73abebac62dfc2e9b61d3", "score": "0.7418617", "text": "func (o *VirtualizationVmwareDistributedSwitchAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "573ac9c9b41f0d4976d5c950b5c42d35", "score": "0.7415178", "text": "func (o *SecurityProblemDetails) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "c647a550c66cac21c25fb2f901eb5ae9", "score": "0.74028635", "text": "func (o *CloudTfcWorkspaceVariablesAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "d3708c9321719a7df113c9170cea863d", "score": "0.7399346", "text": "func (o *WorkflowRollbackWorkflowTaskAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "73d834deca67e41e3975366e11eee42f", "score": "0.73865145", "text": "func (o *StandardAccountCreateSpec) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "dd25b4a752b760a40a0013d7e438fb46", "score": "0.7382716", "text": "func (o *NotebookNotebook) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "3abb68ada508cb87c2034eb8a55a8eaa", "score": "0.73661965", "text": "func (o *InlineResponse20025Links) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "3e211441224009f47802cfb63c4bbffe", "score": "0.7335", "text": "func (o *DirectoryRoleTemplate) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "c37466760a4d597bbaef970a2444df3c", "score": "0.73276603", "text": "func (o *SoftwarerepositoryFileAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "b84f1737ee8c017fab98ee0c3fe47884", "score": "0.73276585", "text": "func (o *TimerTimer) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "4a5e9206f2968b3c6a6170b94ad222e7", "score": "0.73199296", "text": "func (o *HyperflexClusterBackupPolicyDeployment) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "6d4d6f27060a65846f70667cd01fe521", "score": "0.72883874", "text": "func (o *InlineResponse20088Role) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "b78078635af948b3eb71a410532fd5ea", "score": "0.72770995", "text": "func (o *InlineResponse20023Invoice) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "d72bdada460d01bbfaf5dabbfc3cb648", "score": "0.72664475", "text": "func (o *CreateVmGroupRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "af0cad2cd9018f0ae4aa4bdd480906cc", "score": "0.7222294", "text": "func (o *MicrosoftGraphWindowsInformationProtectionDataRecoveryCertificate) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "title": "" }, { "docid": "7688aeb6f742233750bcd3d317d29c4e", "score": "0.7183136", "text": "func (o *UpdateVmTemplateRequest) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "89d3bd755e1002fb0f79afb575c79ce5", "score": "0.7177785", "text": "func (o *AllocationAllocation) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "44189f5e5fba167f3ca21fd3309d1f60", "score": "0.712572", "text": "func (o *InlineResponse20053Projects) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "c61747f1df2b12f6a3d15ee7f45c9f31", "score": "0.71221316", "text": "func (o *InlineResponse20015Tasks) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "title": "" }, { "docid": "127db0ccda8646382a342583482f2fc8", "score": "0.69315946", "text": "func (o *TransactionBase) GetOriginalDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.OriginalDescription.Get(), o.OriginalDescription.IsSet()\n}", "title": "" }, { "docid": "fa458662cd9b9d19e87c18723fd20a76", "score": "0.67436826", "text": "func (o *Subscriptions) GetRenderedDescriptionOk() (*string, bool) {\n\tif o == nil || o.RenderedDescription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RenderedDescription, true\n}", "title": "" }, { "docid": "438de3218b03a711a6106ec7527ad42f", "score": "0.67306674", "text": "func (o *ProjectInformationDto) GetDescriptionShortOk() (*string, bool) {\n\tif o == nil || IsNil(o.DescriptionShort) {\n\t\treturn nil, false\n\t}\n\treturn o.DescriptionShort, true\n}", "title": "" }, { "docid": "55491cfcf5e9f27a4e071949678bf381", "score": "0.6724491", "text": "func (o *DAG) GetTimetableDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.TimetableDescription.Get(), o.TimetableDescription.IsSet()\n}", "title": "" }, { "docid": "2bfa2a5e0383246479c849bad670f2df", "score": "0.6639916", "text": "func (o *ResultAllOfAnalysisMetadataVersionInfoStringInfo) GetFileDescriptionOk() (*string, bool) {\n\tif o == nil || o.FileDescription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FileDescription, true\n}", "title": "" }, { "docid": "e15cd875eb6c09991aa9e1766b3f9290", "score": "0.6625808", "text": "func (o *ViewApp) GetShortDescriptionOk() (*string, bool) {\n\tif o == nil || o.ShortDescription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ShortDescription, true\n}", "title": "" }, { "docid": "fdd21ce8de479f12134915564952b917", "score": "0.6562563", "text": "func (o *OneMetric) GetStateDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.StateDescription, true\n}", "title": "" }, { "docid": "4cc3d8a1fd449cd8068bd77211f881ee", "score": "0.654564", "text": "func (p *PageRelatedArticle) GetDescription() (value string, ok bool) {\n\tif p == nil {\n\t\treturn\n\t}\n\tif !p.Flags.Has(1) {\n\t\treturn value, false\n\t}\n\treturn p.Description, true\n}", "title": "" }, { "docid": "49264ce1c133618e30ca4059b7b1a6bc", "score": "0.64214355", "text": "func (o *License) GetStatusDescriptionOk() (*string, bool) {\n\tif o == nil || o.StatusDescription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StatusDescription, true\n}", "title": "" }, { "docid": "12f50863eccc52ee09a6f046c62de783", "score": "0.6344587", "text": "func (o *InlineResponse200122Activity) GetExtradescriptionOk() (*string, bool) {\n\tif o == nil || o.Extradescription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Extradescription, true\n}", "title": "" }, { "docid": "a05df0787b98fe33b163f39984d16032", "score": "0.6338261", "text": "func (o *ModelsBuildConfigResponse) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1b4640bbfcac1bc79e2d3af042281af0", "score": "0.63250464", "text": "func (o *VlanRangeDataData) GetDomainDescriptionOk() (*string, bool) {\n\tif o == nil || o.DomainDescription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DomainDescription, true\n}", "title": "" }, { "docid": "a044b6b30b1f7e6555076e5b327cba5f", "score": "0.6273379", "text": "func (o *FindingMute) HasDescription() bool {\n\treturn o != nil && o.Description != nil\n}", "title": "" }, { "docid": "07b0bd3836015606ae72185e395a473b", "score": "0.6262266", "text": "func (o *PatchClientRequest) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e246bd874915f5352828e1de4104badc", "score": "0.62553567", "text": "func (o *WorkflowTaskNotificationAllOf) GetTaskDescriptionOk() (*string, bool) {\n\tif o == nil || o.TaskDescription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.TaskDescription, true\n}", "title": "" }, { "docid": "b033386565ac9bd984614e746fcc6d80", "score": "0.6197932", "text": "func (o *IaasCustomTaskInfo) GetTaskDescriptionOk() (*string, bool) {\n\tif o == nil || o.TaskDescription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.TaskDescription, true\n}", "title": "" }, { "docid": "0f477735288c8c3c30c09bad8bd62074", "score": "0.6192208", "text": "func (o *CDROMUpdateRequest) GetDescription() string {\n\treturn o.Description\n}", "title": "" } ]
9c6c68e2a0aa8945b0c6eae5475c0026
UnmarshalJSON implements the json.Unmarshaller interface for type AS2MessageConnectionSettings.
[ { "docid": "7a26971db531b2e6ed054694a34daac9", "score": "0.86783063", "text": "func (a *AS2MessageConnectionSettings) 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 \"ignoreCertificateNameMismatch\":\n\t\t\terr = unpopulate(val, \"IgnoreCertificateNameMismatch\", &a.IgnoreCertificateNameMismatch)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"keepHttpConnectionAlive\":\n\t\t\terr = unpopulate(val, \"KeepHTTPConnectionAlive\", &a.KeepHTTPConnectionAlive)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"supportHttpStatusCodeContinue\":\n\t\t\terr = unpopulate(val, \"SupportHTTPStatusCodeContinue\", &a.SupportHTTPStatusCodeContinue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unfoldHttpHeaders\":\n\t\t\terr = unpopulate(val, \"UnfoldHTTPHeaders\", &a.UnfoldHTTPHeaders)\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": "968ddd91d1fa17439f4f6a14552dad68", "score": "0.8312635", "text": "func (a *AS2ProtocolSettings) 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 \"acknowledgementConnectionSettings\":\n\t\t\terr = unpopulate(val, \"AcknowledgementConnectionSettings\", &a.AcknowledgementConnectionSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"envelopeSettings\":\n\t\t\terr = unpopulate(val, \"EnvelopeSettings\", &a.EnvelopeSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"errorSettings\":\n\t\t\terr = unpopulate(val, \"ErrorSettings\", &a.ErrorSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"mdnSettings\":\n\t\t\terr = unpopulate(val, \"MdnSettings\", &a.MdnSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"messageConnectionSettings\":\n\t\t\terr = unpopulate(val, \"MessageConnectionSettings\", &a.MessageConnectionSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"securitySettings\":\n\t\t\terr = unpopulate(val, \"SecuritySettings\", &a.SecuritySettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"validationSettings\":\n\t\t\terr = unpopulate(val, \"ValidationSettings\", &a.ValidationSettings)\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": "7ad2335913cb3c553513c15e1646c57e", "score": "0.8258372", "text": "func (a *AS2AcknowledgementConnectionSettings) 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 \"ignoreCertificateNameMismatch\":\n\t\t\terr = unpopulate(val, \"IgnoreCertificateNameMismatch\", &a.IgnoreCertificateNameMismatch)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"keepHttpConnectionAlive\":\n\t\t\terr = unpopulate(val, \"KeepHTTPConnectionAlive\", &a.KeepHTTPConnectionAlive)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"supportHttpStatusCodeContinue\":\n\t\t\terr = unpopulate(val, \"SupportHTTPStatusCodeContinue\", &a.SupportHTTPStatusCodeContinue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unfoldHttpHeaders\":\n\t\t\terr = unpopulate(val, \"UnfoldHTTPHeaders\", &a.UnfoldHTTPHeaders)\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": "278fa98ad540cb303856edfb7c22b278", "score": "0.735424", "text": "func (p *ProtocolSettings) 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 \"smb\":\n\t\t\terr = unpopulate(val, \"Smb\", &p.Smb)\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": "ca25209e0938047d6407826b5da568c6", "score": "0.71674895", "text": "func (a *AS2EnvelopeSettings) 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 \"autogenerateFileName\":\n\t\t\terr = unpopulate(val, \"AutogenerateFileName\", &a.AutogenerateFileName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"fileNameTemplate\":\n\t\t\terr = unpopulate(val, \"FileNameTemplate\", &a.FileNameTemplate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"messageContentType\":\n\t\t\terr = unpopulate(val, \"MessageContentType\", &a.MessageContentType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"suspendMessageOnFileNameGenerationError\":\n\t\t\terr = unpopulate(val, \"SuspendMessageOnFileNameGenerationError\", &a.SuspendMessageOnFileNameGenerationError)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"transmitFileNameInMimeHeader\":\n\t\t\terr = unpopulate(val, \"TransmitFileNameInMimeHeader\", &a.TransmitFileNameInMimeHeader)\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": "ff2a9ff4cc8f03aeb8a50e26e8c3cf84", "score": "0.7125521", "text": "func (a *AS2SecuritySettings) 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 \"enableNRRForInboundDecodedMessages\":\n\t\t\terr = unpopulate(val, \"EnableNRRForInboundDecodedMessages\", &a.EnableNRRForInboundDecodedMessages)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableNRRForInboundEncodedMessages\":\n\t\t\terr = unpopulate(val, \"EnableNRRForInboundEncodedMessages\", &a.EnableNRRForInboundEncodedMessages)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableNRRForInboundMDN\":\n\t\t\terr = unpopulate(val, \"EnableNRRForInboundMDN\", &a.EnableNRRForInboundMDN)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableNRRForOutboundDecodedMessages\":\n\t\t\terr = unpopulate(val, \"EnableNRRForOutboundDecodedMessages\", &a.EnableNRRForOutboundDecodedMessages)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableNRRForOutboundEncodedMessages\":\n\t\t\terr = unpopulate(val, \"EnableNRRForOutboundEncodedMessages\", &a.EnableNRRForOutboundEncodedMessages)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableNRRForOutboundMDN\":\n\t\t\terr = unpopulate(val, \"EnableNRRForOutboundMDN\", &a.EnableNRRForOutboundMDN)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"encryptionCertificateName\":\n\t\t\terr = unpopulate(val, \"EncryptionCertificateName\", &a.EncryptionCertificateName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"overrideGroupSigningCertificate\":\n\t\t\terr = unpopulate(val, \"OverrideGroupSigningCertificate\", &a.OverrideGroupSigningCertificate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sha2AlgorithmFormat\":\n\t\t\terr = unpopulate(val, \"SHA2AlgorithmFormat\", &a.SHA2AlgorithmFormat)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"signingCertificateName\":\n\t\t\terr = unpopulate(val, \"SigningCertificateName\", &a.SigningCertificateName)\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": "8cf27ca6880d32868e860ef821ebd8bd", "score": "0.7071405", "text": "func (s *SmbSetting) 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 \"authenticationMethods\":\n\t\t\terr = unpopulate(val, \"AuthenticationMethods\", &s.AuthenticationMethods)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"channelEncryption\":\n\t\t\terr = unpopulate(val, \"ChannelEncryption\", &s.ChannelEncryption)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kerberosTicketEncryption\":\n\t\t\terr = unpopulate(val, \"KerberosTicketEncryption\", &s.KerberosTicketEncryption)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"multichannel\":\n\t\t\terr = unpopulate(val, \"Multichannel\", &s.Multichannel)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"versions\":\n\t\t\terr = unpopulate(val, \"Versions\", &s.Versions)\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": "02f39ca6ff7fad9ff02fa998860a80d7", "score": "0.70374733", "text": "func (a *AlertSyncSettings) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, &a.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := a.Setting.unmarshalInternal(rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f88fcadb0a639f7d599cb316f411de6", "score": "0.7017255", "text": "func (a *AutoscaleSettings) 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 \"maxThroughput\":\n\t\t\terr = unpopulate(val, \"MaxThroughput\", &a.MaxThroughput)\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": "8949115e05218b17c7c35599f42a7e20", "score": "0.6980179", "text": "func (c *ConnectorSetting) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, &c.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := c.Resource.unmarshalInternal(rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c66c4a7c0240de65e2f41111750c0448", "score": "0.6935586", "text": "func (c *ConnectorSetting) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &c.ID)\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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &c.Properties)\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": "39efc05d34f1a0847aadf178d68b5bbb", "score": "0.68541694", "text": "func (a *AlertSyncSettings) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"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 \"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": "3c35ecf6b203a44168ec6b4859c433dd", "score": "0.6844238", "text": "func (s *SecuritySettings) 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 \"immutabilitySettings\":\n\t\t\terr = unpopulate(val, \"ImmutabilitySettings\", &s.ImmutabilitySettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"softDeleteSettings\":\n\t\t\terr = unpopulate(val, \"SoftDeleteSettings\", &s.SoftDeleteSettings)\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": "36fcf6bd6425748e76ed4a940e0bad1b", "score": "0.6826979", "text": "func (v *VmmToAzureNetworkMappingSettings) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &v.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\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": "a7d1fe11cd48300e39c661152d623f65", "score": "0.6786759", "text": "func (a *AS2MdnSettings) 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 \"dispositionNotificationTo\":\n\t\t\terr = unpopulate(val, \"DispositionNotificationTo\", &a.DispositionNotificationTo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"mdnText\":\n\t\t\terr = unpopulate(val, \"MdnText\", &a.MdnText)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"micHashingAlgorithm\":\n\t\t\terr = unpopulate(val, \"MicHashingAlgorithm\", &a.MicHashingAlgorithm)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"needMDN\":\n\t\t\terr = unpopulate(val, \"NeedMDN\", &a.NeedMDN)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"receiptDeliveryUrl\":\n\t\t\terr = unpopulate(val, \"ReceiptDeliveryURL\", &a.ReceiptDeliveryURL)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sendInboundMDNToMessageBox\":\n\t\t\terr = unpopulate(val, \"SendInboundMDNToMessageBox\", &a.SendInboundMDNToMessageBox)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sendMDNAsynchronously\":\n\t\t\terr = unpopulate(val, \"SendMDNAsynchronously\", &a.SendMDNAsynchronously)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"signMDN\":\n\t\t\terr = unpopulate(val, \"SignMDN\", &a.SignMDN)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"signOutboundMDNIfOptional\":\n\t\t\terr = unpopulate(val, \"SignOutboundMDNIfOptional\", &a.SignOutboundMDNIfOptional)\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": "b80d55f868e3795cbcd6b8eb29dd7865", "score": "0.67702484", "text": "func (m *MonitoringSettings) 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 \"azureMonitorAlertSettings\":\n\t\t\terr = unpopulate(val, \"AzureMonitorAlertSettings\", &m.AzureMonitorAlertSettings)\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": "ecff79d5090bf18bcab5aeb73ad343a0", "score": "0.67610276", "text": "func (i *ImmutabilitySettings) 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 \"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": "8bb7cef5c3d90eb02c6daad867291472", "score": "0.6736614", "text": "func (a *AS2ValidationSettings) 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 \"checkCertificateRevocationListOnReceive\":\n\t\t\terr = unpopulate(val, \"CheckCertificateRevocationListOnReceive\", &a.CheckCertificateRevocationListOnReceive)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"checkCertificateRevocationListOnSend\":\n\t\t\terr = unpopulate(val, \"CheckCertificateRevocationListOnSend\", &a.CheckCertificateRevocationListOnSend)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"checkDuplicateMessage\":\n\t\t\terr = unpopulate(val, \"CheckDuplicateMessage\", &a.CheckDuplicateMessage)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"compressMessage\":\n\t\t\terr = unpopulate(val, \"CompressMessage\", &a.CompressMessage)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"encryptMessage\":\n\t\t\terr = unpopulate(val, \"EncryptMessage\", &a.EncryptMessage)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"encryptionAlgorithm\":\n\t\t\terr = unpopulate(val, \"EncryptionAlgorithm\", &a.EncryptionAlgorithm)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"interchangeDuplicatesValidityDays\":\n\t\t\terr = unpopulate(val, \"InterchangeDuplicatesValidityDays\", &a.InterchangeDuplicatesValidityDays)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"overrideMessageProperties\":\n\t\t\terr = unpopulate(val, \"OverrideMessageProperties\", &a.OverrideMessageProperties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"signMessage\":\n\t\t\terr = unpopulate(val, \"SignMessage\", &a.SignMessage)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"signingAlgorithm\":\n\t\t\terr = unpopulate(val, \"SigningAlgorithm\", &a.SigningAlgorithm)\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": "5087e390ff78b977e61cd5c92905e0a4", "score": "0.67348486", "text": "func (a *AzureToAzureNetworkMappingSettings) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &a.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"primaryFabricLocation\":\n\t\t\terr = unpopulate(val, \"PrimaryFabricLocation\", &a.PrimaryFabricLocation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryFabricLocation\":\n\t\t\terr = unpopulate(val, \"RecoveryFabricLocation\", &a.RecoveryFabricLocation)\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": "f70ad3481b2d042c50b02ffc475802e5", "score": "0.6716349", "text": "func (v *VmmToVmmNetworkMappingSettings) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"instanceType\":\n\t\t\terr = unpopulate(val, \"InstanceType\", &v.InstanceType)\n\t\t\tdelete(rawMsg, key)\n\t\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": "bd01fe11f364e37e31822727b9f038b2", "score": "0.66655093", "text": "func (d *DataExportSettings) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, &d.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := d.Setting.unmarshalInternal(rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b45464407cc0a0d938eaaa3640cec372", "score": "0.66093653", "text": "func (o *HostMuteSettings) UnmarshalJSON(bytes []byte) (err error) {\n\traw := map[string]interface{}{}\n\tall := struct {\n\t\tEnd *int64 `json:\"end,omitempty\"`\n\t\tMessage *string `json:\"message,omitempty\"`\n\t\tOverride *bool `json:\"override,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.End = all.End\n\to.Message = all.Message\n\to.Override = all.Override\n\treturn nil\n}", "title": "" }, { "docid": "5dd6f13a1c40c9194b095a87ce0d1a87", "score": "0.6585041", "text": "func (v *ConnectionMessage) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson54c0b74dDecodeGithubComTarbBfapi14(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "53521a6c2dac9c12b1cbc4b246f7dfef", "score": "0.65843296", "text": "func (a *AlertSyncSettingProperties) 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 \"enabled\":\n\t\t\terr = unpopulate(val, \"Enabled\", &a.Enabled)\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": "dd4610209fbe522fff5de0b29b414554", "score": "0.6556271", "text": "func (s *Setting) 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\treturn s.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "ae56f7c2d8ff8189c52fe60a0e69e447", "score": "0.65554523", "text": "func (d *DiagnosticLogSettings) 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 \"enableFullTextQuery\":\n\t\t\terr = unpopulate(val, \"EnableFullTextQuery\", &d.EnableFullTextQuery)\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": "64c6af17efe04aa4308bb5acd4bf361d", "score": "0.6545596", "text": "func (e *EdifactProtocolSettings) 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 \"acknowledgementSettings\":\n\t\t\terr = unpopulate(val, \"AcknowledgementSettings\", &e.AcknowledgementSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"edifactDelimiterOverrides\":\n\t\t\terr = unpopulate(val, \"EdifactDelimiterOverrides\", &e.EdifactDelimiterOverrides)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"envelopeOverrides\":\n\t\t\terr = unpopulate(val, \"EnvelopeOverrides\", &e.EnvelopeOverrides)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"envelopeSettings\":\n\t\t\terr = unpopulate(val, \"EnvelopeSettings\", &e.EnvelopeSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"framingSettings\":\n\t\t\terr = unpopulate(val, \"FramingSettings\", &e.FramingSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"messageFilter\":\n\t\t\terr = unpopulate(val, \"MessageFilter\", &e.MessageFilter)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"messageFilterList\":\n\t\t\terr = unpopulate(val, \"MessageFilterList\", &e.MessageFilterList)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"processingSettings\":\n\t\t\terr = unpopulate(val, \"ProcessingSettings\", &e.ProcessingSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"schemaReferences\":\n\t\t\terr = unpopulate(val, \"SchemaReferences\", &e.SchemaReferences)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"validationOverrides\":\n\t\t\terr = unpopulate(val, \"ValidationOverrides\", &e.ValidationOverrides)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"validationSettings\":\n\t\t\terr = unpopulate(val, \"ValidationSettings\", &e.ValidationSettings)\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": "138073d0c026712e06b67f31f10dbf0b", "score": "0.6539555", "text": "func (x *X12ProtocolSettings) 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\", x, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"acknowledgementSettings\":\n\t\t\terr = unpopulate(val, \"AcknowledgementSettings\", &x.AcknowledgementSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"envelopeOverrides\":\n\t\t\terr = unpopulate(val, \"EnvelopeOverrides\", &x.EnvelopeOverrides)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"envelopeSettings\":\n\t\t\terr = unpopulate(val, \"EnvelopeSettings\", &x.EnvelopeSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"framingSettings\":\n\t\t\terr = unpopulate(val, \"FramingSettings\", &x.FramingSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"messageFilter\":\n\t\t\terr = unpopulate(val, \"MessageFilter\", &x.MessageFilter)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"messageFilterList\":\n\t\t\terr = unpopulate(val, \"MessageFilterList\", &x.MessageFilterList)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"processingSettings\":\n\t\t\terr = unpopulate(val, \"ProcessingSettings\", &x.ProcessingSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"schemaReferences\":\n\t\t\terr = unpopulate(val, \"SchemaReferences\", &x.SchemaReferences)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"securitySettings\":\n\t\t\terr = unpopulate(val, \"SecuritySettings\", &x.SecuritySettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"validationOverrides\":\n\t\t\terr = unpopulate(val, \"ValidationOverrides\", &x.ValidationOverrides)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"validationSettings\":\n\t\t\terr = unpopulate(val, \"ValidationSettings\", &x.ValidationSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"x12DelimiterOverrides\":\n\t\t\terr = unpopulate(val, \"X12DelimiterOverrides\", &x.X12DelimiterOverrides)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", x, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6cb68cb2c6ffe7c14a5c6bb4ef551dbe", "score": "0.65394974", "text": "func (c *CrossSubscriptionRestoreSettings) 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 \"state\":\n\t\t\terr = unpopulate(val, \"State\", &c.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\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "56ced9e040e61cd70ce9b38aad5bac4e", "score": "0.6517852", "text": "func (s *SettingsList) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, &s.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\ts.Value, err = unmarshalSettingClassificationArray(val)\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": "bb517c28d1697cf68a4b9f26b9149462", "score": "0.65143263", "text": "func (c *ConnectionString) 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\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": "d32dd8156b6a9340ef78c2eabf726f93", "score": "0.65059954", "text": "func (c *ConnectionStrings) 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 \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &c.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\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76cc44ef71cde4d47d5daebee0cec546", "score": "0.6502447", "text": "func (c *ConnectorSettingList) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &c.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &c.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\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ece8eec079fdf02c1e02a08fc3cb406", "score": "0.64648145", "text": "func (s *Settings) Unmarshal(msg *pb.GameSettings) error {\n\ts.Reset()\n\tif msg.HeatSettings != nil {\n\t\tproto.Merge(&s.HeatSettings, msg.GetHeatSettings())\n\t} else {\n\t\ts.Init = defaultInit\n\t\ts.Min = defaultMin\n\t\ts.Max = defaultMax\n\t\ts.Decay = defaultDecay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "536d6066c151f62cd99372364aa4403c", "score": "0.64441323", "text": "func (f *FeatureSettings) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"crossRegionRestoreSettings\":\n\t\t\terr = unpopulate(val, \"CrossRegionRestoreSettings\", &f.CrossRegionRestoreSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"crossSubscriptionRestoreSettings\":\n\t\t\terr = unpopulate(val, \"CrossSubscriptionRestoreSettings\", &f.CrossSubscriptionRestoreSettings)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bda2de5457b5fb7dc25540c584de8414", "score": "0.6405754", "text": "func (x *X12SecuritySettings) 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\", x, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"authorizationQualifier\":\n\t\t\terr = unpopulate(val, \"AuthorizationQualifier\", &x.AuthorizationQualifier)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"authorizationValue\":\n\t\t\terr = unpopulate(val, \"AuthorizationValue\", &x.AuthorizationValue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"passwordValue\":\n\t\t\terr = unpopulate(val, \"PasswordValue\", &x.PasswordValue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"securityQualifier\":\n\t\t\terr = unpopulate(val, \"SecurityQualifier\", &x.SecurityQualifier)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", x, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4814d131ea52e063f915ca760748a4f5", "score": "0.6404904", "text": "func (s *SettingsList) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &s.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\ts.Value, err = unmarshalSettingClassificationArray(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\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "111d913b9436d22f05337b994826ef21", "score": "0.6388955", "text": "func (v *RoomSettings) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComGoParkMailRu20191EscapadeInternalPkgModels6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "84e90b76f77395eed6f3b68da6d3d47c", "score": "0.63663244", "text": "func (s *Setting) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &s.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &s.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &s.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &s.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "641078014dd82ce09cd0348acfb5463d", "score": "0.6325898", "text": "func (s *ServerPrivateEndpointConnection) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &s.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &s.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\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e532ded90b59143bf66e9fb32ae7b8d8", "score": "0.63252676", "text": "func (d *DataExportSettings) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &d.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &d.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &d.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &d.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &d.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5bbc55c0132d9d30b9d1a4be29fe7043", "score": "0.6318069", "text": "func (m *Settings) UnmarshalJSON(data []byte) error {\n\t// stage 1, bind the properties\n\tvar stage1 struct {\n\n\t\t// api\n\t\tAPI *SettingsAPI `json:\"api,omitempty\"`\n\n\t\t// appearance\n\t\tAppearance *SettingsAppearance `json:\"appearance,omitempty\"`\n\n\t\t// feature\n\t\tFeature *SettingsFeature `json:\"feature,omitempty\"`\n\n\t\t// folder\n\t\tFolder *SettingsFolder `json:\"folder,omitempty\"`\n\n\t\t// plugins\n\t\tPlugins *SettingsPlugins `json:\"plugins,omitempty\"`\n\n\t\t// printer\n\t\tPrinter *SettingsPrinter `json:\"printer,omitempty\"`\n\n\t\t// scripts\n\t\tScripts *SettingsScripts `json:\"scripts,omitempty\"`\n\n\t\t// serial\n\t\tSerial *SettingsSerial `json:\"serial,omitempty\"`\n\n\t\t// webcam\n\t\tWebcam *SettingsWebcam `json:\"webcam,omitempty\"`\n\t}\n\tif err := json.Unmarshal(data, &stage1); err != nil {\n\t\treturn err\n\t}\n\tvar rcv Settings\n\n\trcv.API = stage1.API\n\trcv.Appearance = stage1.Appearance\n\trcv.Feature = stage1.Feature\n\trcv.Folder = stage1.Folder\n\trcv.Plugins = stage1.Plugins\n\trcv.Printer = stage1.Printer\n\trcv.Scripts = stage1.Scripts\n\trcv.Serial = stage1.Serial\n\trcv.Webcam = stage1.Webcam\n\t*m = rcv\n\n\t// stage 2, remove properties and add to map\n\tstage2 := make(map[string]json.RawMessage)\n\tif err := json.Unmarshal(data, &stage2); err != nil {\n\t\treturn err\n\t}\n\n\tdelete(stage2, \"api\")\n\tdelete(stage2, \"appearance\")\n\tdelete(stage2, \"feature\")\n\tdelete(stage2, \"folder\")\n\tdelete(stage2, \"plugins\")\n\tdelete(stage2, \"printer\")\n\tdelete(stage2, \"scripts\")\n\tdelete(stage2, \"serial\")\n\tdelete(stage2, \"webcam\")\n\t// stage 3, add additional properties values\n\tif len(stage2) > 0 {\n\t\tresult := make(map[string]interface{})\n\t\tfor k, v := range stage2 {\n\t\t\tvar toadd interface{}\n\t\t\tif err := json.Unmarshal(v, &toadd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tresult[k] = toadd\n\t\t}\n\t\tm.Settings = result\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2871bda29cba4278848c2439b93226e6", "score": "0.63116395", "text": "func (c *ConnectorSettingProperties) 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 \"authenticationDetails\":\n\t\t\tc.AuthenticationDetails, err = unmarshalAuthenticationDetailsPropertiesClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hybridComputeSettings\":\n\t\t\terr = unpopulate(val, &c.HybridComputeSettings)\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": "2f16175d72e83958f73e3e439122a506", "score": "0.6276783", "text": "func (d *DatabaseAccountConnectionString) 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 \"connectionString\":\n\t\t\terr = unpopulate(val, \"ConnectionString\", &d.ConnectionString)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &d.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"keyKind\":\n\t\t\terr = unpopulate(val, \"KeyKind\", &d.KeyKind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &d.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87530f62a6a5171eabce7fc3919416a5", "score": "0.6266464", "text": "func (c *ConnectorSettingProperties) 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 \"authenticationDetails\":\n\t\t\tc.AuthenticationDetails, err = unmarshalAuthenticationDetailsPropertiesClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hybridComputeSettings\":\n\t\t\terr = unpopulate(val, \"HybridComputeSettings\", &c.HybridComputeSettings)\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": "6cadf4562d7dd3d3268b5dbb1609b41b", "score": "0.6257067", "text": "func (m *ManagedVirtualNetworkSettings) 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 \"allowedAadTenantIdsForLinking\":\n\t\t\terr = unpopulate(val, \"AllowedAADTenantIDsForLinking\", &m.AllowedAADTenantIDsForLinking)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"linkedAccessCheckOnTargetResource\":\n\t\t\terr = unpopulate(val, \"LinkedAccessCheckOnTargetResource\", &m.LinkedAccessCheckOnTargetResource)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"preventDataExfiltration\":\n\t\t\terr = unpopulate(val, \"PreventDataExfiltration\", &m.PreventDataExfiltration)\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": "3a336ace34893388f2b3e93c831518e7", "score": "0.62410784", "text": "func (a *AzureMonitorAlertSettings) 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 \"alertsForAllJobFailures\":\n\t\t\terr = unpopulate(val, \"AlertsForAllJobFailures\", &a.AlertsForAllJobFailures)\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": "b0ad0b5d795cc0e494305a8d07738de7", "score": "0.6240779", "text": "func (m *Multichannel) 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 \"enabled\":\n\t\t\terr = unpopulate(val, \"Enabled\", &m.Enabled)\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": "bc28ec2a7d48e1450304b7068773d96e", "score": "0.6239908", "text": "func (a *AutoscaleSettingsResource) 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 \"autoUpgradePolicy\":\n\t\t\terr = unpopulate(val, \"AutoUpgradePolicy\", &a.AutoUpgradePolicy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxThroughput\":\n\t\t\terr = unpopulate(val, \"MaxThroughput\", &a.MaxThroughput)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"targetMaxThroughput\":\n\t\t\terr = unpopulate(val, \"TargetMaxThroughput\", &a.TargetMaxThroughput)\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": "545f5de551239129408ea6c2eb38e999", "score": "0.62267447", "text": "func (a *AllowedConnectionsList) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &a.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c4bacbc8f1b4da95761ca5e3768e47c", "score": "0.6213002", "text": "func (m *ManagedIdentitySQLControlSettingsModel) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &m.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &m.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &m.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &m.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\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f248f01b27085d208fbde43fe74fdad8", "score": "0.6199713", "text": "func (a *AssignmentLockSettings) 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 \"excludedActions\":\n\t\t\terr = unpopulate(val, \"ExcludedActions\", &a.ExcludedActions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"excludedPrincipals\":\n\t\t\terr = unpopulate(val, \"ExcludedPrincipals\", &a.ExcludedPrincipals)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"mode\":\n\t\t\terr = unpopulate(val, \"Mode\", &a.Mode)\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": "44b992426111663aaa92c67cd719a53a", "score": "0.61978406", "text": "func (i *IngestionConnectionString) 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 \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &i.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\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": "342725761dfa200cfa9db6cdeae3bdb3", "score": "0.6193944", "text": "func (e *EventHubConnectionProperties) 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 \"compression\":\n\t\t\terr = unpopulate(val, \"Compression\", &e.Compression)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"consumerGroup\":\n\t\t\terr = unpopulate(val, \"ConsumerGroup\", &e.ConsumerGroup)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataFormat\":\n\t\t\terr = unpopulate(val, \"DataFormat\", &e.DataFormat)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"eventHubResourceId\":\n\t\t\terr = unpopulate(val, \"EventHubResourceID\", &e.EventHubResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"eventSystemProperties\":\n\t\t\terr = unpopulate(val, \"EventSystemProperties\", &e.EventSystemProperties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"managedIdentityResourceId\":\n\t\t\terr = unpopulate(val, \"ManagedIdentityResourceID\", &e.ManagedIdentityResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"mappingRuleName\":\n\t\t\terr = unpopulate(val, \"MappingRuleName\", &e.MappingRuleName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &e.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tableName\":\n\t\t\terr = unpopulate(val, \"TableName\", &e.TableName)\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": "c98480818a13b8874fbf7d0a960dd281", "score": "0.61886835", "text": "func (x *X12FramingSettings) 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\", x, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"characterSet\":\n\t\t\terr = unpopulate(val, \"CharacterSet\", &x.CharacterSet)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"componentSeparator\":\n\t\t\terr = unpopulate(val, \"ComponentSeparator\", &x.ComponentSeparator)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataElementSeparator\":\n\t\t\terr = unpopulate(val, \"DataElementSeparator\", &x.DataElementSeparator)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"replaceCharacter\":\n\t\t\terr = unpopulate(val, \"ReplaceCharacter\", &x.ReplaceCharacter)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"replaceSeparatorsInPayload\":\n\t\t\terr = unpopulate(val, \"ReplaceSeparatorsInPayload\", &x.ReplaceSeparatorsInPayload)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"segmentTerminator\":\n\t\t\terr = unpopulate(val, \"SegmentTerminator\", &x.SegmentTerminator)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"segmentTerminatorSuffix\":\n\t\t\terr = unpopulate(val, \"SegmentTerminatorSuffix\", &x.SegmentTerminatorSuffix)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", x, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7edebbb31e1bbd016d7d992c4b912d39", "score": "0.61838275", "text": "func (i *IngestionSetting) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, &i.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := i.Resource.unmarshalInternal(rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bc0bf0819ec6aebd3422e4c9d2b75b37", "score": "0.61694324", "text": "func (c *CrossRegionRestoreSettings) 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 \"state\":\n\t\t\terr = unpopulate(val, \"State\", &c.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\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9984ac654e6bf59ec463191ac70acc1d", "score": "0.61509705", "text": "func (s *ServerPrivateEndpointConnectionProperties) 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 \"privateEndpoint\":\n\t\t\terr = unpopulate(val, \"PrivateEndpoint\", &s.PrivateEndpoint)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"privateLinkServiceConnectionState\":\n\t\t\terr = unpopulate(val, \"PrivateLinkServiceConnectionState\", &s.PrivateLinkServiceConnectionState)\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\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": "244901959b78604bc48533cc391a9df1", "score": "0.6147099", "text": "func (d *DedicatedSQLminimalTLSSettings) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &d.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &d.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &d.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &d.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &d.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "849ba117a40b8c6b16f6dd686b7c7afe", "score": "0.61427426", "text": "func (s *Setting) 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 settingsProperties SettingsProperties\n\t\t\t\terr = json.Unmarshal(*v, &settingsProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts.SettingsProperties = &settingsProperties\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\ts.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\ts.Name = &name\n\t\t\t}\n\t\tcase \"kind\":\n\t\t\tif v != nil {\n\t\t\t\tvar kind string\n\t\t\t\terr = json.Unmarshal(*v, &kind)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts.Kind = &kind\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\ts.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a1cbe4c8663c0044079960a4dba421d7", "score": "0.6107211", "text": "func (a *AdvancedThreatProtectionSetting) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, &a.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := a.Resource.unmarshalInternal(rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d86b718856a486ba354863397a9d34f", "score": "0.609564", "text": "func (s *ServiceNowExtensionSettings) UnmarshalJSON(b []byte) error {\n\tvar fields struct {\n\t\tExtensionID extensions.ExtensionID `json:\"ExtensionId\"`\n\t\tValues map[string]interface{} `json:\"Values\"`\n\t}\n\n\tif err := json.Unmarshal(b, &fields); err != nil {\n\t\treturn err\n\t}\n\n\ts.SetExtensionID(fields.ExtensionID)\n\n\tfor k, v := range fields.Values {\n\t\tswitch k {\n\t\tcase \"ServiceNowChangeControlled\":\n\t\t\ts.SetIsChangeControlled(v.(bool))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "be26a7f078d9fb2df7ef635ffe1d9d2a", "score": "0.6085736", "text": "func (v *ConnectionMessage) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson54c0b74dDecodeGithubComTarbBfapi14(l, v)\n}", "title": "" }, { "docid": "1fa318421936a5ca28c698cb8cec39a0", "score": "0.6069382", "text": "func (l *ListConnectionStringsResult) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", l, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"connectionStrings\":\n\t\t\terr = unpopulate(val, \"ConnectionStrings\", &l.ConnectionStrings)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", l, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e1421c633735f1edd4040ab0a084400c", "score": "0.6064416", "text": "func (a *AdvancedThreatProtectionSetting) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &a.Properties)\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": "c58239eff0d25f0808738c94cd6be1c0", "score": "0.6062217", "text": "func (d *DataExportSettingProperties) 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 \"enabled\":\n\t\t\terr = unpopulate(val, \"Enabled\", &d.Enabled)\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": "0d2b2b26faa06f20f6dc91f9832073b9", "score": "0.605786", "text": "func (s *SecurityMLAnalyticsSettingsList) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &s.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\ts.Value, err = unmarshalSecurityMLAnalyticsSettingClassificationArray(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\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "822eda490f7198851792de4dffc1e9ff", "score": "0.6056312", "text": "func (p *PrivateEndpointConnection) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &p.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7805c5b49c297dec7b7bfdd0d280e586", "score": "0.60559285", "text": "func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7805c5b49c297dec7b7bfdd0d280e586", "score": "0.60559285", "text": "func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7805c5b49c297dec7b7bfdd0d280e586", "score": "0.60559285", "text": "func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "99f73b27a26de049850a4d6e506a0e68", "score": "0.60556895", "text": "func (i *IngestionSetting) 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 \"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": "ec1c51bfc73f7a5172a1d97c9fee8763", "score": "0.60472035", "text": "func (i *IngestionSettingList) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &i.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\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": "a19e594e173074af77b8229c98975966", "score": "0.6036501", "text": "func (p *PrivateEndpointConnection) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a19e594e173074af77b8229c98975966", "score": "0.6036501", "text": "func (p *PrivateEndpointConnection) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a19e594e173074af77b8229c98975966", "score": "0.6036501", "text": "func (p *PrivateEndpointConnection) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a19e594e173074af77b8229c98975966", "score": "0.6036501", "text": "func (p *PrivateEndpointConnection) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a19e594e173074af77b8229c98975966", "score": "0.6036501", "text": "func (p *PrivateEndpointConnection) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &p.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &p.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62320e38777a01508e76b92580562a6d", "score": "0.6030976", "text": "func (d *DatabaseAccountListConnectionStringsResult) 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 \"connectionStrings\":\n\t\t\terr = unpopulate(val, \"ConnectionStrings\", &d.ConnectionStrings)\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": "faaa76db03b607e2ec1ffb4fe9c37498", "score": "0.6026128", "text": "func (h *HybridConnectionProperties) 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 \"createdAt\":\n\t\t\terr = unpopulateTimeRFC3339(val, &h.CreatedAt)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"listenerCount\":\n\t\t\terr = unpopulate(val, &h.ListenerCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiresClientAuthorization\":\n\t\t\terr = unpopulate(val, &h.RequiresClientAuthorization)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"updatedAt\":\n\t\t\terr = unpopulateTimeRFC3339(val, &h.UpdatedAt)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"userMetadata\":\n\t\t\terr = unpopulate(val, &h.UserMetadata)\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": "081e9485b0fabb14f0d533863b5c2620", "score": "0.6022176", "text": "func (p *PrivateEndpointConnectionForPrivateLinkHubBasic) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.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\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d18982c0ded504f4aedf36d063f622aa", "score": "0.602023", "text": "func (i *IotHubConnectionProperties) 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 \"consumerGroup\":\n\t\t\terr = unpopulate(val, \"ConsumerGroup\", &i.ConsumerGroup)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataFormat\":\n\t\t\terr = unpopulate(val, \"DataFormat\", &i.DataFormat)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"eventSystemProperties\":\n\t\t\terr = unpopulate(val, \"EventSystemProperties\", &i.EventSystemProperties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"iotHubResourceId\":\n\t\t\terr = unpopulate(val, \"IotHubResourceID\", &i.IotHubResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"mappingRuleName\":\n\t\t\terr = unpopulate(val, \"MappingRuleName\", &i.MappingRuleName)\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\tcase \"sharedAccessPolicyName\":\n\t\t\terr = unpopulate(val, \"SharedAccessPolicyName\", &i.SharedAccessPolicyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tableName\":\n\t\t\terr = unpopulate(val, \"TableName\", &i.TableName)\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": "4ce45b86b60beb64e75f3d7521f61e3d", "score": "0.6015542", "text": "func (g *GetSensitivitySettingsListResponse) 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 \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &g.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\", g, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd303b3781fc5810c0c5d9be648cfbd3", "score": "0.6009687", "text": "func (p *PrivateEndpointConnectionList) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &p.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &p.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "774076090b308fe353c00516bbc7b76d", "score": "0.60057145", "text": "func (x *X12AcknowledgementSettings) 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\", x, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"acknowledgementControlNumberLowerBound\":\n\t\t\terr = unpopulate(val, \"AcknowledgementControlNumberLowerBound\", &x.AcknowledgementControlNumberLowerBound)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"acknowledgementControlNumberPrefix\":\n\t\t\terr = unpopulate(val, \"AcknowledgementControlNumberPrefix\", &x.AcknowledgementControlNumberPrefix)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"acknowledgementControlNumberSuffix\":\n\t\t\terr = unpopulate(val, \"AcknowledgementControlNumberSuffix\", &x.AcknowledgementControlNumberSuffix)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"acknowledgementControlNumberUpperBound\":\n\t\t\terr = unpopulate(val, \"AcknowledgementControlNumberUpperBound\", &x.AcknowledgementControlNumberUpperBound)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"batchFunctionalAcknowledgements\":\n\t\t\terr = unpopulate(val, \"BatchFunctionalAcknowledgements\", &x.BatchFunctionalAcknowledgements)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"batchImplementationAcknowledgements\":\n\t\t\terr = unpopulate(val, \"BatchImplementationAcknowledgements\", &x.BatchImplementationAcknowledgements)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"batchTechnicalAcknowledgements\":\n\t\t\terr = unpopulate(val, \"BatchTechnicalAcknowledgements\", &x.BatchTechnicalAcknowledgements)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"functionalAcknowledgementVersion\":\n\t\t\terr = unpopulate(val, \"FunctionalAcknowledgementVersion\", &x.FunctionalAcknowledgementVersion)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"implementationAcknowledgementVersion\":\n\t\t\terr = unpopulate(val, \"ImplementationAcknowledgementVersion\", &x.ImplementationAcknowledgementVersion)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"needFunctionalAcknowledgement\":\n\t\t\terr = unpopulate(val, \"NeedFunctionalAcknowledgement\", &x.NeedFunctionalAcknowledgement)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"needImplementationAcknowledgement\":\n\t\t\terr = unpopulate(val, \"NeedImplementationAcknowledgement\", &x.NeedImplementationAcknowledgement)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"needLoopForValidMessages\":\n\t\t\terr = unpopulate(val, \"NeedLoopForValidMessages\", &x.NeedLoopForValidMessages)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"needTechnicalAcknowledgement\":\n\t\t\terr = unpopulate(val, \"NeedTechnicalAcknowledgement\", &x.NeedTechnicalAcknowledgement)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rolloverAcknowledgementControlNumber\":\n\t\t\terr = unpopulate(val, \"RolloverAcknowledgementControlNumber\", &x.RolloverAcknowledgementControlNumber)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sendSynchronousAcknowledgement\":\n\t\t\terr = unpopulate(val, \"SendSynchronousAcknowledgement\", &x.SendSynchronousAcknowledgement)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", x, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c809526f79e4cc339fa101f1b266e52a", "score": "0.6003383", "text": "func (t *TargetCopySetting) 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 \"copyAfter\":\n\t\t\tt.CopyAfter, err = unmarshalCopyOptionClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataStore\":\n\t\t\terr = unpopulate(val, &t.DataStore)\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": "522dfeb6c3c7ef78f244bfdd42e06578", "score": "0.60024387", "text": "func (g *GetSensitivitySettingsResponse) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &g.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &g.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &g.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &g.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", g, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba12149ad39e0b7f8bb2da1310f30a3f", "score": "0.5997733", "text": "func (c *Configuration) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &c.ID)\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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &c.Properties)\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": "d06fadca99f006af0755f0d797056722", "score": "0.5990027", "text": "func (m *Setting) UnmarshalJSON(b []byte) error {\n\treturn SettingJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)\n}", "title": "" }, { "docid": "bf31a25f08e8af2a00fd0930f1a4c264", "score": "0.5989193", "text": "func (s *ServiceBusMessage) 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 \"authentication\":\n\t\t\terr = unpopulate(val, \"Authentication\", &s.Authentication)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"brokeredMessageProperties\":\n\t\t\terr = unpopulate(val, \"BrokeredMessageProperties\", &s.BrokeredMessageProperties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"customMessageProperties\":\n\t\t\terr = unpopulate(val, \"CustomMessageProperties\", &s.CustomMessageProperties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"message\":\n\t\t\terr = unpopulate(val, \"Message\", &s.Message)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"namespace\":\n\t\t\terr = unpopulate(val, \"Namespace\", &s.Namespace)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"transportType\":\n\t\t\terr = unpopulate(val, \"TransportType\", &s.TransportType)\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": "07e9d6450d1c8ae03b479183de71e00e", "score": "0.59885746", "text": "func (p *PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &p.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.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\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e704258a83d8f22c38825933b4b2d16", "score": "0.5988426", "text": "func (c *CaseSettings) UnmarshalJSON(data []byte) error {\n\tif bytes.Equal(data, []byte(\"null\")) {\n\t\treturn nil\n\t}\n\n\tsettings := struct {\n\t\tName string\n\t\tWeight float64\n\t}{}\n\n\tif err := json.Unmarshal(data, &settings); err != nil {\n\t\treturn err\n\t}\n\n\tc.Name = settings.Name\n\tc.Weight = base.FloatToRational(settings.Weight)\n\n\treturn nil\n}", "title": "" }, { "docid": "7e704258a83d8f22c38825933b4b2d16", "score": "0.5988426", "text": "func (c *CaseSettings) UnmarshalJSON(data []byte) error {\n\tif bytes.Equal(data, []byte(\"null\")) {\n\t\treturn nil\n\t}\n\n\tsettings := struct {\n\t\tName string\n\t\tWeight float64\n\t}{}\n\n\tif err := json.Unmarshal(data, &settings); err != nil {\n\t\treturn err\n\t}\n\n\tc.Name = settings.Name\n\tc.Weight = base.FloatToRational(settings.Weight)\n\n\treturn nil\n}", "title": "" }, { "docid": "ab4627e990007bbceda795cc976cf062", "score": "0.59849", "text": "func (d *DedicatedSQLminimalTLSSettingsListResult) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &d.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &d.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce84282a7b129682319ae000af540fd2", "score": "0.5983992", "text": "func (e *EventHubDataConnection) 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 \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &e.Location)\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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &e.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &e.SystemData)\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": "0284bd76759a539c2bfa8561cc7b85d3", "score": "0.59812605", "text": "func (t *ThroughputSettingsUpdateProperties) 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 \"resource\":\n\t\t\terr = unpopulate(val, \"Resource\", &t.Resource)\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": "befea262d5c8341f7c6dc7d3bd73f143", "score": "0.59771365", "text": "func (t *ThroughputSettingsUpdateParameters) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &t.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"identity\":\n\t\t\terr = unpopulate(val, \"Identity\", &t.Identity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &t.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &t.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &t.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &t.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &t.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7c096555a0e154a8b553f9c03b526768", "score": "0.5975598", "text": "func (p *PrivateEndpointConnectionProperties) 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 \"groupId\":\n\t\t\terr = unpopulate(val, \"GroupID\", &p.GroupID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"privateEndpoint\":\n\t\t\terr = unpopulate(val, \"PrivateEndpoint\", &p.PrivateEndpoint)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"privateLinkServiceConnectionState\":\n\t\t\terr = unpopulate(val, \"PrivateLinkServiceConnectionState\", &p.PrivateLinkServiceConnectionState)\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": "55740d7026fbdc20e7c5abf8f7116956", "score": "0.5974546", "text": "func (conns *Connections) UnmarshalJSON(b []byte) error {\n\ttemp := &ConnectionsJSON{}\n\n\tif err := json.Unmarshal(b, &temp); err != nil {\n\t\treturn err\n\t}\n\n\tconns.Set(temp.Get)\n\tconns.SetCapacity(temp.Capacity)\n\n\treturn nil\n}", "title": "" }, { "docid": "1903efc7a13a4dc6b05d84a6b0e799df", "score": "0.59739083", "text": "func (b *BackupDatasourceParameters) 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 \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &b.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", b, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4e904b0444b8ba5042f5091cd5eaf9a5", "score": "0.59660226", "text": "func (s *SettingList) 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 \"value\":\n\t\t\ts.Value, err = unmarshalSettingsClassificationArray(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\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
fdbc428558e200422d09b26abc7e88c4
GoString returns the string representation
[ { "docid": "bd167759b76c8fc56772e2906a7fe7bb", "score": "0.0", "text": "func (s UpdateTaskOutput) GoString() string {\n\treturn s.String()\n}", "title": "" } ]
[ { "docid": "e6516517db33bb95292abc5f4156a08b", "score": "0.7943146", "text": "func runtime_gostring(p *byte) string", "title": "" }, { "docid": "80817c1a66bbd5156b72988406cfbc11", "score": "0.6700026", "text": "func runtime_gostringn(p *byte, l int) string", "title": "" }, { "docid": "24e603de995205f8e169f397fe0b1f31", "score": "0.6692388", "text": "func (t *Type) String() string {\n\treturn tconv(t, 0, fmtGo)\n}", "title": "" }, { "docid": "41cae57996a7d2110c3ae1dc8ab97da5", "score": "0.6547913", "text": "func String(string string) dgo.String {\n\treturn internal.String(string)\n}", "title": "" }, { "docid": "f5800e29dad75c396f29d8a22b217508", "score": "0.65233046", "text": "func (g *GoInterface) String() string {\n\treturn fmt.Sprint(g.v.Interface())\n}", "title": "" }, { "docid": "28b2ae09abedeba732c7ad6701273c8d", "score": "0.6512911", "text": "func (slf *Pubcomp) String() string {\n\tb, _ := json.Marshal(slf)\n\treturn string(b)\n}", "title": "" }, { "docid": "5645b98d27ab43fcddf45cf0f14ffaee", "score": "0.6512714", "text": "func (v Version) String() string {\n\tjv, _ := json.Marshal(v)\n\treturn string(jv)\n}", "title": "" }, { "docid": "0ae27b48e8bda9517a6858259957e2ca", "score": "0.64947844", "text": "func WriteGoString(\n\tval interface{},\n\tuseGoStringer bool,\n\tindentAt int,\n\tbuf *bytes.Buffer,\n) {\n\t// write multiple strings to buffer\n\tvar ws = func(a ...string) {\n\t\tfor _, s := range a {\n\t\t\tbuf.WriteString(s)\n\t\t}\n\t}\n\tvar writeGoString = func(val interface{}) {\n\t\tWriteGoString(val, useGoStringer, indentAt, buf)\n\t}\n\tif val == nil {\n\t\tws(\"nil\")\n\t\treturn\n\t}\n\tif useGoStringer {\n\t\tswitch val := val.(type) {\n\t\tcase GoStringerEx:\n\t\t\tws(val.GoStringEx(indentAt))\n\t\t\treturn\n\t\tcase fmt.GoStringer:\n\t\t\tws(val.GoString())\n\t\t\treturn\n\t\t}\n\t}\n\tvar v = reflect.ValueOf(val)\n\tvar t = reflect.TypeOf(val)\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\tif v.Bool() {\n\t\t\tws(\"true\")\n\t\t} else {\n\t\t\tws(\"false\")\n\t\t}\n\t\treturn\n\tcase reflect.Int,\n\t\treflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tws(String(v.Int()))\n\t\treturn\n\tcase reflect.Uint,\n\t\treflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\tws(String(v.Uint()))\n\t\treturn\n\tcase reflect.Uintptr:\n\t\t//TODO: handle Uintptr\n\t\tbreak\n\tcase reflect.Float32, reflect.Float64:\n\t\tws(String(v.Float()))\n\t\treturn\n\tcase reflect.Complex64, reflect.Complex128, reflect.Array,\n\t\treflect.Chan, reflect.Func, reflect.Interface:\n\t\t//TODO: handle multiple types\n\t\tbreak\n\tcase reflect.Map:\n\t\tws(\"map[\", t.Key().String(), \"]\", t.Elem().String(), \"{\")\n\t\t//\n\t\t// since MapKeys are returned in no specific order,\n\t\t// append each key-value in map to a string array\n\t\t// then sort it to ensure the result is consistent\n\t\tvar lines = make([]string, 0, v.Len())\n\t\tfor _, key := range v.MapKeys() {\n\t\t\tlines = append(lines,\n\t\t\t\tTabSpace+GoString(key.Interface())+\": \"+\n\t\t\t\t\tGoString(v.MapIndex(key).Interface())+\",\")\n\t\t}\n\t\tsort.Strings(lines)\n\t\t//\n\t\t// write out the array\n\t\tfor _, s := range lines {\n\t\t\tws(LF, s)\n\t\t}\n\t\tws(LF, \"}\")\n\t\treturn\n\tcase reflect.Ptr:\n\t\twriteGoString(v.Elem().Interface())\n\t\treturn\n\tcase reflect.Slice:\n\t\tws(t.String(), \"{\")\n\t\tvar manyLines = v.Len() > 0 && v.Index(0).Kind() == reflect.Slice\n\t\tfor i, n := 0, v.Len(); i < n; i++ {\n\t\t\tif i > 0 {\n\t\t\t\tws(\",\")\n\t\t\t}\n\t\t\tif manyLines {\n\t\t\t\tws(LF, TabSpace)\n\t\t\t} else if i > 0 {\n\t\t\t\tws(\" \")\n\t\t\t}\n\t\t\twriteGoString(v.Index(i).Interface())\n\t\t}\n\t\tif manyLines {\n\t\t\tws(\",\", LF)\n\t\t}\n\t\tws(\"}\")\n\t\treturn\n\tcase reflect.String:\n\t\tws(`\"`, str.Replace(val.(string), `\"`, `\\\"`, -1), `\"`)\n\t\treturn\n\tcase reflect.Struct:\n\t\tws(t.String(), \"{\")\n\t\tfor i, n := 0, t.NumField(); i < n; i++ {\n\t\t\tif !v.Field(i).CanInterface() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif i > 0 {\n\t\t\t\tws(\", \")\n\t\t\t}\n\t\t\tws(t.Field(i).Name, \": \")\n\t\t\twriteGoString(v.Field(i).Interface())\n\t\t}\n\t\tws(\"}\")\n\t\treturn\n\tcase reflect.UnsafePointer:\n\t\tbreak //TODO: reflect.UnsafePointer\n\t}\n\t// finally, try using fmt.Stringer (treat 'val' as a string)\n\tif val, ok := val.(fmt.Stringer); ok {\n\t\tws(GoString(val.String()))\n\t\treturn\n\t}\n\t// if 'val' is still not processed, log an error, try to use fmt.Sprint()\n\tmod.Error(\"Type\", t, \"(kind:\", v.Kind(), \") not handled:\", val)\n\tws(\"(\", fmt.Sprint(val), \")\")\n}", "title": "" }, { "docid": "2fb77efe33f82f163f714c99d0e56bae", "score": "0.64865786", "text": "func String() string {\n\treturn GetBuild().String()\n}", "title": "" }, { "docid": "6dc338bcdadc502172cdc05b52ce9e3e", "score": "0.64535403", "text": "func (s Vpc) String() string {\n\treturn sdfutil.Prettify(s)\n}", "title": "" }, { "docid": "a7e7099499a03d78c65416f8254002a8", "score": "0.6447218", "text": "func (rawMsg RawMessage) String() string {\n\tjsonMsg, _ := json.Marshal(rawMsg)\n\treturn string(jsonMsg)\n}", "title": "" }, { "docid": "47f1269ec2f459622c3055a00238cd6c", "score": "0.64460886", "text": "func (v *Version) String() string {\n\tout := make([]byte, v.outSize())\n\tv.stringFill(out, 0)\n\n\treturn string(out)\n}", "title": "" }, { "docid": "643aa8287921fee78c1966837217f220", "score": "0.6431201", "text": "func (g LineString) String() string {\n\treturn g.JSON()\n}", "title": "" }, { "docid": "a7d00f472f1359f8b095612305bf338d", "score": "0.6410058", "text": "func (p Pozycje) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "36c4aceb4376e57af84796f9758b4c2b", "score": "0.63828665", "text": "func String() string {\n\treturn fmt.Sprintf(\n\t\t`Version: %s\nGo version: %s\nOS/Arch: %s/%s\nCgo enabled: %v`,\n\t\tgitCommit,\n\t\truntime.Version(),\n\t\truntime.GOOS,\n\t\truntime.GOARCH,\n\t\tcgoEnabled,\n\t)\n}", "title": "" }, { "docid": "cc2ae2feac20802be7fb760aff01843e", "score": "0.63792247", "text": "func (n *JSONMessage) String() string {\n\tb, _ := json.Marshal(n)\n\treturn string(b)\n}", "title": "" }, { "docid": "77d166a2086235a15e53e79ef7cf4802", "score": "0.63468605", "text": "func (s Vpc) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "71f413605ae335535b8c8d9f571a4708", "score": "0.6334609", "text": "func (phpVal *PHPValue) String(depth int) string {\n\tswitch phpVal.Type {\n\tcase PhpTypeBoolean:\n\t\treturn util.NewValue(phpVal.Value).String()\n\tcase PhpTypeNumber:\n\t\treturn util.NewValue(phpVal.Value).String()\n\tcase PhpTypeString:\n\t\treturn fmtPhpString(util.NewValue(phpVal.Value).String())\n\tcase PhpTypeArray:\n\t\tphpArr := phpVal.Value.(*PHPArray)\n\t\treturn phpArr.String(depth)\n\tcase PhpTypeValue:\n\t\tphpVal := phpVal.Value.(*PHPValue)\n\t\treturn phpVal.String(depth)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "39f213c64a9e00b795594197dfa3bc7c", "score": "0.6332661", "text": "func (g Gifts) String() string {\n\tjg, _ := json.Marshal(g)\n\treturn string(jg)\n}", "title": "" }, { "docid": "ee21006ff910e96cbdc2b00369cdaab8", "score": "0.6327756", "text": "func (g *Graph) String() string {\n\tb := new(bytes.Buffer)\n\tg.Write(b)\n\treturn b.String()\n}", "title": "" }, { "docid": "ad9aaf91be0ce4afc64d078761300a16", "score": "0.62876904", "text": "func (g Gift) String() string {\n\tjg, _ := json.Marshal(g)\n\treturn string(jg)\n}", "title": "" }, { "docid": "649244d9500dfff23dc21833fd23e51e", "score": "0.62744004", "text": "func (p Pozycjes) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "666980441b516cdd15af81dd5d5b4009", "score": "0.626932", "text": "func (v *Value) String() string {\n\ts := C.ValueToString(v.ptr)\n\tdefer C.free(unsafe.Pointer(s))\n\n\treturn C.GoString(s)\n}", "title": "" }, { "docid": "5d3ff46048c5c404af70ba5c979fdb5d", "score": "0.6258394", "text": "func (sc *scenario) String() string {\n\treturn fmt.Sprintf(\"%v\", sc.proto)\n}", "title": "" }, { "docid": "0a4a7f12f3cf826b5f304a3b2feae5a6", "score": "0.6250936", "text": "func (self *Node) String() (string, error) {\n if err := self.checkRaw(); err != nil {\n return \"\", err\n }\n switch self.t {\n case types.V_NULL : return \"\" , nil\n case types.V_TRUE : return \"true\" , nil\n case types.V_FALSE : return \"false\", nil\n case types.V_STRING, _V_NUMBER : return rt.StrFrom(self.p, self.v), nil\n case _V_ANY : \n any := self.packAny()\n switch v := any.(type) {\n case bool : return strconv.FormatBool(v), nil\n case int : return strconv.Itoa(v), nil\n case int8 : return strconv.Itoa(int(v)), nil\n case int16 : return strconv.Itoa(int(v)), nil\n case int32 : return strconv.Itoa(int(v)), nil\n case int64 : return strconv.Itoa(int(v)), nil\n case uint : return strconv.Itoa(int(v)), nil\n case uint8 : return strconv.Itoa(int(v)), nil\n case uint16 : return strconv.Itoa(int(v)), nil\n case uint32 : return strconv.Itoa(int(v)), nil\n case uint64 : return strconv.Itoa(int(v)), nil\n case float32: return strconv.FormatFloat(float64(v), 'g', -1, 64), nil\n case float64: return strconv.FormatFloat(float64(v), 'g', -1, 64), nil\n case string : return v, nil \n case json.Number: return v.String(), nil\n default: return \"\", ErrUnsupportType\n }\n default : return \"\" , ErrUnsupportType\n }\n}", "title": "" }, { "docid": "c904cd4086840619326558532d62714b", "score": "0.6241794", "text": "func (v *Value) String() string {\n\ts := C.ValueToString(v.ptr)\n\tdefer C.free(unsafe.Pointer(s))\n\treturn C.GoString(s)\n}", "title": "" }, { "docid": "1619517730962b314a1e434870cf8a64", "score": "0.6205959", "text": "func (o *Createmetric) 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": "fb48a1bf666c333e1b47d8b027b04430", "score": "0.61953145", "text": "func cGoStringN(s *C.OraText, size int) string {\n\tif size == 0 {\n\t\treturn \"\"\n\t}\n\tp := (*[1 << 30]byte)(unsafe.Pointer(s))\n\tbuf := make([]byte, size)\n\tcopy(buf, p[:])\n\treturn *(*string)(unsafe.Pointer(&buf))\n}", "title": "" }, { "docid": "5aac9c696ccd3231872dd107172ee8cc", "score": "0.61932075", "text": "func String(buf []byte) string {\n\treturn *(*string)(unsafe.Pointer(&buf))\n}", "title": "" }, { "docid": "5ee2fa8e2c753ce8f126f35ab9d789d3", "score": "0.6190572", "text": "func (b *Buffer) String() string { return string(*b) }", "title": "" }, { "docid": "b6535ec92dd01ad9c7486966e52b61a3", "score": "0.61883146", "text": "func (msg *Bytes) String() string {\n\treturn string(*msg)\n}", "title": "" }, { "docid": "a199eaf9d4c3ecde502820fcc48378b8", "score": "0.6182592", "text": "func GoStr(s string) C.GoStr {\n\th := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\treturn C.GoStr{\n\t\tlen: C.ulong(h.Len),\n\t\tdata: (*C.char)(unsafe.Pointer(h.Data)),\n\t}\n}", "title": "" }, { "docid": "6bbb18f1824ea313ec5ee9dea2ca7a5d", "score": "0.61648136", "text": "func (w *wrapper) String() string {\n\treturn w.json\n}", "title": "" }, { "docid": "2736e9c185cf23f0a2889d65ab40d3d6", "score": "0.61644745", "text": "func (p KeyValuePair) String() string {\n\tvar f Marshaller = JSONMarshaller{}\n\tif p.marshaller != nil {\n\t\tf = p.marshaller\n\t}\n\n\tbytes, err := f.Marshal(p)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(bytes)\n}", "title": "" }, { "docid": "7ad446464bf0fb67cc9524c0299ce036", "score": "0.61488116", "text": "func (p *Packet) String() string {\n\tb, _ := json.MarshalIndent(p, \"\", \" \")\n\treturn goutil.BytesToString(b)\n}", "title": "" }, { "docid": "26328216b05bfb2fcb7a373a3dcc7a61", "score": "0.6148177", "text": "func (b ByteArray) String() string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "f46e5b6e993e2438dc5fb3e678fb78a9", "score": "0.61352795", "text": "func TWStringGoString(s unsafe.Pointer) string {\n\treturn C.GoString(C.TWStringUTF8Bytes(s))\n}", "title": "" }, { "docid": "f46e5b6e993e2438dc5fb3e678fb78a9", "score": "0.61352795", "text": "func TWStringGoString(s unsafe.Pointer) string {\n\treturn C.GoString(C.TWStringUTF8Bytes(s))\n}", "title": "" }, { "docid": "0a97369dee9bf1ff7041c0d8451e29f0", "score": "0.6122358", "text": "func (o *Reportingturn) 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": "b4cf9fd94b252fb4c418f53b15c58bc0", "score": "0.6114144", "text": "func String() string {\n\tg := getCurrentGame()\n\treturn g.string()\n}", "title": "" }, { "docid": "3c78ba784afb8ce9b2607e8a23b70300", "score": "0.61108816", "text": "func String(s string) string {\n\treturn fmt.Sprintf(\"%q\", ValueOf(s))\n}", "title": "" }, { "docid": "23155bc138264a8c5fcdfd51c0282899", "score": "0.61060184", "text": "func (s GsmObj) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6ecbec9be28e2d37cb6c31deadf6b636", "score": "0.610362", "text": "func (s Sprzedawcy) String() string {\n\tjs, _ := json.Marshal(s)\n\treturn string(js)\n}", "title": "" }, { "docid": "e4fafd956978e3fddb5169768e91a0cd", "score": "0.6103184", "text": "func (n *node) String() string {\n\tvar buf bytes.Buffer\n\tn.writeDebugString(&buf, \"\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "cb6af1f6937791758bb954f9c0cef0a9", "score": "0.6101932", "text": "func (o *Callbasic) String() string {\n \n \n \n \n \n \n \n \n \n \n \n o.Segments = []Segment{{}} \n \n \n \n \n \n \n \n o.DisconnectReasons = []Disconnectreason{{}} \n \n \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": "2393e34c3e8237f8061ed8607e39ef70", "score": "0.60898405", "text": "func (ver *Version) String() string {\n\treturn ver.raw\n}", "title": "" }, { "docid": "0f83070f366ef0a2c8180109c9813ae0", "score": "0.60896957", "text": "func (b *Buffer) String() string {}", "title": "" }, { "docid": "ae5f9f968ab74e728a752b3426acc304", "score": "0.6086347", "text": "func (meta MsgMeta) String() string {\n\tb, err := json.Marshal(meta)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"%+v (marshal error: %v)\", meta, err)\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "969cfaed00288ad61d7c7bd9933b91b4", "score": "0.6082152", "text": "func (v Versions) String() string {\n\tjv, _ := json.Marshal(v)\n\treturn string(jv)\n}", "title": "" }, { "docid": "3a1f67be91f5b4a58be464aab80edd0b", "score": "0.60748774", "text": "func (s AbpV11) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "561e0e1274d1cb0367dc25310a76b085", "score": "0.6071419", "text": "func (p *PGBabelMessage) String() string {\n\ts, _ := json.Marshal(p.babel)\n\treturn string(s)\n}", "title": "" }, { "docid": "88e4fbac697c3e03d117942f4f5320b9", "score": "0.60605264", "text": "func (c *CheckEngine) String() string {\n if err, str := utils.ObjectToJsonString(c); err != nil{\n return err.Error()\n } else{\n return str\n }\n}", "title": "" }, { "docid": "af74e72c3bfaddd08d04e615c327c2be", "score": "0.6060501", "text": "func (b *CByteBuf) String() string {\n\treturn fastconv.B2S(b.Bytes())\n}", "title": "" }, { "docid": "4490d5be3dd870d03e161760aebde77a", "score": "0.60581523", "text": "func (sb *stringBuilder) String() string {\n\treturn *(*string)(unsafe.Pointer(&sb.buf))\n}", "title": "" }, { "docid": "e21a1ab5ca03c7089165a7befd9519ab", "score": "0.60498285", "text": "func (*GoFlags) String(o, d, c string) *string {\n\treturn flag.String(o, d, c)\n}", "title": "" }, { "docid": "e21a1ab5ca03c7089165a7befd9519ab", "score": "0.60498285", "text": "func (*GoFlags) String(o, d, c string) *string {\n\treturn flag.String(o, d, c)\n}", "title": "" }, { "docid": "5cc44bb9a18177d6fea18330b80e47c2", "score": "0.6031549", "text": "func (c *Context) JSONString(v interface{}) (string, error) {\n\tvar re []byte\n\tvar err error\n\tif c.baa.debug {\n\t\tre, err = json.MarshalIndent(v, \"\", \" \")\n\t} else {\n\t\tre, err = json.Marshal(v)\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(re), nil\n}", "title": "" }, { "docid": "c5637e01f1a535d6141a551eedb0df30", "score": "0.6031479", "text": "func (b *ByteBuffer) String() string {\n\treturn string(b.B)\n}", "title": "" }, { "docid": "7d57ed4888299589771fc1dc7b4f782f", "score": "0.6018171", "text": "func (o *Botconnectorbotversion) String() string {\n \n o.SupportedLanguages = []string{\"\"} \n o.Intents = []Botintent{{}} \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": "d47a5ab2f2a8a1964430860fe24332d2", "score": "0.6017038", "text": "func (c *Composer) String() string {\n\treturn c.buf.String()\n}", "title": "" }, { "docid": "1137b4cc55252b3a23e1d088e3c4c11b", "score": "0.601643", "text": "func (p Params) String() string {\n\tvalue, err := json.Marshal(p)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(value)\n}", "title": "" }, { "docid": "1264c0f11e53c4c18f6d1cf70a19cf42", "score": "0.6014445", "text": "func (o *Dialogflowagentsummary) 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": "aa51741aa6dcaf2f3f856930bb3bcde7", "score": "0.6014067", "text": "func (w *backendSvcDesc) JSONString() (string, error) {\n\tb, err := json.Marshal(w)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"marshal backend service description: %w\", err)\n\t}\n\treturn fmt.Sprintf(\"%s\\n\", b), nil\n}", "title": "" }, { "docid": "2dfce89c4c73ba039e03c26753fe6b4b", "score": "0.60081756", "text": "func (d *dumper) String() string {\n\treturn Dump(d.obj)\n}", "title": "" }, { "docid": "ab60073fd03d1ca2dea5dc0fd03d2a16", "score": "0.60012466", "text": "func (v GoVer) String() string {\n\tswitch {\n\tcase v.Z != 0:\n\t\treturn fmt.Sprintf(\"%d.%d.%d\", v.X, v.Y, v.Z)\n\tcase v.Y != 0:\n\t\treturn fmt.Sprintf(\"%d.%d\", v.X, v.Y)\n\tdefault:\n\t\treturn fmt.Sprintf(\"%d\", v.X)\n\t}\n}", "title": "" }, { "docid": "92b32b85522aff3a95ebe2d16b753f8b", "score": "0.5999608", "text": "func (msg EhMessage) String() string {\n\tjsonMsg, _ := json.Marshal(msg)\n\treturn string(jsonMsg)\n}", "title": "" }, { "docid": "60ec3516e896addb1551a58c824d7a38", "score": "0.5996865", "text": "func (b *ByteCode) String() string {\n\tbuf := rbpool.Get()\n\tdefer rbpool.Release(buf)\n\n\tfmt.Fprintf(buf,\n\t\t\"// Bytecode for '%s'\\n// Generated On: %s\\n\",\n\t\tb.Name,\n\t\tb.GeneratedOn,\n\t)\n\tfor k, v := range b.OpList {\n\t\tfmt.Fprintf(buf, \"%03d. %s\\n\", k+1, v)\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "80fbf40aedf068d102a460d531f977fe", "score": "0.5988366", "text": "func (s PipelineObject) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "947e51f827aea0052b0c21b5ae6fa8e1", "score": "0.5986866", "text": "func (s Gnss) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cd90079e0b11468c7ac7442b5d3edfd9", "score": "0.59824675", "text": "func (o *Developmentactivity) 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": "160f1f0a731e4c1fc80687d1acf06ab4", "score": "0.59816295", "text": "func (self *Surrogate) String() string {\n\tphantom := struct {\n\t\tinputs uint\n\t\toutputs uint\n\t\tnodes uint\n\t}{\n\t\tinputs: self.Inputs,\n\t\toutputs: self.Outputs,\n\t\tnodes: self.Nodes,\n\t}\n\treturn fmt.Sprintf(\"%+v\", phantom)\n}", "title": "" }, { "docid": "be9c943dcb8ebea1b9bf0b9b9d0dee36", "score": "0.597741", "text": "func (c *ConvertUsing) String() string {\n\treturn fmt.Sprintf(\"CONVERT(%s USING %s)\", c.Child.String(), c.TargetCharSet.Name())\n}", "title": "" }, { "docid": "19f65cadec2e7a70b5b9dc79e27b9895", "score": "0.5974977", "text": "func (v Value) String() string {\n\tswitch v.Type {\n\tcase NullValue:\n\t\treturn \"NULL\"\n\tcase TextValue:\n\t\treturn strconv.Quote(v.V.(string))\n\tcase BlobValue:\n\t\treturn stringutil.Sprintf(\"%v\", v.V)\n\t}\n\n\td, _ := v.MarshalJSON()\n\treturn string(d)\n}", "title": "" }, { "docid": "ed8707831e4cd5bec8878ea398378819", "score": "0.59615475", "text": "func (o *Webmessagingeventcobrowse) 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": "f07b541673ffb9dad4c02451ef22cb37", "score": "0.5957267", "text": "func String(v interface{}) string {\n\treturn fmt.Sprintf(\"%v\", v)\n}", "title": "" }, { "docid": "f14de30c749a891561199c11003ec1d5", "score": "0.5951245", "text": "func (o *Mergeoperation) String() string {\n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "63c56e3eeecdc8ef657476c39356444c", "score": "0.59488946", "text": "func (s CdmaObj) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "72ba4190e319f31e060f03e145f26ece", "score": "0.5948154", "text": "func String(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "72ba4190e319f31e060f03e145f26ece", "score": "0.5948154", "text": "func String(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "72ba4190e319f31e060f03e145f26ece", "score": "0.5948154", "text": "func String(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "72ba4190e319f31e060f03e145f26ece", "score": "0.5948154", "text": "func String(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "100eb519e1c43983f7ea0018cada454a", "score": "0.59419507", "text": "func (c Coffee) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "ce8e082d9aef80e2dc7352b6171beb50", "score": "0.5935889", "text": "func (gen *Generator) String() string {\n\tbytes := gen.Bytes()\n\n\treturn hex.EncodeToString(bytes[:])\n}", "title": "" }, { "docid": "623a578fa006b0dda7bbbdc5f6915fd4", "score": "0.59335387", "text": "func (c Combination) String() string {\n\treturn fmt.Sprintf(\"OS: %s, JDK: %s, DB: %s\", c.OS, c.JDK, c.DB)\n}", "title": "" }, { "docid": "bd12f237d20886c6c535ac41b48042d0", "score": "0.5927902", "text": "func (o *Analyticsagentgroup) 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": "11b2e51c5afab61f59c7b3fe60b86157", "score": "0.5925295", "text": "func (v Variant) String() string {\n\ts, unamb := v.format()\n\tif !unamb {\n\t\treturn \"@\" + v.sig.str + \" \" + s\n\t}\n\treturn s\n}", "title": "" }, { "docid": "c2aaaac1a5f934f1558f886707914779", "score": "0.59219694", "text": "func (q *Quad) String() string {\n\tstr := make([]byte, C.DECQUAD_String) // TODO: escapes to heap, need to check how fmt uses sync.Pool\n\tpStr := (*C.char)(unsafe.Pointer(&str[0]))\n\tC.decQuadToString((*C.decQuad)(q), pStr)\n\treturn string(str[:C.strlen(pStr)])\n}", "title": "" }, { "docid": "0977f2db2fc462732ec453563d877916", "score": "0.5918775", "text": "func deriveGoString_21(this *Variable) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() *ast.Variable {\\n\")\n\tif this == nil {\n\t\tfmt.Fprintf(buf, \"return nil\\n\")\n\t} else {\n\t\tfmt.Fprintf(buf, \"this := &ast.Variable{}\\n\")\n\t\tfmt.Fprintf(buf, \"this.Type = %#v\\n\", this.Type)\n\t\tfmt.Fprintf(buf, \"return this\\n\")\n\t}\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.591256", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.591256", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.591256", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.591256", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.591256", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "30c4c71e16ff6ee1240f5a19dab8fffb", "score": "0.59111", "text": "func JString(goStr string) *heap.Object {\n\tinternedStr := getInternedString(goStr)\n\tif internedStr != nil {\n\t\treturn internedStr\n\t}\n\n\tchars := _stringToUtf16(goStr)\n\tcharArr := heap.NewCharArray(chars)\n\tjStr := heap.BootLoader().JLStringClass().NewObj()\n\tjStr.SetFieldValue(\"value\", \"[C\", charArr)\n\treturn InternString(goStr, jStr)\n}", "title": "" }, { "docid": "9ba8ae7f6032296f79c8791dd832539d", "score": "0.5906141", "text": "func (obj *JsonObject) AsStr() string {\n\tproxyResult := /*pr4*/ C.vssc_json_object_as_str(obj.cCtx)\n\n\truntime.KeepAlive(obj)\n\n\treturn C.GoString(C.vsc_str_chars(proxyResult)) /* r5.1 */\n}", "title": "" }, { "docid": "c58a64999452f115399639c955795817", "score": "0.59035", "text": "func (json JSON) String() (str string) {\n\tsb := poolStringBuilder.Get().(*StringBuilder)\n\tjson.encode(sb)\n\tstr = sb.String()\n\tsb.Reset()\n\tpoolStringBuilder.Put(sb)\n\treturn\n}", "title": "" }, { "docid": "d5959df38b1862fc847cccdb0cf44b0d", "score": "0.59004486", "text": "func toString(v Value) string {\n\tbuf := new(strings.Builder)\n\twriteValue(buf, v, nil)\n\treturn buf.String()\n}", "title": "" }, { "docid": "0182b187e6a677dc658d57e9caadcc92", "score": "0.5897439", "text": "func AsString(v interface{}) (string, bool) {\n\tswitch d := indirect(v).(type) {\n\tcase string:\n\t\treturn d, true\n\tcase bool:\n\t\treturn strconv.FormatBool(d), true\n\tcase int:\n\t\treturn strconv.FormatInt(int64(d), 10), true\n\tcase int64:\n\t\treturn strconv.FormatInt(d, 10), true\n\tcase int32:\n\t\treturn strconv.FormatInt(int64(d), 10), true\n\tcase int16:\n\t\treturn strconv.FormatInt(int64(d), 10), true\n\tcase int8:\n\t\treturn strconv.FormatInt(int64(d), 10), true\n\tcase uint:\n\t\treturn strconv.FormatUint(uint64(d), 10), true\n\tcase uint64:\n\t\treturn strconv.FormatUint(d, 10), true\n\tcase uint32:\n\t\treturn strconv.FormatUint(uint64(d), 10), true\n\tcase uint16:\n\t\treturn strconv.FormatUint(uint64(d), 10), true\n\tcase uint8:\n\t\treturn strconv.FormatUint(uint64(d), 10), true\n\tcase float64:\n\t\treturn strconv.FormatFloat(d, 'f', -1, 64), true\n\tcase float32:\n\t\treturn strconv.FormatFloat(float64(d), 'f', -1, 64), true\n\tcase []byte:\n\t\treturn string(d), true\n\tdefault:\n\t\treturn \"\", false\n\t}\n}", "title": "" }, { "docid": "b122bc9ba4be73a28ecb2def8115f53d", "score": "0.58957", "text": "func (g Geometries) String() string {\n\treturn string(g)\n}", "title": "" }, { "docid": "04c84095045ebe0f11fabad4f753f593", "score": "0.58951676", "text": "func String(value types.Type) (string, error) {\n\tsnippet, err := Format(value)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\toutput := \"\"\n\tfor _, token := range snippet.Dump() {\n\t\toutput += token.Text\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "0db46e4d413d7ef3e68390fe7046ed48", "score": "0.58914363", "text": "func (s RedactChannelMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
d7af79dea88b5283526e027fa1340c07
Dumps the configuration internal map into a string.
[ { "docid": "f3ac05c9673c3648a26209d673b50b68", "score": "0.0", "text": "func (config *PropertiesConfig) ToString() string {\n\treturn fmt.Sprintf(\"%s\", config.properties)\n}", "title": "" } ]
[ { "docid": "0cbfffc95b5c68a23d9da83b32bc1688", "score": "0.7538787", "text": "func (c MapConfig) String() string {\n\treturn fmt.Sprintf(\"mapID:%d biases:{%v} #operations:%d emit every:%v ignoreErrors? %t\",\n\t\tc.MapID, c.EPBias, c.Operations, c.EmitInterval, c.IgnoreErrors)\n}", "title": "" }, { "docid": "7c62344ba8e23412149f9075df1bb0d0", "score": "0.72596246", "text": "func (s FilledMapConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8fdab1feb23dd0aac4b75aadb830ba2b", "score": "0.709978", "text": "func (s GeospatialMapConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fb7d74127a7e8f08dd5f8875774cb957", "score": "0.7096145", "text": "func (s HeatMapConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8d8bee2bf987230187abf438514db4a8", "score": "0.69814837", "text": "func (s TreeMapConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f625f13ce0274f49be8f1aa3b143b827", "score": "0.6874855", "text": "func (lhmap *LinkedHashmap) String() string {\n\treturn spew.Sprint(lhmap.Values())\n}", "title": "" }, { "docid": "1075d2359081bff5bafe7e3a4b6d5d00", "score": "0.68222016", "text": "func (pmap Map) String() string {\n\tlist := make([]string, len(pmap.Keys))\n\tfor i, v := range pmap.Keys {\n\t\tlist[i] = fmt.Sprintf(`%s:%v`, v, fmt.Sprint(pmap.Data[v]))\n\t}\n\treturn `map[` + strings.Join(list, ` `) + `]`\n}", "title": "" }, { "docid": "eb86b4e9cce327d2f68033bbbfd43cc3", "score": "0.6818007", "text": "func (c *Data) String() string {\n\tallSettings := c.v.AllSettings()\n\ty, err := yaml.Marshal(&allSettings)\n\tif err != nil {\n\t\tlog.WithFields(map[string]interface{}{\n\t\t\t\"settings\": allSettings,\n\t\t\t\"err\": err,\n\t\t}).Panicln(\"Failed to marshall config to string\")\n\t}\n\treturn fmt.Sprintf(\"%s\\n\", y)\n}", "title": "" }, { "docid": "6facdabde5ba023085b0dc2027d84794", "score": "0.6750575", "text": "func (c *Config) Dump() map[string]any {\n\treturn c.m.Dump()\n}", "title": "" }, { "docid": "764f5f179a94abfacdb00cd6ca7af0f8", "score": "0.67474264", "text": "func (c *Config) Dump() {\n\ts, err := json.Marshal(c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Printf(\"CONFIG = %v\\n\", string(s))\n}", "title": "" }, { "docid": "764f5f179a94abfacdb00cd6ca7af0f8", "score": "0.67474264", "text": "func (c *Config) Dump() {\n\ts, err := json.Marshal(c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Printf(\"CONFIG = %v\\n\", string(s))\n}", "title": "" }, { "docid": "534beb53fa49cb631fbb5d7e7d1aa1c8", "score": "0.6696382", "text": "func (c *Config) String() string {\n\treturn c.ConfigMap.String()\n}", "title": "" }, { "docid": "b9eb67fdd017b2753c7a45b32403e41b", "score": "0.66767454", "text": "func (m *Map) String() string {\n\tf := strconv.FormatFloat(m.LoadFactor(), 'f', 3, 64)\n\treturn fmt.Sprintf(\n\t\t\"[%T \"+\n\t\t\t\"buckets=%p count=%v debug=%v \"+\n\t\t\t\"bytesPerKey=%v keysPerBucket=%v bucketCount=%v bucketPower=%v \"+\n\t\t\t\"expandable=%v expansionCount=%v zeroHash2Count=%v valuesByteCount=%v \"+\n\t\t\t\"seed1=%#x seed2=%#x hasher1=%p hasher2=%p r=%p \"+\n\t\t\t\"loadFactor=%v memoryInBytes=%v\"+\n\t\t\t\"]\",\n\t\tMap{}, m.buckets, m.count, m.debug,\n\t\tm.bytesPerKey, m.keysPerBucket, m.bucketCount, m.bucketPower,\n\t\tm.expandable, m.expansionCount, m.zeroHash2Count, m.valuesByteCount,\n\t\tm.seed1, m.seed2, m.hasher1, m.hasher2, m.r,\n\t\tf, formatByteSize(m.MemoryInBytes()),\n\t)\n}", "title": "" }, { "docid": "1d153e7e40d1ee598d2f3043019b6e57", "score": "0.66361916", "text": "func (conf *Config) String() string {\n\tcfg, err := json.Marshal(conf)\n\tif err != nil && conf.Logger != nil {\n\t\tconf.Logger.Error(\"fail to marshal config to json\", zap.Error(err))\n\t}\n\treturn string(cfg)\n}", "title": "" }, { "docid": "d2fde1d40cfe67b486eee77d75a79ae3", "score": "0.66267586", "text": "func (c Config) String() string {\n\tb, _ := json.MarshalIndent(c, \"\", \" \")\n\treturn fmt.Sprintf(\"config: \\n%v\\n\", string(b))\n}", "title": "" }, { "docid": "13cad68f3e6d8dc4bbcbc44ea3cdea40", "score": "0.6606252", "text": "func (s OutputConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7ca06d1d0ed5d613c6a6f58346b7f3a5", "score": "0.65775734", "text": "func (s GeospatialHeatmapConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "01c7f7a2607312522e7699ad48f0aa2c", "score": "0.6564292", "text": "func (s CloudWatchOutputConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "95746fcd3aed97b9d9b06047438b5cbc", "score": "0.65616", "text": "func (s OutputDataConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2a8fa34ab4aa08ae0b311a95c57c8424", "score": "0.65555465", "text": "func (c *Config) String() string {\n\tout, _ := yaml.Marshal(c)\n\treturn string(out)\n}", "title": "" }, { "docid": "bb949c841bd5920e1dbcdb8b25da2730", "score": "0.6497583", "text": "func (s ConfigurationRecorder) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ec81c4757da98ec0b293138b2aed8e29", "score": "0.6468792", "text": "func (c *Config) DumpStr() string {\n\ts, err := json.MarshalIndent(c, \"\", \"\\t\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(s)\n}", "title": "" }, { "docid": "ec81c4757da98ec0b293138b2aed8e29", "score": "0.6468792", "text": "func (c *Config) DumpStr() string {\n\ts, err := json.MarshalIndent(c, \"\", \"\\t\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(s)\n}", "title": "" }, { "docid": "84461bf698d4be6af98d744a4689d5ec", "score": "0.645421", "text": "func (s DetailsMap) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7dc0a4d4533f83039ba6b9923f350047", "score": "0.6453279", "text": "func (c *Config) String() string {\n\tconfig, err := json.Marshal(c)\n\tif err != nil {\n\t\tlog.Errorln(err)\n\t}\n\treturn string(config)\n}", "title": "" }, { "docid": "4b693f85f7172cf03f7be368940ae7a2", "score": "0.6420337", "text": "func DumpConfig() string {\n\tb, _ := json.MarshalIndent(Config, \"\", \" \")\n\treturn string(b)\n}", "title": "" }, { "docid": "3e6a1c26d96cfed67fff8539b0834fb1", "score": "0.64142615", "text": "func (s InsightConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "89b800dccce90f428bd2ade693067f96", "score": "0.6413385", "text": "func (cfg Config) String() string {\n\tif cfg.Empty() {\n\t\treturn \"\"\n\t}\n\n\treturn fmt.Sprintf(\"\\t ~!~ cert:\\t%q\\n\\t ~!~ key:\\t%q\\n\\t ~!~ ca:\\t%q,\\n\\t ~!~ insecure:\\t%t\\n\\t ~!~ level:\\t%s\\n\",\n\t\tcfg.Cert, cfg.Key, cfg.Ca, cfg.Insecure, cfg.Level)\n}", "title": "" }, { "docid": "bce5affc64ef301e018c3964a7530380", "score": "0.64112914", "text": "func (bc *BuildableConfig) String() string {\n\treturn fmt.Sprintf(\"%s:%s\", bc.name, string(bc.config))\n}", "title": "" }, { "docid": "c9b3ccd6a9d1a84a904fec78ad17b6d7", "score": "0.6403698", "text": "func (c Config) String() string {\n\treturn fmt.Sprintf(\"{root: '%s', baseName: '%s', savePath: '%s', ignoredDirs: %v}\", c.root, c.baseName, c.savePath, c.ignoredDirs)\n}", "title": "" }, { "docid": "4002dd927011760a0e1b19ea5fc0913a", "score": "0.6401975", "text": "func (c Config) String() string {\n\tb, err := json.MarshalIndent(c, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "16fc3a6fc269fbef2e01f285c402d652", "score": "0.6392574", "text": "func (s ApplicationSnapshotConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a4f988be5f4aa7c526efa2a5b5871ccb", "score": "0.63849527", "text": "func (_IniT) ToStr(iniMap map[string]map[string]string) string {\r\n\tout := \"\"\r\n\r\n\tif namelessSection, hasSection := iniMap[\"\"]; hasSection { // blank section?\r\n\t\tfor k, v := range namelessSection {\r\n\t\t\tout += k + \"=\" + v + \"\\r\\n\"\r\n\t\t}\r\n\t\tout += \"\\r\\n\"\r\n\t}\r\n\r\n\tfor sectionName, section := range iniMap {\r\n\t\tif sectionName == \"\" { // skip blank section, already written if any\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\tout += \"[\" + sectionName + \"]\\n\"\r\n\t\tfor k, v := range section {\r\n\t\t\tout += k + \"=\" + v + \"\\r\\n\"\r\n\t\t}\r\n\r\n\t\tout += \"\\r\\n\"\r\n\t}\r\n\r\n\treturn out\r\n}", "title": "" }, { "docid": "ce064202a079952127a828b4a64e3b68", "score": "0.63749164", "text": "func (s FlinkApplicationConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "954e6e0e6e4ed32593797c8241966446", "score": "0.6369217", "text": "func (c *MayaConfig) String() string {\n\treturn stringer.Yaml(\"maya config\", c)\n}", "title": "" }, { "docid": "007aed9dfcd0da45b245a1b660d48fbb", "score": "0.6367232", "text": "func (config Configuration) String() string {\n\tjson, _ := json.Marshal(config)\n\treturn string(json)\n}", "title": "" }, { "docid": "23b9621a1e01506af07e3d2d657aea40", "score": "0.63637066", "text": "func (m *HashMap[K, V]) String() string {\n\treturn fmt.Sprint(m.hmap)\n}", "title": "" }, { "docid": "4bd57ed66c1decae1fbc4f55b391c777", "score": "0.63599515", "text": "func (c Config) Printable() ([]byte, error) {\n\tconst hiddenValue = \"********\"\n\tif c.DB.Password != \"\" {\n\t\tc.DB.Password = hiddenValue\n\t}\n\tif c.Telemetry.SegmentMasterKey != \"\" {\n\t\tc.Telemetry.SegmentMasterKey = hiddenValue\n\t}\n\tif c.Telemetry.SegmentWebUIKey != \"\" {\n\t\tc.Telemetry.SegmentWebUIKey = hiddenValue\n\t}\n\tif c.TaskContainerDefaults.RegistryAuth != nil {\n\t\tif c.TaskContainerDefaults.RegistryAuth.Password != \"\" {\n\t\t\t// RegistryAuth is a pointer, so if we need to hide the password we need to be very\n\t\t\t// careful to replace the pointer, not the contents behind the pointer.\n\t\t\tprintable := *c.TaskContainerDefaults.RegistryAuth\n\t\t\tprintable.Password = hiddenValue\n\t\t\tc.TaskContainerDefaults.RegistryAuth = &printable\n\t\t}\n\t}\n\n\tc.CheckpointStorage = c.CheckpointStorage.Printable()\n\n\tpools := make([]ResourcePoolConfig, 0, len(c.ResourcePools))\n\tfor _, poolConfig := range c.ResourcePools {\n\t\tpools = append(pools, poolConfig.Printable())\n\t}\n\tc.ResourcePools = pools\n\n\toptJSON, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to convert config to JSON\")\n\t}\n\treturn optJSON, nil\n}", "title": "" }, { "docid": "5ae48fc8ad32332252941ee034731b9b", "score": "0.63525105", "text": "func (s VpcConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "29dd5464e583d1a8c26ceca0cdd7aee6", "score": "0.6351103", "text": "func (s JsonConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "eca52ecbc584638bca638c51824b3179", "score": "0.6350128", "text": "func (c *Config) String() string {\n\treturn fmt.Sprintf(\"Config:\\nHostport:%s\\nSendRoutines:%d\\nRecvRoutines:%d\\n\", c.Hostport, c.SendRoutines, c.RecvRoutines)\n}", "title": "" }, { "docid": "46d938b7e97ca5b8e3c9789b152f568f", "score": "0.63468635", "text": "func (m *Map) String() string {\n\tvar a []string\n\tfor k, v := range m.data {\n\t\ta = append(a, fmt.Sprintf(\"%s%s%s\", k, string(m.keyValueDelimiter), v))\n\t}\n\treturn strings.Join(a, string(m.entryDelimiter))\n}", "title": "" }, { "docid": "33caa0f103067d5a481da4c97ce48fcd", "score": "0.63410676", "text": "func (s LoggingConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e96b393301eeeb042569ab323b103e1e", "score": "0.63336086", "text": "func (m Map) String() string {\n\treturn fmt.Sprintf(\"%v\", map[string]string(m))\n}", "title": "" }, { "docid": "62cfcb071173863148f6bca63ed4814e", "score": "0.63255775", "text": "func (s HsmConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "99d173b695ff0aa23ae3811656dfcabe", "score": "0.63171315", "text": "func (config Config) String() string {\n\tjsonStr, _ := json.Marshal(config)\n\treturn string(jsonStr)\n}", "title": "" }, { "docid": "3ed39fcef06c58a352828a0fb374e87d", "score": "0.6287961", "text": "func (s ZeppelinApplicationConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "dfa9329aa2fa5b0dd460bc2e97d28dab", "score": "0.62869257", "text": "func (cfg *Config) String() string {\n\treturn jsonString(cfg)\n}", "title": "" }, { "docid": "2fc97174d71658a32fc03f667f23c000", "score": "0.6286331", "text": "func (m MemoryMap) String() string {\n\treturn fmt.Sprintf(\"[0x%x, 0x%x) (len: 0x%x, size: 0x%x, type: %d)\", m.BaseAddr, m.BaseAddr+m.Length, m.Length, m.Size, m.Type)\n}", "title": "" }, { "docid": "775f7fca285fd0b2d99b7b80346b6478", "score": "0.6284694", "text": "func (s ZoneAwarenessConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "20b89a9d6d99b6f0083a0929380e1ee5", "score": "0.62721854", "text": "func (s VpcConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "20b89a9d6d99b6f0083a0929380e1ee5", "score": "0.62721854", "text": "func (s VpcConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4e52e85da4aea3fa70f8c93d3a873a46", "score": "0.6260275", "text": "func (s SectionBasedLayoutConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ebbc9ec3d05c7dd77829ba1f93fea827", "score": "0.6251956", "text": "func (s KPIConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a75e634e60e3ca16b3246fa1649ee704", "score": "0.6250714", "text": "func (s S3ExportConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7ec2bf1faf64dc4bc167abd2bdacd7f4", "score": "0.62502635", "text": "func (s FormatConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "019ef0567a093941ac02e868fede58db", "score": "0.6246468", "text": "func (s TreeMapSortConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c40166f2ce08822e28c6be25998cc380", "score": "0.62414706", "text": "func (s AddonsConfig) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "1bb8021e4657559a6b724f17615f3520", "score": "0.6237495", "text": "func (s LoggingConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "98054d4916c10f2b2faa855f836416e1", "score": "0.6233682", "text": "func (s FilledMapSortConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2eddb7c45034c0f1cd0164f86666d980", "score": "0.6225027", "text": "func (s RenderingConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a522e645f53e0ec070a211b81e08e253", "score": "0.62233144", "text": "func (s ClusterMarkerConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b83b4e6f1c7c3aad495846e57040d3c9", "score": "0.6214963", "text": "func (config *ContainerConfig) String() string {\n\treturn fmt.Sprintf(\"\\n\\n[CONFIGURATION]\\n[User] %s\\n[Ports] %s\\n[Environment] %s\\n[Roles] %s\\n[Volumes] %s\\n[Resources Limits] %s\\n[Resources Requests] %s\\n\\n\",\n\t\tconfig.User+\", \",\n\t\tstrings.Join(config.Ports, \", \"),\n\t\tstrings.Join(config.Environment, \", \"),\n\t\tstrings.Join(config.Roles, \", \"),\n\t\tstrings.Join(config.Volumes, \", \"),\n\t\tstrings.Join(config.Resources.Limits, \", \"),\n\t\tstrings.Join(config.Resources.Requests, \", \"),\n\t)\n}", "title": "" }, { "docid": "ec899e1476507e78e6360777b189e2e4", "score": "0.62104696", "text": "func (m Map) String() string {\n\tj, err := m.Json()\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn string(j)\n}", "title": "" }, { "docid": "9c1bdd0ef206d1e108d712eea16279a1", "score": "0.62048286", "text": "func (s SqlApplicationConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b7aafb795c1c80ab455cb8762bfa2d96", "score": "0.6204615", "text": "func (s EngineConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a7b1a99cb5566dd14a2f899a350d1750", "score": "0.6201863", "text": "func (m Maps) String() string {\n\tvar buf bytes.Buffer\n\tbuf.WriteString(\"[\")\n\n\tchainSize := len(m)\n\tfor k, mm := range m {\n\t\tvar i int\n\t\tmax := mm.Len()\n\t\tbuf.WriteString(\"{\")\n\t\tfor elem := range mm.Iterate() {\n\t\t\tcollections.StringEncoder(&buf, elem.Key, collections.DetermineDataType(elem.Key))\n\t\t\tbuf.WriteRune(':')\n\t\t\tcollections.StringEncoder(&buf, elem.Value, collections.DetermineDataType(elem.Value))\n\t\t\tif i+1 < max {\n\t\t\t\tbuf.WriteRune(',')\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tbuf.WriteString(\"}\")\n\t\tif k+i < chainSize {\n\t\t\tbuf.WriteString(\", \")\n\t\t}\n\t}\n\tbuf.WriteString(\"]\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "da0f40efbb67d27f05f7d4addba53982", "score": "0.61991274", "text": "func (conf *ScryptConf) String() string {\n\treturn fmt.Sprintf(\"&{rounds: %d, R: %d, P: %d, KeyLen: %d}\", conf.rounds, conf.R, conf.P, conf.KeyLen)\n}", "title": "" }, { "docid": "2fe49079e2627dc5f2078b7ca661b570", "score": "0.61988735", "text": "func (s TLSInspectionConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e922746a6c4631d9d04c3566d6ad12d3", "score": "0.6197222", "text": "func (c *Config) String() (s string) {\n\tindent := 1\n\tcmma := comma\n\tcnt := len(c.sortKeys())\n\ts += fmt.Sprintf(\"{\\n%v%q: [{\\n\", tabs(indent), \"nodes\")\n\n\tfor i, pkey := range c.sortKeys() {\n\t\tif i == cnt-1 {\n\t\t\tcmma = null\n\t\t}\n\n\t\tindent++\n\t\ts += fmt.Sprintf(\"%v%q: {\\n\", tabs(indent), pkey)\n\t\tindent++\n\n\t\ts += fmt.Sprintf(\"%v%q: %q,\\n\", tabs(indent), disabled,\n\t\t\tbooltoStr(c.tree[pkey].disabled))\n\t\ts = is(indent, s, \"ip\", c.tree[pkey].ip)\n\t\ts += getJSONArray(&cfgJSON{array: c.tree[pkey].exc, pk: pkey, leaf: \"excludes\", indent: indent})\n\n\t\tif pkey != rootNode {\n\t\t\ts += getJSONArray(&cfgJSON{array: c.tree[pkey].inc, pk: pkey, leaf: \"includes\", indent: indent})\n\t\t\ts += getJSONsrcArray(&cfgJSON{Config: c, pk: pkey, indent: indent})\n\t\t}\n\n\t\tindent--\n\t\ts += fmt.Sprintf(\"%v}%v\\n\", tabs(indent), cmma)\n\t\tindent--\n\t}\n\n\ts += tabs(indent) + \"}]\\n}\"\n\n\treturn s\n}", "title": "" }, { "docid": "b79ab6b5bea1456514425d1004bee8ee", "score": "0.6196593", "text": "func (c *ClientJWTConfiguration) String() string {\n\treturn Stringify(c)\n}", "title": "" }, { "docid": "6e1a94a8161a7323c87bff84705dfdfd", "score": "0.6196128", "text": "func (m *srcmap) String() string {\n\tlog.RLock()\n\tdefer log.RUnlock()\n\n\toff := \"\"\n\ton := \"\"\n\tfor src, state := range *m {\n\t\tif state {\n\t\t\tif on == \"\" {\n\t\t\t\ton = src\n\t\t\t} else {\n\t\t\t\ton += \",\" + src\n\t\t\t}\n\t\t} else {\n\t\t\tif off == \"\" {\n\t\t\t\toff = src\n\t\t\t} else {\n\t\t\t\toff += \",\" + src\n\t\t\t}\n\t\t}\n\t}\n\n\tif off == \"\" {\n\t\treturn \"on:\" + on\n\t}\n\tif on == \"\" {\n\t\treturn \"off:\" + off\n\t}\n\n\treturn \"on:\" + on + \",\" + \"off:\" + off\n}", "title": "" }, { "docid": "e1e1233d2d9f0d0e711d94a44ff5ab74", "score": "0.61948776", "text": "func (s SectionLayoutConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "655b6fd289c5e0e72e9431bb2bab696f", "score": "0.6192122", "text": "func (s ApplicationConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "20c178bed49534b9d92b7b0804c75a97", "score": "0.6191566", "text": "func (c *DBConfig) String() string {\n\tcfg, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn \"<nil>\"\n\t}\n\treturn string(cfg)\n}", "title": "" }, { "docid": "b28017c46fdf53bcfc2f9252d9b6bebc", "score": "0.61828065", "text": "func (s EventInfoMap) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6463778428c61d2941ce4ea2179d2d0c", "score": "0.6180104", "text": "func (s DecimalPlacesConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7e20bba7c614974a9477aa6b8c88f1b7", "score": "0.61719906", "text": "func (s DefaultSectionBasedLayoutConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "456a5f14bdaf92c7bc49dc73ac21a52f", "score": "0.61717314", "text": "func (s RegisteredUserQuickSightConsoleEmbeddingConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9467e09e020749708804c146c5a24722", "score": "0.6169507", "text": "func (s HeatMapSortConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b08608a82dbc3f15ff20d1927d80a055", "score": "0.6165063", "text": "func (s RegisteredUserDashboardEmbeddingConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5a28257705c38333c92cebca443812e4", "score": "0.6155909", "text": "func (o *Scimserviceproviderconfig) 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": "7a453f16ad249372f649d0c832953482", "score": "0.6155605", "text": "func (s SheetVisualScopingConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "78387b8239a0786d25a77dff47e182a7", "score": "0.615432", "text": "func (s GlueDataCatalogConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c840ea26e20c31b643dca18b16f8e6ed", "score": "0.6147018", "text": "func (s ReferenceLineDataConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "789ddd42785be07ad18d88873ee7efb2", "score": "0.6146034", "text": "func (s SiteConfig) String() string {\n\tjs, _ := json.Marshal(s)\n\treturn string(js)\n}", "title": "" }, { "docid": "7ea021d2f8ea218ac5e3d283e6c3a510", "score": "0.61437136", "text": "func (s PublicAccessBlockConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "24241f7966f1a440d10ef4e638452af0", "score": "0.61422044", "text": "func (m Map) String() string {\n\tif m == nil {\n\t\treturn \"{}\"\n\t}\n\tbuf, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"could not marshal object: %v\", err)\n\t}\n\treturn string(buf)\n}", "title": "" }, { "docid": "fa89a3716d089fb130ff46ef8572ca8f", "score": "0.6137371", "text": "func (s CompatibleVersionsMap) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "53187cb7bb1d41eb106b32d1e99d0f71", "score": "0.61372465", "text": "func (s FreeFormSectionLayoutConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "59977f6a9e5d685d97d1dae3688120aa", "score": "0.6137003", "text": "func (s GetConfigurationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9f62f317ef64ba4df1c081269a007ecc", "score": "0.6134068", "text": "func (s GetLoggingConfigurationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5c55e366fd546c471e2c41be899a4e10", "score": "0.6131123", "text": "func (s ServerConfig) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "329cad38a38ac4e774e480294568e016", "score": "0.61280096", "text": "func (m Map[K, V]) String() string {\n\treturn fmt.Sprintf(\"%v\", m)\n}", "title": "" }, { "docid": "8693d2f0974562ea43b8c257751723c7", "score": "0.6127906", "text": "func String(conf interface{}) string {\n\tv := reflect.ValueOf(conf)\n\tstr := str(v, 1)\n\n\treturn \"Config:\\n\" + str\n}", "title": "" }, { "docid": "2fe57d673cb8a376fa819b5749836b2a", "score": "0.6125986", "text": "func (s SuiteDefinitionConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "888bd7e0187938666e9f7061095af8f9", "score": "0.6121469", "text": "func (s DataSetConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "888bd7e0187938666e9f7061095af8f9", "score": "0.6121469", "text": "func (s DataSetConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5cf52fddf543c29067fc6dffaf6db82b", "score": "0.61155856", "text": "func (s LogDestinationConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6e55e80d391710d5419be7f11016bfe1", "score": "0.6110202", "text": "func (s HeaderFooterSectionConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "30dc594d4e6e8acb994bc38d575233e3", "score": "0.6110035", "text": "func (s ServerSideEncryptionConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
0d4fc15a28661e34da49054860789af0
The permissions assigned to the shared access policy.
[ { "docid": "8aefbba34b23464ff9fb28b46b4ccfcc", "score": "0.51874465", "text": "func (o SharedAccessSignatureAuthorizationRuleOutput) Rights() AccessRightsOutput {\n\treturn o.ApplyT(func(v SharedAccessSignatureAuthorizationRule) AccessRights { return v.Rights }).(AccessRightsOutput)\n}", "title": "" } ]
[ { "docid": "2da5103b8716b8b3e3b9c298a369d649", "score": "0.7379214", "text": "func (o IoTHubSharedAccessPolicyOutput) Permissions() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IoTHubSharedAccessPolicy) *string { return v.Permissions }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4e70bc53e011bd3dc7358ec4c297be05", "score": "0.6566502", "text": "func (r *repository) Permissions(accessToken string) (map[string]string, error) {\n\ttype perm struct {\n\t\tPermission string `json:\"permission\"`\n\t\tStatus string `json:\"status\"`\n\t}\n\tvar perms struct {\n\t\tData []perm `json:\"data\"`\n\t}\n\n\turlStr := fmt.Sprintf(\"/me/permissions?access_token=%s\", accessToken)\n\treq, err := http.NewRequest(http.MethodGet, urlStr, nil)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tif _, err := r.client.Do(req, &perms); err != nil {\n\t\treturn nil, wrapErr(err)\n\t}\n\n\tpermissions := make(map[string]string)\n\tfor _, p := range perms.Data {\n\t\tpermissions[p.Permission] = p.Status\n\t}\n\n\treturn permissions, nil\n}", "title": "" }, { "docid": "56e7033666d6d0b56ad6a3ed390702fd", "score": "0.6513906", "text": "func (m *Site) GetPermissions()([]Permissionable) {\n val, err := m.GetBackingStore().Get(\"permissions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]Permissionable)\n }\n return nil\n}", "title": "" }, { "docid": "800b5c67f980286ef8194918dffeb5f1", "score": "0.63767856", "text": "func (o UserAccessPolicyResponseOutput) Permissions() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserAccessPolicyResponse) *string { return v.Permissions }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "96dd06de7012cfafcee492e4fbb51a19", "score": "0.62594616", "text": "func OperPermissions() []Permission {\n\tps := []Permission{}\n\tfor _, r := range AllResources {\n\t\tfor _, a := range actions {\n\t\t\tps = append(ps, Permission{Action: a, Resource: r})\n\t\t}\n\t}\n\n\treturn ps\n}", "title": "" }, { "docid": "02d2c5ba41f4274c8df80fa43d8607fb", "score": "0.6192231", "text": "func (o AccessPointCreationInfoOutput) Permissions() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AccessPointCreationInfo) string { return v.Permissions }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ae739172350c786df5df4232412038c2", "score": "0.61515445", "text": "func (c *Cache) Permissions(storage interface{}, p string) (*provider.ResourcePermissions, error) {\n\tentry, err := c.Get(storage, p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tperms, err := conversions.NewPermissions(entry.Permissions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn conversions.RoleFromOCSPermissions(perms).CS3ResourcePermissions(), nil\n}", "title": "" }, { "docid": "cd073bd4f12a74dd7ba8d7f675227b93", "score": "0.61263454", "text": "func (o *FileProjectFilesResponseIncluded) GetPermissions() map[string]ViewFilePermissions {\n\tif o == nil || o.Permissions == nil {\n\t\tvar ret map[string]ViewFilePermissions\n\t\treturn ret\n\t}\n\treturn *o.Permissions\n}", "title": "" }, { "docid": "5f757d84866d7be2906d28a49c23b732", "score": "0.6106911", "text": "func (o SecurityProfileOutput) Permissions() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *SecurityProfile) pulumi.StringArrayOutput { return v.Permissions }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "070f549e6e55820d36fa88c362d4f166", "score": "0.60658574", "text": "func (vs *VServers) Permissions(ctx context.Context, lVServer int64) (*VServerPermissions, error) {\n\tpostData := []byte(fmt.Sprintf(`{\"lVServer\": %d}`, lVServer))\n\trequest, err := http.NewRequest(\"POST\", vs.client.Server+\"/api/v1.0/VServers.GetPermissions\", bytes.NewBuffer(postData))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvServerPermissions := new(VServerPermissions)\n\t_, err = vs.client.Do(ctx, request, &vServerPermissions)\n\treturn vServerPermissions, err\n}", "title": "" }, { "docid": "7cb246de06bc87caf2ae2cfa3c31f27f", "score": "0.5992941", "text": "func (o AccessPointCreationInfoPtrOutput) Permissions() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AccessPointCreationInfo) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Permissions\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b7c0832efc8ee2bf28afcbfb6123d8f7", "score": "0.5956886", "text": "func (o StorageAccountKeyResponseOutput) Permissions() pulumi.StringOutput {\n\treturn o.ApplyT(func(v StorageAccountKeyResponse) string { return v.Permissions }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "12e1b2bd33406527ed7ceaf700822eeb", "score": "0.59058595", "text": "func getAllPermissions() map[string][]bakery.Op {\n\tsubserverPermissions := getSubserverPermissions()\n\tlndPermissions := lnd.MainRPCServerPermissions()\n\tmapSize := len(subserverPermissions) + len(lndPermissions)\n\tresult := make(map[string][]bakery.Op, mapSize)\n\tfor key, value := range lndPermissions {\n\t\tresult[key] = value\n\t}\n\tfor key, value := range subserverPermissions {\n\t\tresult[key] = value\n\t}\n\treturn result\n}", "title": "" }, { "docid": "e2e3604c1c9fd6228b07e73b2589d381", "score": "0.5903048", "text": "func (o LookupAccessPolicyResultOutput) SecretPermissions() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupAccessPolicyResult) []string { return v.SecretPermissions }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "399b95e52b0f91bee63c05661583d937", "score": "0.5903039", "text": "func (pa PermissionsForAddress) GetPermissions() []string {\n\treturn pa.permissions\n}", "title": "" }, { "docid": "6aa404ddb405a33df5555f67f106e714", "score": "0.5898834", "text": "func (s *Service) Permissions(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tsrcID, err := paramID(\"id\", r)\n\tif err != nil {\n\t\tError(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)\n\t\treturn\n\t}\n\n\tsrc, err := s.Store.Sources(ctx).Get(ctx, srcID)\n\tif err != nil {\n\t\tnotFound(w, srcID, s.Logger)\n\t\treturn\n\t}\n\n\tts, err := s.TimeSeries(src)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"unable to connect to source %d: %v\", srcID, err)\n\t\tError(w, http.StatusBadRequest, msg, s.Logger)\n\t\treturn\n\t}\n\n\tif err = ts.Connect(ctx, &src); err != nil {\n\t\tmsg := fmt.Sprintf(\"unable to connect to source %d: %v\", srcID, err)\n\t\tError(w, http.StatusBadRequest, msg, s.Logger)\n\t\treturn\n\t}\n\n\tperms := ts.Permissions(ctx)\n\tif err != nil {\n\t\tError(w, http.StatusBadRequest, err.Error(), s.Logger)\n\t\treturn\n\t}\n\thttpAPISrcs := \"/chronograf/v1/sources\"\n\tres := struct {\n\t\tPermissions chronograf.Permissions `json:\"permissions\"`\n\t\tLinks map[string]string `json:\"links\"` // Links are URI locations related to user\n\t}{\n\t\tPermissions: perms,\n\t\tLinks: map[string]string{\n\t\t\t\"self\": fmt.Sprintf(\"%s/%d/permissions\", httpAPISrcs, srcID),\n\t\t\t\"source\": fmt.Sprintf(\"%s/%d\", httpAPISrcs, srcID),\n\t\t},\n\t}\n\tencodeJSON(w, http.StatusOK, res, s.Logger)\n}", "title": "" }, { "docid": "7d5b9c7c82d0eb43d04c01232f28a8d7", "score": "0.5880802", "text": "func PossiblePermissionsValues() []Permissions {\n\treturn []Permissions{PermissionsDelete, PermissionsEdit, PermissionsNoaccess, PermissionsView}\n}", "title": "" }, { "docid": "9ebe7af5f2628d3a9d232036f0701760", "score": "0.58749664", "text": "func PossibleShareAccessTypeValues() []ShareAccessType {\n\treturn []ShareAccessType{\n\t\tShareAccessTypeChange,\n\t\tShareAccessTypeCustom,\n\t\tShareAccessTypeRead,\n\t}\n}", "title": "" }, { "docid": "b4c3e711af9ebc703b36c8edd58cb243", "score": "0.58711606", "text": "func (o *CreateWorkspaceInvitation) GetPermissions() string {\n\tif o == nil || IsNil(o.Permissions) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Permissions\n}", "title": "" }, { "docid": "d86b4ee9cb8e799ce088acc3f59c1497", "score": "0.57930535", "text": "func (o *VLAN) Permissions(info *bambou.FetchingInfo) (PermissionsList, *bambou.Error) {\n\n\tvar list PermissionsList\n\terr := bambou.CurrentSession().FetchChildren(o, PermissionIdentity, &list, info)\n\treturn list, err\n}", "title": "" }, { "docid": "0cd65375f4ab771542c6de2405164534", "score": "0.57706475", "text": "func (c *perPathConfigsReaderV1) getPermissions(p string, username *string) (\n\tpermissions permissionsV1, max permissionsV1, effectivePath string) {\n\t// This is only called on the root perPathConfigsReaderV1, and c.ac is always\n\t// populated here. So even if no other path shows up in the per-path\n\t// configs, any path will get root's *perPathConfigV1 as the last resort.\n\tac := c.getPerPathConfig(nil, p)\n\tpermissions = ac.anonymous\n\tif ac.whitelistAdditional == nil || username == nil {\n\t\treturn permissions, ac.maxPermission, ac.p\n\t}\n\tif perms, ok := ac.whitelistAdditional[*username]; ok {\n\t\tpermissions.read = perms.read || permissions.read\n\t\tpermissions.list = perms.list || permissions.list\n\t}\n\treturn permissions, ac.maxPermission, ac.p\n}", "title": "" }, { "docid": "a8a0dece3bdb8d6dc3519ac8ca58a36d", "score": "0.5765852", "text": "func (o SqlRoleDefinitionOutput) Permissions() SqlRoleDefinitionPermissionArrayOutput {\n\treturn o.ApplyT(func(v *SqlRoleDefinition) SqlRoleDefinitionPermissionArrayOutput { return v.Permissions }).(SqlRoleDefinitionPermissionArrayOutput)\n}", "title": "" }, { "docid": "2685c758f2b6da829a5b38bf0ac359ca", "score": "0.57103693", "text": "func (o AccessPointRootDirectoryCreationInfoOutput) Permissions() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AccessPointRootDirectoryCreationInfo) string { return v.Permissions }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "981956abc3ed7802e41c28610dd21ea3", "score": "0.56983227", "text": "func (m *RoleDefinition) GetRolePermissions()([]RolePermissionable) {\n val, err := m.GetBackingStore().Get(\"rolePermissions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]RolePermissionable)\n }\n return nil\n}", "title": "" }, { "docid": "a26c2a5a9043239dcfbea136e0b0723f", "score": "0.56866556", "text": "func (o CatalogDatabaseCreateTableDefaultPermissionOutput) Permissions() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v CatalogDatabaseCreateTableDefaultPermission) []string { return v.Permissions }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "e89d4baf304326a9bcacef2dc9624ad5", "score": "0.5679493", "text": "func PermissionsMode_Values() []string {\n\treturn []string{\n\t\tPermissionsModeAllowAll,\n\t\tPermissionsModeStandard,\n\t}\n}", "title": "" }, { "docid": "c3cbb5a9da3aba82b17d174c87632cfd", "score": "0.5674162", "text": "func (ex *Execution) AccessList() types.AccessList { return ex.accessList }", "title": "" }, { "docid": "7aae23f12d882428e90bbb19719c86b2", "score": "0.5668129", "text": "func (o *InlineResponse20090Stats) GetPermissions() InlineResponse20090StatsPermissions {\n\tif o == nil || o.Permissions == nil {\n\t\tvar ret InlineResponse20090StatsPermissions\n\t\treturn ret\n\t}\n\treturn *o.Permissions\n}", "title": "" }, { "docid": "403459ef781a4bdfcba92cc2d920d6c3", "score": "0.5645265", "text": "func (f *fsClient) GetAccess() (access string, policyJSON string, err *probe.Error) {\n\t// For windows this feature is not implemented.\n\tif runtime.GOOS == \"windows\" {\n\t\treturn \"\", \"\", probe.NewError(APINotImplemented{API: \"GetAccess\", APIType: \"filesystem\"})\n\t}\n\tst, err := f.fsStat(false)\n\tif err != nil {\n\t\treturn \"\", \"\", err.Trace(f.PathURL.String())\n\t}\n\tif !st.Mode().IsDir() {\n\t\treturn \"\", \"\", probe.NewError(APINotImplemented{API: \"GetAccess\", APIType: \"filesystem\"})\n\t}\n\t// Mask with os.ModePerm to get only inode permissions\n\tswitch st.Mode() & os.ModePerm {\n\tcase os.FileMode(0777):\n\t\treturn \"readwrite\", \"\", nil\n\tcase os.FileMode(0555):\n\t\treturn \"readonly\", \"\", nil\n\tcase os.FileMode(0333):\n\t\treturn \"writeonly\", \"\", nil\n\t}\n\treturn \"none\", \"\", nil\n}", "title": "" }, { "docid": "ca3ddeb4b1b97e298c6d8218e0f3fcb5", "score": "0.56394637", "text": "func (o KafkaSchemaRegistryAclOutput) Permission() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *KafkaSchemaRegistryAcl) pulumi.StringOutput { return v.Permission }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "142408e64d5f9524c6302bc3201463fc", "score": "0.56349945", "text": "func (srv *AccessControlServer) GetPermissions(\n\tctx context.Context,\n\treq *accessprotos.AccessControl_PermissionsRequest,\n) (*accessprotos.AccessControl_Entity, error) {\n\tres := &accessprotos.AccessControl_Entity{}\n\terr := accessprotos.VerifyPermissionsRequest(req)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tacl, err := srv.store.GetACL(req.Operator)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tres.Id = req.Entity\n\tres.Permissions = accessprotos.GetEntityPermissions(acl, res.Id) // Aggregated entity permissions\n\treturn res, nil\n}", "title": "" }, { "docid": "ecc6dffe18b6aba975f26f4bb4172cbd", "score": "0.5633612", "text": "func getSubserverPermissions() map[string][]bakery.Op {\n\tmapSize := len(frdrpc.RequiredPermissions) +\n\t\tlen(loopd.RequiredPermissions) + len(pool.RequiredPermissions)\n\tresult := make(map[string][]bakery.Op, mapSize)\n\tfor key, value := range frdrpc.RequiredPermissions {\n\t\tresult[key] = value\n\t}\n\tfor key, value := range loopd.RequiredPermissions {\n\t\tresult[key] = value\n\t}\n\tfor key, value := range pool.RequiredPermissions {\n\t\tresult[key] = value\n\t}\n\treturn result\n}", "title": "" }, { "docid": "6478310554341d0da603c65e37e894a4", "score": "0.56259215", "text": "func PossibleShareAccessProtocolValues() []ShareAccessProtocol {\n\treturn []ShareAccessProtocol{\n\t\tShareAccessProtocolNFS,\n\t\tShareAccessProtocolSMB,\n\t}\n}", "title": "" }, { "docid": "c4e19bdbe5b13e53e8b31be2abac22e6", "score": "0.55921435", "text": "func PossiblePublicAccessValues() []PublicAccess {\n\treturn []PublicAccess{\n\t\tPublicAccessContainer,\n\t\tPublicAccessBlob,\n\t\tPublicAccessNone,\n\t}\n}", "title": "" }, { "docid": "d02ea79fe320034b32837e61e51c0cfd", "score": "0.559075", "text": "func (m *DriveItemItemRequestBuilder) Permissions()(*ifda175920025647e9407948753f11cc7a3fabff7fd6e426cf29edc97c408e5c2.PermissionsRequestBuilder) {\n return ifda175920025647e9407948753f11cc7a3fabff7fd6e426cf29edc97c408e5c2.NewPermissionsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "5213504cf6e0a142f61dd62972677f9b", "score": "0.55770504", "text": "func OrgAdminPermissions(orgID ID) []Permission {\n\tps := []Permission{}\n\tfor _, r := range OrgResources {\n\t\tfor _, a := range actions {\n\t\t\tps = append(ps, Permission{ID: &orgID, Action: a, Resource: r})\n\t\t}\n\t}\n\n\treturn ps\n}", "title": "" }, { "docid": "ed1a03afee7b13c9230714da35797f6a", "score": "0.5540869", "text": "func (o *UpdateUserPermissionsRequest) GetPermissions() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\n\treturn o.Permissions\n}", "title": "" }, { "docid": "f4fb379440ad427cc89b356b2addd10f", "score": "0.55345756", "text": "func (a Auth0) Allowed(token string, perm introspector.Permission, expectedScopes ...string) (*introspector.Introspection, bool, error) {\n\ti, err := a.Introspect(token)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\n\t// Check scopes and permissions\n\tscopes := strings.Split(i.Scope, \" \")\n\tpermScope := perm.Action + \":\" + perm.Resource\n\tfound := false\n\tfor _, scope := range expectedScopes {\n\t\tif !in(scopes, scope) {\n\t\t\treturn i, false, errors.New(\"missing scope \" + scope)\n\t\t}\n\n\t\tif scope == permScope {\n\t\t\tfound = true\n\t\t}\n\t}\n\n\tif !found {\n\t\treturn i, false, errors.New(\"cannot \" + perm.Action + \" \" + perm.Resource)\n\t}\n\n\treturn i, true, nil\n}", "title": "" }, { "docid": "a9d33cdab7ec1a4bd45a7f823455014e", "score": "0.5530329", "text": "func OrgMemberPermissions(orgID ID) []Permission {\n\tps := []Permission{}\n\tfor _, r := range OrgResources {\n\t\tps = append(ps, Permission{ID: &orgID, Action: ReadAction, Resource: r})\n\t}\n\n\treturn ps\n}", "title": "" }, { "docid": "32467304d9d8aca80830664b6df2c304", "score": "0.552127", "text": "func (client *FakeTabletManagerClient) GetPermissions(ctx context.Context, tablet *topodatapb.Tablet) (*tabletmanagerdatapb.Permissions, error) {\n\treturn &tabletmanagerdatapb.Permissions{}, nil\n}", "title": "" }, { "docid": "45dd2cc815c975e8c8815eb95daec8ec", "score": "0.5481281", "text": "func PossiblePermissionsValues() []Permissions {\n\treturn []Permissions{\n\t\tPermissionsA,\n\t\tPermissionsC,\n\t\tPermissionsD,\n\t\tPermissionsL,\n\t\tPermissionsP,\n\t\tPermissionsR,\n\t\tPermissionsU,\n\t\tPermissionsW,\n\t}\n}", "title": "" }, { "docid": "aa174e43ca97c5ece01cc82afdf05a99", "score": "0.5473118", "text": "func (o AccessPointRootDirectoryCreationInfoPtrOutput) Permissions() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AccessPointRootDirectoryCreationInfo) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Permissions\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "212a4e05a05251a1aa630ea8a2ae2d30", "score": "0.54659593", "text": "func CopyPermissions(cc *callContext, cur *node) *VersionedPermissions {\n\tif cur.vPerms == nil {\n\t\treturn nil\n\t}\n\tvPerms := cur.vPerms.Copy()\n\tif cc.rbn == nil {\n\t\treturn vPerms\n\t}\n\tfor _, b := range cc.rbn {\n\t\tvPerms.Add(security.BlessingPattern(b), string(mounttable.Admin))\n\t}\n\tvPerms.P.Normalize()\n\treturn vPerms\n}", "title": "" }, { "docid": "38983bd7a31cc9f6be11c4fcc5fb64c1", "score": "0.5463512", "text": "func PossibleDefaultSharePermissionValues() []DefaultSharePermission {\n\treturn []DefaultSharePermission{\n\t\tDefaultSharePermissionNone,\n\t\tDefaultSharePermissionStorageFileDataSmbShareContributor,\n\t\tDefaultSharePermissionStorageFileDataSmbShareElevatedContributor,\n\t\tDefaultSharePermissionStorageFileDataSmbShareReader,\n\t}\n}", "title": "" }, { "docid": "80a3fce9c955797f76126d06684f0b64", "score": "0.54525506", "text": "func (as AccountStorage) GetGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey) ([]*GrantPermission, sdk.Error) {\n\tstore := ctx.KVStore(as.key)\n\tgrantPubKeyByte := store.Get(getGrantPermKey(me, grantTo))\n\tif grantPubKeyByte == nil {\n\t\treturn nil, ErrGrantPubKeyNotFound()\n\t}\n\tgrantPubKeys := new([]*GrantPermission)\n\tif err := as.cdc.UnmarshalBinaryLengthPrefixed(grantPubKeyByte, grantPubKeys); err != nil {\n\t\treturn nil, ErrFailedToUnmarshalGrantPubKey(err)\n\t}\n\treturn *grantPubKeys, nil\n}", "title": "" }, { "docid": "7316026b17be1c9ebb520f37e5838445", "score": "0.5446524", "text": "func GetPermissions(id uint) []string {\n\tvar nameResults []NameResult\n\tdb.GetDB().Raw(\"select DISTINCT name from permissions where id in (\tselect permission_id as id from permission_role where role_id in (\t\t\tselect role_id as id from role_users where user_id = ?\t))\", 1).Scan(&nameResults)\n\tvar result []string\n\tfor _, v := range nameResults {\n\t\tresult = append(result, v.Name)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4de503a4c142cbd0a6ccd3e2ad79fa1d", "score": "0.544214", "text": "func (m *RootRequestBuilder) Permissions()(*i7ab3c96c86b3b38921e0b8f81dcd5b872cc990c5cf8809f28bea1fb4dcf1558e.PermissionsRequestBuilder) {\n return i7ab3c96c86b3b38921e0b8f81dcd5b872cc990c5cf8809f28bea1fb4dcf1558e.NewPermissionsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "ed2ce96518e46cf87f068664d275e55f", "score": "0.5437493", "text": "func GetPermissions(names ...string) ([]Permission, error) {\n\tmu.RLock()\n\tvar err error\n\tfor _, name := range names {\n\t\tif _, ok := perms[name]; !ok {\n\t\t\terr = errors.Reason(\"permission not registered: %q\", name).Err()\n\t\t\tbreak\n\t\t}\n\t}\n\tforbiddenAlready := forbidChanges\n\tmu.RUnlock()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !forbiddenAlready {\n\t\tmu.Lock()\n\t\tforbidChanges = true\n\t\tmu.Unlock()\n\t}\n\n\tperms := make([]Permission, 0, len(names))\n\tfor _, name := range names {\n\t\tperms = append(perms, Permission{name})\n\t}\n\treturn perms, nil\n}", "title": "" }, { "docid": "654d5fe5ad95eb5e8ea9324028719a61", "score": "0.5432249", "text": "func GetPermissions(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tdb, err := db.Open()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer db.Close()\n\tdb = util.SetDBPagination(db, r)\n\n\tvar permissions types.Permissions\n\tif err := permissions.Get(db); err != nil {\n\t\tutil.ErrorResponder(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tutil.PaginationResponder(w, r, permissions)\n}", "title": "" }, { "docid": "b83356df8406105502093bea43a4af62", "score": "0.54100335", "text": "func (o LookupRoleDefinitionResultOutput) Permissions() GetRoleDefinitionPermissionArrayOutput {\n\treturn o.ApplyT(func(v LookupRoleDefinitionResult) []GetRoleDefinitionPermission { return v.Permissions }).(GetRoleDefinitionPermissionArrayOutput)\n}", "title": "" }, { "docid": "ea694209fd0986faa7eae01eddc63fde", "score": "0.5390201", "text": "func (m *AccessReviewScheduleSettings) GetApplyActions()([]AccessReviewApplyActionable) {\n val, err := m.GetBackingStore().Get(\"applyActions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]AccessReviewApplyActionable)\n }\n return nil\n}", "title": "" }, { "docid": "303d98769b88e7333fac435ebf08b939", "score": "0.5375152", "text": "func QueryPermissions(db gnorm.DB, schema string, proc string) ([]*Permission, error) {\n\tconst sqlstr = `\n\n\t\n\t\tSELECT \n\t\t\t\to.name as ProcName, \n\t\t\t \tdp.permission_name as Permission, \n\t \t\t \tp.name as Role\n\n\t\t\tFROM sys.objects o\n \t INNER JOIN sys.database_permissions dp ON dp.major_id = o.object_id\n INNER JOIN sys.database_principals p ON dp.grantee_principal_id = p.principal_id\n\n\t \t WHERE o.[type] = 'P' -- stored procedure\n\t\t\tAND dp.permission_name = 'EXECUTE'\n\t\t\tAND dp.state IN ('G', 'W') -- GRANT or GRANT WITH GRANT\n\t\t\tAND o.name = @proc\n;\n\n`\n\tlog.Println(\"querying proc permissions\", sqlstr)\n\n\tvar vals []*Permission\n\tq, err := db.Query(sqlstr,\n\t\tsql.Named(\"proc\", proc),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor q.Next() {\n\n\t\tp := Permission{}\n\n\t\terr = q.Scan(\n\t\t\t&p.ProcName,\n\t\t\t&p.Permission,\n\t\t\t&p.Role,\n\t\t)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvals = append(vals, &p)\n\t}\n\treturn vals, nil\n\n}", "title": "" }, { "docid": "34b177d2c1069090aee98b1079563fc0", "score": "0.53729326", "text": "func (instance *SSOInstance) GetPermissionSetList() []string {\n\tpermissionsets := []string{}\n\tfor _, permissionset := range instance.PermissionSets {\n\t\tpermissionsets = append(permissionsets, permissionset.Name)\n\t}\n\treturn permissionsets\n}", "title": "" }, { "docid": "c809fb150512c56462ba6fb549047bbd", "score": "0.53677005", "text": "func (o ApiTokenPolicyOutput) PermissionGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ApiTokenPolicy) []string { return v.PermissionGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "01ced9aac4cf220a692ee19707a7b323", "score": "0.5355935", "text": "func (p *DefaultPolicy) AllowAccess() bool {\n\treturn p.Effect == ladon.AllowAccess\n}", "title": "" }, { "docid": "e4ab5d4fd77f8ba57c74b53598e12fdc", "score": "0.5353951", "text": "func (ch *CredHub) GetPermissions(credName string) ([]permissions.Permission, error) {\n\tquery := url.Values{}\n\tquery.Set(\"credential_name\", credName)\n\n\tresp, err := ch.Request(http.MethodGet, \"/api/v1/permissions\", query, nil, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\tvar response permissionsResponse\n\n\tif err := json.NewDecoder(resp.Body).Decode(&response); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response.Permissions, nil\n}", "title": "" }, { "docid": "5c672e1f3900feed746580dbb6b49f9d", "score": "0.5347825", "text": "func (r *CalendarCalendarPermissionsCollectionRequest) Get(ctx context.Context) ([]CalendarPermission, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "70b90da40c8d8567bf9979288084282f", "score": "0.532729", "text": "func (role *Role[T]) Permissions() []Permission[T] {\n\trole.RLock()\n\tresult := make([]Permission[T], 0, len(role.permissions))\n\tfor _, p := range role.permissions {\n\t\tresult = append(result, p)\n\t}\n\trole.RUnlock()\n\treturn result\n}", "title": "" }, { "docid": "2348a01db28db3664d78dc1e4e68318c", "score": "0.5321099", "text": "func PossibleStoragePermissionsValues() []StoragePermissions {\n\treturn []StoragePermissions{StoragePermissionsAll, StoragePermissionsBackup, StoragePermissionsDelete, StoragePermissionsDeletesas, StoragePermissionsGet, StoragePermissionsGetsas, StoragePermissionsList, StoragePermissionsListsas, StoragePermissionsPurge, StoragePermissionsRecover, StoragePermissionsRegeneratekey, StoragePermissionsRestore, StoragePermissionsSet, StoragePermissionsSetsas, StoragePermissionsUpdate}\n}", "title": "" }, { "docid": "f30fd0ecdb952c12f653aecb37b96da9", "score": "0.53182554", "text": "func (o *ParameterContextEntity) GetPermissions() PermissionsDTO {\n\tif o == nil || o.Permissions == nil {\n\t\tvar ret PermissionsDTO\n\t\treturn ret\n\t}\n\treturn *o.Permissions\n}", "title": "" }, { "docid": "d8aca504cbf11566ece6c56ba6f9a3f1", "score": "0.5309519", "text": "func PossiblePublicNetworkAccessValues() []PublicNetworkAccess {\n\treturn []PublicNetworkAccess{Disabled, Enabled}\n}", "title": "" }, { "docid": "008feec2a7fa92fea1c42070492db8b0", "score": "0.53070164", "text": "func Get(r *http.Request) (p *Permissions, err error) {\n\tp = new(Permissions)\n\tuname, err := session.Get(r, \"openid-email\")\n\tif err != nil {\n\t\tp.Authenticated = false\n\t\treturn p, err\n\t}\n\tp.Authenticated = true\n\n\tuperms, err := GetUserPerms(uname, r.URL.Path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif uperms == nil {\n\t\tp.Recognized = false\n\t\treturn p, nil\n\t}\n\tp.Recognized = true\n\n\tp.Write = uperms.Write\n\tp.Read = uperms.Read\n\n\tgroups, err := loadGroups(uname)\n\tif err != nil {\n\t\t// Group permissions can only possibly be *more* permissive than user permissions; failing to load the permissions for a user's group shouldn't be a fatal error.\n\t\treturn p, err\n\t}\n\n\tfor _, group := range groups {\n\t\tgperms, err := GetGroupPerms(group, r.URL.Path)\n\t\tif err != nil {\n\t\t\treturn p, err\n\t\t}\n\t\tif gperms == nil {\n\t\t\tcontinue\n\t\t}\n\t\t// Use the most permissive interpretation of the permissions. If a group is allowed to access something, so should all the users in the group.\n\t\tif !uperms.Read {\n\t\t\tif gperms.Read {\n\t\t\t\tp.Read = true\n\t\t\t}\n\t\t}\n\t\tif !uperms.Write {\n\t\t\tif gperms.Write {\n\t\t\t\tp.Write = true\n\t\t\t}\n\t\t}\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "a31c2b8896f2b53ba8f8f60da7db4cc3", "score": "0.53034914", "text": "func permissionsAllow(permissions []auth.Permission, operation authz.Operation) bool {\n\tfor _, permission := range permissions {\n\t\tif permissionAllows(permission, operation) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "99584257bcfc7f3bbe50cfa5e885833f", "score": "0.5291896", "text": "func SelectPermissions(resource uuid.UUID, scopes []string) (permissions []Permission, err error) {\n\tquery, args, err := sqlx.In(\n\t\tfindResourcePermissions+\"AND scope IN (?)\",\n\t\tresource, scopes,\n\t)\n\tif err != nil {\n\t\treturn permissions, err\n\t}\n\terr = store.GetDB().Select(\n\t\t&permissions,\n\t\tstore.GetDB().Rebind(query),\n\t\targs...,\n\t)\n\treturn\n}", "title": "" }, { "docid": "2d0a4e6a97ca1438110f72fdd81a204d", "score": "0.52841896", "text": "func (c *YouTube) GetPermission() int {\n\treturn c.PermLvl\n}", "title": "" }, { "docid": "91290c20d8e53245c1a83926312cce79", "score": "0.5274481", "text": "func (fs *ocfs) permissionSet(ctx context.Context, owner *userpb.UserId) *provider.ResourcePermissions {\n\tif owner == nil {\n\t\treturn &provider.ResourcePermissions{\n\t\t\tStat: true,\n\t\t}\n\t}\n\tu, ok := ctxpkg.ContextGetUser(ctx)\n\tif !ok {\n\t\treturn &provider.ResourcePermissions{\n\t\t\t// no permissions\n\t\t}\n\t}\n\tif u.Id == nil {\n\t\treturn &provider.ResourcePermissions{\n\t\t\t// no permissions\n\t\t}\n\t}\n\tif u.Id.OpaqueId == owner.OpaqueId && u.Id.Idp == owner.Idp {\n\t\treturn &provider.ResourcePermissions{\n\t\t\t// owner has all permissions\n\t\t\tAddGrant: true,\n\t\t\tCreateContainer: true,\n\t\t\tDelete: true,\n\t\t\tGetPath: true,\n\t\t\tGetQuota: true,\n\t\t\tInitiateFileDownload: true,\n\t\t\tInitiateFileUpload: true,\n\t\t\tListContainer: true,\n\t\t\tListFileVersions: true,\n\t\t\tListGrants: true,\n\t\t\tListRecycle: true,\n\t\t\tMove: true,\n\t\t\tPurgeRecycle: true,\n\t\t\tRemoveGrant: true,\n\t\t\tRestoreFileVersion: true,\n\t\t\tRestoreRecycleItem: true,\n\t\t\tStat: true,\n\t\t\tUpdateGrant: true,\n\t\t}\n\t}\n\t// TODO fix permissions for share recipients by traversing reading acls up to the root? cache acls for the parent node and reuse it\n\treturn &provider.ResourcePermissions{\n\t\tAddGrant: true,\n\t\tCreateContainer: true,\n\t\tDelete: true,\n\t\tGetPath: true,\n\t\tGetQuota: true,\n\t\tInitiateFileDownload: true,\n\t\tInitiateFileUpload: true,\n\t\tListContainer: true,\n\t\tListFileVersions: true,\n\t\tListGrants: true,\n\t\tListRecycle: true,\n\t\tMove: true,\n\t\tPurgeRecycle: true,\n\t\tRemoveGrant: true,\n\t\tRestoreFileVersion: true,\n\t\tRestoreRecycleItem: true,\n\t\tStat: true,\n\t\tUpdateGrant: true,\n\t}\n}", "title": "" }, { "docid": "954247d17ac20b537c111eba9a13e662", "score": "0.5265598", "text": "func (m *ResourceSpecificPermissionGrant) GetPermission()(*string) {\n return m.permission\n}", "title": "" }, { "docid": "6c20bc3b1f88aa9d01fd03c83aa965b2", "score": "0.52639884", "text": "func PossibleSecretPermissionsValues() []SecretPermissions {\n\treturn []SecretPermissions{SecretPermissionsAll, SecretPermissionsBackup, SecretPermissionsDelete, SecretPermissionsGet, SecretPermissionsList, SecretPermissionsPurge, SecretPermissionsRecover, SecretPermissionsRestore, SecretPermissionsSet}\n}", "title": "" }, { "docid": "d04c1554631a86d5acbc6b44388d43fc", "score": "0.5263854", "text": "func desiredPerms(path string) (ownerMode fs.FileMode, botAndReaderMode fs.FileMode, err error) {\n\tstat, err := os.Stat(path)\n\tif err != nil {\n\t\treturn 0, 0, trace.Wrap(err)\n\t}\n\n\tbotAndReaderMode = modeACLReadWrite\n\townerMode = modeACLReadWrite\n\tif stat.IsDir() {\n\t\tbotAndReaderMode = modeACLReadExecute\n\t\townerMode = modeACLReadWriteExecute\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "ee01b6e4cab719d864202996315068f8", "score": "0.5259735", "text": "func PossibleAccessRightsValues() []AccessRights {\n\treturn []AccessRights{\n\t\tAccessRightsManage,\n\t\tAccessRightsSend,\n\t\tAccessRightsListen,\n\t}\n}", "title": "" }, { "docid": "5d89432737ebc79a4ef63b35e769c492", "score": "0.52518564", "text": "func (o *IamAccountPermissions) GetPermissions() []IamPermissionReference {\n\tif o == nil {\n\t\tvar ret []IamPermissionReference\n\t\treturn ret\n\t}\n\treturn o.Permissions\n}", "title": "" }, { "docid": "086da66a9d3803673ada2ba8a73619ac", "score": "0.525161", "text": "func PossibleAccessRightsValues() []AccessRights {\n\treturn []AccessRights{Listen, Manage, SendEnumValue}\n}", "title": "" }, { "docid": "8a1a7a24f10cfaa570069ec49bb479bb", "score": "0.5249065", "text": "func (ac *OSSAccessControlService) GetUserPermissions(ctx context.Context, user *models.SignedInUser, roles []string) ([]*accesscontrol.Permission, error) {\n\tpermissions := make([]*accesscontrol.Permission, 0)\n\tfor _, legacyRole := range roles {\n\t\tif builtInRoleNames, ok := builtInRoleGrants[legacyRole]; ok {\n\t\t\tfor _, builtInRoleName := range builtInRoleNames {\n\t\t\t\tbuiltInRole := getBuiltInRole(builtInRoleName)\n\t\t\t\tif builtInRole == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, p := range builtInRole.Permissions {\n\t\t\t\t\tpermission := p\n\t\t\t\t\tpermissions = append(permissions, &permission)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn permissions, nil\n}", "title": "" }, { "docid": "aa1143bb6a0f1d3183fd2411c2e3951d", "score": "0.5248926", "text": "func (m *UnifiedRoleDefinition) GetRolePermissions()([]UnifiedRolePermissionable) {\n return m.rolePermissions\n}", "title": "" }, { "docid": "36817b4594020d70b136ae36897a72f0", "score": "0.52408355", "text": "func (m *AppManagementPolicy) GetAppliesTo()([]DirectoryObjectable) {\n val, err := m.GetBackingStore().Get(\"appliesTo\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]DirectoryObjectable)\n }\n return nil\n}", "title": "" }, { "docid": "0edcb983d348f8bbddbd4d0bf0880096", "score": "0.5234389", "text": "func (o *FileProjectFilesResponseIncluded) GetPermissionsOk() (*map[string]ViewFilePermissions, bool) {\n\tif o == nil || o.Permissions == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Permissions, true\n}", "title": "" }, { "docid": "b0f51768dac3531550b83e641ee79b19", "score": "0.5228472", "text": "func PossibleAccessLevelValues() []AccessLevel {\n\treturn []AccessLevel{None, Read, Write}\n}", "title": "" }, { "docid": "a49df3af4a340cb3456d17459955a4bf", "score": "0.5227205", "text": "func PossibleEnvironmentPermissionValues() []EnvironmentPermission {\n\treturn []EnvironmentPermission{\n\t\tEnvironmentPermissionContributor,\n\t\tEnvironmentPermissionReader,\n\t}\n}", "title": "" }, { "docid": "69840a111384626b741281c3c691fe05", "score": "0.5222934", "text": "func (b *Base) AccessPolicy() *accesspolicy.Kind {\n\treturn b.accesspolicy\n}", "title": "" }, { "docid": "6c5ca12aa57c92091570c103f5e69f07", "score": "0.52218187", "text": "func PossibleAccessRightsValues() []AccessRights {\n\treturn []AccessRights{\n\t\tAccessRightsListen,\n\t\tAccessRightsManage,\n\t\tAccessRightsSend,\n\t}\n}", "title": "" }, { "docid": "f4ce51d666b3986fc5ffcd58ecd61681", "score": "0.52154493", "text": "func ListFilePermissions(c *gin.Context) {\n\tfileID := c.Param(\"fileID\")\n\tlog.Println(\"FileID:\",fileID)\n\n\ttok,err := getTokenFromHeader(c)\n\tif err != nil {\n\t\treturn\n\t}\n\tpermissions,err := goDrive.GetFilePermissions(tok,fileID)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\t\t\t\n\t}\n\tc.JSON(http.StatusOK, gin.H{\"Permissions\": permissions})\n}", "title": "" }, { "docid": "e514cf3b0de359ed7a522280d7b0e47a", "score": "0.52145183", "text": "func (p *iscsiProvisioner) getAccessModes() []v1.PersistentVolumeAccessMode {\n\treturn []v1.PersistentVolumeAccessMode{\n\t\t v1.ReadWriteOnce,\n\t\t}\n}", "title": "" }, { "docid": "a90e09fda85bf37a293bb42c3670bbc4", "score": "0.52142143", "text": "func (o *Operation) ReadAccess(gid GoogleID) (bool, []Zone) {\n\tvar zones []Zone\n\tvar permitted bool\n\n\tif o.ID.IsOwner(gid) {\n\t\tzones = append(zones, ZoneAll)\n\t\treturn true, zones\n\t}\n\n\tif err := o.PopulateTeams(); err != nil {\n\t\tlog.Error(err)\n\t\treturn false, zones\n\t}\n\n\tfor _, t := range o.Teams {\n\t\tswitch t.Role {\n\t\tcase opPermRoleAssignedOnly:\n\t\t\tcontinue\n\t\tcase opPermRoleRead:\n\t\t\tif inteam, _ := gid.AgentInTeam(t.TeamID); inteam {\n\t\t\t\tpermitted = true\n\t\t\t\tzones = append(zones, t.Zone)\n\t\t\t\tif t.Zone == ZoneAll {\n\t\t\t\t\treturn permitted, zones // fast-path\n\t\t\t\t}\n\t\t\t}\n\t\tcase opPermRoleWrite:\n\t\t\tif inteam, _ := gid.AgentInTeam(t.TeamID); inteam {\n\t\t\t\tpermitted = true\n\t\t\t\tzones = append(zones, ZoneAll)\n\t\t\t\treturn permitted, zones // fast-path\n\t\t\t}\n\t\t}\n\t}\n\treturn permitted, zones\n}", "title": "" }, { "docid": "162925778376c71a1208dae471b73a78", "score": "0.5201518", "text": "func PossibleInheritedPermissionsValues() []InheritedPermissions {\n\treturn []InheritedPermissions{Delete, Edit, Noaccess, View}\n}", "title": "" }, { "docid": "c5cb85cf089c909bb9bca8aad6dad23d", "score": "0.5178317", "text": "func (c *Config) AccessAllowed(acessType string) bool {\n\tvar found bool\n\tfor _, k := range c.AllowedAccessType {\n\t\tif k == acessType {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn found\n}", "title": "" }, { "docid": "2f1a897c84113282c0b35237c9e802b4", "score": "0.5177403", "text": "func (r ListPermResult) ExtractPermissions() ([]Permission, error) {\n\tvar s struct {\n\t\tPermissions []Permission `json:\"permissions\"`\n\t}\n\n\terr := r.ExtractInto(&s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.Permissions, nil\n}", "title": "" }, { "docid": "3df2e6d21a3db970ae92d06d3eb4a7fe", "score": "0.51770025", "text": "func (m *AndroidGeneralDeviceConfiguration) GetDeviceSharingAllowed()(*bool) {\n val, err := m.GetBackingStore().Get(\"deviceSharingAllowed\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "91f62f687ab155877f6fd922334bc5bd", "score": "0.5176014", "text": "func (m *ManagedAppProtection) GetAllowedOutboundClipboardSharingLevel()(*ManagedAppClipboardSharingLevel) {\n return m.allowedOutboundClipboardSharingLevel\n}", "title": "" }, { "docid": "e79fa714793bd760cd628942fe8dccca", "score": "0.51726925", "text": "func (m *UnifiedRoleDefinition) GetInheritsPermissionsFrom()([]UnifiedRoleDefinitionable) {\n return m.inheritsPermissionsFrom\n}", "title": "" }, { "docid": "17eb1c264a211c280c2547418a320243", "score": "0.51697916", "text": "func doGetAccess(ctx context.Context, targetURL string) (perms accessPerms, anonymousStr string, err *probe.Error) {\n\tclnt, err := newClient(targetURL)\n\tif err != nil {\n\t\treturn \"\", \"\", err.Trace(targetURL)\n\t}\n\tperm, anonymousJSON, err := clnt.GetAccess(ctx)\n\tif err != nil {\n\t\treturn \"\", \"\", err.Trace(targetURL)\n\t}\n\treturn stringToAccessPerm(perm), anonymousJSON, nil\n}", "title": "" }, { "docid": "27d9c5350d7087b5926ff4276f45964f", "score": "0.5165095", "text": "func (m *ManagedAppProtection) GetAllowedDataStorageLocations()([]ManagedAppDataStorageLocation) {\n return m.allowedDataStorageLocations\n}", "title": "" }, { "docid": "ca65989fb36263bac4629f3829fd7ed0", "score": "0.51537204", "text": "func (o *IamAccountPermissions) GetPermissionsOk() ([]IamPermissionReference, bool) {\n\tif o == nil || o.Permissions == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Permissions, true\n}", "title": "" }, { "docid": "62ef599208274c54f0d3e19662863df4", "score": "0.5153314", "text": "func (x DashboardEntity) GetPermissions() DashboardPermissions {\n\treturn x.Permissions\n}", "title": "" }, { "docid": "142854e3592fc5d9bde642995a92f66c", "score": "0.5148645", "text": "func computeBasePermissions(g *Guild, m *GuildMember) (permissions int) {\n\tif g.OwnerID == m.User.ID {\n\t\treturn PermissionAdministrator\n\t}\n\n\t// Role '@everyone' has the same ID as the guild ID\n\t// and is always present, so no need to check for nil.\n\troleEveryone := roleByID(g.Roles, g.ID)\n\tpermissions = roleEveryone.Permissions\n\n\tfor _, id := range m.Roles {\n\t\trole := roleByID(g.Roles, id)\n\t\tif role != nil {\n\t\t\tpermissions |= role.Permissions\n\t\t}\n\t}\n\n\tif PermissionsContains(permissions, PermissionAdministrator) {\n\t\treturn PermissionAdministrator\n\t}\n\treturn permissions\n}", "title": "" }, { "docid": "91625054e5845b384b30847c88eae304", "score": "0.5139278", "text": "func (o *InlineResponse20090Stats) HasPermissions() bool {\n\tif o != nil && o.Permissions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "53625584761ae53ca97f7804c381082c", "score": "0.51363003", "text": "func PossibleKeyPermissionsValues() []KeyPermissions {\n\treturn []KeyPermissions{KeyPermissionsAll, KeyPermissionsBackup, KeyPermissionsCreate, KeyPermissionsDecrypt, KeyPermissionsDelete, KeyPermissionsEncrypt, KeyPermissionsGet, KeyPermissionsImport, KeyPermissionsList, KeyPermissionsPurge, KeyPermissionsRecover, KeyPermissionsRestore, KeyPermissionsSign, KeyPermissionsUnwrapKey, KeyPermissionsUpdate, KeyPermissionsVerify, KeyPermissionsWrapKey}\n}", "title": "" }, { "docid": "3e32c173ac034d31d309efd274b2e205", "score": "0.5131967", "text": "func (a *Client) GetPermissions(params *GetPermissionsParams, authInfo runtime.ClientAuthInfoWriter) (*GetPermissionsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetPermissionsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetPermissions\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/permissions\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetPermissionsReader{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.(*GetPermissionsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*GetPermissionsDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "c00ccdfe208f58441c073d85cb58fb6f", "score": "0.51273656", "text": "func (o *MicrosoftGraphAndroidGeneralDeviceConfiguration) GetDeviceSharingAllowed() bool {\n\tif o == nil || o.DeviceSharingAllowed == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.DeviceSharingAllowed\n}", "title": "" }, { "docid": "61c6dd5b1862ce38996bd734b5616665", "score": "0.5126155", "text": "func (a *App) GetAllPermissions(w http.ResponseWriter, _ *http.Request) {\n\thandler.GetAllPermissions(a.DB, w)\n}", "title": "" }, { "docid": "cd5d0b0277fe0c44e9df3c96aad884c1", "score": "0.5125588", "text": "func (m *UnifiedRoleAssignmentMultiple) GetAppScopes()([]AppScopeable) {\n val, err := m.GetBackingStore().Get(\"appScopes\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]AppScopeable)\n }\n return nil\n}", "title": "" } ]
c709121186cd310ea615247bab238ffd
RequesterAccessController is a free data retrieval call binding the contract method 0x70efdf2d. Solidity: function requesterAccessController() view returns(address)
[ { "docid": "f3f7250b17d6463464b98554377d160a", "score": "0.72434443", "text": "func (_OffchainAggregator *OffchainAggregatorCallerSession) RequesterAccessController() (common.Address, error) {\n\treturn _OffchainAggregator.Contract.RequesterAccessController(&_OffchainAggregator.CallOpts)\n}", "title": "" } ]
[ { "docid": "11ae356e29238edceb8fa812182a9cd7", "score": "0.7711866", "text": "func (_OffchainAggregator *OffchainAggregatorCaller) RequesterAccessController(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _OffchainAggregator.contract.Call(opts, &out, \"requesterAccessController\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "d396fd0e0d8213c09a5ccf4a4fb89f70", "score": "0.72821146", "text": "func (_OffchainAggregator *OffchainAggregatorSession) RequesterAccessController() (common.Address, error) {\n\treturn _OffchainAggregator.Contract.RequesterAccessController(&_OffchainAggregator.CallOpts)\n}", "title": "" }, { "docid": "40a1c9ccb677bc6899e21b863c9cd91c", "score": "0.6604284", "text": "func (_Chainlink *ChainlinkCaller) AccessController(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Chainlink.contract.Call(opts, &out, \"accessController\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "322978198c86681b4122aa5631bb92f9", "score": "0.6528861", "text": "func (_Chainlink *ChainlinkCallerSession) AccessController() (common.Address, error) {\n\treturn _Chainlink.Contract.AccessController(&_Chainlink.CallOpts)\n}", "title": "" }, { "docid": "28312f33496f666a9df8b4a5356414a0", "score": "0.64252585", "text": "func (_Chainlink *ChainlinkSession) AccessController() (common.Address, error) {\n\treturn _Chainlink.Contract.AccessController(&_Chainlink.CallOpts)\n}", "title": "" }, { "docid": "3d8e5b577085a355b0b276ee9a6e9caf", "score": "0.62853396", "text": "func (_OffchainAggregator *OffchainAggregatorTransactor) SetRequesterAccessController(opts *bind.TransactOpts, _requesterAccessController common.Address) (*types.Transaction, error) {\n\treturn _OffchainAggregator.contract.Transact(opts, \"setRequesterAccessController\", _requesterAccessController)\n}", "title": "" }, { "docid": "0685a20f82cda572f4287d8ca3c8db41", "score": "0.6067214", "text": "func (_OffchainAggregator *OffchainAggregatorSession) SetRequesterAccessController(_requesterAccessController common.Address) (*types.Transaction, error) {\n\treturn _OffchainAggregator.Contract.SetRequesterAccessController(&_OffchainAggregator.TransactOpts, _requesterAccessController)\n}", "title": "" }, { "docid": "fe8f87b35eda06cc3729684931f14d78", "score": "0.60405886", "text": "func (_OffchainAggregator *OffchainAggregatorTransactorSession) SetRequesterAccessController(_requesterAccessController common.Address) (*types.Transaction, error) {\n\treturn _OffchainAggregator.Contract.SetRequesterAccessController(&_OffchainAggregator.TransactOpts, _requesterAccessController)\n}", "title": "" }, { "docid": "fafa18595833822988b04cde68f588d0", "score": "0.5852872", "text": "func (_OffchainAggregator *OffchainAggregatorCaller) BillingAccessController(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _OffchainAggregator.contract.Call(opts, &out, \"billingAccessController\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "bf0f89234eabd7ca525e8573e3807ad2", "score": "0.5742899", "text": "func (_OffchainAggregator *OffchainAggregatorCallerSession) BillingAccessController() (common.Address, error) {\n\treturn _OffchainAggregator.Contract.BillingAccessController(&_OffchainAggregator.CallOpts)\n}", "title": "" }, { "docid": "13d09c1fe1c2166f1de175220f2640e4", "score": "0.5651214", "text": "func (_OffchainAggregator *OffchainAggregatorSession) BillingAccessController() (common.Address, error) {\n\treturn _OffchainAggregator.Contract.BillingAccessController(&_OffchainAggregator.CallOpts)\n}", "title": "" }, { "docid": "696a8a879417d7871de88f00be63508e", "score": "0.5502882", "text": "func (_OffchainAggregator *OffchainAggregatorFilterer) FilterRequesterAccessControllerSet(opts *bind.FilterOpts) (*OffchainAggregatorRequesterAccessControllerSetIterator, error) {\n\n\tlogs, sub, err := _OffchainAggregator.contract.FilterLogs(opts, \"RequesterAccessControllerSet\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &OffchainAggregatorRequesterAccessControllerSetIterator{contract: _OffchainAggregator.contract, event: \"RequesterAccessControllerSet\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "7061c01d7da5218d7b4505a641d2cff5", "score": "0.53151613", "text": "func (_SimpleWriteAccessController *SimpleWriteAccessControllerCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SimpleWriteAccessController.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "79763ac3a2ab5036aadec51047644809", "score": "0.5297745", "text": "func (_SimpleWriteAccessController *SimpleWriteAccessControllerCallerSession) Owner() (common.Address, error) {\n\treturn _SimpleWriteAccessController.Contract.Owner(&_SimpleWriteAccessController.CallOpts)\n}", "title": "" }, { "docid": "88ca3f3e26384d071b1aa078c78a4451", "score": "0.5284847", "text": "func (a *RemoteAccessApiService) GetAccessRequest(ctx _context.Context, requestId string) ApiGetAccessRequestRequest {\n\treturn ApiGetAccessRequestRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\trequestId: requestId,\n\t}\n}", "title": "" }, { "docid": "ae5d0b20803f3e1140fa0aeccb33103e", "score": "0.524331", "text": "func (cs *ConnServer) Access(ctx context.Context, req *pb.AccessReq) (*pb.AccessResp, error) {\n\trtime := time.Now()\n\tmethod := common.GRPCMethod(ctx)\n\tlogger.V(2).Infof(\"%s[%s]| input[%+v]\", method, req.Seq, req)\n\n\tresponse := new(pb.AccessResp)\n\n\tdefer func() {\n\t\tcost := cs.collector.StatRequest(method, response.Code, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"%s[%s]| output[%dms][%+v]\", method, req.Seq, cost, response)\n\t}()\n\n\taction := signallingaction.NewAccessAction(ctx, cs.viper, cs.accessResource, req, response)\n\tif err := cs.executor.Execute(action); err != nil {\n\t\tlogger.Errorf(\"%s[%s]| %+v\", method, req.Seq, err)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "f062a0ea916ad80a513ccd624144c460", "score": "0.523625", "text": "func (o ListingOutput) RequestAccess() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Listing) pulumi.StringPtrOutput { return v.RequestAccess }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1e0c1dd40e388129353f7a7ed664da17", "score": "0.5235488", "text": "func (_Contract *ContractCallerSession) Controller() (common.Address, error) {\n\treturn _Contract.Contract.Controller(&_Contract.CallOpts)\n}", "title": "" }, { "docid": "81544a6d41e69444e21a4af4063942b3", "score": "0.5213054", "text": "func (_DisputeCrowdsourcer *DisputeCrowdsourcerCallerSession) GetController() (common.Address, error) {\n\treturn _DisputeCrowdsourcer.Contract.GetController(&_DisputeCrowdsourcer.CallOpts)\n}", "title": "" }, { "docid": "26a4ca61b91c6782a2513551e3c838ea", "score": "0.5179524", "text": "func (_Contract *ContractCaller) Controller(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Contract.contract.Call(opts, &out, \"controller\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "372a998a43663a07df27e94fe5ca33fd", "score": "0.517949", "text": "func (_Poolbindings *PoolbindingsCallerSession) GetController() (common.Address, error) {\n\treturn _Poolbindings.Contract.GetController(&_Poolbindings.CallOpts)\n}", "title": "" }, { "docid": "0e1ada7b50760099c7b06dd7860dcfdb", "score": "0.5174468", "text": "func (_ExchangeData *ExchangeDataCaller) AccessAllowed(opts *bind.CallOpts, arg0 common.Address) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ExchangeData.contract.Call(opts, out, \"accessAllowed\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "cb9ef42224dba75672bca1df176f2d6b", "score": "0.51554", "text": "func (_Ingress *IngressCaller) ADMINCONTRACT(opts *bind.CallOpts) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _Ingress.contract.Call(opts, out, \"ADMIN_CONTRACT\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "26f45035211ad328ef909a361eea35a6", "score": "0.51450735", "text": "func (_SimpleGatekeeperWithLimitLive *SimpleGatekeeperWithLimitLiveCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SimpleGatekeeperWithLimitLive.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a68b587fa65ba5763fbd1f05a333df9f", "score": "0.51447", "text": "func (_ExchangeData *ExchangeDataCallerSession) AccessAllowed(arg0 common.Address) (bool, error) {\n\treturn _ExchangeData.Contract.AccessAllowed(&_ExchangeData.CallOpts, arg0)\n}", "title": "" }, { "docid": "a86e4f4f7dfeef61b4112732f0ea2a8f", "score": "0.51445675", "text": "func (_SimpleWriteAccessController *SimpleWriteAccessControllerSession) Owner() (common.Address, error) {\n\treturn _SimpleWriteAccessController.Contract.Owner(&_SimpleWriteAccessController.CallOpts)\n}", "title": "" }, { "docid": "11558237ff2478d7398b60d031c4b658", "score": "0.51413924", "text": "func (_CanReclaimTokens *CanReclaimTokensCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _CanReclaimTokens.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b44e34c405f35ae53a5f073b106f847d", "score": "0.51408297", "text": "func (_Claimable *ClaimableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Claimable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "c233f83197b02a4579d3ab43d45c1569", "score": "0.5109546", "text": "func (_NodeIngress *NodeIngressCaller) ADMINCONTRACT(opts *bind.CallOpts) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _NodeIngress.contract.Call(opts, out, \"ADMIN_CONTRACT\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "5744a3852cc53959a396865766fff750", "score": "0.5090652", "text": "func (_SimpleGatekeeperWithLimit *SimpleGatekeeperWithLimitCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SimpleGatekeeperWithLimit.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "da94b9302ae34294fd6c54f287cde0bf", "score": "0.50902027", "text": "func (_DisputeCrowdsourcer *DisputeCrowdsourcerCaller) GetController(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _DisputeCrowdsourcer.contract.Call(opts, out, \"getController\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "cb50df292b9a5517ad34abac7290cee4", "score": "0.5080745", "text": "func (_Ingress *IngressCallerSession) ADMINCONTRACT() ([32]byte, error) {\n\treturn _Ingress.Contract.ADMINCONTRACT(&_Ingress.CallOpts)\n}", "title": "" }, { "docid": "ffd8124fde688250cf3d0a932ae21526", "score": "0.5073312", "text": "func requestAccess(ctx context.Context, id string) error {\n\tuser := model.CtxUser(ctx)\n\tif user.ID != id {\n\t\treturn mgo.ErrNotFound\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9978df8b05f4dfb5f6dc0ad878876407", "score": "0.5056314", "text": "func (c *Cluster) GetAccessRequest(ctx context.Context, req types.AccessRequestFilter) (*AccessRequest, error) {\n\tvar (\n\t\trequest types.AccessRequest\n\t\tresourceDetails map[string]ResourceDetails\n\t\tproxyClient *client.ProxyClient\n\t\tauthClient auth.ClientI\n\t\terr error\n\t)\n\n\terr = AddMetadataToRetryableError(ctx, func() error {\n\t\tproxyClient, err = c.clusterClient.ConnectToProxy(ctx)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tdefer proxyClient.Close()\n\n\t\trequests, err := proxyClient.GetAccessRequests(ctx, req)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\n\t\t// This has to happen inside this scope because we need access to the authClient\n\t\t// We can remove this once we make the change to keep around the proxy and auth clients\n\t\tif len(requests) < 1 {\n\t\t\treturn trace.NotFound(\"Access request not found.\")\n\t\t}\n\t\trequest = requests[0]\n\n\t\tauthClient, err = proxyClient.ConnectToCluster(ctx, c.clusterClient.SiteName)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tdefer authClient.Close()\n\n\t\tresourceDetails, err = getResourceDetails(ctx, request, authClient)\n\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn &AccessRequest{\n\t\tURI: c.URI.AppendAccessRequest(request.GetName()),\n\t\tAccessRequest: request,\n\t\tResourceDetails: resourceDetails,\n\t}, nil\n}", "title": "" }, { "docid": "83729276c058110eaf467e29592882a5", "score": "0.5046546", "text": "func (_Contract *ContractSession) Controller() (common.Address, error) {\n\treturn _Contract.Contract.Controller(&_Contract.CallOpts)\n}", "title": "" }, { "docid": "bff5571635d5bdff3d773ecb956394da", "score": "0.5041663", "text": "func (_Poolbindings *PoolbindingsSession) GetController() (common.Address, error) {\n\treturn _Poolbindings.Contract.GetController(&_Poolbindings.CallOpts)\n}", "title": "" }, { "docid": "3001aa25d8c985116780661bb942ba3a", "score": "0.5033554", "text": "func (f *Fosite) NewAccessRequest(ctx context.Context, r *http.Request, session Session) (AccessRequester, error) {\n\tvar err error\n\taccessRequest := NewAccessRequest(session)\n\n\tif r.Method != \"POST\" {\n\t\treturn accessRequest, errors.Wrap(ErrInvalidRequest, \"HTTP method is not POST\")\n\t} else if err := r.ParseForm(); err != nil {\n\t\treturn accessRequest, errors.Wrap(ErrInvalidRequest, err.Error())\n\t}\n\n\taccessRequest.Form = r.PostForm\n\tif session == nil {\n\t\treturn accessRequest, errors.New(\"Session must not be nil\")\n\t}\n\n\taccessRequest.SetRequestedScopes(removeEmpty(strings.Split(r.PostForm.Get(\"scope\"), \" \")))\n\taccessRequest.GrantTypes = removeEmpty(strings.Split(r.PostForm.Get(\"grant_type\"), \" \"))\n\tif len(accessRequest.GrantTypes) < 1 {\n\t\treturn accessRequest, errors.Wrap(ErrInvalidRequest, \"No grant type given\")\n\t}\n\n\t// Decode client_id and client_secret which should be in \"application/x-www-form-urlencoded\" format.\n\tclientID, clientSecret, ok := r.BasicAuth()\n\tif !ok {\n\t\treturn accessRequest, errors.Wrap(ErrInvalidRequest, \"HTTP authorization header missing or invalid\")\n\t}\n\n\tclient, err := f.Store.GetClient(clientID)\n\tif err != nil {\n\t\treturn accessRequest, errors.Wrap(ErrInvalidClient, err.Error())\n\t}\n\n\tif !client.IsPublic() {\n\t\t// Enforce client authentication\n\t\tif err := f.Hasher.Compare(client.GetHashedSecret(), []byte(clientSecret)); err != nil {\n\t\t\treturn accessRequest, errors.Wrap(ErrInvalidClient, err.Error())\n\t\t}\n\t}\n\taccessRequest.Client = client\n\n\tvar found bool = false\n\tfor _, loader := range f.TokenEndpointHandlers {\n\t\tif err := loader.HandleTokenEndpointRequest(ctx, r, accessRequest); err == nil {\n\t\t\tfound = true\n\t\t} else if errors.Cause(err) == ErrUnknownRequest {\n\t\t\t// do nothing\n\t\t} else if err != nil {\n\t\t\treturn accessRequest, err\n\t\t}\n\t}\n\n\tif !found {\n\t\treturn nil, errors.WithStack(ErrInvalidRequest)\n\t}\n\treturn accessRequest, nil\n}", "title": "" }, { "docid": "5998f64adbde2047dfe3d97e2acb0e2d", "score": "0.5016718", "text": "func (s service) sendRequestAccessEmail(ctx context.Context, companyModel *models.Company, requesterName, requesterEmail, recipientName, recipientAddress string) {\n\tf := logrus.Fields{\n\t\t\"functionName\": \"company.service.sendRequestAccessEmail\",\n\t\tutils.XREQUESTID: ctx.Value(utils.XREQUESTID),\n\t\t\"requesterName\": requesterName,\n\t\t\"requesterEmail\": requesterEmail,\n\t\t\"recipientName\": recipientName,\n\t\t\"recipientAddress\": recipientAddress,\n\t}\n\tcompanyName := companyModel.CompanyName\n\n\trequestedUserInfo := fmt.Sprintf(\"<ul><li>%s (%s)</li></ul>\", requesterName, requesterEmail)\n\n\t// subject string, body string, recipients []string\n\tsubject := fmt.Sprintf(\"EasyCLA: New Company Manager Access Request for %s\", companyName)\n\trecipients := []string{recipientAddress}\n\tbody := fmt.Sprintf(`\n<p>Hello %s,</p>\n<p>This is a notification email from EasyCLA regarding the company %s.</p>\n<p>The following user has requested to join %s as a Company Manager. \nBy approving this request the user could view and apply for CLA Manager\nstatus on projects associated with your company. </p>\n%s\n<p>To get started, please log into the <a href=\"%s\" target=\"_blank\">EasyCLA Corporate Console</a>, and select your\ncompany.You can choose to accept or deny the request.\n</p>\n%s\n%s`,\n\t\trecipientName, companyName, companyName, requestedUserInfo, utils.GetCorporateURL(false),\n\t\tutils.GetEmailHelpContent(false), utils.GetEmailSignOffContent())\n\n\terr := utils.SendEmail(subject, body, recipients)\n\tif err != nil {\n\t\tlog.WithFields(f).WithError(err).Warnf(\"problem sending email with subject: %s to recipients: %+v, error: %+v\", subject, recipients, err)\n\t} else {\n\t\tlog.WithFields(f).Debugf(\"sent email with subject: %s to recipients: %+v\", subject, recipients)\n\t}\n}", "title": "" }, { "docid": "ded63671f1930ee17795d5f0b998f25e", "score": "0.50147915", "text": "func (_Poolbindings *PoolbindingsCaller) GetController(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Poolbindings.contract.Call(opts, &out, \"getController\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "51250d4021d02da9a744732366aeb22f", "score": "0.5006261", "text": "func (_ProxyAdmin *ProxyAdminCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ProxyAdmin.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b9443b86a156aca95d855c3fb998b62f", "score": "0.50014067", "text": "func (_NodeIngress *NodeIngressCallerSession) ADMINCONTRACT() ([32]byte, error) {\n\treturn _NodeIngress.Contract.ADMINCONTRACT(&_NodeIngress.CallOpts)\n}", "title": "" }, { "docid": "f1f8f576d3d223a2d716be31db31ca08", "score": "0.49859843", "text": "func (_DisputeCrowdsourcer *DisputeCrowdsourcerSession) GetController() (common.Address, error) {\n\treturn _DisputeCrowdsourcer.Contract.GetController(&_DisputeCrowdsourcer.CallOpts)\n}", "title": "" }, { "docid": "561fc437e83eeff0ba6c223459ae44a6", "score": "0.49639323", "text": "func (_Claimable *ClaimableCallerSession) Owner() (common.Address, error) {\n\treturn _Claimable.Contract.Owner(&_Claimable.CallOpts)\n}", "title": "" }, { "docid": "6bb1c77f59affbfa651435cafae96797", "score": "0.49612302", "text": "func (a *Auth) RequestHandler(c *gin.Context) {\n\n\t// Authentication\n\t// get and cache a list of accounts ass\n\tname, key, ok := c.Request.BasicAuth()\n\tif !ok {\n\t\tak := ack.Gin(c)\n\t\tak.GinErrorAbort(401, \"Unauthorized\", \"Access requires BasicAuth with access key credentials.\")\n\t\treturn\n\t}\n\n\taccessKey := provision.AccessKey{\n\t\tName: name,\n\t\tKey: key,\n\t}\n\n\t// The only GET operations required for the Grafana\n\t// datasource plugin is /[ACCOUNT]-index/_mapping all other\n\t// patterns should be ignored.\n\tif c.Request.Method == http.MethodGet {\n\n\t\t// check the query string for account\n\t\t// parse account\n\t\tif mappingRxp.MatchString(c.Request.URL.Path) {\n\t\t\taP := accountPathRxp.FindString(strings.TrimPrefix(c.Request.URL.Path, a.PathPrefix))\n\t\t\taccountId := aP[1 : len(aP)-1]\n\t\t\taccountId = strings.TrimPrefix(accountId, \"[\")\n\n\t\t\ta.Logger.Info(\"Mapping request\", zap.String(\"account\", accountId))\n\n\t\t\t// check for key access to account\n\t\t\tok, err := a.checkAccount(accountId, accessKey)\n\t\t\tif err != nil {\n\t\t\t\ta.Logger.Warn(\"Account lookup error\", zap.Error(err))\n\n\t\t\t\tak := ack.Gin(c)\n\t\t\t\tak.GinErrorAbort(401, \"AccountLookupError\", err.Error())\n\t\t\t\ta.Logger.Info(\"Mapping request denied\",\n\t\t\t\t\tzap.String(\"key_name\", accessKey.Name),\n\t\t\t\t\tzap.String(\"account\", accountId),\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// access granted\n\t\t\tif ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// not a _mapping GET or unauthorized key\n\t\tak := ack.Gin(c)\n\t\tak.GinErrorAbort(401, \"UnauthorizedGetRequest\", c.Request.URL.Path)\n\t\ta.Logger.Info(\"GET request access denied.\",\n\t\t\tzap.String(\"url\", c.Request.URL.Path),\n\t\t)\n\t\treturn\n\t}\n\n\t// /_msearch POST\n\tif c.Request.Method == http.MethodPost {\n\t\ttUrl := strings.TrimPrefix(c.Request.URL.Path, a.PathPrefix)\n\t\tif tUrl != \"/_msearch\" {\n\t\t\tak := ack.Gin(c)\n\t\t\tak.SetPayload(\"Only _msearch POST requests accepted.\")\n\t\t\tak.GinErrorAbort(401, \"NonMsearchPostRequest\", tUrl)\n\t\t\ta.Logger.Info(\"Only _msearch POST requests accepted.\",\n\t\t\t\tzap.String(\"url\", tUrl),\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tb, err := ioutil.ReadAll(c.Request.Body)\n\t\tif err != nil {\n\t\t\tak := ack.Gin(c)\n\t\t\tak.GinErrorAbort(401, \"MsearchPostBodyError\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Restore the io.ReadCloser to its original state\n\t\tc.Request.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\n\t\tbytesReader := bytes.NewReader(b)\n\t\tscanner := bufio.NewScanner(bytesReader)\n\n\t\t// Each line contains its own JSON object\n\t\tfor scanner.Scan() {\n\t\t\tln := scanner.Bytes()\n\n\t\t\t// does the line contain a reference to an index?\n\t\t\tif !indexRxp.Match(ln) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// does the line contain a reference to aa array index?\n\t\t\tif indexArrayRxp.Match(ln) {\n\t\t\t\tidxArray := &IndexArray{}\n\t\t\t\terr := json.Unmarshal(ln, &idxArray)\n\t\t\t\tif err != nil {\n\t\t\t\t\tak := ack.Gin(c)\n\t\t\t\t\tak.GinErrorAbort(401, \"MsearchPostBodyIdxLineError\", err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tfor _, idx := range idxArray.Indexes {\n\t\t\t\t\taccountId := strings.TrimSuffix(accountRxp.FindString(idx), \"-\")\n\t\t\t\t\tok, err := a.checkAccount(accountId, accessKey)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tak := ack.Gin(c)\n\t\t\t\t\t\tak.GinErrorAbort(401, \"AccountLookupError\", err.Error())\n\t\t\t\t\t\ta.Logger.Info(\"Mapping request denied\",\n\t\t\t\t\t\t\tzap.String(\"key_name\", accessKey.Name),\n\t\t\t\t\t\t\tzap.String(\"account\", accountId),\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// on failure return unauthorized\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tak := ack.Gin(c)\n\t\t\t\t\t\tak.GinErrorAbort(401, \"UnauthorizedIndex\", accountId)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// does the line contain a reference to a single index?\n\t\t\tif indexSingleRxp.Match(ln) {\n\t\t\t\tidxSingle := &IndexSingle{}\n\t\t\t\terr := json.Unmarshal(ln, &idxSingle)\n\t\t\t\tif err != nil {\n\t\t\t\t\tak := ack.Gin(c)\n\t\t\t\t\tak.GinErrorAbort(401, \"MsearchPostBodyIdxLineError\", err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\taccountId := strings.TrimSuffix(accountRxp.FindString(idxSingle.Index), \"-\")\n\t\t\t\tok, err := a.checkAccount(accountId, accessKey)\n\t\t\t\tif err != nil {\n\t\t\t\t\tak := ack.Gin(c)\n\t\t\t\t\tak.GinErrorAbort(401, \"AccountLookupError\", err.Error())\n\t\t\t\t\ta.Logger.Info(\"Mapping request denied\",\n\t\t\t\t\t\tzap.String(\"key_name\", accessKey.Name),\n\t\t\t\t\t\tzap.String(\"account\", accountId),\n\t\t\t\t\t)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// access granted\n\t\t\t\tif ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\treturn\n\t}\n\n\t// Anything other than a post including PUT / DELETE etc..\n\t// should return false. DO NOT LET OTHER OPERATIONS THROUGH\n\tak := ack.Gin(c)\n\tak.GinErrorAbort(401, \"UnauthorizedRequest\", c.Request.URL.Path)\n}", "title": "" }, { "docid": "1cae8a5a14edea297ce769889d53a7f0", "score": "0.49597907", "text": "func (o JitNetworkAccessRequestOutput) Requestor() pulumi.StringOutput {\n\treturn o.ApplyT(func(v JitNetworkAccessRequest) string { return v.Requestor }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "dc59d83a4cd7e980123be5f42816b9d6", "score": "0.49566415", "text": "func (_ProxyAdmin *ProxyAdminCallerSession) Owner() (common.Address, error) {\n\treturn _ProxyAdmin.Contract.Owner(&_ProxyAdmin.CallOpts)\n}", "title": "" }, { "docid": "dc59d83a4cd7e980123be5f42816b9d6", "score": "0.49566415", "text": "func (_ProxyAdmin *ProxyAdminCallerSession) Owner() (common.Address, error) {\n\treturn _ProxyAdmin.Contract.Owner(&_ProxyAdmin.CallOpts)\n}", "title": "" }, { "docid": "dc59d83a4cd7e980123be5f42816b9d6", "score": "0.4955892", "text": "func (_ProxyAdmin *ProxyAdminCallerSession) Owner() (common.Address, error) {\n\treturn _ProxyAdmin.Contract.Owner(&_ProxyAdmin.CallOpts)\n}", "title": "" }, { "docid": "aae6fe4b9ac41b05a77f992d444354da", "score": "0.49527964", "text": "func (_OffchainAggregator *OffchainAggregatorFilterer) WatchRequesterAccessControllerSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorRequesterAccessControllerSet) (event.Subscription, error) {\n\n\tlogs, sub, err := _OffchainAggregator.contract.WatchLogs(opts, \"RequesterAccessControllerSet\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(OffchainAggregatorRequesterAccessControllerSet)\n\t\t\t\tif err := _OffchainAggregator.contract.UnpackLog(event, \"RequesterAccessControllerSet\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "3e956f062e8f12dc2af711dfdc22e3da", "score": "0.49324086", "text": "func (_RenProxyAdmin *RenProxyAdminCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _RenProxyAdmin.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3f892fcc91c2e043d8263f1c27543cdc", "score": "0.49241558", "text": "func (*GetCustomerUserAccessRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v8_services_customer_user_access_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "3f1ca9c80952c365cb93bd6027a43098", "score": "0.49167717", "text": "func AuthorizedRequester(ctx context.Context) *UserContextValue {\n\tcontextValue := forContext(ctx)\n\tif contextValue == nil || contextValue.User == nil || contextValue.AuthType != \"jwt\" || !contextValue.User.EmailVerified || !contextValue.User.CanRequestWork || contextValue.User.Type != models.REQUESTER {\n\t\treturn nil\n\t}\n\treturn contextValue\n}", "title": "" }, { "docid": "9d0162f321f4075619809ac348fa13b2", "score": "0.491503", "text": "func (st *Store) Access(s,\n\tremoteAddr, referer, origin, userAgent string) (t *Token, err error) {\n\n\tvar ss = [...]string{remoteAddr, referer, origin, userAgent}\n\tvar setFpC bool\n\n\tif nil == st.serlr {\n\t\treturn nil, ErrNoSerializer\n\t}\n\n\tif err = st.serlr.Deserialize(s, &t); nil != err || nil == t {\n\t\treturn nil, err\n\t}\n\n\tfor _, s := range ss {\n\t\tif len(s) != 0 {\n\t\t\tsetFpC = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif setFpC {\n\t\tt.fpc = makeFootprint(0, ss[0], ss[1], ss[2], ss[3])\n\t}\n\n\tif err = st.accessToken(t); nil != err {\n\t\treturn nil, err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "bf78f906d92cbd8602832e8dbc3541ef", "score": "0.49039403", "text": "func (_CanReclaimTokens *CanReclaimTokensCallerSession) Owner() (common.Address, error) {\n\treturn _CanReclaimTokens.Contract.Owner(&_CanReclaimTokens.CallOpts)\n}", "title": "" }, { "docid": "4cdeeded06a41ac7efd265efea3c40c1", "score": "0.49033493", "text": "func (_ComptrollerG4 *ComptrollerG4Caller) Admin(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _ComptrollerG4.contract.Call(opts, &out, \"admin\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "dbd764b7bef23c6ea45594fe615aedec", "score": "0.49031705", "text": "func (client ManagedClustersClient) GetAccessProfileSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "fbdcb8b8868026d62680df296cff2a87", "score": "0.486928", "text": "func (r Network_Security_Scanner_Request) GetRequestorOwnedFlag() (resp bool, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Security_Scanner_Request\", \"getRequestorOwnedFlag\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "7411dc90db838749a4f9821abacc933b", "score": "0.48514068", "text": "func (_Owned *OwnedCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Owned.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "91fadeb7428f21766fd7a245b42f4b51", "score": "0.4851046", "text": "func (_Cerc20 *Cerc20Caller) Admin(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Cerc20.contract.Call(opts, &out, \"admin\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "9b20518f788e9516a2ce0296034d86f6", "score": "0.48420405", "text": "func (_Cash *CashCaller) GetController(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Cash.contract.Call(opts, out, \"getController\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4e99bd3dd80e704cbaa17762ac0b6597", "score": "0.48253396", "text": "func (_Cash *CashCallerSession) GetController() (common.Address, error) {\n\treturn _Cash.Contract.GetController(&_Cash.CallOpts)\n}", "title": "" }, { "docid": "76d6fe8ce61c2d1546b2b9d554cdcc80", "score": "0.48244217", "text": "func (_GatewayRegistry *GatewayRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _GatewayRegistry.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "feb06f58f0f7da67e97df9a178d9546b", "score": "0.4824108", "text": "func (_Token *TokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "feb06f58f0f7da67e97df9a178d9546b", "score": "0.4824108", "text": "func (_Token *TokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4f88010fb8638e3ab7a6abe2e7062f78", "score": "0.4810614", "text": "func (_Ingress *IngressSession) ADMINCONTRACT() ([32]byte, error) {\n\treturn _Ingress.Contract.ADMINCONTRACT(&_Ingress.CallOpts)\n}", "title": "" }, { "docid": "8d787dd6fac1218bbde5868abb8ac7c4", "score": "0.4808866", "text": "func NewAccessRequest(\n\tparams []string,\n\tcommanderName string,\n\tcommanderID string,\n) Action {\n\taccessRequestParams := []string{\"\", \"\", \"\"}\n\tfor i := range params {\n\t\taccessRequestParams[i] = params[i]\n\t}\n\n\treturn &accessRequest{\n\t\tparams: accessRequestParams,\n\t\tcommanderName: commanderName,\n\t\tcommanderID: commanderID,\n\t}\n}", "title": "" }, { "docid": "2c09568293abf5a13db51ec693a767fe", "score": "0.4808771", "text": "func (_TokenProvider *TokenProviderCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _TokenProvider.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b5311590e3c233e47fef21274f58f9c6", "score": "0.48087397", "text": "func (_Heritable *HeritableCallerSession) Owner() (common.Address, error) {\n\treturn _Heritable.Contract.Owner(&_Heritable.CallOpts)\n}", "title": "" }, { "docid": "1dff346bc689e5a67091758a601a8641", "score": "0.48077914", "text": "func (_GatewayRegistry *GatewayRegistryCallerSession) Owner() (common.Address, error) {\n\treturn _GatewayRegistry.Contract.Owner(&_GatewayRegistry.CallOpts)\n}", "title": "" }, { "docid": "ef9039590c26f12d4612a8e22ae4a5f8", "score": "0.48073223", "text": "func (_WindMineToken *WindMineTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _WindMineToken.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "258ca6359332ba306ceee7406c60c7b1", "score": "0.48059943", "text": "func (_ProxyAdmin *ProxyAdminCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _ProxyAdmin.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "258ca6359332ba306ceee7406c60c7b1", "score": "0.48059943", "text": "func (_ProxyAdmin *ProxyAdminCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _ProxyAdmin.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "d2327e077bcdfc49aacb76af9e13e195", "score": "0.48046172", "text": "func (_Heritable *HeritableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Heritable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a35cef366b77e266577df088d695d1a4", "score": "0.48043188", "text": "func (o *GrantController) Control(ktx kontext.Context, c *gin.Context) {\n\tvar req entity.AuthorizationRequestJSON\n\n\trawData, err := c.GetRawData()\n\tif err != nil {\n\t\tlog.Error().\n\t\t\tErr(err).\n\t\t\tStack().\n\t\t\tInterface(\"request_id\", c.Value(\"request_id\")).\n\t\t\tArray(\"tags\", zerolog.Arr().Str(\"controller\").Str(\"authorization\").Str(\"grant\").Str(\"get_raw_data\")).\n\t\t\tMsg(\"Cannot get raw data\")\n\t\tc.JSON(http.StatusBadRequest, jsonapi.BuildResponse(o.apiError.BadRequestError(\"request body\")))\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(rawData, &req)\n\tif err != nil {\n\t\tlog.Error().\n\t\t\tErr(err).\n\t\t\tStack().\n\t\t\tInterface(\"request_id\", c.Value(\"request_id\")).\n\t\t\tArray(\"tags\", zerolog.Arr().Str(\"controller\").Str(\"authorization\").Str(\"grant\").Str(\"unmarshal\")).\n\t\t\tMsg(\"Cannot unmarshal json\")\n\t\tc.JSON(http.StatusBadRequest, jsonapi.BuildResponse(o.apiError.BadRequestError(\"request body\")))\n\t\treturn\n\t}\n\n\tdata, jsonapierr := o.authorizationUsecase.GrantAuthorizationCode(ktx, req)\n\tif jsonapierr != nil {\n\t\tc.JSON(jsonapierr.HTTPStatus(), jsonapi.BuildResponse(jsonapi.WithErrors(jsonapierr)))\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, jsonapi.BuildResponse(\n\t\tjsonapi.WithData(data),\n\t))\n}", "title": "" }, { "docid": "3e2e3d7f366de62b28208e7872b3b6ea", "score": "0.4803318", "text": "func (_APIConsumer *APIConsumerCallerSession) Owner() (common.Address, error) {\n\treturn _APIConsumer.Contract.Owner(&_APIConsumer.CallOpts)\n}", "title": "" }, { "docid": "6103582672ae145697dfe885f37f9890", "score": "0.47979194", "text": "func (_Ownable *OwnableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Ownable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6103582672ae145697dfe885f37f9890", "score": "0.4797758", "text": "func (_Ownable *OwnableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Ownable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6103582672ae145697dfe885f37f9890", "score": "0.4797758", "text": "func (_Ownable *OwnableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Ownable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6103582672ae145697dfe885f37f9890", "score": "0.4797758", "text": "func (_Ownable *OwnableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Ownable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6103582672ae145697dfe885f37f9890", "score": "0.4797758", "text": "func (_Ownable *OwnableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Ownable.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "596711a36bdaceef82ec821209c9f60d", "score": "0.4795895", "text": "func (_CappedToken *CappedTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _CappedToken.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "79c5253a06b6c25575a4d231faa975c1", "score": "0.47927383", "text": "func (_JobsManager *JobsManagerCaller) Controller(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _JobsManager.contract.Call(opts, out, \"controller\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a963434530cf6ac87efadfa62a1be9d0", "score": "0.4782563", "text": "func (client ManagedClustersClient) GetAccessProfileResponder(resp *http.Response) (result ManagedClusterAccessProfile, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "67e05616f62df97f4567269c3cb96aba", "score": "0.47727707", "text": "func (a *RemoteAccessApiService) GetAccessRequestExecute(r ApiGetAccessRequestRequest) (AccessRequestData, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue AccessRequestData\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"RemoteAccessApiService.GetAccessRequest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/remoteaccess/requests/{requestId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"requestId\"+\"}\", _neturl.PathEscape(parameterToString(r.requestId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Api-Token\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "cebf5f6cf69ae68e169044808cb3101f", "score": "0.4772708", "text": "func (_Orders *OrdersCallerSession) GetController() (common.Address, error) {\n\treturn _Orders.Contract.GetController(&_Orders.CallOpts)\n}", "title": "" }, { "docid": "5699bcc727e818a59bd73daa569d5ba8", "score": "0.477205", "text": "func (_Orders *OrdersCaller) GetController(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Orders.contract.Call(opts, out, \"getController\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "187c9aed81c09dee535208e89887bb76", "score": "0.47594956", "text": "func (_ERC20WithRate *ERC20WithRateCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ERC20WithRate.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e8237d1ebf18f681498e4fc36b0c22a3", "score": "0.47583088", "text": "func (_SimpleGatekeeperWithLimitLive *SimpleGatekeeperWithLimitLiveCallerSession) Owner() (common.Address, error) {\n\treturn _SimpleGatekeeperWithLimitLive.Contract.Owner(&_SimpleGatekeeperWithLimitLive.CallOpts)\n}", "title": "" }, { "docid": "e732b870f2faac5dba0431bde96f40fd", "score": "0.47567317", "text": "func (vs *ViewServer) Get(args *GetArgs, reply *GetReply) error {\n vs.mu.Lock()\n reply.View = vs.return_view\n vs.mu.Unlock()\n // Your code here.\n\n return nil\n}", "title": "" }, { "docid": "9162594e314d5ad0e9d478206cbe4667", "score": "0.47559196", "text": "func (_Ownable *OwnableCallerSession) Owner() (common.Address, error) {\n\treturn _Ownable.Contract.Owner(&_Ownable.CallOpts)\n}", "title": "" }, { "docid": "9162594e314d5ad0e9d478206cbe4667", "score": "0.47559196", "text": "func (_Ownable *OwnableCallerSession) Owner() (common.Address, error) {\n\treturn _Ownable.Contract.Owner(&_Ownable.CallOpts)\n}", "title": "" }, { "docid": "9162594e314d5ad0e9d478206cbe4667", "score": "0.47559196", "text": "func (_Ownable *OwnableCallerSession) Owner() (common.Address, error) {\n\treturn _Ownable.Contract.Owner(&_Ownable.CallOpts)\n}", "title": "" }, { "docid": "9162594e314d5ad0e9d478206cbe4667", "score": "0.47559196", "text": "func (_Ownable *OwnableCallerSession) Owner() (common.Address, error) {\n\treturn _Ownable.Contract.Owner(&_Ownable.CallOpts)\n}", "title": "" }, { "docid": "740468c8daa8875ae33abe9435325d98", "score": "0.47553158", "text": "func (_Mortgage *MortgageCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Mortgage.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "9162594e314d5ad0e9d478206cbe4667", "score": "0.475471", "text": "func (_Ownable *OwnableCallerSession) Owner() (common.Address, error) {\n\treturn _Ownable.Contract.Owner(&_Ownable.CallOpts)\n}", "title": "" }, { "docid": "bc4143ccb8d23f351f81de99f6314795", "score": "0.4754417", "text": "func (c DelegatorClaim) GetOwner() sdk.AccAddress { return c.Owner }", "title": "" }, { "docid": "b3464eac0d9c63bf3deb7610595c38b8", "score": "0.47518605", "text": "func (_RenProxyAdmin *RenProxyAdminCallerSession) Owner() (common.Address, error) {\n\treturn _RenProxyAdmin.Contract.Owner(&_RenProxyAdmin.CallOpts)\n}", "title": "" }, { "docid": "7d5f9b92d46e552962c0f23607d91562", "score": "0.47516802", "text": "func (_NodeIngress *NodeIngressSession) ADMINCONTRACT() ([32]byte, error) {\n\treturn _NodeIngress.Contract.ADMINCONTRACT(&_NodeIngress.CallOpts)\n}", "title": "" }, { "docid": "ca14bed9750e45b4818615e56640961a", "score": "0.47436044", "text": "func TestEffectiveCallerIDWithAccess(t *testing.T) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tvtgateConn, err := cluster.DialVTGate(ctx, t.Name(), vtgateGrpcAddress, \"some_other_user\", \"test_password\")\n\trequire.NoError(t, err)\n\tdefer vtgateConn.Close()\n\n\tsession := vtgateConn.Session(keyspaceName+\"@primary\", nil)\n\tquery := \"SELECT id FROM test_table\"\n\tctx = callerid.NewContext(ctx, callerid.NewEffectiveCallerID(\"user_with_access\", \"\", \"\"), nil)\n\t_, err = session.Execute(ctx, query, nil)\n\tassert.NoError(t, err)\n}", "title": "" }, { "docid": "2efcede4ddd10163e1df5313e0e36ccc", "score": "0.47424316", "text": "func (_SimpleGatekeeperWithLimit *SimpleGatekeeperWithLimitCallerSession) Owner() (common.Address, error) {\n\treturn _SimpleGatekeeperWithLimit.Contract.Owner(&_SimpleGatekeeperWithLimit.CallOpts)\n}", "title": "" } ]
0810b2842f8e7ba3d11677cf4e76ef6b
DeleteCron indicates an expected call of DeleteCron
[ { "docid": "465157981c2f44e7f2fefb9c896a7314", "score": "0.68854547", "text": "func (mr *MockCronServiceMockRecorder) DeleteCron(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteCron\", reflect.TypeOf((*MockCronService)(nil).DeleteCron), arg0, arg1)\n}", "title": "" } ]
[ { "docid": "732a70e17e29ccd3314a8eed8a492d02", "score": "0.710279", "text": "func TestCrontabDelete(t *testing.T) {\n\tassert := asserts.NewTestingAsserts(t, true)\n\t// Create test crontab with job.\n\tcounter := 0\n\tc := NewCrontab()\n\tcf := func(now time.Time) (bool, bool) { return now.Unix()%2 == 0, true }\n\ttf := func(id string) { counter++ }\n\n\tc.AddJob(\"keep\", cf, tf)\n\ttime.Sleep(5 * 1e9)\n\tc.Stop()\n\n\tassert.Equal(counter, 1, \"Counter should be increased only once.\")\n}", "title": "" }, { "docid": "71aa590e174ea17d1184d87784d343be", "score": "0.6753", "text": "func TestDel(t *testing.T) {\n\n\ttestJob := Job{\n\t\tCronPattern: \"*/1 * * * *\",\n\t\tImageName: \"jpweber/crontest:0.1.0\",\n\t\tState: ENABLED,\n\t}\n\ttestJob.encodeHash()\n\n\tcronJobs.Add(testJob)\n\n\tcronJobs.Del(0, \"\")\n\ttestData := cronJobs[0]\n\tif len(testData) != 0 {\n\t\tt.Error(\"Job was not deleted.\")\n\t}\n}", "title": "" }, { "docid": "4623d5af8b497bb10b45f06c26240929", "score": "0.65892833", "text": "func (m *MockCronService) DeleteCron(arg0, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteCron\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f343eeaf317fbde3dd0c894b5546efe5", "score": "0.6588366", "text": "func DelCronByKeys(cronID int, cronName string) error {\n cron := new(SysCron)\n cron.CronId = cronID\n cron.CronName = cronName\n\n affected, err := utils.Engine.Delete(cron)\n if err != nil {\n // seelog.Errorf(\"utils.Engine.Delete Error : %v\", err)\n return err\n }\n seelog.Debugf(\"%v delete : %v\", affected, cron)\n\n return nil\n}", "title": "" }, { "docid": "ee10e84e1334cefa912ff7f1c30722f6", "score": "0.5949089", "text": "func (c *Cron) Delete(db weave.KVStore, taskID []byte) error {\n\tif c.Err != nil {\n\t\treturn c.Err\n\t}\n\n\tfor i, t := range c.tasks {\n\t\tif bytes.Equal(t.tid, taskID) {\n\t\t\tc.tasks = append(c.tasks[:i], c.tasks[i+1:]...)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.Wrap(errors.ErrNotFound, \"no task\")\n}", "title": "" }, { "docid": "bec516585490620012210059247e3131", "score": "0.5884842", "text": "func TestNewCronTriggerAbnormal(t *testing.T) {\n\ttest_arguments := [][]string{\n\t\t// lower bounds\n\t\t[]string{\"-1\", \"2\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"1\", \"-1\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"1\", \"2\", \"0\", \"4\", \"5\"},\n\t\t[]string{\"1\", \"2\", \"3\", \"0\", \"5\"},\n\t\t[]string{\"1\", \"2\", \"3\", \"4\", \"-1\"},\n\n\t\t// upper bounds\n\t\t[]string{\"60\", \"2\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"1\", \"24\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"1\", \"2\", \"32\", \"4\", \"5\"},\n\t\t[]string{\"1\", \"2\", \"3\", \"13\", \"5\"},\n\t\t[]string{\"1\", \"2\", \"3\", \"4\", \"7\"},\n\n\t\t// floating point numbers\n\t\t[]string{\"1.1\", \"2\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"1\", \"1.1\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"1\", \"2\", \"1.1\", \"4\", \"5\"},\n\t\t[]string{\"1\", \"2\", \"3\", \"1.1\", \"5\"},\n\t\t[]string{\"1\", \"2\", \"3\", \"4\", \"1.1\"},\n\n\t\t// badly formatted cron strings\n\t\t[]string{\"*/ 3\", \"2\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"4,\", \"2\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"*3\", \"2\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"* /3\", \"2\", \"3\", \"4\", \"5\"},\n\t\t[]string{\"4,5,\", \"2\", \"3\", \"4\", \"5\"},\n\t\t[]string{\",4\", \"2\", \"3\", \"4\", \"5\"},\n\t}\n\tfor _, arg_list := range test_arguments {\n\t\t_, err := NewCronTrigger(arg_list[0], arg_list[1], arg_list[2], arg_list[3], arg_list[4])\n\t\tif err == nil {\n\t\t\tt.Errorf(\"no error when there should have been with args %s\", arg_list)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ad1756cd86a14be22f395ead103068b3", "score": "0.58736426", "text": "func TestSchedule_Delete(t *testing.T) {\n\tsetup()\n\tdefer teardown()\n\n\tmux.HandleFunc(\"/schedules/1\", func(w http.ResponseWriter, r *http.Request) {\n\t\ttestMethod(t, r, \"DELETE\")\n\t})\n\n\tclient := defaultTestClient(server.URL, \"foo\")\n\tid := \"1\"\n\terr := client.DeleteSchedule(id)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "c920db4adc932d5954ca76c4ff2fce66", "score": "0.57875067", "text": "func TestNoEntries(t *testing.T) {\n\tcron, err := New()\n\tif err != nil {\n\t\tt.Fatal(\"unexpected error\")\n\t}\n\tcron.Start(context.Background())\n\n\tselect {\n\tcase <-time.After(ONE_SECOND):\n\t\tt.FailNow()\n\tcase <-stop(cron):\n\t}\n}", "title": "" }, { "docid": "26f52d5a669acd56b7ec00459a3da5e7", "score": "0.5723084", "text": "func DeleteCronJob(ctx context.Context, id int64) error {\n\tsql := \"DELETE FROM cron WHERE id = $1\"\n\t_, err := pool.Exec(ctx, sql, id)\n\treturn err\n}", "title": "" }, { "docid": "86142d1cbf72186fbf7cd60bae70e879", "score": "0.5718546", "text": "func TestCronRead(t *testing.T) {\n\tclk := clocktesting.NewFakeClock(time.Now())\n\tc := getNewCronWithClock(clk)\n\tschedule := \"@every 1s\"\n\tassert.NoErrorf(t, c.Init(context.Background(), getTestMetadata(schedule)), \"error initializing valid schedule\")\n\texpectedCount := int32(5)\n\tvar observedCount atomic.Int32\n\terr := c.Read(context.Background(), func(ctx context.Context, res *bindings.ReadResponse) ([]byte, error) {\n\t\tassert.NotNil(t, res)\n\t\tobservedCount.Add(1)\n\t\treturn nil, nil\n\t})\n\t// Check if cron triggers 5 times in 5 seconds\n\tfor i := int32(0); i < expectedCount; i++ {\n\t\t// Add time to mock clock in 1 second intervals using loop to allow cron go routine to run\n\t\tclk.Step(time.Second)\n\t\truntime.Gosched()\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n\t// Wait for 1 second after adding the last second to mock clock to allow cron to finish triggering\n\tassert.Eventually(t, func() bool {\n\t\treturn observedCount.Load() == expectedCount\n\t}, time.Second, time.Millisecond*10,\n\t\t\"Cron did not trigger expected number of times, expected %d, got %d\", expectedCount, observedCount.Load())\n\tassert.NoErrorf(t, err, \"error on read\")\n\tassert.NoError(t, c.Close())\n}", "title": "" }, { "docid": "85f9644cbff922a5d60ec8d421700275", "score": "0.57119876", "text": "func TestNoEntries(t *testing.T) {\n\tclock := clockwork.NewFakeClock()\n\tcron := New(WithClock(clock))\n\tcron.Start()\n\trecvWithTimeout(t, cron.Stop().Done(), \"expected cron will be stopped immediately\")\n}", "title": "" }, { "docid": "2b0cf63cb1f7760863f499461fcbdcd9", "score": "0.5695585", "text": "func UpdateCronJob(cron models.NewCron) error {\n seelog.Debugf(\"Update Job : %v\", cron)\n cronName := cron.CronName\n cronSpec := cron.CronSpec\n cronEnvs := strings.Split(cron.CronEnvs, \" \")\n cronCmd := cron.CronCmd\n cronArgs := strings.Split(cron.CronArgs, \" \")\n cronUuid := cron.CronUuid\n\n job, err := cronlib.NewJobModel(\n cronSpec,\n func() {\n Execute(\"cron\", cronUuid, cronCmd, cronEnvs, cronArgs...)\n },\n cronlib.AsyncMode(),\n )\n if err != nil {\n seelog.Errorf(\"Cron Update Fail : [%v]\", cronName)\n return err\n }\n\n err = Cron.UpdateJobModel(cronName, job)\n if err != nil {\n seelog.Errorf(\"Cron Register Error : %v\", err.Error())\n return err\n }\n\n return nil\n}", "title": "" }, { "docid": "11781d36d210359dffd3d4c3630db360", "score": "0.5639362", "text": "func TestNewCronTriggerNormal(t *testing.T) {\n\tregular_test_arguments := []string{\"2\", \"*/2\", \"2,3\", \"2,3,4,5,6\", \"1,18,23\"}\n\tfor _, argument := range regular_test_arguments {\n\t\t_, err := NewCronTrigger(\"1\", argument, \"3\", \"4\", \"5\")\n\t\tif err != nil {\n\t\t\tt.Errorf(\"arg %s: %s\", argument, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7fe61e2ffcff150244891db710555aed", "score": "0.56174594", "text": "func TestScheduleAfterRemoval(t *testing.T) {\n\t// The first time this job is run, set a timer and remove the other job\n\t// 750ms later. Correct behavior would be to still run the job again in\n\t// 250ms, but the bug would cause it to run instead 1s later.\n\tvar calls int32\n\tclock := clockwork.NewFakeClock()\n\tcron := New(WithClock(clock))\n\thourJob := cron.Schedule(Every(time.Hour), FuncJob(func() {}), \"\")\n\tcron.Schedule(Every(time.Second), FuncJob(func() {\n\t\tswitch atomic.LoadInt32(&calls) {\n\t\tcase 0:\n\t\t\tatomic.AddInt32(&calls, 1)\n\t\tcase 1:\n\t\t\tatomic.AddInt32(&calls, 1)\n\t\t\tadvanceAndCycleNoJobWait(cron, 750*time.Millisecond)\n\t\t\tcron.Remove(hourJob)\n\t\t\tcycle(cron)\n\t\tcase 2:\n\t\t\tatomic.AddInt32(&calls, 1)\n\t\tcase 3:\n\t\t\tpanic(\"unexpected 3rd call\")\n\t\t}\n\t}), \"\")\n\tcron.Start()\n\tdefer cron.Stop()\n\tcycle(cron)\n\tadvanceAndCycle(cron, time.Second)\n\tassert.Equal(t, int32(1), atomic.LoadInt32(&calls))\n\tadvanceAndCycle(cron, time.Second)\n\tassert.Equal(t, int32(2), atomic.LoadInt32(&calls))\n\tadvanceAndCycle(cron, 250*time.Millisecond)\n\tassert.Equal(t, int32(3), atomic.LoadInt32(&calls))\n}", "title": "" }, { "docid": "fa217c72666e335fdb85e87dbf175028", "score": "0.5546448", "text": "func TestCrontabKeep(t *testing.T) {\n\tassert := asserts.NewTestingAsserts(t, true)\n\t// Create test crontab with job.\n\tcounter := 0\n\tc := NewCrontab()\n\tcf := func(now time.Time) (bool, bool) { return now.Unix()%2 == 0, false }\n\ttf := func(id string) { counter++ }\n\n\tc.AddJob(\"keep\", cf, tf)\n\ttime.Sleep(5 * time.Second)\n\tc.Stop()\n\n\tassert.Equal(counter, 2, \"Counter should be increased two times.\")\n}", "title": "" }, { "docid": "82f2a50c8cb0480eade5f673e7514f6c", "score": "0.5529596", "text": "func handleCron(w http.ResponseWriter, r *http.Request) {\n\t// @TODO\n}", "title": "" }, { "docid": "ca25fb0aa85f7701bb42b416926c839b", "score": "0.54447895", "text": "func (client *TextmagicRestClient) DeleteScheduled(id uint32) (bool, error) {\n\tvar success bool\n\n\tmethod := \"DELETE\"\n\n\turi := fmt.Sprintf(\"%s/%s/%d\", client.BaseUrl(), SCHEDULED_RES, id)\n\n\tresponse, err := client.Request(method, uri, nil, nil)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif response[0] == 204 {\n\t\tsuccess = true\n\t}\n\n\treturn success, err\n}", "title": "" }, { "docid": "534468902da551f37b10dbb486a42bcd", "score": "0.5441425", "text": "func TestStopWithoutStart(t *testing.T) {\n\tclock := clockwork.NewRealClock()\n\tcron := New(WithClock(clock))\n\tcron.Stop()\n}", "title": "" }, { "docid": "8e34a88b95f03490fc3257fd429d942e", "score": "0.5420223", "text": "func EnsureCronJob(client kubernetes.Interface, funcObj *kubelessApi.Function, schedule, reqImage string, or []metav1.OwnerReference, reqImagePullSecret []v1.LocalObjectReference) error {\n\tvar maxSucccessfulHist, maxFailedHist int32\n\tmaxSucccessfulHist = 3\n\tmaxFailedHist = 1\n\tvar timeout int\n\tif funcObj.Spec.Timeout != \"\" {\n\t\tvar err error\n\t\ttimeout, err = strconv.Atoi(funcObj.Spec.Timeout)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Unable convert %s to a valid timeout\", funcObj.Spec.Timeout)\n\t\t}\n\t} else {\n\t\ttimeout, _ = strconv.Atoi(defaultTimeout)\n\t}\n\tactiveDeadlineSeconds := int64(timeout)\n\tjobName := fmt.Sprintf(\"trigger-%s\", funcObj.ObjectMeta.Name)\n\tvar headersString = \"\"\n\ttimestamp := time.Now().UTC()\n\teventID, err := GetRandString(11)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to create a event-ID %v\", err)\n\t}\n\theadersString = headersString + \" -H \\\"event-id: \" + eventID + \"\\\"\"\n\theadersString = headersString + \" -H \\\"event-time: \" + timestamp.String() + \"\\\"\"\n\theadersString = headersString + \" -H \\\"event-type: application/json\\\"\"\n\theadersString = headersString + \" -H \\\"event-namespace: cronjobtrigger.kubeless.io\\\"\"\n\n\tjob := &batchv1beta1.CronJob{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: jobName,\n\t\t\tNamespace: funcObj.ObjectMeta.Namespace,\n\t\t\tLabels: addDefaultLabel(funcObj.ObjectMeta.Labels),\n\t\t\tOwnerReferences: or,\n\t\t},\n\t\tSpec: batchv1beta1.CronJobSpec{\n\t\t\tSchedule: schedule,\n\t\t\tSuccessfulJobsHistoryLimit: &maxSucccessfulHist,\n\t\t\tFailedJobsHistoryLimit: &maxFailedHist,\n\t\t\tJobTemplate: batchv1beta1.JobTemplateSpec{\n\t\t\t\tSpec: batchv1.JobSpec{\n\t\t\t\t\tActiveDeadlineSeconds: &activeDeadlineSeconds,\n\t\t\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\t\t\tImagePullSecrets: reqImagePullSecret,\n\t\t\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tImage: reqImage,\n\t\t\t\t\t\t\t\t\tName: \"trigger\",\n\t\t\t\t\t\t\t\t\tArgs: []string{\"curl\", \"-Lv\", headersString, fmt.Sprintf(\"http://%s.%s.svc.cluster.local:8080\", funcObj.ObjectMeta.Name, funcObj.ObjectMeta.Namespace)},\n\t\t\t\t\t\t\t\t\tResources: v1.ResourceRequirements{\n\t\t\t\t\t\t\t\t\t\tLimits: v1.ResourceList{\n\t\t\t\t\t\t\t\t\t\t\tv1.ResourceMemory: resource.MustParse(\"4Mi\"),\n\t\t\t\t\t\t\t\t\t\t\tv1.ResourceCPU: resource.MustParse(\"1m\"),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tRequests: v1.ResourceList{\n\t\t\t\t\t\t\t\t\t\t\tv1.ResourceMemory: resource.MustParse(\"4Mi\"),\n\t\t\t\t\t\t\t\t\t\t\tv1.ResourceCPU: resource.MustParse(\"1m\"),\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\tRestartPolicy: v1.RestartPolicyNever,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err = client.BatchV1beta1().CronJobs(funcObj.ObjectMeta.Namespace).Create(job)\n\tif err != nil && k8sErrors.IsAlreadyExists(err) {\n\t\tnewCronJob := &batchv1beta1.CronJob{}\n\t\tnewCronJob, err = client.BatchV1beta1().CronJobs(funcObj.ObjectMeta.Namespace).Get(jobName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !hasDefaultLabel(newCronJob.ObjectMeta.Labels) {\n\t\t\treturn fmt.Errorf(\"Found a conflicting cronjob object %s/%s. Aborting\", funcObj.ObjectMeta.Namespace, funcObj.ObjectMeta.Name)\n\t\t}\n\t\tnewCronJob.ObjectMeta.Labels = funcObj.ObjectMeta.Labels\n\t\tnewCronJob.ObjectMeta.OwnerReferences = or\n\t\tnewCronJob.Spec = job.Spec\n\t\t_, err = client.BatchV1beta1().CronJobs(funcObj.ObjectMeta.Namespace).Update(newCronJob)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "620145b3541ab2f48d4d35f9af5326e1", "score": "0.53659075", "text": "func TestScheduleJobs(t *testing.T) {\n\tcroner := cron.New()\n\n\t// Each cases is on the same cron instance\n\t// Tests must be executed sequentially!\n\tcases := []struct {\n\t\tname string\n\t\tqueriedJobs []ContainerCronJob\n\t\texpectedJobs []ContainerCronJob\n\t}{\n\t\t{\n\t\t\tname: \"No containers\",\n\t\t\tqueriedJobs: []ContainerCronJob{},\n\t\t\texpectedJobs: []ContainerCronJob{},\n\t\t},\n\t\t{\n\t\t\tname: \"One container with schedule\",\n\t\t\tqueriedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Add a second job\",\n\t\t\tqueriedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_2\",\n\t\t\t\t\tcontainerID: \"has_schedule_2\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_2\",\n\t\t\t\t\tcontainerID: \"has_schedule_2\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Replace job 1\",\n\t\t\tqueriedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1_prime\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_2\",\n\t\t\t\t\tcontainerID: \"has_schedule_2\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_2\",\n\t\t\t\t\tcontainerID: \"has_schedule_2\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1_prime\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tfor loopIndex, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"Loop %d: %s\", loopIndex, c.name), func(t *testing.T) {\n\t\t\tlog.Printf(\"Running %s\", t.Name())\n\n\t\t\tt.Logf(\"Expected jobs: %+v Queried jobs: %+v\", c.expectedJobs, c.queriedJobs)\n\n\t\t\tScheduleJobs(croner, c.queriedJobs)\n\n\t\t\tscheduledEntries := croner.Entries()\n\t\t\tt.Logf(\"Cron entries: %+v\", scheduledEntries)\n\n\t\t\tErrorUnequal(t, len(c.expectedJobs), len(scheduledEntries), \"Job and entry lengths don't match\")\n\t\t\tfor i, entry := range scheduledEntries {\n\t\t\t\tErrorUnequal(t, c.expectedJobs[i], entry.Job, \"Job value does not match entry\")\n\t\t\t}\n\t\t})\n\t}\n\n\t// Make sure the cron stops\n\tcroner.Stop()\n}", "title": "" }, { "docid": "405b2fa13f90d673323b639f7aaf6f96", "score": "0.53634894", "text": "func TestStopCausesJobsToNotRun(t *testing.T) {\n\tclock := clockwork.NewFakeClock()\n\tcron := New(WithClock(clock))\n\tcron.Start()\n\tcron.Stop()\n\tvar call int32\n\t_, _ = cron.AddFunc(\"* * * * * ?\", func() { atomic.AddInt32(&call, 1) }, \"\")\n\tcycle(cron)\n\tadvanceAndCycle(cron, time.Second)\n\tassert.Equal(t, int32(0), atomic.LoadInt32(&call))\n}", "title": "" }, { "docid": "d67d7f45e627f046a67788a974be03e0", "score": "0.53290695", "text": "func (mr *MockCronServiceMockRecorder) CreateCron(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateCron\", reflect.TypeOf((*MockCronService)(nil).CreateCron), arg0)\n}", "title": "" }, { "docid": "5af5a847377465e875a1fa8a227f4edd", "score": "0.52787536", "text": "func AddCronJob(cron models.NewCron) error {\n seelog.Debugf(\"Set New Job : %v\", cron)\n cronName := cron.CronName\n cronSpec := cron.CronSpec\n cronEnvs := strings.Split(cron.CronEnvs, \" \")\n cronCmd := cron.CronCmd\n cronArgs := strings.Split(cron.CronArgs, \" \")\n cronUuid := cron.CronUuid\n\n job, err := cronlib.NewJobModel(\n cronSpec,\n func() {\n Execute(\"cron\", cronUuid, cronCmd, cronEnvs, cronArgs...)\n },\n cronlib.AsyncMode(),\n )\n if err != nil {\n seelog.Errorf(\"Cron Set Fail : [%v]\", cronName)\n return err\n }\n\n err = Cron.UpdateJobModel(cronName, job)\n if err != nil {\n seelog.Errorf(\"Cron Register Error : %v\", err.Error())\n return err\n }\n\n return nil\n}", "title": "" }, { "docid": "20095075a52bb844e713dfd07d14ab78", "score": "0.5255877", "text": "func (mr *MockCronServiceMockRecorder) UpdateCron(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateCron\", reflect.TypeOf((*MockCronService)(nil).UpdateCron), arg0)\n}", "title": "" }, { "docid": "8c02ba73ed899936c2a5a2973bb56d70", "score": "0.5255631", "text": "func NewMockCron(ctrl *gomock.Controller) *MockCron {\n\tmock := &MockCron{ctrl: ctrl}\n\tmock.recorder = &MockCronMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "784593e6bba9fb89561cebbb565d94a1", "score": "0.5248526", "text": "func (scheduler Scheduler) DeleteSchedule(assID int) error {\n\n\t//this is what is being sent to the scheduler service\n\tjsonData := map[string]interface{}{\n\t\t\"authentication\": os.Getenv(\"PEER_AUTH\"),\n\t\t\"assignment_id\": assID,\n\t}\n\n\t//this is just sending the request\n\tjsonValue, err := json.Marshal(jsonData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\turl := \"http://localhost:8086\" //schedulerservice\n\n\tif os.Getenv(\"SCHEDULE_SERVICE\") != \"\" {\n\t\turl = \"http://\" + os.Getenv(\"SCHEDULE_SERVICE\") //schedulerservice address changed in env var\n\t}\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(http.MethodDelete, url, bytes.NewBuffer(jsonValue))\n\tif err != nil {\n\t\t// handle error\n\t\tlog.Fatal(err)\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\tresponse, err := client.Do(req) //run PUT request\n\tif err != nil {\n\t\t// handle error\n\t\tlog.Fatal(err)\n\t} else {\n\t\tdata, _ := ioutil.ReadAll(response.Body)\n\t\tfmt.Println(string(data))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "14a55d7dd85e777d5300a01eb139991c", "score": "0.52437764", "text": "func TestParseCronFieldAbnormal(t *testing.T) {\n\ttest_arguments := []TPCFArguments{\n\t\t// comma-separated case\n\t\tTPCFArguments{FieldValue: \"0,2\", LowerBound: 1, UpperBound: 3},\n\t\tTPCFArguments{FieldValue: \"0,2\", LowerBound: 0, UpperBound: 1},\n\t\tTPCFArguments{FieldValue: \"0,2\", LowerBound: 2, UpperBound: 0},\n\n\t\t// slash-separated case\n\t\tTPCFArguments{FieldValue: \"*/2\", LowerBound: 2, UpperBound: 0},\n\n\t\t// asterisk case\n\t\tTPCFArguments{FieldValue: \"*\", LowerBound: 2, UpperBound: 0},\n\t}\n\tfor _, args := range test_arguments {\n\t\t_, err := parseCronField(args.FieldValue, args.LowerBound, args.UpperBound)\n\t\tif err == nil {\n\t\t\tt.Errorf(\"no error where there should have been with args %v\", args)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5a813a1491d196e84550b71cd55b7620", "score": "0.52391815", "text": "func TestDeleteTask(t *testing.T) {\n\tserver, store := setupTaskTests()\n\n\tt.Run(\"Delete task 'math' from project 'homework'\", func(t *testing.T) {\n\t\tmathTask := store.Tasks[0]\n\n\t\treq, _ := http.NewRequest(\"DELETE\", \"/projects/homework/tasks/math\", nil)\n\t\tw := httptest.NewRecorder()\n\t\tserver.Router.ServeHTTP(w, req)\n\n\t\tassert.Equalf(t, http.StatusOK, w.Code, \"wanted http.StatusOK, got %s\", w.Code)\n\t\tassert.NotContains(t, store.Tasks, mathTask, \"Task was not deleted\")\n\t})\n\n\tt.Run(\"Try to delete nonexistent task\", func(t *testing.T) {\n\t\treq, _ := http.NewRequest(\"DELETE\", \"/projects/homework/tasks/math2\", nil)\n\t\tw := httptest.NewRecorder()\n\t\tserver.Router.ServeHTTP(w, req)\n\n\t\tassert.Equalf(t, http.StatusNotFound, w.Code, \"wanted http.StatusNotFound, got %s\", w.Code)\n\t\tassert.Lenf(t, store.Tasks, 2, \"No task should have been deleted\")\n\t})\n}", "title": "" }, { "docid": "fa834f79869f9d7f9d0742e210d86940", "score": "0.5236254", "text": "func NewCron(spec string, fun func()) {\n\tc.AddFunc(spec, fun)\n}", "title": "" }, { "docid": "7e60b5c71bacc295bce961a08179406e", "score": "0.5183779", "text": "func (mr *MockCronServiceMockRecorder) GetCron(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetCron\", reflect.TypeOf((*MockCronService)(nil).GetCron), arg0, arg1)\n}", "title": "" }, { "docid": "df703bc0dafd247f04e7672082f2068a", "score": "0.5165754", "text": "func TestAdd(t *testing.T) {\n\n\ttestJob := Job{\n\t\tCronPattern: \"*/1 * * * *\",\n\t\tImageName: \"jpweber/crontest:0.1.0\",\n\t\tState: ENABLED,\n\t}\n\n\tcronJobs.Add(testJob)\n\n\tif len(cronJobs) != 2 {\n\t\tt.Error(\"Expected 2 jobs in jobs list got \", len(cronJobs), \"instead\")\n\t}\n}", "title": "" }, { "docid": "20fed09562fe56ee40c4c61c7da76aaf", "score": "0.51619756", "text": "func (s Scheduler) ScheduleCron(event string, payload string, cron string) {\n\tlog.Print(\"🚀 Scheduling event \", event, \" with cron string \", cron)\n\tentryID, ok := s.cronEntries[event]\n\tif ok {\n\t\ts.cron.Remove(entryID)\n\t\t_, err := s.db.Exec(`UPDATE \"public\".\"jobs\" SET \"cron\" = $1 , \"payload\" = $2 WHERE \"name\" = $3 AND \"cron\" != '-'`, cron, payload, event)\n\t\tif err != nil {\n\t\t\tlog.Print(\"schedule cron update error: \", err)\n\t\t}\n\t} else {\n\t\t_, err := s.db.Exec(`INSERT INTO \"public\".\"jobs\" (\"name\", \"payload\", \"runAt\", \"cron\") VALUES ($1, $2, $3, $4)`, event, payload, time.Now(), cron)\n\t\tif err != nil {\n\t\t\tlog.Print(\"schedule cron insert error: \", err)\n\t\t}\n\t}\n\n\teventFn, ok := s.listeners[event]\n\tif ok {\n\t\tentryID, err := s.cron.AddFunc(cron, func() { eventFn(payload) })\n\t\ts.cronEntries[event] = entryID\n\t\tif err != nil {\n\t\t\tlog.Print(\"💀 error: \", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2521083a838284062ea916207b0ad3b8", "score": "0.5160173", "text": "func TestStartNoop(t *testing.T) {\n\tclock := clockwork.NewRealClock()\n\tcron := New(WithClock(clock))\n\tstarted := cron.Start()\n\tdefer cron.Stop()\n\tassert.True(t, started)\n\tstarted = cron.Start()\n\tassert.False(t, started)\n}", "title": "" }, { "docid": "13de36ca49f0cf94deb5e3a2811ee3fc", "score": "0.5113041", "text": "func (mr *MockWorkflowClientMockRecorder) CronTrigger(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CronTrigger\", reflect.TypeOf((*MockWorkflowClient)(nil).CronTrigger), varargs...)\n}", "title": "" }, { "docid": "b34ec4c27ae8fcfc04114f01aebc5eba", "score": "0.51119953", "text": "func (c *Cron) Stop() error {\n\tif atomic.CompareAndSwapUint32(&c.stopped, 0, 1) {\n\t\tclose(c.done)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "544c3444387d611b4d1bc9919dc89ef9", "score": "0.51089156", "text": "func (suite *PlanTestSuite) TestDeterminePlanDeleteCommand() {\n\tcfg := env.Config{\n\t\tCommand: \"delete\",\n\t}\n\tstepsMaker := determineSteps(cfg)\n\tsuite.Same(&uninstall, stepsMaker)\n}", "title": "" }, { "docid": "f254b9bb206497a0a13e914a6e24bd47", "score": "0.5106626", "text": "func runDeleteWeb(cmd *cobra.Command) {\n\tverb := \"DELETE\"\n\turl := \"/1.0/regex/\" + get.name\n\n\tif _, err := web.Request(cmd, verb, url, nil); err != nil {\n\t\tcmd.Println(\"Deleting Regex : \", err)\n\t}\n\n\tcmd.Println(\"Deleting Regex : Deleted\")\n}", "title": "" }, { "docid": "bd68ebd9aa3a110b72040470a99e9328", "score": "0.50682724", "text": "func (r *PutJob) Cron(cron string) *PutJob {\n\n\tr.req.Cron = cron\n\n\treturn r\n}", "title": "" }, { "docid": "c544ff766cf323c4a440d5d119befb58", "score": "0.5053967", "text": "func (a Actor) OnDeferredCronEvent(rt Runtime, payload *CronEventPayload) *adt.EmptyValue {\n\trt.ValidateImmediateCallerIs(builtin.StoragePowerActorAddr)\n\n\tswitch payload.EventType {\n\tcase CronEventTempFault:\n\t\ta.checkTemporaryFaultEvents(rt, payload.Sectors)\n\tcase CronEventPreCommitExpiry:\n\t\ta.checkPrecommitExpiry(rt, payload.Sectors, payload.RegisteredProof)\n\tcase CronEventSectorExpiry:\n\t\ta.checkSectorExpiry(rt, payload.Sectors)\n\tcase CronEventWindowedPoStExpiration:\n\t\ta.checkPoStProvingPeriodExpiration(rt)\n\tcase CronEventWorkerKeyChange:\n\t\ta.commitWorkerKeyChange(rt)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "77cc275009cf4bedb66c5ff1a9180ea4", "score": "0.5047939", "text": "func Cron(w http.ResponseWriter, r *http.Request) {\n\t// Check that the request is originating from within app engine\n\t// https://cloud.google.com/appengine/docs/flexible/go/scheduling-jobs-with-cron-yaml#validating_cron_requests\n\tif r.Header.Get(\"X-Appengine-Cron\") != \"true\" {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\t// setting up database connection\n\tctx := context.Background()\n\tvar err error\n\tclient, err = firestore.NewClient(ctx, \"algobot-308118\")\n\tdefer client.Close()\n\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tswitch hour := time.Now().Hour(); hour {\n\tcase 9:\n\t\tMessagePairs(client, ctx)\n\tcase 11:\n\t\tMessageSolo(client, ctx)\n\tcase 13:\n\t\tPostDaily(client, ctx)\n\tdefault:\n\t\tlog.Fatal(\"Something is up with cron; this shouldn't be running! Check out your YAML\")\n\t}\n}", "title": "" }, { "docid": "fdebfce70b7f04d821691a78ffd87b4f", "score": "0.50373054", "text": "func runDeleteDB(cmd *cobra.Command) {\n\tcmd.Printf(\"Deleting Regex : Name[%s]\\n\", delete.name)\n\n\tif delete.name == \"\" {\n\t\tcmd.Help()\n\t\treturn\n\t}\n\n\tif err := regex.Delete(\"\", conn, delete.name); err != nil {\n\t\tcmd.Println(\"Deleting Regex : \", err)\n\t\treturn\n\t}\n\n\tcmd.Println(\"Deleting Regex : Deleted\")\n}", "title": "" }, { "docid": "4eea3909fce958df3876d6d4334a2ede", "score": "0.5026989", "text": "func TestBlockingRunNoop(t *testing.T) {\n\tclock := clockwork.NewFakeClock()\n\tcron := New(WithClock(clock))\n\tgo cron.Run()\n\tdefer cron.Stop()\n\ttime.Sleep(time.Millisecond)\n\tassert.False(t, cron.Run())\n}", "title": "" }, { "docid": "bb00e0cc737cf2da136399ba2bc32fba", "score": "0.50220644", "text": "func (c *Cron) GetAllCronTasks() ([]*Cron, error) {\r\n\tvar crons []*Cron\r\n\terr := DBConn.Table(c.TableName()).Find(&crons).Error\r\n\treturn crons, err\r\n}", "title": "" }, { "docid": "8efe3bff3c457d741385e982a2f801c1", "score": "0.4998986", "text": "func (r Resource) deleteTestTaskRun(name string) {\n\tT.Logf(\"Deleting taskrun: %s\\n\", name)\n\t_ = r.PipelineClient.TektonV1alpha1().TaskRuns(\"ns1\").Delete(name, &metav1.DeleteOptions{})\n}", "title": "" }, { "docid": "ebb86165e3076fbf2f76faf4e66efc99", "score": "0.49974945", "text": "func ValidateCronSchedule(schedule string) error {\n\tif !(strings.HasPrefix(schedule, \"CRON_TZ=\") || strings.HasPrefix(schedule, \"@every \")) {\n\t\treturn errors.New(\"cron schedule must specify a time zone using CRON_TZ, e.g. 'CRON_TZ=UTC 5 * * * *', or use the @every syntax, e.g. '@every 1h30m'\")\n\t}\n\tparser := cron.NewParser(cron.SecondOptional | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor)\n\t_, err := parser.Parse(schedule)\n\treturn pkgerrors.Wrapf(err, \"invalid cron schedule '%v'\", schedule)\n}", "title": "" }, { "docid": "ff8ceeac181d32e9d9fb56a74cf36339", "score": "0.4988706", "text": "func (m *MockCronService) UpdateCron(arg0 *models.Cron) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateCron\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6d7c6de3cd6959c86a921d64ccdb4d01", "score": "0.49699104", "text": "func TestTriggerCronJobWithLongName(t *testing.T) {\n\tlongName := strings.Repeat(\"test\", 13)\n\n\tcron := batch.CronJob{\n\t\tObjectMeta: metaV1.ObjectMeta{\n\t\t\tName: longName,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: labels,\n\t\t}, TypeMeta: metaV1.TypeMeta{\n\t\t\tKind: \"CronJob\",\n\t\t\tAPIVersion: \"v1\",\n\t\t}}\n\n\tclient := fake.NewSimpleClientset(&cron)\n\terr := cronjob.TriggerCronJob(client, namespace, longName)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "484ee45029beee7622619b0a67e26b7c", "score": "0.4948948", "text": "func (r *ReconcileDescheduler) createCronJob(descheduler *deschedulerv1alpha1.Descheduler) (*batchv1beta1.CronJob, error) {\n\tlog.Printf(\"Creating descheduler job\")\n\t// ttl := int32(100)\n\t// TTLSecondsAfterFinished: &ttl,\n\tflags, err := ValidateFlags(descheduler.Spec.Flags)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(descheduler.Spec.Image) == 0 {\n\t\t// Set the default image here\n\t\tdescheduler.Spec.Image = DefaultImage // No need to update the CR here making it opaque to end-user\n\t}\n\n\tflags = append(DeschedulerCommand, flags...)\n\n\tjob := &batchv1beta1.CronJob{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"CronJob\",\n\t\t\tAPIVersion: batch.SchemeGroupVersion.String(),\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: descheduler.Name,\n\t\t\tNamespace: descheduler.Namespace,\n\t\t},\n\t\tSpec: batchv1beta1.CronJobSpec{\n\t\t\tSchedule: descheduler.Spec.Schedule,\n\t\t\tJobTemplate: batchv1beta1.JobTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"descheduler-job-spec\",\n\t\t\t\t},\n\t\t\t\tSpec: batch.JobSpec{\n\t\t\t\t\t// TTLSecondsAfterFinished: &ttl,\n\t\t\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\t\t\tVolumes: []v1.Volume{{\n\t\t\t\t\t\t\t\tName: \"policy-volume\",\n\t\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\t\tConfigMap: &v1.ConfigMapVolumeSource{\n\t\t\t\t\t\t\t\t\t\tLocalObjectReference: v1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\t\tName: descheduler.Name,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPriorityClassName: \"system-cluster-critical\",\n\t\t\t\t\t\t\tRestartPolicy: \"Never\",\n\t\t\t\t\t\t\tContainers: []v1.Container{{\n\t\t\t\t\t\t\t\tName: \"descheduler-axway\",\n\t\t\t\t\t\t\t\tImage: descheduler.Spec.Image,\n\t\t\t\t\t\t\t\tResources: v1.ResourceRequirements{\n\t\t\t\t\t\t\t\t\tLimits: v1.ResourceList{\n\t\t\t\t\t\t\t\t\t\tv1.ResourceCPU: resource.MustParse(\"100m\"),\n\t\t\t\t\t\t\t\t\t\tv1.ResourceMemory: resource.MustParse(\"500Mi\"),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tRequests: v1.ResourceList{\n\t\t\t\t\t\t\t\t\t\tv1.ResourceCPU: resource.MustParse(\"100m\"),\n\t\t\t\t\t\t\t\t\t\tv1.ResourceMemory: resource.MustParse(\"500Mi\"),\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\tCommand: flags,\n\t\t\t\t\t\t\t\tVolumeMounts: []v1.VolumeMount{{\n\t\t\t\t\t\t\t\t\tMountPath: \"/policy-dir\",\n\t\t\t\t\t\t\t\t\tName: \"policy-volume\",\n\t\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t\tServiceAccountName: \"descheduler-operator\", // TODO: This is hardcoded as of now, find a way to reference it from rbac.yaml.\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\terr = controllerutil.SetControllerReference(descheduler, job, r.scheme)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error setting owner references %v\", err)\n\t}\n\treturn job, nil\n}", "title": "" }, { "docid": "14ac0f3fa1ec46daa4691dd43744bc26", "score": "0.49264565", "text": "func checkStatus() {\n time.Sleep(time.Duration(renewStep) * time.Millisecond) // 1s = 1000\n //fmt.Println(\"Crontab updated\") //Uncomment to see a console message everytime it checks\n\n _, err := os.Stat(\"../boulder/renewTmp/renew1\")\n if err == nil {\n fmt.Printf(\"File deleted\")\n renewBytes, _ := ioutil.ReadFile(\"../boulder/renewTmp/renew1\")\n renewStr := string(renewBytes[0:len(renewBytes)])\n contents := strings.SplitN(renewStr,\" \",3)\n addToCron(contents[0], contents[1], contents[2])\n err = os.Remove(\"../boulder/renewTmp/renew1\") //Can't be deferred as this process never ends\n if err != nil {\n\t\t\tfmt.Printf(\"Failed\")\n\t\t\tpanic(err) \n }\n } else {\n //fmt.Printf(\"File doesnt exist\")\n}\n\n\n\n checkStatus()\n}", "title": "" }, { "docid": "ad84ee4f2ffca3842d285d34b0594a6d", "score": "0.4914267", "text": "func (mr *MockWorkflowServerMockRecorder) CronTrigger(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CronTrigger\", reflect.TypeOf((*MockWorkflowServer)(nil).CronTrigger), arg0, arg1)\n}", "title": "" }, { "docid": "1715a5b7973ed4699b6ee5e8756f88a3", "score": "0.49121553", "text": "func NewCron() *cron.Cron {\n\treturn cron.New()\n}", "title": "" }, { "docid": "b8dcba76be25d1e53b252b8728a26057", "score": "0.4908236", "text": "func Close() error {\n\treturn defaultCron().Close()\n}", "title": "" }, { "docid": "aac79a586c44f24f02364ce379345361", "score": "0.49048987", "text": "func (c *Cron) Kill(ctx *core.Context) error {\n\treturn c.command(ctx, \"kill\")\n}", "title": "" }, { "docid": "25a768465afd030785a21fd2077308be", "score": "0.49012622", "text": "func (r *ReconcileDescheduler) generateDeschedulerJob(Descheduler *deschedulerv1alpha1.Descheduler) error {\n\t// Check if the cron job already exists\n\tDeschedulerCronJob := &batchv1beta1.CronJob{}\n\terr := r.client.Get(context.TODO(), types.NamespacedName{Name: Descheduler.Name, Namespace: Descheduler.Namespace}, DeschedulerCronJob)\n\tif err != nil && errors.IsNotFound(err) {\n\t\t// Create Descheduler cronjob\n\t\tdj, err := r.createCronJob(Descheduler)\n\t\tif err != nil {\n\t\t\tlog.Printf(\" error while creating job %v\", err)\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"Creating a new cron job %s/%s\\n\", dj.Namespace, dj.Name)\n\t\terr = r.client.Create(context.TODO(), dj)\n\t\tif err != nil {\n\t\t\tlog.Printf(\" error while creating cron job %v\", err)\n\t\t\treturn err\n\t\t}\n\t\t// Cronjob created successfully - don't requeue\n\t\treturn nil\n\t} else if DeschedulerCronJob.Spec.Schedule != Descheduler.Spec.Schedule {\n\t\t// Descheduler schedule mismatch. Let's delete it and in the next reconcilation loop, we will create a new one.\n\t\tlog.Printf(\"Schedule mismatch in cron job. Delete it\")\n\t\terr = r.client.Delete(context.TODO(), DeschedulerCronJob, client.PropagationPolicy(metav1.DeletePropagationOrphan))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error while deleting cronjob\")\n\t\t\treturn err\n\t\t}\n\t\treturn r.updateDeschedulerStatus(Descheduler, Updating)\n\t} else if !CheckIfFlagsChanged(Descheduler.Spec.Flags, DeschedulerCronJob.Spec.JobTemplate.Spec.\n\t\tTemplate.Spec.Containers[0].Command) {\n\t\t//By the time we reach here, job would have been created, so no need to check for nil pointers anywhere\n\t\t// till command\n\t\tlog.Printf(\"Flags mismatch for Descheduler. Delete cronjob\")\n\n\t\terr = r.client.Delete(context.TODO(), DeschedulerCronJob, client.PropagationPolicy(metav1.DeletePropagationOrphan))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error while deleting cronjob\")\n\t\t\treturn err\n\t\t}\n\t\treturn r.updateDeschedulerStatus(Descheduler, Updating)\n\t} else if Descheduler.Spec.Image != DeschedulerCronJob.Spec.JobTemplate.Spec.Template.Spec.Containers[0].Image {\n\t\tlog.Printf(\"Image mismatch within Descheduler. Delete cronjob\")\n\t\terr = r.client.Delete(context.TODO(), DeschedulerCronJob, client.PropagationPolicy(metav1.DeletePropagationOrphan))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error while deleting cronjob\")\n\t\t\treturn err\n\t\t}\n\t\treturn r.updateDeschedulerStatus(Descheduler, Updating)\n\t} else if err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f87beeec63f830fbb76d4e516e8b576f", "score": "0.48872983", "text": "func (cron NewCron) TableName() string {\n return \"SYS_CRON\"\n}", "title": "" }, { "docid": "fc1d89c6aa55eb9781cbb57380604121", "score": "0.4885801", "text": "func startUpdateCron(config Config) {\n\tjob := cron.New()\n\tjob.AddFunc(config.Cron, updateHistoryStats)\n\tjob.Start()\n}", "title": "" }, { "docid": "e2504803bcf51266e3cd9879b18c9b01", "score": "0.4884449", "text": "func TestCheckBuiltinDeleteIntDouble(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `delete(1, 1, 1)`, env,\n\t\t`too many arguments to delete`,\n\t)\n\n}", "title": "" }, { "docid": "7f0994e9766fcfa35a9d6982f13a47a2", "score": "0.48755628", "text": "func ScheduleCron() {\n\tscheduler := cron.New()\n\t_, err := scheduler.AddFunc(\"@every 30m\", func() {\n\t\tVideo_fetcher.FetchVideoData(Video_fetcher.YtService, []string{\"snippet\"}, false)\n\t\tfmt.Println(\"cron called\")\n\t})\n\tif err != nil {\n\t\tfmt.Println(\"Unable to schedule cron\")\n\t\treturn\n\t}\n\tscheduler.Start()\n}", "title": "" }, { "docid": "25a2e10a23be9d860774b954169e0124", "score": "0.48737904", "text": "func generateCron(jobType, jobName, repoName string, timeout int) string {\n\tgetUTCtime := func(i int) int { return i + 7 }\n\t// Sums the ascii valus of all letters in a jobname,\n\t// this value is used for deriving offset after hour\n\tvar sum float64\n\tfor _, c := range jobType + jobName {\n\t\tsum += float64(c)\n\t}\n\t// Divide 60 minutes into 6 buckets\n\tbucket := int(math.Mod(sum, 6))\n\t// Offset in bucket, range from 0-9, first mod with 11(a random prime number)\n\t// to ensure every digit has a chance (i.e., if bucket is 0, sum has to be multiply of 6,\n\t// so mod by 10 can only return even number)\n\toffsetInBucket := int(math.Mod(math.Mod(sum, 11), 10))\n\tminutesOffset := bucket*10 + offsetInBucket\n\t// Determines hourly job inteval based on timeout\n\thours := int((timeout+5)/60) + 1 // Allow at least 5 minutes between runs\n\thourCron := fmt.Sprintf(\"%d * * * *\", minutesOffset)\n\tif hours > 1 {\n\t\thourCron = fmt.Sprintf(\"%d */%d * * *\", minutesOffset, hours)\n\t}\n\tdayCron := fmt.Sprintf(\"%d %%d * * *\", minutesOffset) // hour\n\tweekCron := fmt.Sprintf(\"%d %%d * * %%d\", minutesOffset) // hour, weekday\n\n\tvar res string\n\tswitch jobType {\n\tcase \"continuous\", \"custom-job\", \"auto-release\": // Every hour\n\t\tres = fmt.Sprintf(hourCron)\n\tcase \"branch-ci\": // Every day 1-2 PST\n\t\tres = fmt.Sprintf(dayCron, getUTCtime(1))\n\tcase \"nightly\": // Every day 2-3 PST\n\t\tres = fmt.Sprintf(dayCron, getUTCtime(2))\n\tcase \"dot-release\":\n\t\tif strings.HasSuffix(repoName, \"-operator\") {\n\t\t\t// Every Tuesday 12-13 PST\n\t\t\tres = fmt.Sprintf(weekCron, getUTCtime(12), 2)\n\t\t} else {\n\t\t\t// Every Tuesday 2-3 PST\n\t\t\tres = fmt.Sprintf(weekCron, getUTCtime(2), 2)\n\t\t}\n\tcase \"webhook-apicoverage\": // Every day 2-3 PST\n\t\tres = fmt.Sprintf(dayCron, getUTCtime(2))\n\tdefault:\n\t\tlog.Printf(\"job type not supported for cron generation '%s'\", jobName)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "1900c46e11d8306f65b842cba8013932", "score": "0.48710242", "text": "func ValidateCronJobs(ctx context.Context, cronjobs []unstructured.Unstructured, regoRulesList kube.RegoRulesList) {\n\tvar validateCronjobsResults kube.CronjobsValidateResults\n\tqueryRule := \"data.kubeeye_workloads_rego\"\n\tfor _, cronjob := range cronjobs {\n\t\tvalidateResults := ValidateK8SResource(ctx, cronjob, regoRulesList, queryRule)\n\t\tvalidateCronjobsResults.ValidateResults = append(validateCronjobsResults.ValidateResults, validateResults)\n\t}\n\tkube.CronjobsResultsChan <- validateCronjobsResults\n}", "title": "" }, { "docid": "3daef34371bdec817ec0a6b6805fc45a", "score": "0.48655456", "text": "func DeleteLabours(d string) {\n\tquery := `DELETE FROM labour WHERE date=?`\n\n\tif _, err := db.Exec(query, d); err != nil {\n\t\tlog.Println(\"Error in deleting the labour names : \", err)\n\t}\n}", "title": "" }, { "docid": "30dc6c491a138ea0d776fcc9e821ed55", "score": "0.48637846", "text": "func ExampleSchedulesClient_BeginDelete() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armdevcenter.NewSchedulesClient(\"0ac520ee-14c0-480f-b6c9-0a90c58ffff\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := client.BeginDelete(ctx, \"rg1\", \"TestProject\", \"DevPool\", \"autoShutdown\", &armdevcenter.SchedulesClientBeginDeleteOptions{Top: nil})\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t_, err = poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n}", "title": "" }, { "docid": "6483c29036c642e0d18bad9213873b9f", "score": "0.4861808", "text": "func PeriodDELETE(c *gin.Context) {\n\n}", "title": "" }, { "docid": "f8f1030b781703e32de453d889bc9a4b", "score": "0.4861194", "text": "func MarkRunsAsDelete(ctx context.Context, store cache.Store, DBFunc func() *gorp.DbMap, workflowRunsMarkToDelete *stats.Int64Measure) {\n\ttickMark := time.NewTicker(15 * time.Minute)\n\tdefer tickMark.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tif ctx.Err() != nil {\n\t\t\t\tlog.Error(ctx, \"Exiting mark runs as delete: %v\", ctx.Err())\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-tickMark.C:\n\t\t\t// Mark workflow run to delete\n\t\t\tlog.Info(ctx, \"purge> Start marking workflow run as delete\")\n\t\t\tif err := markWorkflowRunsToDelete(ctx, store, DBFunc(), workflowRunsMarkToDelete); err != nil {\n\t\t\t\tctx = sdk.ContextWithStacktrace(ctx, err)\n\t\t\t\tlog.Error(ctx, \"%v\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7ed67c7d9774cdd627a8423f36f36a9e", "score": "0.4855364", "text": "func (t *CronTicker) Stop() bool {\n\tif t.Cron != nil {\n\t\tif t.beenRun.CompareAndSwap(true, false) {\n\t\t\tt.Cron.Stop()\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "62054589e37c036c223647e89191444c", "score": "0.48419642", "text": "func TestJob(t *testing.T) {\n\tvar calls int32\n\tclock := clockwork.NewFakeClock()\n\tcron := New(WithClock(clock))\n\t_, _ = cron.AddJob(\"0 0 0 30 Feb ?\", testJob{&calls, \"job5\"}, \"\")\n\t_, _ = cron.AddJob(\"0 0 0 1 1 ?\", testJob{&calls, \"job3\"}, \"\")\n\t_, _ = cron.AddJob(\"* * * * * ?\", testJob{&calls, \"job0\"}, \"\")\n\t_, _ = cron.AddJob(\"1 0 0 1 1 ?\", testJob{&calls, \"job4\"}, \"\")\n\tcron.Schedule(Every(5*time.Second+5*time.Nanosecond), testJob{&calls, \"job1\"}, \"\")\n\tcron.Schedule(Every(5*time.Minute), testJob{&calls, \"job2\"}, \"\")\n\tcron.Start()\n\tdefer cron.Stop()\n\tcycle(cron)\n\tadvanceAndCycle(cron, time.Second)\n\tassert.Equal(t, int32(1), atomic.LoadInt32(&calls))\n\t// Ensure the entries are in the right order.\n\tfor i, entry := range cron.Entries() {\n\t\tassert.Equal(t, fmt.Sprintf(\"job%d\", i), entry.Job.(testJob).name)\n\t}\n}", "title": "" }, { "docid": "dd48573edd754a7230dcf215d2393f01", "score": "0.4839139", "text": "func TestJobWithZeroTimeDoesNotRun(t *testing.T) {\n\tclock := clockwork.NewFakeClock()\n\tcron := New(WithClock(clock))\n\tvar calls int32\n\t_, _ = cron.AddFunc(\"* * * * * *\", func() { atomic.AddInt32(&calls, 1) }, \"\")\n\tcron.Schedule(new(ZeroSchedule), FuncJob(func() { t.Error(\"expected zero task will not run\") }), \"\")\n\tcron.Start()\n\tdefer cron.Stop()\n\tcycle(cron)\n\tadvanceAndCycle(cron, time.Second)\n\tassert.Equal(t, int32(1), atomic.LoadInt32(&calls))\n}", "title": "" }, { "docid": "e4a99c3a0403a1e30f74a70175f22bda", "score": "0.48362046", "text": "func TestJob(t *testing.T) {\n\twg := &sync.WaitGroup{}\n\twg.Add(1)\n\n\tcron, err := New()\n\tif err != nil {\n\t\tt.Fatal(\"unexpected error\")\n\t}\n\n\tcron.AddJob(Job{\n\t\tName: \"job0\",\n\t\tRhythm: \"0 0 0 30 Feb ?\",\n\t\tFunc: func(context.Context) error { wg.Done(); return nil },\n\t})\n\tcron.AddJob(Job{\n\t\tName: \"job1\",\n\t\tRhythm: \"0 0 0 1 1 ?\",\n\t\tFunc: func(context.Context) error { wg.Done(); return nil },\n\t})\n\tcron.AddJob(Job{\n\t\tName: \"job2\",\n\t\tRhythm: \"* * * * * ?\",\n\t\tFunc: func(context.Context) error { wg.Done(); return nil },\n\t})\n\tcron.AddJob(Job{\n\t\tName: \"job3\",\n\t\tRhythm: \"1 0 0 1 1 ?\",\n\t\tFunc: func(context.Context) error { wg.Done(); return nil },\n\t})\n\tcron.Schedule(Every(5*time.Second+5*time.Nanosecond), Job{\n\t\tName: \"job4\",\n\t\tFunc: func(context.Context) error { wg.Done(); return nil },\n\t})\n\tcron.Schedule(Every(5*time.Minute), Job{\n\t\tName: \"job5\",\n\t\tFunc: func(context.Context) error { wg.Done(); return nil },\n\t})\n\n\tcron.Start(context.Background())\n\tdefer cron.Stop()\n\n\tselect {\n\tcase <-time.After(ONE_SECOND):\n\t\tt.FailNow()\n\tcase <-wait(wg):\n\t}\n\n\t// Ensure the entries are in the right order.\n\texpecteds := []string{\"job2\", \"job4\", \"job5\", \"job1\", \"job3\", \"job0\"}\n\n\tvar actuals []string\n\tfor _, entry := range cron.Entries() {\n\t\tactuals = append(actuals, entry.Job.Name)\n\t}\n\n\tfor i, expected := range expecteds {\n\t\tif actuals[i] != expected {\n\t\t\tt.Errorf(\"Jobs not in the right order. (expected) %s != %s (actual)\", expecteds, actuals)\n\t\t\tt.FailNow()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cbee9621ca8a5fea6b3c4a43892707dc", "score": "0.48287767", "text": "func (r *Reconciler) reconcileCronJob(ctx context.Context, s *v1alpha1.CronJobSource) error {\n\tcronjob, err := r.getCronJob(ctx, s)\n\tdesired := resources.MakeCronJob(s)\n\n\tif apierrs.IsNotFound(err) {\n\t\t// No job, must create it\n\t\tcronjob, err := r.KubeClientSet.BatchV1beta1().CronJobs(s.Namespace).Create(desired)\n\t\tif err != nil || cronjob == nil {\n\t\t\tmsg := \"Failed to make CronJob.\"\n\t\t\tif err != nil {\n\t\t\t\tmsg = msg + \" \" + err.Error()\n\t\t\t}\n\t\t\ts.Status.MarkNoCronJob(\"FailedCreate\", msg)\n\t\t\treturn fmt.Errorf(\"failed to create CronJob: %s\", err)\n\t\t}\n\n\t\ts.Status.MarkCronJobCreated()\n\t\ts.Status.PropagateCronJobStatus(&cronjob.Status)\n\t\treturn nil\n\t} else if err != nil {\n\t\tr.Logger.Warnw(\"Failed get:\", zap.Error(err))\n\t\ts.Status.MarkNoCronJob(\"FailedGet\", err.Error())\n\t\treturn fmt.Errorf(\"failed to get CronJob: %s\", err)\n\t}\n\n\t// CronJob exists. Make sure it matches what we want.\n\t// The service exists; check if it looks like we expect\n\tif diff := cmp.Diff(desired.Spec, cronjob.Spec); diff != \"\" {\n\t\tcronjob.Spec = desired.Spec\n\t\tcronjob, err := r.KubeClientSet.BatchV1beta1().CronJobs(s.Namespace).Update(cronjob)\n\t\tr.Logger.Desugar().Info(\"CronJob updated.\",\n\t\t\tzap.Error(err), zap.Any(\"cronjob\", cronjob), zap.String(\"diff\", diff))\n\t\t// TODO(spencer-p) What should the status be at this point?\n\t\ts.Status.MarkCronJobCreated()\n\t\ts.Status.PropagateCronJobStatus(&cronjob.Status)\n\t\treturn err\n\t}\n\n\t// Copy its status.\n\ts.Status.MarkCronJobCreated()\n\ts.Status.PropagateCronJobStatus(&cronjob.Status)\n\n\treturn nil\n}", "title": "" }, { "docid": "5ded06a0931e511d47fc2743ab4894a3", "score": "0.48260075", "text": "func TestSchedule(t *testing.T) {\n\tsched := NewScheduler()\n\n\ttestJob1 := &Job{\n\t\tName: \"cron_job\",\n\t\tSchedule: \"@every 2s\", //* * * * * ?\n\t\tCommand: \"echo 'test1'\",\n\t\tOwner: \"John Dough\",\n\t\tOwnerEmail: \"foo@bar.com\",\n\t\tShell: true,\n\t\tJobType: \"shell\",\n\t\tDisabled: false,\n\t}\n\tsched.Start([]*Job{testJob1})\n\n\tselect {\n\tcase <-time.After(10 * time.Second):\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "a62f59d9458b7d183e496c669753ffb8", "score": "0.48237267", "text": "func TestDoLoop(t *testing.T) {\n\tcroner := cron.New()\n\tclient := NewFakeDockerClient()\n\n\tcases := []struct {\n\t\tname string\n\t\tfakeContainers []dockerTypes.Container\n\t\texpectedJobs []ContainerCronJob\n\t}{\n\t\t{\n\t\t\tname: \"No containers\",\n\t\t\tfakeContainers: []dockerTypes.Container{},\n\t\t\texpectedJobs: []ContainerCronJob{},\n\t\t},\n\t\t{\n\t\t\tname: \"One container without schedule\",\n\t\t\tfakeContainers: []dockerTypes.Container{\n\t\t\t\tdockerTypes.Container{\n\t\t\t\t\tNames: []string{\"no_schedule_1\"},\n\t\t\t\t\tID: \"no_schedule_1\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedJobs: []ContainerCronJob{},\n\t\t},\n\t\t{\n\t\t\tname: \"One container with schedule\",\n\t\t\tfakeContainers: []dockerTypes.Container{\n\t\t\t\tdockerTypes.Container{\n\t\t\t\t\tNames: []string{\"has_schedule_1\"},\n\t\t\t\t\tID: \"has_schedule_1\",\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"dockron.schedule\": \"* * * * *\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t\tcontext: context.Background(),\n\t\t\t\t\tclient: client,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"One container with and one without schedule\",\n\t\t\tfakeContainers: []dockerTypes.Container{\n\t\t\t\tdockerTypes.Container{\n\t\t\t\t\tNames: []string{\"no_schedule_1\"},\n\t\t\t\t\tID: \"no_schedule_1\",\n\t\t\t\t},\n\t\t\t\tdockerTypes.Container{\n\t\t\t\t\tNames: []string{\"has_schedule_1\"},\n\t\t\t\t\tID: \"has_schedule_1\",\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"dockron.schedule\": \"* * * * *\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t\tcontext: context.Background(),\n\t\t\t\t\tclient: client,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Add a second container with a schedule\",\n\t\t\tfakeContainers: []dockerTypes.Container{\n\t\t\t\tdockerTypes.Container{\n\t\t\t\t\tNames: []string{\"has_schedule_1\"},\n\t\t\t\t\tID: \"has_schedule_1\",\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"dockron.schedule\": \"* * * * *\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdockerTypes.Container{\n\t\t\t\t\tNames: []string{\"has_schedule_2\"},\n\t\t\t\t\tID: \"has_schedule_2\",\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"dockron.schedule\": \"* * * * *\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t\tcontext: context.Background(),\n\t\t\t\t\tclient: client,\n\t\t\t\t},\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_2\",\n\t\t\t\t\tcontainerID: \"has_schedule_2\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t\tcontext: context.Background(),\n\t\t\t\t\tclient: client,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Modify the first container\",\n\t\t\tfakeContainers: []dockerTypes.Container{\n\t\t\t\tdockerTypes.Container{\n\t\t\t\t\tNames: []string{\"has_schedule_1\"},\n\t\t\t\t\tID: \"has_schedule_1_prime\",\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"dockron.schedule\": \"* * * * *\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdockerTypes.Container{\n\t\t\t\t\tNames: []string{\"has_schedule_2\"},\n\t\t\t\t\tID: \"has_schedule_2\",\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"dockron.schedule\": \"* * * * *\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_2\",\n\t\t\t\t\tcontainerID: \"has_schedule_2\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t\tcontext: context.Background(),\n\t\t\t\t\tclient: client,\n\t\t\t\t},\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1_prime\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t\tcontext: context.Background(),\n\t\t\t\t\tclient: client,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Remove second container and add exec to first\",\n\t\t\tfakeContainers: []dockerTypes.Container{\n\t\t\t\tdockerTypes.Container{\n\t\t\t\t\tNames: []string{\"has_schedule_1\"},\n\t\t\t\t\tID: \"has_schedule_1_prime\",\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"dockron.schedule\": \"* * * * *\",\n\t\t\t\t\t\t\"dockron.test.schedule\": \"* * * * *\",\n\t\t\t\t\t\t\"dockron.test.command\": \"date\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedJobs: []ContainerCronJob{\n\t\t\t\tContainerStartJob{\n\t\t\t\t\tname: \"has_schedule_1\",\n\t\t\t\t\tcontainerID: \"has_schedule_1_prime\",\n\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t\tcontext: context.Background(),\n\t\t\t\t\tclient: client,\n\t\t\t\t},\n\t\t\t\tContainerExecJob{\n\t\t\t\t\tContainerStartJob: ContainerStartJob{\n\t\t\t\t\t\tname: \"has_schedule_1/test\",\n\t\t\t\t\t\tcontainerID: \"has_schedule_1_prime\",\n\t\t\t\t\t\tschedule: \"* * * * *\",\n\t\t\t\t\t\tcontext: context.Background(),\n\t\t\t\t\t\tclient: client,\n\t\t\t\t\t},\n\t\t\t\t\tshellCommand: \"date\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tfor loopIndex, c := range cases {\n\t\tt.Run(fmt.Sprintf(\"Loop %d: %s\", loopIndex, c.name), func(t *testing.T) {\n\t\t\tlog.Printf(\"Running %s\", t.Name())\n\n\t\t\t// Load fake containers\n\t\t\tt.Logf(\"Fake containers: %+v\", c.fakeContainers)\n\t\t\tclient.FakeResults[\"ContainerList\"] = []FakeResult{\n\t\t\t\tFakeResult{c.fakeContainers, nil},\n\t\t\t}\n\n\t\t\t// Execute loop iteration loop\n\t\t\tjobs := QueryScheduledJobs(client)\n\t\t\tScheduleJobs(croner, jobs)\n\n\t\t\t// Validate results\n\n\t\t\tscheduledEntries := croner.Entries()\n\t\t\tt.Logf(\"Cron entries: %+v\", scheduledEntries)\n\n\t\t\tErrorUnequal(t, len(c.expectedJobs), len(scheduledEntries), \"Job and entry lengths don't match\")\n\t\t\tfor i, entry := range scheduledEntries {\n\t\t\t\tErrorUnequal(t, c.expectedJobs[i], entry.Job, \"Job value does not match entry\")\n\t\t\t}\n\t\t})\n\t}\n\n\t// Make sure the cron stops\n\tcroner.Stop()\n}", "title": "" }, { "docid": "c4edbf54d1f00c271ba9e3a6a10861fe", "score": "0.4823254", "text": "func TestNonLocalTimezone(t *testing.T) {\n\tclock := clockwork.NewFakeClock()\n\tloc, err := time.LoadLocation(\"Atlantic/Cape_Verde\")\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to load time zone Atlantic/Cape_Verde: %+v\", err)\n\t\tt.Fail()\n\t}\n\tnow := clock.Now().In(loc)\n\tspec := fmt.Sprintf(\"%d,%d %d %d %d %d ?\",\n\t\tnow.Second()+1, now.Second()+2, now.Minute(), now.Hour(), now.Day(), now.Month())\n\tcron := New(WithClock(clock), WithLocation(loc))\n\tvar calls int32\n\t_, _ = cron.AddFunc(spec, func() { atomic.AddInt32(&calls, 1) }, \"\")\n\tcron.Start()\n\tdefer cron.Stop()\n\tcycle(cron)\n\tadvanceAndCycle(cron, time.Second)\n\tadvanceAndCycle(cron, time.Second)\n\tassert.Equal(t, int32(2), atomic.LoadInt32(&calls))\n}", "title": "" }, { "docid": "ed1062994b137f5e19f6fe6cd6326f2d", "score": "0.4819254", "text": "func TestInvalidJobSpec(t *testing.T) {\n\tclock := clockwork.NewRealClock()\n\tcron := New(WithClock(clock))\n\t_, err := cron.AddJob(\"this will not parse\", nil, \"\")\n\tif err == nil {\n\t\tt.Errorf(\"expected an error with invalid spec, got nil\")\n\t}\n}", "title": "" }, { "docid": "ba0ace010d8bd123475a6512b592699d", "score": "0.48129708", "text": "func (j *Jobs) CronFormat(cron string) *Jobs {\n\tcronSlice := strings.Split(cron, \" \")\n\tj.Cron = cronSlice\n\n\treturn j\n}", "title": "" }, { "docid": "1289d46b37b243d3b95e18fbb20dda7d", "score": "0.48121458", "text": "func watchCronJob(c controller.Controller) error {\n\terr := c.Watch(&source.Kind{Type: &v1beta1.CronJob{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &mobilesecurityservicev1alpha1.MobileSecurityServiceBackup{},\n\t})\n\treturn err\n}", "title": "" }, { "docid": "975ec820484fc608ec3545fe758e227d", "score": "0.4809868", "text": "func TestCron_Parallel(t *testing.T) {\n\twg := &sync.WaitGroup{}\n\twg.Add(2)\n\n\tcron1, err := New()\n\tif err != nil {\n\t\tt.Fatal(\"unexpected error\")\n\t}\n\tdefer cron1.Stop()\n\n\tcron2, err := New()\n\tif err != nil {\n\t\tt.Fatal(\"unexpected error\")\n\t}\n\tdefer cron2.Stop()\n\n\tjob := Job{\n\t\tName: \"test-parallel\",\n\t\tRhythm: \"* * * * * ?\",\n\t\tFunc: func(context.Context) error {\n\t\t\twg.Done()\n\t\t\treturn nil\n\t\t},\n\t}\n\tcron1.AddJob(job)\n\tcron2.AddJob(job)\n\n\tcron1.Start(context.Background())\n\tcron2.Start(context.Background())\n\n\tselect {\n\tcase <-time.After(time.Duration(2) * ONE_SECOND):\n\t\tt.FailNow()\n\tcase <-wait(wg):\n\t}\n}", "title": "" }, { "docid": "b3c09a8d453b9f51f15268f8714d2808", "score": "0.47946927", "text": "func RunUptimeChecksDelete(c *CmdConfig) error {\n\tif len(c.Args) == 0 {\n\t\treturn doctl.NewMissingArgsErr(c.NS)\n\t}\n\n\treturn c.UptimeChecks().Delete(c.Args[0])\n}", "title": "" }, { "docid": "ec660ddb3880fac1876d0eb2a18f272b", "score": "0.4792617", "text": "func (this *TimeWheel) AddCron(delay time.Duration, handler func(*Task, ...interface{}), args ...interface{}) *Task {\n\treturn this.addAny(delay, modeIsCircle, modeIsAsync, handler, args...)\n}", "title": "" }, { "docid": "9043153f6733034e419c24e10d593aef", "score": "0.47856665", "text": "func (c *MockClient) DeleteCheck(namespace, name string) error {\n\targs := c.Called(namespace, name)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "8f4be86994debbc8aa4c9d1f4415e67e", "score": "0.47846356", "text": "func (m *MockCronService) CreateCron(arg0 *models.Cron) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateCron\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8d49e09156bb23485a7bf54d9f5a9245", "score": "0.4782694", "text": "func Test_DeleteOk(t *testing.T) {\n testConn, toTest, _ := initialiseConnection()\n\n testConn.ToRead = append(testConn.ToRead, \"+OK deleted\\r\\n\")\n err := toTest.Delete(10)\n\n if err != nil {\n t.Error(\"Error returned\")\n }\n if testConn.Written[0] != \"DELE 10\\r\\n\" {\n t.Error(\"Invalid command\")\n }\n}", "title": "" }, { "docid": "c8045531040970ab76de4d446bf6004e", "score": "0.4781562", "text": "func TestRcDelete(t *testing.T) {\n\tr, call := rcNewRun(t, \"operations/delete\")\n\n\tfile1 := r.WriteObject(context.Background(), \"small\", \"1234567890\", t2) // 10 bytes\n\tfile2 := r.WriteObject(context.Background(), \"medium\", \"------------------------------------------------------------\", t1) // 60 bytes\n\tfile3 := r.WriteObject(context.Background(), \"large\", \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\", t1) // 100 bytes\n\tr.CheckRemoteItems(t, file1, file2, file3)\n\n\tin := rc.Params{\n\t\t\"fs\": r.FremoteName,\n\t}\n\tout, err := call.Fn(context.Background(), in)\n\trequire.NoError(t, err)\n\tassert.Equal(t, rc.Params(nil), out)\n\n\tr.CheckRemoteItems(t)\n}", "title": "" }, { "docid": "f61b8362e443f220556c762952945cf2", "score": "0.47815198", "text": "func (s *SchedulesService) Delete(id int) (*Response, error) {\n\tu := fmt.Sprintf(\"api/v1/schedules/%d\", id)\n\n\tresp, err := s.client.Call(\"DELETE\", u, nil, nil)\n\treturn resp, err\n}", "title": "" }, { "docid": "78eeb80c0ceac4ba6f8543470051fc90", "score": "0.478004", "text": "func testAccChecksCRUDDelete(t *testing.T, id int) {\n\tc := New()\n\tparams := DeleteCheckInput{\n\t\tCheckID: id,\n\t}\n\tout, err := c.DeleteCheck(params)\n\tif err != nil {\n\t\tt.Fatalf(\"Error deleting check: %v\", err)\n\t}\n\tif strings.HasPrefix(out.Message, \"Deletion of check was successful!\") == false {\n\t\tt.Fatalf(\"Expected out.Message to start with Deletion of check was successful!, got %v\", out.Message)\n\t}\n}", "title": "" }, { "docid": "c84f66c43c9eea3c1fb7172526e0dcc7", "score": "0.47745466", "text": "func NewCron(job CronJob, period time.Duration) *Cron {\n\treturn &Cron{\n\t\tjob: job,\n\t\tperiod: period,\n\t\tstopped: 0,\n\t\tdone: make(chan struct{}),\n\t\ttickerFactory: util.NewTickerFactory(),\n\t}\n}", "title": "" }, { "docid": "67f22d8d7877e3d547c2f0e8ea1f5682", "score": "0.47720844", "text": "func runDelete(cmd *cobra.Command, args []string) {\n\tif conn == nil {\n\t\trunDeleteWeb(cmd)\n\t\treturn\n\t}\n\n\trunDeleteDB(cmd)\n}", "title": "" }, { "docid": "5d74fc49a0f648256a9328eb32246a2f", "score": "0.47703943", "text": "func testCephCacheDelete(t *testing.T) {\n\n\tres := model.InitTestResult(runID)\n\tdefer res.CheckTestAndSave(t, time.Now())\n\tCheckDependencies(t, res, Env.CheckCephConfiguration, CheckCephClusterExists)\n\n\tlog.AuctaLogger.Info(\"CEPH CACHE: adding the cache\")\n\tvar (\n\t\terr error\n\t\tcephCache *ceph3.CephCacheTier\n\t\tcephCaches []*ceph3.CephCacheTier\n\t)\n\n\tcephCache = addCephCache(t, \"\", \"blackbox2\")\n\tPcc.DeleteCephCache(cephCache.ID)\n\n\t// Check if the cache exist\n\tif _, err = Pcc.GetCephCaches(); err == nil {\n\t\tfor i := range cephCaches {\n\t\t\tcc := cephCaches[i]\n\n\t\t\tif cc.ID == cephCache.ID {\n\t\t\t\tmsg := \"the cache still exist\"\n\t\t\t\tres.SetTestFailure(msg)\n\t\t\t\tlog.AuctaLogger.Error(msg)\n\t\t\t\tt.FailNow()\n\t\t\t}\n\t\t}\n\t} else {\n\t\tmsg := fmt.Sprintf(\"%v\", err)\n\t\tres.SetTestFailure(msg)\n\t\tlog.AuctaLogger.Error(msg)\n\t\tt.FailNow()\n\t}\n}", "title": "" }, { "docid": "55638d002eaf9ca2590b96a2c736757e", "score": "0.47692832", "text": "func TestMultipleEntries(t *testing.T) {\n\tclock := clockwork.NewFakeClock()\n\tcron := New(WithClock(clock))\n\tvar calls int32\n\t_, _ = cron.AddFunc(\"0 0 0 1 1 ?\", func() {}, \"\")\n\t_, _ = cron.AddFunc(\"* * * * * ?\", func() { atomic.AddInt32(&calls, 1) }, \"\")\n\t_, _ = cron.AddFunc(\"0 0 0 31 12 ?\", func() {}, \"\")\n\t_, _ = cron.AddFunc(\"* * * * * ?\", func() { atomic.AddInt32(&calls, 1) }, \"\")\n\tcron.Start()\n\tdefer cron.Stop()\n\tcycle(cron)\n\tadvanceAndCycle(cron, time.Second)\n\tassert.Equal(t, int32(2), atomic.LoadInt32(&calls))\n}", "title": "" }, { "docid": "5e31358b5e43359d5ab662886b349942", "score": "0.47620335", "text": "func TestAddBeforeRunning(t *testing.T) {\n\twg := &sync.WaitGroup{}\n\twg.Add(1)\n\n\tcron, err := New()\n\tif err != nil {\n\t\tt.Fatal(\"unexpected error\")\n\t}\n\tcron.AddJob(Job{\n\t\tName: \"test-add-before-running\",\n\t\tRhythm: \"* * * * * ?\",\n\t\tFunc: func(context.Context) error { wg.Done(); return nil },\n\t})\n\tcron.Start(context.Background())\n\tdefer cron.Stop()\n\n\t// Give cron 2 seconds to run our job (which is always activated).\n\tselect {\n\tcase <-time.After(ONE_SECOND):\n\t\tt.FailNow()\n\tcase <-wait(wg):\n\t}\n}", "title": "" }, { "docid": "539c77e86bf2a1db8781a055cc74ed7a", "score": "0.4760698", "text": "func runSaturdayReminderCron(post *slack.Client, channel string) {\n\t// gocron.Every(3).Seconds().Do(saturdayReminderCron, post, channel) // (dev) TODO: update this to check env.\n\tgocron.Every(1).Day().At(\"20:00\").Do(saturdayReminderCron, post, channel) // (prod)\n\t<-gocron.Start()\n}", "title": "" }, { "docid": "e61a853c4f0d7a261911c66602ef4d10", "score": "0.4753975", "text": "func txGameServerDelete(serverurl string) (err error) {\n\n\tquery := `--sql\n\t\tDELETE FROM GameServer WHERE Serverurl = $1 \n\t`\n\n\t_, err = DATABASE.Exec(query, serverurl)\n\n\tif err != nil {\n\t\tDB.Printf(\"%s error: (%s)\", extendedFnName(), err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b891043faa4f0684ee1bedd84045c4a6", "score": "0.4751093", "text": "func TestDeleteSync(t *testing.T) {\n\ttests := []controllerTest{\n\t\t{\n\t\t\tname: \"1-1 - content non-nil DeletionTimestamp with delete policy will delete snapshot\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-1\", \"snapuid1-1\", \"snap1-1\", \"sid1-1\", classGold, \"\", \"snap1-1-volumehandle\", deletionPolicy, nil, nil, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-1\", \"snapuid1-1\", \"snap1-1\", \"\", classGold, \"\", \"snap1-1-volumehandle\", deletionPolicy, nil, nil, false, &timeNowMetav1),\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\texpectedCreateCalls: []createCall{\n\t\t\t\t{\n\t\t\t\t\tsnapshotName: \"snapshot-snapuid1-1\",\n\t\t\t\t\tvolumeHandle: \"snap1-1-volumehandle\",\n\t\t\t\t\tparameters: map[string]string{\"param1\": \"value1\"},\n\t\t\t\t\tdriverName: mockDriverName,\n\t\t\t\t\tsize: defaultSize,\n\t\t\t\t\tsnapshotId: \"snapuid1-1-deleted\",\n\t\t\t\t\tcreationTime: timeNow,\n\t\t\t\t\treadyToUse: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedListCalls: []listCall{{\"sid1-1\", map[string]string{}, true, time.Now(), 1, nil}},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-1\", nil, nil}},\n\t\t\texpectSuccess: true,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-2 - content non-nil DeletionTimestamp with retain policy will not delete snapshot\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-2\", \"snapuid1-2\", \"snap1-2\", \"sid1-2\", classGold, \"\", \"snap1-2-volumehandle\", retainPolicy, nil, nil, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-2\", \"snapuid1-2\", \"snap1-2\", \"sid1-2\", classGold, \"\", \"snap1-2-volumehandle\", retainPolicy, nil, nil, false, &timeNowMetav1),\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\texpectedCreateCalls: []createCall{\n\t\t\t\t{\n\t\t\t\t\tsnapshotName: \"snapshot-snapuid1-2\",\n\t\t\t\t\tvolumeHandle: \"snap1-2-volumehandle\",\n\t\t\t\t\tparameters: map[string]string{\"param1\": \"value1\"},\n\t\t\t\t\tdriverName: mockDriverName,\n\t\t\t\t\tsize: defaultSize,\n\t\t\t\t\tsnapshotId: \"snapuid1-2-deleted\",\n\t\t\t\t\tcreationTime: timeNow,\n\t\t\t\t\treadyToUse: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedListCalls: []listCall{{\"sid1-2\", map[string]string{}, true, time.Now(), 1, nil}},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-2\", nil, nil}},\n\t\t\texpectSuccess: true,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-3 - delete snapshot error should result in an event, bound finalizer should remain\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-3\", \"snapuid1-3\", \"snap1-3\", \"sid1-3\", validSecretClass, \"\", \"snap1-3-volumehandle\", deletePolicy, nil, nil, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-3\", \"snapuid1-3\", \"snap1-3\", \"sid1-3\", validSecretClass, \"\", \"snap1-3-volumehandle\", deletePolicy, nil, nil, true, &timeNowMetav1),\n\t\t\terrors: noerrors,\n\t\t\texpectedCreateCalls: []createCall{\n\t\t\t\t{\n\t\t\t\t\tsnapshotName: \"snapshot-snapuid1-3\",\n\t\t\t\t\tvolumeHandle: \"snap1-3-volumehandle\",\n\t\t\t\t\tparameters: map[string]string{\"foo\": \"bar\"},\n\t\t\t\t\tdriverName: mockDriverName,\n\t\t\t\t\tsize: defaultSize,\n\t\t\t\t\tsnapshotId: \"snapuid1-3-deleted\",\n\t\t\t\t\tcreationTime: timeNow,\n\t\t\t\t\treadyToUse: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-3\", nil, fmt.Errorf(\"mock csi driver delete error\")}},\n\t\t\texpectedEvents: []string{\"Warning SnapshotDeleteError\"},\n\t\t\texpectedListCalls: []listCall{{\"sid1-3\", map[string]string{}, true, time.Now(), 1, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-4 - fail to delete with a snapshot class which has invalid secret parameter, bound finalizer should remain\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-1\", \"snapuid1-1\", \"snap1-1\", \"sid1-1\", \"invalid\", \"\", \"snap1-4-volumehandle\", deletionPolicy, nil, nil, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-1\", \"snapuid1-1\", \"snap1-1\", \"sid1-1\", \"invalid\", \"\", \"snap1-4-volumehandle\", deletionPolicy, nil, nil, true, &timeNowMetav1),\n\t\t\texpectedEvents: noevents,\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-1\", nil, fmt.Errorf(\"mock csi driver delete error\")}},\n\t\t\terrors: []reactorError{\n\t\t\t\t// Inject error to the first client.VolumesnapshotV1().VolumeSnapshotContents().Delete call.\n\t\t\t\t// All other calls will succeed.\n\t\t\t\t{\"get\", \"secrets\", errors.New(\"mock get invalid secret error\")},\n\t\t\t},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-5 - csi driver delete snapshot returns error, bound finalizer should remain\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-5\", \"sid1-5\", \"snap1-5\", \"sid1-5\", validSecretClass, \"\", \"snap1-5-volumehandle\", deletionPolicy, nil, &defaultSize, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-5\", \"sid1-5\", \"snap1-5\", \"sid1-5\", validSecretClass, \"\", \"snap1-5-volumehandle\", deletionPolicy, nil, &defaultSize, true, &timeNowMetav1),\n\t\t\texpectedListCalls: []listCall{{\"sid1-5\", map[string]string{}, true, time.Now(), 1000, nil}},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-5\", nil, errors.New(\"mock csi driver delete error\")}},\n\t\t\texpectedEvents: []string{\"Warning SnapshotDeleteError\"},\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\t// delete success(?) - content is deleted before deleteSnapshot starts\n\t\t\tname: \"1-6 - content is deleted before deleting\",\n\t\t\tinitialContents: newContentArray(\"content1-6\", \"sid1-6\", \"snap1-6\", \"sid1-6\", classGold, \"sid1-6\", \"\", deletionPolicy, nil, nil, true),\n\t\t\texpectedContents: nocontents,\n\t\t\texpectedListCalls: []listCall{{\"sid1-6\", nil, false, time.Now(), 0, nil}},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-6\", map[string]string{\"foo\": \"bar\"}, nil}},\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\ttest: wrapTestWithInjectedOperation(testSyncContent, func(ctrl *csiSnapshotSideCarController, reactor *snapshotReactor) {\n\t\t\t\t// Delete the content before delete operation starts\n\t\t\t\treactor.lock.Lock()\n\t\t\t\tdelete(reactor.contents, \"content1-6\")\n\t\t\t\treactor.lock.Unlock()\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"1-7 - content will not be deleted if it is bound to a snapshot correctly, snapshot uid is not specified\",\n\t\t\tinitialContents: newContentArrayWithReadyToUse(\"content1-7\", \"\", \"snap1-7\", \"sid1-7\", validSecretClass, \"sid1-7\", \"\", deletePolicy, nil, &defaultSize, &True, true),\n\t\t\texpectedContents: newContentArrayWithReadyToUse(\"content1-7\", \"\", \"snap1-7\", \"sid1-7\", validSecretClass, \"sid1-7\", \"\", deletePolicy, nil, &defaultSize, &True, true),\n\t\t\texpectedEvents: noevents,\n\t\t\texpectedListCalls: []listCall{{\"sid1-7\", map[string]string{}, true, time.Now(), 1000, nil}},\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-8 - content with retain policy will not be deleted if it is bound to a non-exist snapshot and also has a snapshot uid specified\",\n\t\t\tinitialContents: newContentArrayWithReadyToUse(\"content1-8\", \"sid1-8\", \"none-existed-snapshot\", \"sid1-8\", validSecretClass, \"sid1-8\", \"\", retainPolicy, nil, &defaultSize, &True, true),\n\t\t\texpectedContents: newContentArrayWithReadyToUse(\"content1-8\", \"sid1-8\", \"none-existed-snapshot\", \"sid1-8\", validSecretClass, \"sid1-8\", \"\", retainPolicy, nil, &defaultSize, &True, true),\n\t\t\texpectedEvents: noevents,\n\t\t\texpectedListCalls: []listCall{{\"sid1-8\", map[string]string{}, true, time.Now(), 0, nil}},\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-9 - continue deletion with snapshot class that has nonexistent secret, bound finalizer removed\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-9\", \"sid1-9\", \"snap1-9\", \"sid1-9\", emptySecretClass, \"\", \"snap1-9-volumehandle\", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-9\", \"sid1-9\", \"snap1-9\", \"\", emptySecretClass, \"\", \"snap1-9-volumehandle\", deletePolicy, nil, &defaultSize, false, &timeNowMetav1),\n\t\t\texpectedEvents: noevents,\n\t\t\texpectedListCalls: []listCall{{\"sid1-9\", map[string]string{}, true, time.Now(), 0, nil}},\n\t\t\terrors: noerrors,\n\t\t\tinitialSecrets: []*v1.Secret{}, // secret does not exist\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-9\", nil, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-10 - (dynamic)deletion of content with retain policy should not trigger CSI call, not update status, but remove bound finalizer\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-10\", \"sid1-10\", \"snap1-10\", \"sid1-10\", emptySecretClass, \"\", \"snap1-10-volumehandle\", retainPolicy, nil, &defaultSize, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-10\", \"sid1-10\", \"snap1-10\", \"sid1-10\", emptySecretClass, \"\", \"snap1-10-volumehandle\", retainPolicy, nil, &defaultSize, false, &timeNowMetav1),\n\t\t\texpectedEvents: noevents,\n\t\t\texpectedListCalls: []listCall{{\"sid1-10\", map[string]string{}, true, time.Now(), 0, nil}},\n\t\t\terrors: noerrors,\n\t\t\tinitialSecrets: []*v1.Secret{},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-11 - (dynamic)deletion of content with deletion policy should trigger CSI call, update status, and remove bound finalizer removed.\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-11\", \"sid1-11\", \"snap1-11\", \"sid1-11\", emptySecretClass, \"\", \"snap1-11-volumehandle\", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-11\", \"sid1-11\", \"snap1-11\", \"\", emptySecretClass, \"\", \"snap1-11-volumehandle\", deletePolicy, nil, nil, false, &timeNowMetav1),\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-11\", nil, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-12 - (pre-provision)deletion of content with retain policy should not trigger CSI call, not update status, but remove bound finalizer\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-12\", \"sid1-12\", \"snap1-12\", \"sid1-12\", emptySecretClass, \"sid1-12\", \"\", retainPolicy, nil, &defaultSize, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-12\", \"sid1-12\", \"snap1-12\", \"sid1-12\", emptySecretClass, \"sid1-12\", \"\", retainPolicy, nil, &defaultSize, false, &timeNowMetav1),\n\t\t\texpectedEvents: noevents,\n\t\t\texpectedListCalls: []listCall{{\"sid1-12\", map[string]string{}, true, time.Now(), 0, nil}},\n\t\t\terrors: noerrors,\n\t\t\tinitialSecrets: []*v1.Secret{},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-13 - (pre-provision)deletion of content with deletion policy should trigger CSI call, update status, and remove bound finalizer removed.\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-13\", \"sid1-13\", \"snap1-13\", \"sid1-13\", emptySecretClass, \"sid1-13\", \"\", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-13\", \"sid1-13\", \"snap1-13\", \"\", emptySecretClass, \"sid1-13\", \"\", deletePolicy, nil, nil, false, &timeNowMetav1),\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-13\", nil, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-14 - (pre-provision)deletion of content with deletion policy and no snapshotclass should trigger CSI call, update status, and remove bound finalizer removed.\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-14\", \"sid1-14\", \"snap1-14\", \"sid1-14\", \"\", \"sid1-14\", \"\", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-14\", \"sid1-14\", \"snap1-14\", \"\", \"\", \"sid1-14\", \"\", deletePolicy, nil, nil, false, &timeNowMetav1),\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-14\", nil, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-15 - (dynamic)deletion of content with no snapshotclass should succeed\",\n\t\t\tinitialContents: newContentArrayWithDeletionTimestamp(\"content1-15\", \"sid1-15\", \"snap1-15\", \"sid1-15\", \"\", \"\", \"snap1-15-volumehandle\", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),\n\t\t\texpectedContents: newContentArrayWithDeletionTimestamp(\"content1-15\", \"sid1-15\", \"snap1-15\", \"\", \"\", \"\", \"snap1-15-volumehandle\", deletePolicy, nil, &defaultSize, false, &timeNowMetav1),\n\t\t\terrors: noerrors,\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-15\", nil, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t}\n\trunSyncContentTests(t, tests, snapshotClasses)\n}", "title": "" }, { "docid": "4778a2a0f4885a495fc100fdc3bb7680", "score": "0.4745923", "text": "func NewCron(delay time.Duration, scanner *Scanner) *Cron {\n\tcron := new(Cron)\n\tcron.scanner = scanner\n\tcron.delay = delay\n\tcron.term = make(chan chan error, 0) // cannot be buffered\n\tcron.termlock = make(chan chan chan error, 1)\n\tcron.termlock <- cron.term\n\treturn cron\n}", "title": "" }, { "docid": "2001d590dc18bb03d81bc8ee2c1206dd", "score": "0.4740531", "text": "func TestCheckBuiltinDeleteTypeDouble(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `delete(int, 1, 1)`, env,\n\t\t`too many arguments to delete`,\n\t)\n\n}", "title": "" }, { "docid": "eeef9a732e3fd3aee60318f7af181e21", "score": "0.47395387", "text": "func (in *Cron) DeepCopy() *Cron {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Cron)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2465c9666d73c109d2315a749453fe91", "score": "0.47246557", "text": "func TestCheckBuiltinDeleteNilDouble(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `delete(nil, 1, 1)`, env,\n\t\t`too many arguments to delete`,\n\t)\n\n}", "title": "" }, { "docid": "722f703f9d7c46a412654c24984a9df9", "score": "0.47234103", "text": "func Crontab(cron string) ([]int, []int, []int, []time.Month, []time.Weekday) {\n\tminute := Before(cron, \" \")\n\tcron = cron[len(minute)+1:]\n\thour := Before(cron, \" \")\n\tcron = cron[len(hour)+1:]\n\tmonthday := Before(cron, \" \")\n\tcron = cron[len(monthday)+1:]\n\tmonth := Before(cron, \" \")\n\tweekday := cron[len(month)+1:]\n\n\t// Minute\n\tvar cMinute []int\n\tif minute == \"*\" {\n\t\tfor i := 0; i < 60; i++ {\n\t\t\tcMinute = append(cMinute, i)\n\t\t}\n\t} else if strings.Contains(minute, \"*/\") {\n\t\tM := After(minute, \"*/\")\n\t\tMint, _ := strconv.Atoi(M)\n\t\tvar Msum int\n\t\tif Mint >= 0 && Mint < 60 {\n\t\t\tfor Msum < 60 {\n\t\t\t\tcMinute = append(cMinute, Msum)\n\t\t\t\tMsum += Mint\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor len(minute) > 0 {\n\t\t\tif strings.Contains(minute, \",\") {\n\t\t\t\tM := Before(minute, \",\")\n\t\t\t\tMint, _ := strconv.Atoi(M)\n\t\t\t\tif Mint >= 0 && Mint < 60 {\n\t\t\t\t\tcMinute = append(cMinute, Mint)\n\t\t\t\t\tminute = minute[len(M)+1:]\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tMint, _ := strconv.Atoi(minute)\n\t\t\t\tif Mint >= 0 && Mint < 60 {\n\t\t\t\t\tcMinute = append(cMinute, Mint)\n\t\t\t\t\tminute = minute[len(minute):]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Hour\n\tvar cHour []int\n\tif hour == \"*\" {\n\t\tfor i := 0; i < 24; i++ {\n\t\t\tcHour = append(cHour, i)\n\t\t}\n\t} else {\n\t\tfor len(hour) > 0 {\n\t\t\tif strings.Contains(hour, \",\") {\n\t\t\t\tH := Before(hour, \",\")\n\t\t\t\tHint, _ := strconv.Atoi(H)\n\t\t\t\tif Hint >= 0 && Hint < 24 {\n\t\t\t\t\tcHour = append(cHour, Hint)\n\t\t\t\t\thour = hour[len(H)+1:]\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tHint, _ := strconv.Atoi(hour)\n\t\t\t\tif Hint >= 0 && Hint < 24 {\n\t\t\t\t\tcHour = append(cHour, Hint)\n\t\t\t\t\thour = hour[len(hour):]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Monthday\n\tvar cMonthday []int\n\tif monthday == \"*\" {\n\t\tfor i := 1; i < 32; i++ {\n\t\t\tcMonthday = append(cMonthday, i)\n\t\t}\n\t} else if strings.Contains(monthday, \"-\") {\n\t\tfmonthdayString := Before(monthday, \"-\")\n\t\tfmonthday, _ := strconv.Atoi(fmonthdayString)\n\t\tlmonthdayString := After(monthday, \"-\")\n\t\tlmonthday, _ := strconv.Atoi(lmonthdayString)\n\t\tif fmonthday >= 1 && lmonthday < 32 {\n\t\t\tfor i := fmonthday; i < lmonthday+1; i++ {\n\t\t\t\tcMonthday = append(cMonthday, i)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tmonthdayInt, _ := strconv.Atoi(monthday)\n\t\tcMonthday = append(cMonthday, monthdayInt)\n\t}\n\n\t// Month\n\tvar cMonth []time.Month\n\tif month == \"*\" {\n\t\tfor i := 1; i < 13; i++ {\n\t\t\tMonth := NameMonthInt(i)\n\t\t\tcMonth = append(cMonth, Month)\n\t\t}\n\t} else if strings.Contains(month, \"-\") {\n\t\tfmonthString := Before(month, \"-\")\n\t\tfmonth, _ := strconv.Atoi(fmonthString)\n\t\tlmonthString := After(month, \"-\")\n\t\tlmonth, _ := strconv.Atoi(lmonthString)\n\t\tif fmonth >= 1 || lmonth < 13 {\n\t\t\tfor i := fmonth; i < lmonth+1; i++ {\n\t\t\t\tMonth := NameMonthInt(i)\n\t\t\t\tcMonth = append(cMonth, Month)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tmonthInt, _ := strconv.Atoi(month)\n\t\tMonth := NameMonthInt(monthInt)\n\t\tcMonth = append(cMonth, Month)\n\t}\n\n\t// Weekday\n\tvar cWeekday []time.Weekday\n\tif weekday == \"0-6\" || weekday == \"1-7\" || weekday == \"*\" {\n\t\tfor i := 0; i < 7; i++ {\n\t\t\tWeekday := NameWeekInt(i)\n\t\t\tcWeekday = append(cWeekday, Weekday)\n\t\t}\n\t} else if weekday == \"1-5\" {\n\t\tfor i := 1; i < 6; i++ {\n\t\t\tWeekday := NameWeekInt(i)\n\t\t\tcWeekday = append(cWeekday, Weekday)\n\t\t}\n\t} else if strings.Contains(weekday, \"-\") {\n\t\tfweekdayString := Before(weekday, \"-\")\n\t\tfweekday, _ := strconv.Atoi(fweekdayString)\n\t\tlweekdayString := After(weekday, \"-\")\n\t\tlweekday, _ := strconv.Atoi(lweekdayString)\n\t\tif fweekday >= 0 && lweekday < 8 {\n\t\t\tif lweekday == 7 {\n\t\t\t\tlweekday = 0\n\t\t\t}\n\t\t\tfor i := fweekday; i < lweekday+1; i++ {\n\t\t\t\tWeekday := NameWeekInt(i)\n\t\t\t\tcWeekday = append(cWeekday, Weekday)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tweekdayInt, _ := strconv.Atoi(weekday)\n\t\tWeekday := NameWeekInt(weekdayInt)\n\t\tcWeekday = append(cWeekday, Weekday)\n\t}\n\treturn cMinute, cHour, cMonthday, cMonth, cWeekday\n}", "title": "" }, { "docid": "1411a9f04e1bf16b4b8f8a2dc0eb016a", "score": "0.4721033", "text": "func TestCheckBuiltinDeleteStringDouble(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `delete(\"abc\", 1, 1)`, env,\n\t\t`too many arguments to delete`,\n\t)\n\n}", "title": "" }, { "docid": "f5dc5d852dc2c213c50920e17c1aa595", "score": "0.4715336", "text": "func (c *Cron) Stop() {\n\tc.ticker.Stop()\n}", "title": "" }, { "docid": "ee4f3e02401649b4c3d492bfce1aacb5", "score": "0.47149092", "text": "func TestDelOperation(t *testing.T) {\n\tredis.DelOperation(\"sample_custID\", \"\")\n\tcustIdValueAfterDeletion, _ := redis.GetOperation(\"sample_custID\")\n\tassert.Equal(t, \"\", custIdValueAfterDeletion, \"Del operation did not work as expected\")\n}", "title": "" } ]
159954bcdd7556ab8baf5a87ec8a28d8
Create a new KafkaHook.
[ { "docid": "3ffe9487afb73b7ed3cb560c97a03c0e", "score": "0.72430223", "text": "func NewKafkaHook(id string, levels []logrus.Level, formatter logrus.Formatter, brokers []string) (*KafkaHook, error) {\n\tkafkaConfig := sarama.NewConfig()\n\tkafkaConfig.Producer.RequiredAcks = sarama.WaitForLocal // Only wait for the leader to ack\n\tkafkaConfig.Producer.Compression = sarama.CompressionSnappy // Compress messages\n\tkafkaConfig.Producer.Flush.Frequency = 500 * time.Millisecond // Flush batches every 500ms\n\n\tproducer, err := sarama.NewAsyncProducer(brokers, kafkaConfig)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// We will just log to STDOUT if we're not able to produce messages.\n\t// Note: messages will only be returned here after all retry attempts are exhausted.\n\tgo func() {\n\t\tfor err := range producer.Errors() {\n\t\t\tlog.Printf(\"Failed to send log entry to kafka: %v\\n\", err)\n\t\t}\n\t}()\n\n\thook := &KafkaHook{\n\t\tid,\n\t\tlevels,\n\t\tformatter,\n\t\tproducer,\n\t}\n\n\treturn hook, nil\n}", "title": "" } ]
[ { "docid": "955e3d7f75c322ffa037276608122158", "score": "0.64452386", "text": "func (client *RestClient) CreateHook(hook *corev2.HookConfig) (err error) {\n\tbytes, err := json.Marshal(types.WrapResource(hook))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpath := HooksPath(hook.Namespace)\n\tres, err := client.R().SetBody(bytes).Post(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif res.StatusCode() >= 400 {\n\t\treturn UnmarshalError(res)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2e05a917845db8bbea95cdc99ba5f998", "score": "0.6441137", "text": "func NewHook(host string, port int, key string, format string, appname string) (*RedisHook, error) {\n\tpool := newRedisConnectionPool(host, port)\n\n\t// test if connection with REDIS can be established\n\tconn := pool.Get()\n\tdefer conn.Close()\n\n\t// check connection\n\t_, err := conn.Do(\"PING\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to connect to REDIS: %s\", err)\n\t}\n\n\t// by default, use V0 format\n\tif strings.ToLower(format) != \"v0\" && strings.ToLower(format) != \"v1\" {\n\t\tformat = \"v0\"\n\t}\n\n\treturn &RedisHook{\n\t\tRedisHost: host,\n\t\tRedisPool: pool,\n\t\tRedisKey: key,\n\t\tLogstashFormat: format,\n\t\tAppName: appname,\n\t}, nil\n}", "title": "" }, { "docid": "099dfd4a3ae0718a6a110f4559ec8d4f", "score": "0.63631546", "text": "func NewHook() *Hook {\n\treturn &Hook{\n\t\tnotifier: honeybadger.DefaultClient,\n\t}\n}", "title": "" }, { "docid": "d807da17490e1af2b56cbbdfd4601983", "score": "0.63278115", "text": "func NewHook() *Hook {\n\thook := &Hook{\n\t\tformatter: txtFormatter,\n\t}\n\treturn hook\n}", "title": "" }, { "docid": "7a1bc3939118ec66967a847734d0a175", "score": "0.6284097", "text": "func New(config Config) (logrus.Hook, error) {\n\tif config.APIKey == \"\" {\n\t\treturn nil, errors.New(\"LogDNA API key is required\")\n\t}\n\n\tif config.Hostname == \"\" {\n\t\tvar err error\n\t\tconfig.Hostname, err = os.Hostname()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif config.QueueSize == 0 {\n\t\tconfig.QueueSize = 128\n\t}\n\n\thook := &Hook{\n\t\tConfig: &config,\n\t\tc: make(chan *logEntry, config.QueueSize),\n\t\twg: &sync.WaitGroup{},\n\t}\n\tgo hook.run()\n\tlogrus.RegisterExitHandler(func() {\n\t\t_ = hook.Close()\n\t})\n\treturn hook, nil\n}", "title": "" }, { "docid": "35baf118e04891b21c93038e6628ee49", "score": "0.6051604", "text": "func NewKafka(logger logger.Logger) *Kafka {\n\treturn &Kafka{logger: logger}\n}", "title": "" }, { "docid": "24c45e25fcb6b98bdb124ad37a1a97a4", "score": "0.6044056", "text": "func (bs *client) CreateHook(client *http.Client, project, slug, hook_key, link string) (*Hook, error) {\n\n\t// Set hook\n\thookBytes := []byte(fmt.Sprintf(`{\"hook-url-0\":\"%s\"}`, link))\n\n\t// Enable hook\n\tenablePath := fmt.Sprintf(\"/rest/api/1.0/projects/%s/repos/%s/settings/hooks/%s/enabled\",\n\t\tproject, slug, hook_key)\n\n\tdoPut(client, bs.URL+enablePath, hookBytes)\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "81b40377185f20c122c688f693f6f5cb", "score": "0.6027844", "text": "func New(mgr manager.Manager, args Args) (*extensionswebhook.Webhook, error) {\n\tlogger := logger.WithValues(\"kind\", args.Kind, \"provider\", args.Provider)\n\n\t// Create handler\n\thandler, err := extensionswebhook.NewBuilder(mgr, logger).WithMutator(args.Mutator, args.Types...).Build()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create webhook\n\tlogger.Info(\"Creating webhook\", \"name\", getName(args.Kind))\n\n\t// Build namespace selector from the webhook kind and provider\n\tnamespaceSelector, err := buildSelector(args.Kind, args.Provider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &extensionswebhook.Webhook{\n\t\tName: getName(args.Kind),\n\t\tKind: args.Kind,\n\t\tProvider: args.Provider,\n\t\tTypes: args.Types,\n\t\tTarget: extensionswebhook.TargetSeed,\n\t\tPath: getName(args.Kind),\n\t\tWebhook: &admission.Webhook{Handler: handler},\n\t\tSelector: namespaceSelector,\n\t}, nil\n}", "title": "" }, { "docid": "c71cd4c1dabe341db0d2449bc9c2dae0", "score": "0.5880365", "text": "func CreateHookHandler(app *App) func(c echo.Context) error {\n\treturn func(c echo.Context) error {\n\t\tc.Set(\"route\", \"CreateHook\")\n\t\tstart := time.Now()\n\t\tgameID := c.Param(\"gameID\")\n\t\tl := app.Logger.With(\n\t\t\tzap.String(\"source\", \"CreateHookHandler\"),\n\t\t\tzap.String(\"operation\", \"createHook\"),\n\t\t\tzap.String(\"gameID\", gameID),\n\t\t)\n\n\t\tvar payload HookPayload\n\n\t\terr := WithSegment(\"payload\", c, func() error {\n\t\t\tif err := LoadJSONPayload(&payload, c, l); err != nil {\n\t\t\t\tlog.E(l, \"Failed to parse json payload.\", func(cm log.CM) {\n\t\t\t\t\tcm.Write(zap.Error(err))\n\t\t\t\t})\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn FailWith(http.StatusBadRequest, err.Error(), c)\n\t\t}\n\n\t\tvar hook *models.Hook\n\t\tvar tx *gorp.Transaction\n\t\terr = WithSegment(\"hook-create\", c, func() error {\n\t\t\terr := WithSegment(\"tx-begin\", c, func() error {\n\t\t\t\ttx, err = app.BeginTrans(l)\n\t\t\t\treturn err\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlog.D(l, \"Creating hook...\")\n\t\t\thook, err = models.CreateHook(\n\t\t\t\ttx,\n\t\t\t\tgameID,\n\t\t\t\tpayload.Type,\n\t\t\t\tpayload.HookURL,\n\t\t\t)\n\n\t\t\tif err != nil {\n\t\t\t\ttxErr := app.Rollback(tx, \"Failed to create hook\", c, l, err)\n\t\t\t\tif txErr != nil {\n\t\t\t\t\treturn txErr\n\t\t\t\t}\n\n\t\t\t\tlog.E(l, \"Failed to create the hook.\", func(cm log.CM) {\n\t\t\t\t\tcm.Write(zap.Error(err))\n\t\t\t\t})\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn FailWith(http.StatusInternalServerError, err.Error(), c)\n\t\t}\n\n\t\terr = app.Commit(tx, \"Create hook\", c, l)\n\t\tif err != nil {\n\t\t\treturn FailWith(http.StatusInternalServerError, err.Error(), c)\n\t\t}\n\n\t\tlog.I(l, \"Created hook successfully.\", func(cm log.CM) {\n\t\t\tcm.Write(\n\t\t\t\tzap.String(\"hookPublicID\", hook.PublicID),\n\t\t\t\tzap.Duration(\"duration\", time.Now().Sub(start)),\n\t\t\t)\n\t\t})\n\t\treturn SucceedWith(map[string]interface{}{\n\t\t\t\"publicID\": hook.PublicID,\n\t\t}, c)\n\t}\n}", "title": "" }, { "docid": "0f24a62d907a4e5c6b51d5b36d3244d1", "score": "0.5860808", "text": "func NewKafka(ctx *pulumi.Context,\n\tname string, args *KafkaArgs, opts ...pulumi.ResourceOption) (*Kafka, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Plan == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Plan'\")\n\t}\n\tif args.Project == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Project'\")\n\t}\n\tif args.ServiceName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ServiceName'\")\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"servicePassword\",\n\t\t\"serviceUri\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Kafka\n\terr := ctx.RegisterResource(\"aiven:index/kafka:Kafka\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "fb3eadde3e824a47a81b265197c4d3a0", "score": "0.58371323", "text": "func CreateHookHandler(app *App) func(c echo.Context) error {\n\treturn func(c echo.Context) error {\n\t\tc.Set(\"route\", \"CreateHook\")\n\t\tstart := time.Now()\n\t\tgameID := c.Param(\"gameID\")\n\n\t\tdb := app.Db(c.StdContext())\n\n\t\tlogger := app.Logger.With(\n\t\t\tzap.String(\"source\", \"CreateHookHandler\"),\n\t\t\tzap.String(\"operation\", \"createHook\"),\n\t\t\tzap.String(\"gameID\", gameID),\n\t\t)\n\n\t\tvar payload HookPayload\n\n\t\tif err := LoadJSONPayload(&payload, c, logger); err != nil {\n\t\t\tlog.E(logger, \"Failed to parse json payload.\", func(cm log.CM) {\n\t\t\t\tcm.Write(zap.Error(err))\n\t\t\t})\n\t\t\treturn FailWith(http.StatusBadRequest, err.Error(), c)\n\t\t}\n\n\t\tlog.D(logger, \"Creating hook...\")\n\t\thook, err := models.CreateHook(\n\t\t\tdb,\n\t\t\tgameID,\n\t\t\tpayload.Type,\n\t\t\tpayload.HookURL,\n\t\t)\n\n\t\tif err != nil {\n\t\t\tlog.E(logger, \"Failed to create the hook.\", func(cm log.CM) {\n\t\t\t\tcm.Write(zap.Error(err))\n\t\t\t})\n\t\t\treturn FailWith(http.StatusInternalServerError, err.Error(), c)\n\t\t}\n\n\t\tlog.I(logger, \"Created hook successfully.\", func(cm log.CM) {\n\t\t\tcm.Write(\n\t\t\t\tzap.String(\"hookPublicID\", hook.PublicID),\n\t\t\t\tzap.Duration(\"duration\", time.Now().Sub(start)),\n\t\t\t)\n\t\t})\n\t\treturn SucceedWith(map[string]interface{}{\n\t\t\t\"publicID\": hook.PublicID,\n\t\t}, c)\n\t}\n}", "title": "" }, { "docid": "ecdcd898861d67c62a3159b9ff7ec104", "score": "0.5836675", "text": "func CreateHookFactory(db DB, gameID string, eventType int, url string) (*Hook, error) {\n\tif gameID == \"\" {\n\t\tgameID = uuid.NewV4().String()\n\t}\n\tgame := GameFactory.MustCreateWithOption(map[string]interface{}{\n\t\t\"PublicID\": gameID,\n\t}).(*Game)\n\terr := db.Insert(game)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thook := HookFactory.MustCreateWithOption(map[string]interface{}{\n\t\t\"GameID\": gameID,\n\t\t\"PublicID\": uuid.NewV4().String(),\n\t\t\"EventType\": eventType,\n\t\t\"URL\": url,\n\t}).(*Hook)\n\terr = db.Insert(hook)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn hook, nil\n}", "title": "" }, { "docid": "76cf3fe31d57af187abe999925c1db6c", "score": "0.5778188", "text": "func createHookService() *Service {\n\treturn &Service{\n\t\tList: map[string]string{\n\t\t\t\"all\": ListHooks,\n\t\t\t\"repo\": ListRepoHooks,\n\t\t},\n\t\tSelect: map[string]string{\n\t\t\t\"count\": SelectRepoHookCount,\n\t\t\t\"repo\": SelectRepoHook,\n\t\t\t\"last\": SelectLastRepoHook,\n\t\t},\n\t\tDelete: DeleteHook,\n\t}\n}", "title": "" }, { "docid": "6f22aca7b75a3bdf2e04e8c629b6a270", "score": "0.574537", "text": "func NewHook(conf Config) (*Hook, error) {\n\tif conf.Addr == \"\" || conf.Table == \"\" {\n\t\treturn nil, errors.New(\"clickrus: clickhouse data is invalid\")\n\t}\n\tif conf.Logger == nil {\n\t\tconf.Logger = logrus.New()\n\t}\n\tif conf.BufferSize == 0 {\n\t\tconf.BufferSize = 32 * 1024\n\t}\n\tif conf.Period == 0 {\n\t\tconf.Period = 10 * time.Second\n\t}\n\tif conf.Levels == nil {\n\t\tconf.Levels = []string{\"info\", \"error\"}\n\t}\n\t\n\tconf.Columns = append([]string{\n\t\t\"date\", \n\t\t\"time\", \n\t\t\"level\",\n\t\t\"message\",\n\t}, conf.Columns...)\n\n\tconn := clickhouse.NewConn(conf.Addr, clickhouse.HttpTransport{Timeout: 5 * time.Second})\n\tif err := conn.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar exists int8\n\tq := clickhouse.NewQuery(fmt.Sprintf(\"EXISTS TABLE %s\", conf.Table))\n\tq.Iter(conn).Scan(&exists)\n\n\tif exists == 0 {\n\t\treturn nil, fmt.Errorf(\"clickrus: table %s does not exist\", conf.Table)\n\t}\n\n\tvar levels []logrus.Level\n\tfor _, lvl := range conf.Levels {\n\t\tlevel, err := logrus.ParseLevel(lvl)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlevels = append(levels, level)\n\t}\n\n\thook := &Hook{\n\t\tConfig: conf,\n\t\tconn: conn,\n\t\tlevels: levels,\n\t\tticker: time.NewTicker(conf.Period),\n\t\tbus: make(chan map[string]interface{}, conf.BufferSize),\n\t\tflush: make(chan bool),\n\t\thalt: make(chan bool),\n\t}\n\n\tgo hook.startTicker()\n\treturn hook, nil\n}", "title": "" }, { "docid": "75c71218633c62f3f940b93e398902c3", "score": "0.5696568", "text": "func ConfigureKafkaHook() {\n\tif !*ToKafka {\n\t\treturn\n\t}\n\tif *KafkaTopic == \"\" {\n\t\tfmt.Println(\"Error: --log-kafka-topic can't be empty\")\n\t\tflag.PrintDefaults()\n\t\tos.Exit(2)\n\t}\n\tif *KafkaTopic == \"\" {\n\t\tfmt.Println(\"Error: --log-kafka-brokers can't be empty\")\n\t\tflag.PrintDefaults()\n\t\tos.Exit(2)\n\t}\n\tl := strings.Split(*KafkaBrokers, \",\")\n\tif len(l) < 1 {\n\t\tfmt.Println(\"Error: --log-kafka-brokers can't be empty\")\n\t\tflag.PrintDefaults()\n\t\tos.Exit(2)\n\t}\n\n\tvar brokers []string\n\n\tfor _, i := range l {\n\t\tbrokers = append(brokers, strings.TrimSpace(i))\n\t}\n\n\thook, err := kafkalogrus.NewKafkaLogrusHook(\n\t\t\"kh\",\n\t\tlog.AllLevels,\n\t\tdefalutJSONFormatter(),\n\t\tbrokers,\n\t\t*KafkaTopic,\n\t\ttrue, nil)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.AddHook(hook)\n}", "title": "" }, { "docid": "00d5865b7ded9b18c4f30d29ebea507d", "score": "0.56600475", "text": "func NewHook() Hook {\n\thook := &hook{\n\t\tctx: make(chan os.Signal, 1),\n\t}\n\n\treturn hook.WithSignals(syscall.SIGINT, syscall.SIGTERM)\n}", "title": "" }, { "docid": "c8de6f03ed0efb8332ce3d04df3cc75f", "score": "0.5582573", "text": "func (s *repositoryService) CreateHook(ctx context.Context, repo string, input *scm.HookInput) (*scm.Hook, *scm.Response, error) {\n\treturn nil,nil,scm.ErrNotSupported\n}", "title": "" }, { "docid": "50f243bab0f60f7d02b3c0e04f58e18f", "score": "0.5577166", "text": "func NewHook(url, secret string) *github.Hook {\n\treturn &github.Hook{\n\t\tEvents: []string{\"push\"},\n\t\tActive: github.Bool(true),\n\t\tName: github.String(\"web\"),\n\t\tConfig: map[string]interface{}{\n\t\t\t\"url\": url,\n\t\t\t\"content_type\": \"json\",\n\t\t\t\"secret\": secret,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "227a809c230a5efa69f9a7fecb726cfa", "score": "0.55733573", "text": "func (h *KafkaTopicsHandler) Create(ctx context.Context, project, service string, req CreateKafkaTopicRequest) error {\n\tpath := buildPath(\"project\", project, \"service\", service, \"topic\")\n\tbts, err := h.client.doPostRequest(ctx, path, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn checkAPIResponse(bts, nil)\n}", "title": "" }, { "docid": "2eb7779dfae27e1a7e83c6799b2329af", "score": "0.5542022", "text": "func New(consulClient *consul.Client) queue.Queue {\n\treturn &kafka{\n\t\tConsulClient: consulClient,\n\t}\n}", "title": "" }, { "docid": "017a43614a22e651be4542c426648f50", "score": "0.55339307", "text": "func New(args []string) *hook.Hook {\n\te := Sns{\n\t\ttopic: &args[0],\n\t}\n\n\tif len(args) > 1 {\n\t\te.subject = &args[1]\n\t}\n\n\tif len(args) > 2 {\n\t\te.message = &args[2]\n\t}\n\n\th := hook.Hook(&e)\n\treturn &h\n}", "title": "" }, { "docid": "eb97c853979619ae256d3cdab0ed73b5", "score": "0.55263555", "text": "func (s *RepositoryService) CreateHook(ctx context.Context, repo string, input *scm.HookInput) (*scm.Hook, *scm.Response, error) {\n\t// https://docs.microsoft.com/en-us/rest/api/azure/devops/hooks/subscriptions/create?view=azure-devops-rest-6.0\n\tif s.client.project == \"\" {\n\t\treturn nil, nil, ProjectRequiredError()\n\t}\n\tendpoint := fmt.Sprintf(\"%s/_apis/hooks/subscriptions?api-version=6.0\", s.client.owner)\n\tin := new(subscription)\n\tin.Status = \"enabled\"\n\tin.PublisherID = \"tfs\"\n\tin.ResourceVersion = \"1.0\"\n\tin.ConsumerID = \"webHooks\"\n\tin.ConsumerActionID = \"httpRequest\"\n\t// we do not support scm hookevents, only native events\n\tif input.NativeEvents == nil {\n\t\treturn nil, nil, fmt.Errorf(\"CreateHook, You must pass at least one native event\")\n\t}\n\tif len(input.NativeEvents) > 1 {\n\t\treturn nil, nil, fmt.Errorf(\"CreateHook, Azure only allows the creation of a single hook at a time %v\", input.NativeEvents)\n\t}\n\tin.EventType = input.NativeEvents[0]\n\t// publisher\n\tprojectID, projErr := s.getProjectIDFromProjectName(ctx, s.client.project)\n\tif projErr != nil {\n\t\treturn nil, nil, fmt.Errorf(\"CreateHook was unable to look up the project's projectID, %s\", projErr)\n\t}\n\tin.PublisherInputs.ProjectID = projectID\n\tin.PublisherInputs.Repository = repo\n\t// consumer\n\tin.ConsumerInputs.URL = input.Target\n\tif input.SkipVerify {\n\t\tin.ConsumerInputs.AcceptUntrustedCerts = \"enabled\"\n\t}\n\t// with version 1.0, azure provides incomplete data for issue-comment\n\tif in.EventType == \"ms.vss-code.git-pullrequest-comment-event\" {\n\t\tin.ResourceVersion = \"2.0\"\n\t}\n\tout := new(subscription)\n\tres, err := s.client.do(ctx, \"POST\", endpoint, in, out)\n\treturn convertHook(out), res, err\n}", "title": "" }, { "docid": "eaf5cbe71c13b4995fe9fea5acaffd04", "score": "0.55087864", "text": "func NewHook(url string, options ...Option) *Hook {\n\tif url == \"\" {\n\t\turl = \"http://localhost:3100\"\n\t}\n\n\th := &Hook{\n\t\turl: url,\n\n\t\t// default values\n\t\tlabels: make(map[string]interface{}),\n\t\tlabelsEnabled: nil,\n\t\tformatter: &logfmtFormatter{removeColors: false},\n\t\tlevel: logrus.TraceLevel,\n\t\tbatchInterval: 10 * time.Second,\n\t\tbatchSize: 1000,\n\t\tsynchronous: false,\n\t\tsuppressErrors: false,\n\t}\n\n\tfor _, o := range options {\n\t\to.apply(h)\n\t}\n\n\tif !h.synchronous {\n\t\th.flush = make(chan struct{})\n\t\th.buf = make(chan *logrus.Entry, BufSize)\n\t\th.bufLabels = make(lokiLabels)\n\t\th.bufValues = make([]*lokiValue, 0)\n\n\t\tgo h.worker()\n\t}\n\n\treturn h\n}", "title": "" }, { "docid": "f19869ed01d38fb55ccf59d18eab0e54", "score": "0.54526955", "text": "func New(minScore int, logger log.Logger) (webhook.Webhook, error) {\n\tval := &validator{\n\t\tminScore: minScore,\n\t\tlogger: logger,\n\t}\n\n\tcfg := validating.WebhookConfig{\n\t\tID: \"kubesec\",\n\t\tValidator: val,\n\t\tLogger: logger,\n\t}\n\n\treturn validating.NewWebhook(cfg)\n}", "title": "" }, { "docid": "3fd42ea1b4541999c6a3331e42ca820e", "score": "0.5426896", "text": "func (s *Service) CreateHookRevision(ctx context.Context,\n\treq *pbcs.CreateHookRevisionReq) (*pbcs.CreateHookRevisionResp, error) {\n\n\tgrpcKit := kit.FromGrpcContext(ctx)\n\tresp := new(pbcs.CreateHookRevisionResp)\n\n\tres := &meta.ResourceAttribute{Basic: &meta.Basic{Type: meta.TemplateSpace, Action: meta.Create,\n\t\tResourceID: req.BizId}, BizID: grpcKit.BizID}\n\tif err := s.authorizer.AuthorizeWithResp(grpcKit, resp, res); err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := &pbds.CreateHookRevisionReq{\n\t\tAttachment: &pbhr.HookRevisionAttachment{\n\t\t\tBizId: grpcKit.BizID,\n\t\t\tHookId: req.HookId,\n\t\t},\n\t\tSpec: &pbhr.HookRevisionSpec{\n\t\t\tName: tools.GenerateRevisionName(),\n\t\t\tContent: req.Content,\n\t\t\tMemo: req.Memo,\n\t\t},\n\t}\n\n\trp, err := s.client.DS.CreateHookRevision(grpcKit.RpcCtx(), r)\n\tif err != nil {\n\t\tlogs.Errorf(\"create HookRevision failed, err: %v, rid: %s\", err, grpcKit.Rid)\n\t\treturn nil, err\n\t}\n\n\tresp = &pbcs.CreateHookRevisionResp{\n\t\tId: rp.Id,\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "fda5b795a92418b4a0ae7fc12160c5b9", "score": "0.5424852", "text": "func CreateHook(ctx *context.APIContext) {\n\t// swagger:operation POST /repos/{owner}/{repo}/hooks repository repoCreateHook\n\t// ---\n\t// summary: Create a hook\n\t// consumes:\n\t// - application/json\n\t// produces:\n\t// - application/json\n\t// parameters:\n\t// - name: owner\n\t// in: path\n\t// description: owner of the repo\n\t// type: string\n\t// required: true\n\t// - name: repo\n\t// in: path\n\t// description: name of the repo\n\t// type: string\n\t// required: true\n\t// - name: body\n\t// in: body\n\t// schema:\n\t// \"$ref\": \"#/definitions/CreateHookOption\"\n\t// responses:\n\t// \"201\":\n\t// \"$ref\": \"#/responses/Hook\"\n\n\tutils.AddRepoHook(ctx, web.GetForm(ctx).(*api.CreateHookOption))\n}", "title": "" }, { "docid": "f7c72a200e4149c78f1e03aee0ebdf7e", "score": "0.54091567", "text": "func TestInstanceWithHookCreate(t *testing.T) {\n\terr := LoadMockPlugins(utils.LoadedPlugins)\n\tif err != nil {\n\t\tt.Fatalf(\"LoadMockPlugins returned an error (%s)\", err)\n\t}\n\n\t// Load the mock kube config file into memory\n\tfd, err := ioutil.ReadFile(\"../../mock_files/mock_configs/mock_kube_config\")\n\tif err != nil {\n\t\tt.Fatal(\"Unable to read mock_kube_config\")\n\t}\n\n\tt.Run(\"Successfully create Instance With Hook\", func(t *testing.T) {\n\t\tdb.DBconn = &db.MockDB{\n\t\t\tItems: map[string]map[string][]byte{\n\t\t\t\trb.ProfileKey{RBName: \"test-rbdef-hook\", RBVersion: \"v1\",\n\t\t\t\t\tProfileName: \"profile1\"}.String(): {\n\t\t\t\t\t\"profilemetadata\": []byte(\n\t\t\t\t\t\t\"{\\\"profile-name\\\":\\\"profile1\\\",\" +\n\t\t\t\t\t\t\t\"\\\"release-name\\\":\\\"testprofilereleasename\\\",\" +\n\t\t\t\t\t\t\t\"\\\"namespace\\\":\\\"testnamespace\\\",\" +\n\t\t\t\t\t\t\t\"\\\"rb-name\\\":\\\"test-rbdef\\\",\" +\n\t\t\t\t\t\t\t\"\\\"rb-version\\\":\\\"v1\\\",\" +\n\t\t\t\t\t\t\t\"\\\"kubernetesversion\\\":\\\"1.12.3\\\"}\"),\n\t\t\t\t\t// base64 encoding of vagrant/tests/vnfs/testrb/helm/profile\n\t\t\t\t\t\"profilecontent\": []byte(\"H4sICCVd3FwAA3Byb2ZpbGUxLnRhcgDt1NEKgjAUxvFd7ylG98aWO\" +\n\t\t\t\t\t\t\"sGXiYELxLRwJvj2rbyoIPDGiuD/uzmwM9iB7Vvruvrgw7CdXHsUn6Ejm2W3aopcP9eZL\" +\n\t\t\t\t\t\t\"YRJM1voPN+ZndAm16kVSn9onheXMLheKeGqfdM0rq07/3bfUv9PJUkiR9+H+tSVajRym\" +\n\t\t\t\t\t\t\"M6+lEqN7njxoVSbU+z2deX388r9nWzkr8fGSt5d79pnLOZfm0f+dRrzb7P4DZD/LyDJA\" +\n\t\t\t\t\t\t\"AAAAAAAAAAAAAAA/+0Ksq1N5QAoAAA=\"),\n\t\t\t\t},\n\t\t\t\trb.DefinitionKey{RBName: \"test-rbdef-hook\", RBVersion: \"v1\"}.String(): {\n\t\t\t\t\t\"defmetadata\": []byte(\n\t\t\t\t\t\t\"{\\\"rb-name\\\":\\\"test-rbdef-hook\\\",\" +\n\t\t\t\t\t\t\t\"\\\"rb-version\\\":\\\"v1\\\",\" +\n\t\t\t\t\t\t\t\"\\\"chart-name\\\":\\\"test\\\",\" +\n\t\t\t\t\t\t\t\"\\\"description\\\":\\\"testresourcebundle\\\"}\"),\n\t\t\t\t\t// base64 encoding of test helm package with hooks inside\n\t\t\t\t\t\"defcontent\": []byte(\"H4sICE+Q8WAAA3Rlc3QudGFyAO1aW2+jOBTOM7/CYl6HlEsIq7xV24\" +\n\t\t\t\t\t\t\"fVqluNdlYjrVajkQMnhS1gFjvZjbr972MDJYTQwGhMMmn9qVUaYx/o8TnfuRgGlF1NxoX\" +\n\t\t\t\t\t\t\"J4Xmu+LQ812x+PmNiOXzEMe3ZfD4xLdO23QlyR36uAmvKcI7QhIXs6Ly+6xcKJvZ/g+M1\" +\n\t\t\t\t\t\t\"0OkWJ/EY9xAbPJ/PXtx/m9tGtf+WOePjlu143gSZYzxMG298/9+hG1jhdcxQaQRoRXKU5\" +\n\t\t\t\t\t\t\"WBEKVdMHEM+1d6hP8KIIv6D0Z/Xv90afE6CGYMAraIYxIQb8GOcAxeSR3gZczmMoCWgDF\" +\n\t\t\t\t\t\t\"PKp0Up/8pCQAySLMbc6KYaDpIoXWgIhYQ8fAkgBgZfMhJH/naBdDFo0LXvAwQQvOey+E3\" +\n\t\t\t\t\t\t\"BKIb9HDCLSKqfW3mvAIX//xzinI3m/r3+b7nzZ/83Z57gf9tyHeX/pwDOok+QU+5NC7Sx\" +\n\t\t\t\t\t\t\"NJxl9VfdmppTU9cCoH4eZawYvEa/QJwgX1hMwRXCgKL0HiWcQyI/JutAS3ECi+KCtnkWV\" +\n\t\t\t\t\t\t\"sjSzv3fKrRR+H/NyuNkgoPyv5npzRzxOxP+b9uOyv9Ogdb+BxgSklKQGg36+N+zZ7v9tw\" +\n\t\t\t\t\t\t\"X/u3xM8f8p0OR/Tv70igeBhygNFuimMIWPwLQEGA4wwyJZK7n98RFNf+cZG6YwveMj6On\" +\n\t\t\t\t\t\t\"JqE2nmkUz7POp+uPj3tRi+OlJ57NivISYCqlI3LtPLM3AF5Mpn+EzkpcLeSLqh7cNSYNk\" +\n\t\t\t\t\t\t\"oToTraQ0/kWBeE/gQJH80apHFPBJynCUcuU+jxiV9uortfgowfdCV8s13S7Jf3p9gbKAJ\" +\n\t\t\t\t\t\t\"8mI5WuoxxjbtkZ8kiRY7NlfOg31z9+y/y3/zwhlRpmLG3+TpRwW6PF/25l7Vf5nWZaIE9\" +\n\t\t\t\t\t\t\"ac/6H8/xRo+v9SuNKOAH4ly4Gu37IaSy4DdEjHaUpYUQNWi/WQZ6VTGl6JAlFfoMaaw+v\" +\n\t\t\t\t\t\t\"GvxDdh4xP042f9I7r1c3KYlQvn+pT2SMpqtbpYcmK/kf/rAkTD1wT1RL7D2S1uo2SiC2Q\" +\n\t\t\t\t\t\t\"I490OjSyzz2Up+fwISc+UHq324kGaeQg7J59qOrtO9jUdHRIXDvqojFAZhwS2BEK26cns\" +\n\t\t\t\t\t\t\"V5/z2sLU/+sGYahjWGA9qgGaMs0QPMV2J89tv31Wd+LttdlebawvHPT7g+DdvzPQXr474\" +\n\t\t\t\t\t\t\"//7i7+25Yt8n/PVPH/JJBDv3tWIzv8HwjvJ996yWsM/gf6eOOxf08fskP/gXBZxneZgf9\" +\n\t\t\t\t\t\t\"AHSruXzZa8Z9Cvol8kHsW1Nf/K+r/sv83dx3R/5u5rjr/PQla5z8l+X4srWAgAVc2I7nt\" +\n\t\t\t\t\t\t\"B1lMtgmku75fRnJWLTOKLwtkces56AgOkXlutf8waPf/axVJpIDe/r9jtc5/XNszlf+fA\" +\n\t\t\t\t\t\t\"kf6/ztvGXgAsFswNhV8xxFA8yFlnQE0ZV7YIUBH/V+9+XOy/v/M9qxd/PfMsv/vKv8/BY\" +\n\t\t\t\t\t\t\"7F/2vfJ+vB7k9xUaJwC6oMaKh/dy0cVGXtph+p8d0R6iyptWvD3UbonLSky9PrxfZOWhp\" +\n\t\t\t\t\t\t\"RzZOGQkbonrSkSzPAi+2ftBRyYQ2UtuV9Z87YVMhY+eOL95Bmi9YQW9Q7X2GWkNLuP6V8\" +\n\t\t\t\t\t\t\"Sx2Q1B5La48yXFdq25XcHqS3qoKXg673f2QXAL3nf17j/M8U539zx1T5/0kg7/WLEfPYD\" +\n\t\t\t\t\t\t\"vHDXsB4xZlsh07eeCrb0sgYLwF9czI71AgvM5vtUMmFpbPnpl8FBQUFBQUFBQUFBQUFBQ\" +\n\t\t\t\t\t\t\"UFBQUFhdHwFf2f+3IAUAAA\"),\n\t\t\t\t},\n\t\t\t\tconnection.ConnectionKey{CloudRegion: \"mock_connection\"}.String(): {\n\t\t\t\t\t\"metadata\": []byte(\n\t\t\t\t\t\t\"{\\\"cloud-region\\\":\\\"mock_connection\\\",\" +\n\t\t\t\t\t\t\t\"\\\"cloud-owner\\\":\\\"mock_owner\\\",\" +\n\t\t\t\t\t\t\t\"\\\"kubeconfig\\\": \\\"\" + base64.StdEncoding.EncodeToString(fd) + \"\\\"}\"),\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tic := NewInstanceClient()\n\t\tinput := InstanceRequest{\n\t\t\tRBName: \"test-rbdef-hook\",\n\t\t\tRBVersion: \"v1\",\n\t\t\tProfileName: \"profile1\",\n\t\t\tCloudRegion: \"mock_connection\",\n\t\t}\n\n\t\tir, err := ic.Create(input, \"\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"TestInstanceWithHookCreate returned an error (%s)\", err)\n\t\t}\n\n\t\tlog.Println(ir)\n\n\t\tif len(ir.Resources) == 0 {\n\t\t\tt.Fatalf(\"TestInstanceWithHookCreate returned empty data (%+v)\", ir)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "e195e5e98d2838099b0543e18a50bdf6", "score": "0.5408349", "text": "func CreateKafkaSender(ctx context.Context, log *zap.SugaredLogger) sender.EventSender {\n\treturn &kafkaSender{\n\t\tctx: ctx,\n\t\tlog: log,\n\t}\n}", "title": "" }, { "docid": "eefa19212a8d6edf95bf64a353eaeead", "score": "0.53901833", "text": "func NewFluentHook(config fluent.Config, defaultTag string, fields map[string]string) (*FluentHook, error) {\n\tlogger, err := fluent.New(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif defaultTag == \"\" {\n\t\tdefaultTag = DefaultTag\n\t}\n\n\treturn &FluentHook{\n\t\tFluent: logger,\n\t\tDefaultTag: defaultTag,\n\t\tFields: fields,\n\t}, nil\n}", "title": "" }, { "docid": "4ee736b91ff17a4d27c7abc1298b9b96", "score": "0.5346912", "text": "func (s *WebhookServiceOp) Create(webhook Webhook) (*Webhook, error) {\n\tpath := fmt.Sprintf(\"%s.json\", webhooksBasePath)\n\twrappedData := WebhookResource{Webhook: &webhook}\n\tresource := new(WebhookResource)\n\terr := s.client.Post(path, wrappedData, resource)\n\treturn resource.Webhook, err\n}", "title": "" }, { "docid": "341e8a4649490e00bdc60a82ae5b719f", "score": "0.53443927", "text": "func (s *SCM) CreateHook(repo, target, secret, provider string, data HookForm) (*scm.Hook, error) {\n\tinput := &scm.HookInput{\n\t\tName: \"Abstruse CI\",\n\t\tTarget: target,\n\t\tSecret: secret,\n\t\tSkipVerify: false,\n\t}\n\n\tif provider == \"gitea\" {\n\t\tvar events []string\n\t\tif data.Branch || data.Tag {\n\t\t\tevents = append(events, \"create\")\n\t\t}\n\t\tif data.PullRequest {\n\t\t\tevents = append(events, \"pull_request\")\n\t\t}\n\t\tif data.Push {\n\t\t\tevents = append(events, \"push\")\n\t\t}\n\t\tinput.NativeEvents = events\n\t} else {\n\t\tinput.Events = scm.HookEvents{\n\t\t\tBranch: data.Branch,\n\t\t\tPush: data.Push,\n\t\t\tTag: data.Tag,\n\t\t\tPullRequest: data.PullRequest,\n\t\t\tIssue: false,\n\t\t\tIssueComment: false,\n\t\t\tPullRequestComment: false,\n\t\t\tReviewComment: false,\n\t\t}\n\t}\n\n\thook, _, err := s.client.Repositories.CreateHook(s.ctx, repo, input)\n\treturn hook, err\n}", "title": "" }, { "docid": "2a34733214788cee99b5572a85d122f9", "score": "0.53223455", "text": "func NewKafka(s *Sink) (SinkI, error) {\n\tksConf := &KafkaSinkConfig{}\n\terr := s.Conf.Unmarshal(ksConf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Kafka{\n\t\tSink: s,\n\t\tKafkaConf: ksConf,\n\t}, nil\n}", "title": "" }, { "docid": "42732b35104bf7758f828b8839b5928d", "score": "0.52810806", "text": "func NewHook(db *pgxpool.Pool, tableName string, timeout time.Duration) (hook *PGXHook, err error) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)\n\tdefer cancel()\n\n\tif _, err = db.Exec(ctx, \"SELECT version();\"); err != nil {\n\t\treturn\n\t}\n\thook = &PGXHook{\n\t\tdb: db,\n\t\ttimeout: timeout,\n\t\ttableName: tableName,\n\t}\n\n\t// default timeout\n\tif hook.timeout == 0 {\n\t\thook.timeout = defaultTimeout\n\t}\n\tif err = hook.createTable(); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "ff5641c5639823bbf439abdb4f947cb6", "score": "0.5278331", "text": "func (gc *Client) CreateHook(owner, repo, callback string, events []string) error {\n\thook := &github.Hook{\n\t\tEvents: events,\n\t\tName: github.String(\"web\"),\n\t\tConfig: map[string]interface{}{\n\t\t\t\"url\": callback,\n\t\t\t\"content_type\": \"json\",\n\t\t},\n\t}\n\n\tif _, _, err := gc.client().Repositories.CreateHook(owner, repo, hook); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d8f56ba06f8c212e9b22d7d835b967fe", "score": "0.5257284", "text": "func NewHookRunner(hook Hook, backoff time.Duration, data *hookData, log *logging.Logger) *HookRunner {\n\treturn &HookRunner{hook: hook, backoff: backoff, data: data, logger: log}\n}", "title": "" }, { "docid": "0243b74363e7b0970b8bd174ec8f0605", "score": "0.5256136", "text": "func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) {\n\tu := fmt.Sprintf(\"repos/%v/%v/hooks\", owner, repo)\n\treq, err := s.client.NewRequest(\"POST\", u, hook)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\th := new(Hook)\n\tresp, err := s.client.Do(ctx, req, h)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn h, resp, nil\n}", "title": "" }, { "docid": "913516d9f61506008847f806d1a2e900", "score": "0.525232", "text": "func NewCoralogixHook(PrivateKey string, ApplicationName string, SubsystemName string) *Hook {\n NewHookInstance := &Hook{\n *NewLoggerManager(\n PrivateKey,\n ApplicationName,\n SubsystemName,\n true,\n ),\n }\n\n go NewHookInstance.Writer.Run()\n\n return NewHookInstance\n}", "title": "" }, { "docid": "667bf22362113fd0fa28018cb0867377", "score": "0.52511966", "text": "func (client *Client) WebhookCreate(project_id string, params *WebhookParams) (*Webhook, error) {\n\tretVal := new(Webhook)\n\terr := func() error {\n\n\t\turl := fmt.Sprintf(\"/v2/projects/%s/webhooks\", url.QueryEscape(project_id))\n\n\t\tparamsBuf := bytes.NewBuffer(nil)\n\t\terr := json.NewEncoder(paramsBuf).Encode(&params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trc, err := client.sendRequest(\"POST\", url, \"application/json\", paramsBuf, 201)\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": "afb96d24925c2572876333db051b5f4f", "score": "0.5229213", "text": "func NewHook(levelMap map[logrus.Level]Writer, formatter logrus.Formatter) *SFHook {\n\tif formatter == nil {\n\t\tformatter = &logrus.TextFormatter{DisableColors: true}\n\t}\n\n\thook := &SFHook{\n\t\tformatter: formatter,\n\t\twriterMap: levelMap,\n\t\tlock: new(sync.Mutex),\n\t}\n\n\tfor level := range levelMap {\n\t\thook.levels = append(hook.levels, level)\n\t}\n\n\treturn hook\n}", "title": "" }, { "docid": "743e2e7629ec5080fc681bf0350792c7", "score": "0.5206301", "text": "func CreateWebhookListener(config, remoteConfig *rest.Config, scheme *runtime.Scheme, tlsKeyFile, tlsCrtFile string) (*WebhookListener, error) {\n\tif klog.V(utils.QuiteLogLel) {\n\t\tfnName := utils.GetFnName()\n\t\tklog.Infof(\"Entering: %v()\", fnName)\n\n\t\tdefer klog.Infof(\"Exiting: %v()\", fnName)\n\t}\n\n\tvar err error\n\n\tdynamicClient := dynamic.NewForConfigOrDie(config)\n\n\tl := &WebhookListener{\n\t\tDynamicClient: dynamicClient,\n\t\tlocalConfig: config,\n\t}\n\n\t// The user-provided key and cert files take precedence over the default provided files if both sets exist.\n\tif _, err := os.Stat(defaultKeyFile); err == nil {\n\t\tl.TLSKeyFile = defaultKeyFile\n\t}\n\n\tif _, err := os.Stat(defaultCrtFile); err == nil {\n\t\tl.TLSCrtFile = defaultCrtFile\n\t}\n\n\tif _, err := os.Stat(tlsKeyFile); err == nil {\n\t\tl.TLSKeyFile = tlsKeyFile\n\t}\n\n\tif _, err := os.Stat(tlsCrtFile); err == nil {\n\t\tl.TLSCrtFile = tlsCrtFile\n\t}\n\n\tl.LocalClient, err = client.New(config, client.Options{})\n\n\tif err != nil {\n\t\tklog.Error(\"Failed to initialize client to update local status. error: \", err)\n\t\treturn nil, err\n\t}\n\n\tl.RemoteClient = l.LocalClient\n\tif remoteConfig != nil {\n\t\tl.RemoteClient, err = client.New(remoteConfig, client.Options{})\n\n\t\tif err != nil {\n\t\t\tklog.Error(\"Failed to initialize client to update remote status. error: \", err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn l, err\n}", "title": "" }, { "docid": "c19bcab1c95be9976c79f6c5710d3e3d", "score": "0.5200018", "text": "func NewHook(req *http.Request) *GitHubHook {\n\tcommon.LogInfo.Printf(\"%##v\", req.Header)\n\treturn &GitHubHook{\n\t\tSignature: req.Header.Get(\"X-Hub-Signature\"),\n\t\tEvent: req.Header.Get(\"X-GitHub-Event\"),\n\t\tID: req.Header.Get(\"X-Github-Delivery\"),\n\t}\n}", "title": "" }, { "docid": "e75fb366dc593c8c8b571de01a78dd69", "score": "0.5197371", "text": "func NewKafka(webBuilder *config.WebBuilder) *DefaultKafka {\n\tinstance := new(DefaultKafka)\n\tinstance.Addr = webBuilder.KafkaAddr\n\tinstance.Topic = webBuilder.KafkaTopic\n\tinstance.WithSASL = webBuilder.WithSASL\n\tinstance.KerberosConfigPath = webBuilder.KerberosConfigPath\n\tinstance.KerberosServiceName = webBuilder.KerberosServiceName\n\tinstance.KerberosUsername = webBuilder.KerberosUsername\n\tinstance.KerberosPassword = webBuilder.KerberosPassword\n\tinstance.KerberosRealm = webBuilder.KerberosRealm\n\n\treturn instance\n}", "title": "" }, { "docid": "665fedc5c02cca795be6d422a3892bdb", "score": "0.51929617", "text": "func (s *Session) WebhookCreate(channelID int64, name, avatar string, options ...RequestOption) (st *Webhook, err error) {\n\n\tdata := struct {\n\t\tName string `json:\"name\"`\n\t\tAvatar string `json:\"avatar,omitempty\"`\n\t}{name, avatar}\n\n\tbody, err := s.RequestWithBucketID(\"POST\", EndpointChannelWebhooks(channelID), data, nil, EndpointChannelWebhooks(channelID), options...)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = unmarshal(body, &st)\n\n\treturn\n}", "title": "" }, { "docid": "07808fa225c9d249b684932f061ff8c3", "score": "0.51888216", "text": "func (x *fastReflection_EventCreateBatch) New() protoreflect.Message {\n\treturn new(fastReflection_EventCreateBatch)\n}", "title": "" }, { "docid": "04e18f1315df99b1b344b8cb9bddf9d1", "score": "0.51503813", "text": "func New(r io.Reader) ([]*Hook, error) {\n\tres := []*Hook{}\n\td := yaml.NewDecoder(r)\n\n\tvar err error\n\tfor err == nil {\n\t\th := new(Hook)\n\t\terr = d.Decode(h)\n\t\tif err == nil {\n\t\t\tres = append(res, h)\n\t\t}\n\t}\n\tif err != io.EOF {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "d19c5792ef5facbd1bd1ea7599b79620", "score": "0.5148735", "text": "func New(options ...Option) (*Webhook, error) {\n\thook := new(Webhook)\n\tfor _, opt := range options {\n\t\tif err := opt(hook); err != nil {\n\t\t\treturn nil, errors.New(\"Error applying Option\")\n\t\t}\n\t}\n\treturn hook, nil\n}", "title": "" }, { "docid": "d19c5792ef5facbd1bd1ea7599b79620", "score": "0.5148735", "text": "func New(options ...Option) (*Webhook, error) {\n\thook := new(Webhook)\n\tfor _, opt := range options {\n\t\tif err := opt(hook); err != nil {\n\t\t\treturn nil, errors.New(\"Error applying Option\")\n\t\t}\n\t}\n\treturn hook, nil\n}", "title": "" }, { "docid": "d19c5792ef5facbd1bd1ea7599b79620", "score": "0.5148735", "text": "func New(options ...Option) (*Webhook, error) {\n\thook := new(Webhook)\n\tfor _, opt := range options {\n\t\tif err := opt(hook); err != nil {\n\t\t\treturn nil, errors.New(\"Error applying Option\")\n\t\t}\n\t}\n\treturn hook, nil\n}", "title": "" }, { "docid": "d19c5792ef5facbd1bd1ea7599b79620", "score": "0.5148735", "text": "func New(options ...Option) (*Webhook, error) {\n\thook := new(Webhook)\n\tfor _, opt := range options {\n\t\tif err := opt(hook); err != nil {\n\t\t\treturn nil, errors.New(\"Error applying Option\")\n\t\t}\n\t}\n\treturn hook, nil\n}", "title": "" }, { "docid": "53e025da077fe49b81c579caf9658bbb", "score": "0.5140819", "text": "func CreateKafkaWorker(statuschan chan string, filename string) KafkaWorker {\n // Create, and return the worker.\n worker := Worker{\n StatusChan: statuschan,\n NumRetries: 2,\n messages: []string{},\n Filename: filename,\n }\n kafka_worker := KafkaWorker{\n Worker: worker,\n Producer: Getkafkaproducer(),\n Count: 0,\n QuitChan: make(chan bool),\n }\n return kafka_worker\n}", "title": "" }, { "docid": "9899e2d2bf69107959c186c79f45a0c2", "score": "0.51226956", "text": "func NewHook(output interface{}, formatter logrus.Formatter) *LfsHook {\n\thook := &LfsHook{\n\t\tlock: new(sync.Mutex),\n\t}\n\n\thook.SetFormatter(formatter)\n\n\tswitch output.(type) {\n\tcase string:\n\t\thook.SetDefaultPath(output.(string))\n\t\tbreak\n\tcase io.Writer:\n\t\thook.SetDefaultWriter(output.(io.Writer))\n\t\tbreak\n\tcase PathMap:\n\t\thook.paths = output.(PathMap)\n\t\tfor level := range output.(PathMap) {\n\t\t\thook.levels = append(hook.levels, level)\n\t\t}\n\t\tbreak\n\tcase WriterMap:\n\t\thook.writers = output.(WriterMap)\n\t\tfor level := range output.(WriterMap) {\n\t\t\thook.levels = append(hook.levels, level)\n\t\t}\n\t\tbreak\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported level map type: %v\", reflect.TypeOf(output)))\n\t}\n\n\treturn hook\n}", "title": "" }, { "docid": "4dd8dee18e4f537b728afce3f14238b9", "score": "0.5112289", "text": "func NewFileHook(jsonCfg string) (*FileHook, error) {\n\thook := &FileHook{\n\t\tFilename: \"\",\n\t\tMaxLines: 1000000,\n\t\tMaxSize: 1 << 28, //256 MB\n\t\tDaily: true,\n\t\tMaxDays: 7,\n\t\tRotate: true,\n\t\tLevel: logrus.InfoLevel,\n\t\tPerm: 0660,\n\t}\n\terr := json.Unmarshal([]byte(jsonCfg), hook)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thook.suffix = filepath.Ext(hook.Filename)\n\thook.fileNameOnly = strings.TrimSuffix(hook.Filename, hook.suffix)\n\tif hook.suffix == \"\" {\n\t\thook.suffix = \".log\"\n\t}\n\terr = hook.startLogger()\n\treturn hook, err\n}", "title": "" }, { "docid": "eb33f9409a7d6a598e511da75aa4cc7c", "score": "0.510436", "text": "func NewHook(output interface{}, formatter logrus.Formatter) *LfsHook {\n\thook := &LfsHook{\n\t\tlock: new(sync.Mutex),\n\t\tField: \"line\",\n\t\tSkip: 5,\n\t}\n\n\thook.SetFormatter(formatter)\n\n\tswitch output.(type) {\n\tcase string:\n\t\thook.SetDefaultPath(output.(string))\n\t\tbreak\n\tcase io.Writer:\n\t\thook.SetDefaultWriter(output.(io.Writer))\n\t\tbreak\n\tcase PathMap:\n\t\thook.paths = output.(PathMap)\n\t\tfor level := range output.(PathMap) {\n\t\t\thook.levels = append(hook.levels, level)\n\t\t}\n\t\tbreak\n\tcase WriterMap:\n\t\thook.writers = output.(WriterMap)\n\t\tfor level := range output.(WriterMap) {\n\t\t\thook.levels = append(hook.levels, level)\n\t\t}\n\t\tbreak\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported level map type: %v\", reflect.TypeOf(output)))\n\t}\n\n\treturn hook\n}", "title": "" }, { "docid": "76c31a0a2fbbccaa5f0e79478ef5f2c8", "score": "0.5099974", "text": "func NewContextHook(ctx context.Context, sql string, args []interface{}) *ContextHook {\n\treturn &ContextHook{\n\t\tstart: time.Now(),\n\t\tCtx: ctx,\n\t\tSQL: sql,\n\t\tArgs: args,\n\t}\n}", "title": "" }, { "docid": "4fe3457f662039773156220f18df698c", "score": "0.50838375", "text": "func New(id string, token string, version string, backoff Backoff) Layer {\n\treturn Layer{ID: id, Token: token, Version: version, Backoff: backoff}\n}", "title": "" }, { "docid": "9b951137672f3da50da71f89d7a3bc7e", "score": "0.5077645", "text": "func NewHookData() *hookData {\n\treturn &hookData{\n\t\tch: make(chan struct{}, 1),\n\t}\n}", "title": "" }, { "docid": "9b951137672f3da50da71f89d7a3bc7e", "score": "0.5077645", "text": "func NewHookData() *hookData {\n\treturn &hookData{\n\t\tch: make(chan struct{}, 1),\n\t}\n}", "title": "" }, { "docid": "24eb7328f4d575e13391357e1e70b67e", "score": "0.50627774", "text": "func New(options ...Option) (*Webhook, error) {\n\thook := new(Webhook)\n\tfor _, opt := range options {\n\t\tif err := opt(hook); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"applying Option failed: %s\", err)\n\t\t}\n\t}\n\treturn hook, nil\n}", "title": "" }, { "docid": "24eb7328f4d575e13391357e1e70b67e", "score": "0.50627774", "text": "func New(options ...Option) (*Webhook, error) {\n\thook := new(Webhook)\n\tfor _, opt := range options {\n\t\tif err := opt(hook); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"applying Option failed: %s\", err)\n\t\t}\n\t}\n\treturn hook, nil\n}", "title": "" }, { "docid": "af8efbe3915ddeee802e70dabc0c1500", "score": "0.5057289", "text": "func (s *Setup) Kafka() (Service, error) {\n\tlogrus.Tracef(\"Creating %s queue client from CLI configuration\", constants.DriverKafka)\n\t// return kafka.New(c.String(\"queue-config\"), \"vela\")\n\treturn nil, fmt.Errorf(\"unsupported queue driver: %s\", constants.DriverKafka)\n}", "title": "" }, { "docid": "221aadd038ad057b534225745b94b4ff", "score": "0.50533247", "text": "func CreateNvidiaCTKHook(nvidiaCTKPath string, hookName string, additionalArgs ...string) Hook {\n\treturn Hook{\n\t\tLifecycle: cdi.CreateContainerHook,\n\t\tPath: nvidiaCTKPath,\n\t\tArgs: append([]string{filepath.Base(nvidiaCTKPath), \"hook\", hookName}, additionalArgs...),\n\t}\n}", "title": "" }, { "docid": "a94e696407d004289e0b1265985e79f4", "score": "0.5040637", "text": "func CreateKafkaConsumer(triggerObjName, funcName, ns, topic string, clientset kubernetes.Interface) error {\n\tconsumerID := generateUniqueConsumerGroupID(triggerObjName, funcName, ns, topic)\n\tif !consumerM[consumerID] {\n\t\tlogrus.Infof(\"Creating Kafka consumer for the function %s associated with for trigger %s\", funcName, triggerObjName)\n\t\tstopM[consumerID] = make(chan struct{})\n\t\tstoppedM[consumerID] = make(chan struct{})\n\t\tgo createConsumerProcess(brokers, topic, funcName, ns, consumerID, clientset, stopM[consumerID], stoppedM[consumerID])\n\t\tconsumerM[consumerID] = true\n\t\tlogrus.Infof(\"Created Kafka consumer for the function %s associated with for trigger %s\", funcName, triggerObjName)\n\t} else {\n\t\tlogrus.Infof(\"Consumer for function %s associated with trigger %s already exists, so just returning\", funcName, triggerObjName)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "991643f83d7d1555f0b67f49318aa3bb", "score": "0.5038651", "text": "func (c *Client) CreateWebhook(request *CreateWebhookRequest) (*Webhook, error) {\n\tresp, err := c.doPost(c.buildURL(\"/api/webhooks\"), request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer closeBody(resp)\n\n\tswitch resp.StatusCode {\n\tcase http.StatusAccepted:\n\t\treturn WebhookFromReader(resp.Body)\n\n\tdefault:\n\t\treturn nil, errors.Errorf(\"failed with status code %d\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "ecc7bda4a116e030571318c9ad13c26c", "score": "0.5025629", "text": "func CreateRecorder(kubeClient k8s.Interface, eventSourceName string) record.EventRecorder {\n\tscheme := scheme.Scheme\n\n\tcoreinstall.Install(scheme)\n\n\teventBroadcaster := record.NewBroadcaster()\n\teventBroadcaster.StartLogging(logger.Logger.Debugf)\n\teventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: typedcorev1.New(kubeClient.CoreV1().RESTClient()).Events(\"\")})\n\treturn eventBroadcaster.NewRecorder(scheme, corev1.EventSource{Component: eventSourceName})\n}", "title": "" }, { "docid": "ba0aa09dc04c5d09bfb317cfbeb66101", "score": "0.5014127", "text": "func NewHookRunner(hook Hook, backoff time.Duration, data *hookData, log logintf, oneTime bool) *HookRunner {\n\thr := &HookRunner{hook: hook, backoff: backoff, data: data, log: log}\n\tif oneTime {\n\t\thr.oneTimeResult = make(chan bool, 1)\n\t}\n\treturn hr\n}", "title": "" }, { "docid": "8c1f8feceb1efa01dc4d0f05fd3695c6", "score": "0.50102633", "text": "func NewWebhook(ctx *pulumi.Context,\n\tname string, args *WebhookArgs, opts ...pulumi.ResourceOption) (*Webhook, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ProjectName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ProjectName'\")\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"secret\",\n\t})\n\topts = append(opts, secrets)\n\tvar resource Webhook\n\terr := ctx.RegisterResource(\"aws:codebuild/webhook:Webhook\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "5106b6350041ed98cd0eba592057685a", "score": "0.50051224", "text": "func NewPrometheusHook(\n\tmetricPrefix string, severityLevel string) (*PrometheusHook, error) {\n\n\tcounterVec := prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\tName: metricPrefix + \"log_messages_total\",\n\t\tHelp: \"Total number of log messages.\",\n\t}, []string{\"severity\"})\n\n\tvar severityLevels []string\n\n\tswitch severityLevel {\n\tcase klog.InfoSeverityLevel:\n\t\tseverityLevels = []string{\n\t\t\tklog.InfoSeverityLevel,\n\t\t\tklog.WarningSeverityLevel,\n\t\t\tklog.ErrorSeverityLevel,\n\t\t}\n\tcase klog.WarningSeverityLevel:\n\t\tseverityLevels = []string{\n\t\t\tklog.WarningSeverityLevel,\n\t\t\tklog.ErrorSeverityLevel,\n\t\t}\n\tcase klog.ErrorSeverityLevel:\n\t\tseverityLevels = []string{\n\t\t\tklog.ErrorSeverityLevel,\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"only following severity levels are supported: %v\",\n\t\t\tsupportedSeverityLevels)\n\t}\n\n\t// Initialise counters for all supported severity:\n\tfor _, severity := range severityLevels {\n\t\tcounterVec.WithLabelValues(severity)\n\t}\n\n\t// Try to unregister the counter vector,\n\t// in case already registered for some reason,\n\t// e.g. double initialisation/configuration\n\t// done by mistake by the end-user.\n\tprometheus.Unregister(counterVec)\n\t// Try to register the counter vector:\n\terr := prometheus.Register(counterVec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &PrometheusHook{\n\t\tseverityLevel: severityLevel,\n\t\tcounterVec: counterVec,\n\t}, nil\n}", "title": "" }, { "docid": "a3a5ba5710d6472808b370df63e7b7eb", "score": "0.50008196", "text": "func (s *WebhooksService) Create(opt *WebhooksCreateOptions) (*SingleStage, *Response, error) {\n\treq, err := s.client.NewRequest(http.MethodPost, \"/webhooks\", nil, opt)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar record *SingleStage\n\n\tresp, err := s.client.Do(req, &record)\n\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn record, resp, nil\n}", "title": "" }, { "docid": "89f4b76475974b9cb74120682b5dfb54", "score": "0.49925798", "text": "func NewLocalKafka(p *providers.Provider) (providers.ClowderProvider, error) {\n\tconfig := config.KafkaConfig{\n\t\tTopics: []config.TopicConfig{},\n\t\tBrokers: []config.BrokerConfig{{\n\t\t\tHostname: fmt.Sprintf(\"%v-kafka.%v.svc\", p.Env.Name, p.Env.GetClowdNamespace()),\n\t\t\tPort: utils.IntPtr(29092),\n\t\t}},\n\t}\n\n\tkafkaProvider := localKafka{\n\t\tProvider: *p,\n\t\tConfig: config,\n\t}\n\n\tzookeeperCacheMap := []providers.ResourceIdent{\n\t\tLocalZookeeperDeployment,\n\t\tLocalZookeeperService,\n\t}\n\n\tif p.Env.Spec.Providers.Kafka.PVC {\n\t\tzookeeperCacheMap = append(zookeeperCacheMap, LocalZookeeperPVC)\n\t}\n\n\tif err := providers.CachedMakeComponent(p.Cache, zookeeperCacheMap, p.Env, \"zookeeper\", makeLocalZookeeper, p.Env.Spec.Providers.Kafka.PVC, p.Env.IsNodePort()); err != nil {\n\t\treturn &kafkaProvider, err\n\t}\n\n\tkafkaCacheMap := []providers.ResourceIdent{\n\t\tLocalKafkaDeployment,\n\t\tLocalKafkaService,\n\t}\n\n\tif p.Env.Spec.Providers.Kafka.PVC {\n\t\tkafkaCacheMap = append(kafkaCacheMap, LocalKafkaPVC)\n\t}\n\n\tif err := providers.CachedMakeComponent(p.Cache, kafkaCacheMap, p.Env, \"kafka\", makeLocalKafka, p.Env.Spec.Providers.Kafka.PVC, p.Env.IsNodePort()); err != nil {\n\t\treturn &kafkaProvider, err\n\t}\n\n\treturn &kafkaProvider, nil\n}", "title": "" }, { "docid": "34aedf1b0053f4728a51401167174e36", "score": "0.49827448", "text": "func (c *Client) CreateWebhook(\n\tchannelID discord.Snowflake,\n\tname string, avatar discord.Hash) (*discord.Webhook, error) {\n\n\tvar param struct {\n\t\tName string `json:\"name\"`\n\t\tAvatar discord.Hash `json:\"avatar\"`\n\t}\n\n\tparam.Name = name\n\tparam.Avatar = avatar\n\n\tvar w *discord.Webhook\n\treturn w, c.RequestJSON(\n\t\t&w, \"POST\",\n\t\tEndpointChannels+channelID.String()+\"/webhooks\",\n\t\thttputil.WithJSONBody(c, param),\n\t)\n}", "title": "" }, { "docid": "31edb9ccbd1ce20087bc38b24deaa8ed", "score": "0.49717122", "text": "func NewHook(url string) *Client {\n\treturn &Client{url: url, HTTPClient: http.DefaultClient}\n}", "title": "" }, { "docid": "92a9c7dfa64c306d52d71cf43f75192b", "score": "0.49674624", "text": "func NewValidationHook() controller.Hook {\n\treturn controller.Hook{\n\t\tCreate: validateTaskrunCreate(),\n\t}\n}", "title": "" }, { "docid": "e1f9fb02494f3fbd78e734222b11861d", "score": "0.49665245", "text": "func CreatePostReceive(name string, token string, endpoint string, HTTPS string) (string, error) {\n\tt := template.New(\"Post Receive Hook\")\n\tt, err := t.Parse(postReceiveHook)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdata := templateData{}\n\tdata.Name = name\n\tdata.Token = token\n\tdata.CustomEndpoint = endpoint\n\tdata.HTTPS = HTTPS\n\tvar tpl bytes.Buffer\n\terr = t.Execute(&tpl, data)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn tpl.String(), nil\n}", "title": "" }, { "docid": "76215a036c30bc041b74621a0ff55d86", "score": "0.49642947", "text": "func Create(msg []byte) {\n\tvar create kafka.CreateTodoMessage\n\tif err := unmarshal(msg, &create); err != nil {\n\t\treturn\n\t}\n\n\tlog.Printf(\"creating todo with name: %s\", create.Name)\n\tstorage.S.Put(storage.Todo{\n\t\tName: create.Name,\n\t})\n}", "title": "" }, { "docid": "fcafdd08febee0980cef27c8ab9e4eb6", "score": "0.49608186", "text": "func NewWebhook(config Config, kubeClient kubernetes.Interface, certManager certificate.Manager, meshCatalog catalog.MeshCataloger, kubeController k8s.Controller, meshName, osmNamespace, webhookConfigName string, stop <-chan struct{}, cfg configurator.Configurator) error {\n\tcn := certificate.CommonName(fmt.Sprintf(\"%s.%s.svc\", constants.OSMControllerName, osmNamespace))\n\tcert, err := certManager.IssueCertificate(cn, constants.XDSCertificateValidityPeriod)\n\tif err != nil {\n\t\treturn errors.Errorf(\"Error issuing certificate for the mutating webhook: %+v\", err)\n\t}\n\n\twh := webhook{\n\t\tconfig: config,\n\t\tkubeClient: kubeClient,\n\t\tcertManager: certManager,\n\t\tmeshCatalog: meshCatalog,\n\t\tkubeController: kubeController,\n\t\tosmNamespace: osmNamespace,\n\t\tcert: cert,\n\t\tconfigurator: cfg,\n\t}\n\n\tgo wh.run(stop)\n\tif err = patchMutatingWebhookConfiguration(cert, meshName, osmNamespace, webhookConfigName, wh.kubeClient); err != nil {\n\t\treturn errors.Errorf(\"Error configuring MutatingWebhookConfiguration: %+v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01c118b5347a9e6028eec36148874ab5", "score": "0.49572176", "text": "func (r *Repository) CreateWebhook(listenerURL, secret string) (string, error) {\n\tin := &scm.HookInput{\n\t\tTarget: listenerURL,\n\t\tSecret: secret,\n\t\tEvents: scm.HookEvents{\n\t\t\tPullRequest: true,\n\t\t\tPush: true,\n\t\t},\n\t}\n\n\tcreated, _, err := r.Client.Repositories.CreateHook(context.Background(), r.name, in)\n\treturn created.ID, err\n}", "title": "" }, { "docid": "cbc656b52832e6d827dc3cb1090ff6ba", "score": "0.49438235", "text": "func NewWebhook(title string, trigger string, response string, delivery string, url string) *Webhook {\n\tthis := Webhook{}\n\tthis.Title = title\n\tthis.Trigger = trigger\n\tthis.Response = response\n\tthis.Delivery = delivery\n\tthis.Url = url\n\treturn &this\n}", "title": "" }, { "docid": "808b2e46a9d4a5223b99e25f607251d3", "score": "0.49383804", "text": "func (r *REST) Create(ctx kapi.Context, obj runtime.Object) (runtime.Object, error) {\n\n\tservicebroker := obj.(*servicebrokerapi.ServiceBroker)\n\tservicebroker.Status.Phase = servicebrokerapi.ServiceBrokerNew\n\n\treturn r.store.Create(ctx, obj)\n}", "title": "" }, { "docid": "46a6a080c914f0e701abe1d6ddc16553", "score": "0.4938144", "text": "func NewWebhook() *Webhook {\n\treturn &Webhook{&WebhookClientImpl{}}\n}", "title": "" }, { "docid": "b339c117f0bb2f238dc1e28437c06c57", "score": "0.49212962", "text": "func (h *Hooker) Init(configFilePath string) error {\n\treturn nil\n}", "title": "" }, { "docid": "ebdde2f402e953981ba3ef03181e1594", "score": "0.49207637", "text": "func NewKafka(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) {\n\t// TODO: V4 Remove this.\n\tif conf.Kafka.MaxBatchCount > 1 {\n\t\tlog.Warnf(\"Field '%v.max_batch_count' is deprecated, use '%v.batching.count' instead.\\n\", conf.Type, conf.Type)\n\t\tconf.Kafka.Batching.Count = conf.Kafka.MaxBatchCount\n\t}\n\tk, err := reader.NewKafka(conf.Kafka, mgr, log, stats)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar kb reader.Type = k\n\tif !conf.Kafka.Batching.IsNoop() {\n\t\tif kb, err = reader.NewSyncBatcher(conf.Kafka.Batching, k, mgr, log, stats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn NewReader(TypeKafka, reader.NewPreserver(kb), log, stats)\n}", "title": "" }, { "docid": "9dc3fec6e04bd670ef8a5b0828f9eb63", "score": "0.49199066", "text": "func NewCmdWebhooksCreate() *cobra.Command {\n\tcfgs, curCfg, err := configmgr.GetCurrentConfig()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%+v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tvar cmd = &cobra.Command{\n\t\tUse: \"create\",\n\t\tShort: \"Create a webhook\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tcurrent := cfgs.Configurations[curCfg]\n\t\t\tclient := eclient.New(current.Endpoint)\n\t\t\tif err := client.SetToken(&current); err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"%+v\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\t// get the url and event list\n\t\t\treq, err := promptCreateWebhook()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"%v\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\t// attempt to create the webhook\n\t\t\tctx := context.Background()\n\t\t\twebhook, err := client.CreateWebhook(ctx, req)\n\t\t\tif err == eclient.ErrEventTypeNotFound {\n\t\t\t\tfmt.Fprint(os.Stderr, \"one or more of the events are not known\\n\")\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tif err == eclient.ErrWebhookExists {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"webhook with this URL of %s already exists\\n\",\n\t\t\t\t\treq.URL)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"%+v\\n\", err)\n\t\t\t\tfmt.Fprintf(os.Stderr, \"error creating user: %+v\\n\",\n\t\t\t\t\terrors.Unwrap(err))\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\tformat := \"%v\\t%v\\t\\n\"\n\t\t\ttw := new(tabwriter.Writer).Init(os.Stdout, 0, 8, 2, ' ', 0)\n\t\t\tfmt.Fprintf(tw, format, \"ID:\", webhook.ID)\n\t\t\tfmt.Fprintf(tw, format, \"Signing Key:\", webhook.SigningKey)\n\t\t\tfmt.Fprintf(tw, format, \"URL:\", webhook.URL)\n\t\t\tfmt.Fprintf(tw, format, \"Events:\", webhook.Events)\n\t\t\tfmt.Fprintf(tw, format, \"Enabled:\", webhook.Enabled)\n\t\t\tfmt.Fprintf(tw, format, \"Created:\", webhook.Created)\n\t\t\tfmt.Fprintf(tw, format, \"Modified:\", webhook.Modified)\n\t\t\ttw.Flush()\n\t\t},\n\t}\n\treturn cmd\n}", "title": "" }, { "docid": "955536ec9ca2f3a0784a8016284891a2", "score": "0.49147126", "text": "func CreateWebhook(w http.ResponseWriter, r *http.Request) {\n\twh, err := webhook.NewFromRequest(r)\n\tif err != nil {\n\t\tw.WriteHeader(503)\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\n\t// save webhook to database\n\tid, err := wh.Insert()\n\tif err != nil {\n\t\tw.WriteHeader(503)\n\t\treturn\n\t}\n\n\t// only send the id as response\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.Write([]byte(id.Hex()))\n}", "title": "" }, { "docid": "74ef4cb58f48fd8445c36f95acfa3b69", "score": "0.490048", "text": "func New(options ...Option) (func(context.Context, events.CloudwatchLogsEvent) error, error) {\n\tportValue, _ := strconv.Atoi(os.Getenv(\"PAPERTRAIL_PORT\"))\n\tconfig := configuration{\n\t\tpapertrailHost: os.Getenv(\"PAPERTRAIL_HOST\"),\n\t\tpapertrailPort: portValue,\n\t\tmessageTransform: func(message string, event events.CloudwatchLogsLogEvent) (string, bool) {\n\t\t\treturn message, true\n\t\t},\n\t}\n\n\tfor _, option := range options {\n\t\tconfig = option(config)\n\t}\n\n\tif err := config.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn func(ctx context.Context, log events.CloudwatchLogsEvent) error {\n\t\tdata, dataErr := log.AWSLogs.Parse()\n\t\tif dataErr != nil {\n\t\t\treturn dataErr\n\t\t}\n\n\t\tlogger, loggerErr := syslog.Dial(\n\t\t\t\"udp\", fmt.Sprintf(\"%s:%d\", config.papertrailHost, config.papertrailPort), syslog.LOG_EMERG, data.LogGroup,\n\t\t)\n\t\tif loggerErr != nil {\n\t\t\treturn loggerErr\n\t\t}\n\n\t\tfor _, event := range data.LogEvents {\n\t\t\tif line, ok := config.messageTransform(event.Message, event); ok {\n\t\t\t\tlogger.Info(line)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}, nil\n}", "title": "" }, { "docid": "438a3826166d242d83ed77e35a6ac2a6", "score": "0.48760703", "text": "func CreateCreateSymlinkHook(nvidiaCTKPath string, links []string) Discover {\n\tif len(links) == 0 {\n\t\treturn None{}\n\t}\n\n\tvar args []string\n\tfor _, link := range links {\n\t\targs = append(args, \"--link\", link)\n\t}\n\treturn CreateNvidiaCTKHook(\n\t\tnvidiaCTKPath,\n\t\t\"create-symlinks\",\n\t\targs...,\n\t)\n}", "title": "" }, { "docid": "75d82c2640728532a8f01cc5e640fdde", "score": "0.48736462", "text": "func NewWebhook() *Webhook {\n\tthis := Webhook{}\n\treturn &this\n}", "title": "" }, { "docid": "042fd783862fc30f01f851354f727d8b", "score": "0.4871452", "text": "func New(s store.Store, ctx context.Context) (*watcher.Watcher, error) {\n\treturn watcher.New(s, ctx, KEY, convert, invertKey)\n}", "title": "" }, { "docid": "758606ce74619dbcc18d7a9283f4920c", "score": "0.48615882", "text": "func InitKafka(conf Config, influxAccessor influxlogger.InfluxD, signalChan chan struct{}, wg *sync.WaitGroup) (*Kafka, error) {\n\tvar err error\n\tkafka := &Kafka{\n\t\tConf: conf,\n\t\tShutdown: signalChan,\n\t\tWaitGroup: wg,\n\t}\n\n\tkafka.kafkaConfig = consumergroup.NewConfig()\n\n\tkafka.kafkaConfig.Config.Producer.Retry.Max = conf.MaxRetry\n\tkafka.kafkaConfig.Config.Producer.RequiredAcks = sarama.WaitForLocal\n\tkafka.kafkaConfig.Config.Producer.Compression = sarama.CompressionGZIP\n\tkafka.kafkaConfig.Config.Producer.Flush.Messages = conf.BatchSize\n\tkafka.kafkaConfig.Config.Producer.Flush.Frequency = time.Millisecond * time.Duration(conf.FlushInterval)\n\tkafka.kafkaConfig.Producer.Partitioner = sarama.NewRoundRobinPartitioner\n\tkafka.kafkaConfig.Config.Producer.Return.Successes = true\n\tkafka.kafkaConfig.Config.Producer.Return.Errors = true\n\tkafka.kafkaConfig.Config.ClientID = \"firehose_realtime\"\n\n\tlog.Printf(\"InitKafka - client id %v\\n\", kafka.kafkaConfig.Config.ClientID)\n\n\tkafka.kzClient, err = kazoo.NewKazoo(conf.Zookeepers, kafka.kafkaConfig.Zookeeper)\n\tif err != nil {\n\t\tlog.Printf(\"InitKafka - Unable to initialize kazoo client: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tkafka.Brokers, err = kafka.kzClient.BrokerList()\n\tif err != nil {\n\t\tlog.Printf(\"InitKafka - Unable to get list of brokers: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tlog.Printf(\"InitKafka - Brokers connecting to %v\", kafka.Brokers)\n\n\tkafka.kafkaClient, err = sarama.NewClient(kafka.Brokers, nil) // this will just be used for grabbing config so no reason to give conf\n\tif err != nil {\n\t\tlog.Printf(\"InitKafka - Unable to create kafka client: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tkafka.kzConsumerGroup = kafka.kzClient.Consumergroup(conf.ConsumerGroupName)\n\n\tatomic.StoreUint64(kafka.Conf.ConsumerTransactions, 0)\n\tatomic.StoreUint64(kafka.Conf.ProducerTransactions, 0)\n\n\tkafka.influx = influxAccessor\n\n\treturn kafka, err\n}", "title": "" }, { "docid": "802439e41e5b33f2fcfb0c0173fb1798", "score": "0.4856154", "text": "func New(services []brokerapi.Service, logger lager.Logger, env Config) brokerapi.ServiceBroker {\n\treturn &broker{services: services, logger: logger, env: env}\n}", "title": "" }, { "docid": "24db564948949bc13db417ace1578920", "score": "0.48490635", "text": "func (x *fastReflection_EventCreateClass) New() protoreflect.Message {\n\treturn new(fastReflection_EventCreateClass)\n}", "title": "" }, { "docid": "6fc4a3477f0465b154a2ecb538c27d77", "score": "0.48413455", "text": "func (i *TeleInstance) Create(trustedSecrets []*InstanceSecrets, console io.Writer) error {\n\ttconf := service.MakeDefaultConfig()\n\ttconf.Console = console\n\ttconf.Proxy.DisableWebService = true\n\ttconf.Proxy.DisableWebInterface = true\n\treturn i.CreateEx(trustedSecrets, tconf)\n}", "title": "" }, { "docid": "884d427e60eb930bb8badebc18435f15", "score": "0.4841315", "text": "func New() (*kafkaPub, error) {\n\n\tconfig := sarama.NewConfig()\n\tconfig.Producer.RequiredAcks = sarama.WaitForAll // Wait for all in-sync replicas to ack the message\n\tconfig.Producer.Retry.Max = 10 // Retry up to 10 times to produce the message\n\tconfig.Producer.Return.Successes = true\n\n\tkfkHostPort := \"127.0.0.1:9092\"\n\tif os.Getenv(\"KFK_HOST_PORT\") != \"\" {\n\t\tkfkHostPort = os.Getenv(\"KFK_HOST_PORT\")\n\t}\n\tlogrus.Info(\"kfkHostPort: \", kfkHostPort)\n\n\tproducer, err := sarama.NewSyncProducer([]string{kfkHostPort}, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &kafkaPub{producer: producer}, nil\n}", "title": "" }, { "docid": "4c620a9795bd9a951c61a66d92d67c31", "score": "0.48354334", "text": "func (kvp *KvProtoPluginWrapper) NewWatcher(prefix string) keyval.ProtoWatcher {\n\treturn NewProtoWatcherWrapper(kvp.KvProtoPlugin.NewWatcher(prefix), kvp.decrypter, kvp.decryptFunc)\n}", "title": "" }, { "docid": "45ea4d301c99d0d07296352c00f7b232", "score": "0.48324728", "text": "func NewKafkaHelmChart() *HelmChart {\n\tvaluesFilePath := filepath.Join(tools.ProjectRoot, \"environment/charts/kafka/overrideValues.yaml\")\n\toverrideValues, err := chartutil.ReadValuesFile(valuesFilePath)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tchart := &HelmChart{\n\t\tid: \"kafka\",\n\t\tchartPath: filepath.Join(tools.ProjectRoot, \"environment/charts/kafka/kafka-14.1.0.tgz\"),\n\t\treleaseName: \"kafka\",\n\t\tvalues: map[string]interface{}{},\n\t\tSetValuesHelmFunc: func(manifest *HelmChart) error {\n\t\t\tmanifest.values[\"clusterURL\"] = \"kafka:9092\"\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tfor index, element := range overrideValues {\n\t\tchart.values[index] = element\n\t}\n\n\treturn chart\n}", "title": "" }, { "docid": "e72e4832f6f4bc9a026f9fa0935be1d1", "score": "0.4809254", "text": "func ExampleAddHook() {\n\n\ttestHook := func(logger console.Logger) error {\n\n\t\tfmt.Printf(\n\t\t\t\"Test hook fired. Message=%s, Level=%s, File=%s \\n\",\n\t\t\tlogger.Message,\n\t\t\tlogger.Level,\n\t\t\tlogger.Location.Filename,\n\t\t)\n\n\t\treturn nil\n\t}\n\n\tmyConsole.AddHook(testHook)\n\n}", "title": "" }, { "docid": "83133f8b1ed7d7dfd338dec61ddac119", "score": "0.47958463", "text": "func luaKafkaOffset(l *lua.State) int {\n\tname := getArgString(l, 1, luaNameKafkaOffsetFn)\n\toffset, err := kafka.NewOffset(name)\n\tif err != nil {\n\t\tl.PushNil()\n\t\tl.PushString(fmt.Sprintf(\"%s\", err))\n\t} else {\n\t\tl.PushUserData(offset)\n\t\tl.PushNil()\n\t}\n\treturn 2\n}", "title": "" }, { "docid": "ab7ef9270d1c8b5472b00ddd4cb8b05d", "score": "0.4776639", "text": "func (hooks *PersistHooks) PreCreateHook(m Model, ser Service, tx Tx) error {\n\treturn hooks.callHooks(hooks.PreCreateHooks, m, ser, tx)\n}", "title": "" }, { "docid": "c3fdc14d7a23c7d95210f315215f55b4", "score": "0.4768433", "text": "func NewFileWriteHook(filename string) (*WriteHook, error) {\n\tf, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0600)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &WriteHook{\n\t\tw: f,\n\t\tformatter: &logrus.TextFormatter{\n\t\t\tFullTimestamp: true,\n\t\t\tQuoteEmptyFields: true,\n\t\t\tDisableColors: true,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "5e28bd634d13f5ba0e3dab70774f0f53", "score": "0.47665355", "text": "func NewFromConfig(cfg config.Configuration) (logrus.Hook, error) {\n\treturn New(NewConfig(cfg))\n}", "title": "" }, { "docid": "ecac675cece330a716e16c31b4502f7e", "score": "0.4760867", "text": "func prepareKafka() {\n\terr := exe.DeleteTopic(inputTopic)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err = exe.CreateTopic(inputTopic); err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = exe.DeleteTopic(clientTopic)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err = exe.CreateTopic(clientTopic); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" } ]
1ab5b28b8ca2159b28711e5db043b6a7
Copy returns a pointer to a copy the SSHIdentitiesList.
[ { "docid": "f717b46a4b0ca4910e91d59ce6e6b5a9", "score": "0.8117204", "text": "func (o SSHIdentitiesList) Copy() elemental.Identifiables {\n\n\tcopy := append(SSHIdentitiesList{}, o...)\n\treturn &copy\n}", "title": "" } ]
[ { "docid": "e56a107ff0d9e41ce1a71609a695cb81", "score": "0.75897014", "text": "func (o SparseSSHIdentitiesList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseSSHIdentitiesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "9391e787fff79fd21fcc35239f1b7622", "score": "0.6196436", "text": "func (o SSHIdentitiesList) List() elemental.IdentifiablesList {\n\n\tout := make(elemental.IdentifiablesList, len(o))\n\tfor i := 0; i < len(o); i++ {\n\t\tout[i] = o[i]\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "383752452812f737702d9c06b1dc8364", "score": "0.6148421", "text": "func (o SSHIdentitiesList) Append(objects ...elemental.Identifiable) elemental.Identifiables {\n\n\tout := append(SSHIdentitiesList{}, o...)\n\tfor _, obj := range objects {\n\t\tout = append(out, obj.(*SSHIdentity))\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "8ae7e5467299624784e684e08045e71b", "score": "0.60313433", "text": "func (o PingResultsList) Copy() elemental.Identifiables {\n\n\tcopy := append(PingResultsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "a023949855f3407f928b3b4ad3bd95b5", "score": "0.60295844", "text": "func (o SparseTenantsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseTenantsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "47473f6e92a221ae0a59d91b7d5314b5", "score": "0.59924173", "text": "func (o TenantsList) Copy() elemental.Identifiables {\n\n\tcopy := append(TenantsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "887916f6080063bcc05150e5b1263665", "score": "0.5978006", "text": "func (o SparsePingResultsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparsePingResultsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "ad9f9256d34e0fd3d58b8074a979896c", "score": "0.5974369", "text": "func (o PCSearchResultsList) Copy() elemental.Identifiables {\n\n\tcopy := append(PCSearchResultsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "78675a758384f35106ebac0c00278432", "score": "0.59593433", "text": "func (o SparseCloudNetworkQueriesList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseCloudNetworkQueriesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "db5691fcf6b7affbd93033d0e04551f3", "score": "0.5946207", "text": "func (o CloudNetworkQueriesList) Copy() elemental.Identifiables {\n\n\tcopy := append(CloudNetworkQueriesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "9941fe0c50fc74506c59c95596422f40", "score": "0.59352857", "text": "func (o SparsePCSearchResultsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparsePCSearchResultsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "bf23841cb575c84cfafc99d00f0d7f5f", "score": "0.5862953", "text": "func (o SparseSSHIdentitiesList) List() elemental.IdentifiablesList {\n\n\tout := make(elemental.IdentifiablesList, len(o))\n\tfor i := 0; i < len(o); i++ {\n\t\tout[i] = o[i]\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "0836f6ddc0dc6c3c235b3c635d823ec5", "score": "0.5856138", "text": "func (o SparseSSHIdentitiesList) Append(objects ...elemental.Identifiable) elemental.Identifiables {\n\n\tout := append(SparseSSHIdentitiesList{}, o...)\n\tfor _, obj := range objects {\n\t\tout = append(out, obj.(*SparseSSHIdentity))\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "257024474e84ac9d2b7256ae17589ce6", "score": "0.5830591", "text": "func (o AuthoritiesList) Copy() elemental.Identifiables {\n\n\tcopy := append(AuthoritiesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "da3dbcb232742421eb8ffc8596055b10", "score": "0.5786552", "text": "func (o SparseAuthoritiesList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseAuthoritiesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "68f719c19f026922e2753da4b6111581", "score": "0.5773747", "text": "func (addrs *IPAddresses) Copy() *IPAddresses {\n\taddrsCopy := NewIPAddresses()\n\tfor _, addr := range addrs.list {\n\t\taddrsCopy.list = append(addrsCopy.list, addr)\n\t}\n\treturn addrsCopy\n}", "title": "" }, { "docid": "95394c297982503c1528a7de1daad9fe", "score": "0.57611054", "text": "func (o EnforcersList) Copy() elemental.Identifiables {\n\n\tcopy := append(EnforcersList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "68237998d87fbb1b5ced8306339667a2", "score": "0.57535934", "text": "func (b *repositoryBucket) Copy() []string {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tb.evictStale()\n\n\tout := make([]string, len(b.list))\n\tfor i, e := range b.list {\n\t\tout[i] = e.repository\n\t}\n\treturn out\n}", "title": "" }, { "docid": "ed52798c11f6df0c786a0b4921895dfa", "score": "0.5745956", "text": "func (o InvoicesList) Copy() elemental.Identifiables {\n\n\tcopy := append(InvoicesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "70689640c4b8ada7a22b7fe1bf7bdb82", "score": "0.5701683", "text": "func (o SparseInvoicesList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseInvoicesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "cf736933cecf84699d45bb592bf3ff5c", "score": "0.56554765", "text": "func (o SparseDebugBundlesList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseDebugBundlesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "0d64b47a6b072422fd1418357ca058be", "score": "0.56533515", "text": "func (l *PeerList) Copy() map[string]*Peer {\n\tl.RLock()\n\tdefer l.RUnlock()\n\n\tlistCopy := make(map[string]*Peer)\n\tfor k, v := range l.peersByHostPort {\n\t\tlistCopy[k] = v.Peer\n\t}\n\treturn listCopy\n}", "title": "" }, { "docid": "a9d764103549f7672b8b3ad00ed62d45", "score": "0.56484085", "text": "func (o DebugBundlesList) Copy() elemental.Identifiables {\n\n\tcopy := append(DebugBundlesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "032a3b55cc4d435dfc905c59ebca36ff", "score": "0.5561776", "text": "func (o SparsePacketReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparsePacketReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "36ac9bf2626bc573a5eb8992421aa225", "score": "0.5552002", "text": "func (o SparseEnforcersList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseEnforcersList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "b4feed4d3102b4361cc9ded0baceec2a", "score": "0.5532747", "text": "func (in *UserSSHKeyList) DeepCopy() *UserSSHKeyList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UserSSHKeyList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4764b248a53af4406b1e80bd33cafedb", "score": "0.5478686", "text": "func (o PingReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(PingReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "e5f99d07eb17f433371ec13453ea3134", "score": "0.5478411", "text": "func (o SparseConnectionExceptionReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseConnectionExceptionReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "b86f0510ac734e2d388282ad43a0992a", "score": "0.5463798", "text": "func (o SparseFlowReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseFlowReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "2218a6084c49a9e7f4d90d54bc2167fd", "score": "0.5450845", "text": "func (o SparsePCTimeRangesList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparsePCTimeRangesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "d792451443f9b7aed6dc9c901519e4e4", "score": "0.54311377", "text": "func (o SparsePingReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparsePingReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "48b8b0ea302d809922707d4612a71942", "score": "0.53889644", "text": "func (o PCTimeRangesList) Copy() elemental.Identifiables {\n\n\tcopy := append(PCTimeRangesList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "aeb942fcbf9ac03df761c3e0784b9bd7", "score": "0.53840876", "text": "func (o PacketReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(PacketReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "083eb7f3c03850bbd82d2b7b097a31c5", "score": "0.53595376", "text": "func (o FlowReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(FlowReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "41bc35502610a87baf78df55136930cc", "score": "0.53552085", "text": "func (g *entityGroup) getListCopy(c ctx) []string {\n\tdefer c.FuncIn(\"cache::getListCopy\", \"p:%s c:%d d:%t\",\n\t\tg.parentEntity, g.entityCount,\n\t\tg.detached).Out()\n\n\tcount := g.entityCount\n\tnewList := make([]string, 0, count)\n\tfor entity := range g.entities {\n\t\tnewList = append(newList, entity)\n\t}\n\n\tif count != len(newList) {\n\t\tpanic(fmt.Sprintf(\"BUG: newCount %d != len(newList) %d\\n\", count,\n\t\t\tlen(newList)))\n\t}\n\n\treturn newList\n}", "title": "" }, { "docid": "9b33f899965e28398306a374cc66e20c", "score": "0.5329403", "text": "func (o SSHIdentitiesList) Identity() elemental.Identity {\n\n\treturn SSHIdentityIdentity\n}", "title": "" }, { "docid": "6fc6f18c1be7e3712e3a7b1ab2aa2085", "score": "0.5325058", "text": "func (o ConnectionExceptionReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(ConnectionExceptionReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "bd69ffc1c3109428f0d27f1e839f08a6", "score": "0.5291334", "text": "func (list AnimalsList) Copy() AnimalsList {\n\tnewList := make(AnimalsList, len(list))\n\tcopy(newList, list)\n\treturn newList\n}", "title": "" }, { "docid": "fe71d3fb1b20676fd2a16d78fdc358f3", "score": "0.52504706", "text": "func (o SparseEnforcerTraceReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseEnforcerTraceReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "ed48837b57fb065558e23cc0d4c08b5d", "score": "0.5224446", "text": "func (in *GCPCredentialsList) DeepCopy() *GCPCredentialsList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GCPCredentialsList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "837f32eb91257591c1aa71bbe0096e97", "score": "0.52179605", "text": "func (this *SIPHeaderList) Clone() interface{} {\n\tretval := &SIPHeaderList{}\n\n\tretval.headerName = this.headerName\n\n\treturn retval\n}", "title": "" }, { "docid": "6cb6bfd2ea1fbad7f04191c4b5e9bbce", "score": "0.51828945", "text": "func (o EnforcerTraceReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(EnforcerTraceReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "e61a6b76f951cd3f625ad9bd3a437fdc", "score": "0.513973", "text": "func (o SSHIdentitiesList) ToSparse(fields ...string) elemental.Identifiables {\n\n\tout := make(SparseSSHIdentitiesList, len(o))\n\tfor i := 0; i < len(o); i++ {\n\t\tout[i] = o[i].ToSparse(fields...).(*SparseSSHIdentity)\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "079e44c99ebc285562a2e1e3d9acd114", "score": "0.5117839", "text": "func (in *SMTPCredentialSetList) DeepCopy() *SMTPCredentialSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SMTPCredentialSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "893adf3a564f2691e119fce80273cc3c", "score": "0.5111668", "text": "func (o SparseCounterReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseCounterReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "1d062b801ea846e8f3f503750fb5b8ed", "score": "0.5100929", "text": "func (o *SSHIdentity) DeepCopy() *SSHIdentity {\n\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\tout := &SSHIdentity{}\n\to.DeepCopyInto(out)\n\n\treturn out\n}", "title": "" }, { "docid": "696532b5bb913710d5f2aa5b28449236", "score": "0.5085136", "text": "func (m *OrchestratorList) Clone(into interface{}) (interface{}, error) {\n\tvar out *OrchestratorList\n\tvar ok bool\n\tif into == nil {\n\t\tout = &OrchestratorList{}\n\t} else {\n\t\tout, ok = into.(*OrchestratorList)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"mismatched object types\")\n\t\t}\n\t}\n\t*out = *(ref.DeepCopy(m).(*OrchestratorList))\n\treturn out, nil\n}", "title": "" }, { "docid": "59b214ea0afd816cc190b93379062df7", "score": "0.50832367", "text": "func hostInfoListToPtrList(infos []storage.HostInfo) []*storage.HostInfo {\n\tptrs := make([]*storage.HostInfo, len(infos))\n\t// copy the pointer to the pointer list. The pointer value to be appended need\n\t// to be declared within the loop. More details please visit this blog:\n\t// https://medium.com/codezillas/uh-ohs-in-go-slice-of-pointers-c0a30669feee\n\tfor i, info := range infos {\n\t\tinfoCopy := info\n\t\tptrs[i] = &infoCopy\n\t}\n\treturn ptrs\n}", "title": "" }, { "docid": "e65556597591ab080c2b3a975bb65424", "score": "0.5077256", "text": "func validatorListCopy(valsList []*Validator) []*Validator {\n\tif valsList == nil {\n\t\treturn nil\n\t}\n\tvalsCopy := make([]*Validator, len(valsList))\n\tfor i, val := range valsList {\n\t\tvalsCopy[i] = val.Copy()\n\t}\n\treturn valsCopy\n}", "title": "" }, { "docid": "43551ffa9d1346b31a808cecf29bb4ba", "score": "0.5056634", "text": "func (vl VarList) Copy() (w VarList) {\n\tw = make([]*Var, len(vl))\n\tcopy(w, vl)\n\treturn\n}", "title": "" }, { "docid": "2891a47e01fbacec8d8ffd5e54877231", "score": "0.50249267", "text": "func (o SparseSSHIdentitiesList) Identity() elemental.Identity {\n\n\treturn SSHIdentityIdentity\n}", "title": "" }, { "docid": "99991cbaffab7a95be3bef2be27c3c3f", "score": "0.49269184", "text": "func (in *VhostList) DeepCopy() *VhostList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VhostList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "62bca3258c5a809c9d6f3cae2638fc97", "score": "0.48897496", "text": "func (list *ChatsList) GetCopy() map[SteamId]Chat {\n\tlist.mutex.RLock()\n\tdefer list.mutex.RUnlock()\n\tglist := make(map[SteamId]Chat)\n\tfor key, chat := range list.byId {\n\t\tglist[key] = *chat\n\t}\n\treturn glist\n}", "title": "" }, { "docid": "f9b9e2e04959b6ef193527424f9e8997", "score": "0.48762202", "text": "func (b *AwsEtcdEncryptionListBuilder) Copy(list *AwsEtcdEncryptionList) *AwsEtcdEncryptionListBuilder {\n\tif list == nil || list.items == nil {\n\t\tb.items = nil\n\t} else {\n\t\tb.items = make([]*AwsEtcdEncryptionBuilder, len(list.items))\n\t\tfor i, v := range list.items {\n\t\t\tb.items[i] = NewAwsEtcdEncryption().Copy(v)\n\t\t}\n\t}\n\treturn b\n}", "title": "" }, { "docid": "b26da7b6981d79f7ba505610e0a30603", "score": "0.48413795", "text": "func (in *UserSSHKeyList) DeepCopyInto(out *UserSSHKeyList) {\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([]UserSSHKey, 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": "985994f3bab1d9b800982eb52380d71c", "score": "0.48219982", "text": "func (list FileInfoList) Clone() FileInfoList {\n\treturn NewFileInfoList(list...)\n}", "title": "" }, { "docid": "76f87278467b8d975dc58ca802a6e0c9", "score": "0.48080865", "text": "func (in *IamSamlProviderList) DeepCopy() *IamSamlProviderList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IamSamlProviderList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "05d78bd5f3d0da6192c1143db02c6d7a", "score": "0.4804152", "text": "func (vms VMs) clone() VMs {\n\tcloneList := make(VMs, len(vms))\n\tfor k, v := range vms {\n\t\tcloneList[k] = v\n\t}\n\treturn cloneList\n}", "title": "" }, { "docid": "3ff4b0e648ea417176984499865e19be", "score": "0.48025823", "text": "func (in *RemoteIstioList) DeepCopy() *RemoteIstioList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RemoteIstioList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0992607cb61a1edb37f00deff46da5c7", "score": "0.47929686", "text": "func (list Devices) Clone() Devices {\n\tcopy := make(Devices, len(list))\n\n\tfor deviceName, device := range list {\n\t\tcopy[deviceName] = device.Clone()\n\t}\n\n\treturn copy\n}", "title": "" }, { "docid": "fee08412ef5ab8edf9e66acaf8111df9", "score": "0.4780366", "text": "func (s macStore) Identities(flags int) ([]Identity, error) {\n\trawQuery := map[C.CFTypeRef]C.CFTypeRef{\n\t\tC.CFTypeRef(C.kSecClass): C.CFTypeRef(C.kSecClassIdentity),\n\t\tC.CFTypeRef(C.kSecReturnRef): C.CFTypeRef(C.kCFBooleanTrue),\n\t\tC.CFTypeRef(C.kSecMatchLimit): C.CFTypeRef(C.kSecMatchLimitAll),\n\t}\n\tif (flags & RequireToken) == 1 {\n\t\trawQuery[C.CFTypeRef(C.kSecAttrAccessGroup)] = C.CFTypeRef(C.kSecAttrAccessGroupToken)\n\t}\n\tquery := mapToCFDictionary(rawQuery)\n\tif query == nilCFDictionaryRef {\n\t\treturn nil, errors.New(\"error creating CFDictionary\")\n\t}\n\tdefer C.CFRelease(C.CFTypeRef(query))\n\n\tvar absResult C.CFTypeRef\n\tif err := osStatusError(C.SecItemCopyMatching(query, &absResult)); err != nil {\n\t\tif err == errSecItemNotFound {\n\t\t\treturn []Identity{}, nil\n\t\t}\n\n\t\treturn nil, err\n\t}\n\tdefer C.CFRelease(C.CFTypeRef(absResult))\n\n\t// don't need to release aryResult since the abstract result is released above.\n\taryResult := C.CFArrayRef(absResult)\n\n\t// identRefs aren't owned by us initially. newMacIdentity retains them.\n\tn := C.CFArrayGetCount(aryResult)\n\tidentRefs := make([]C.CFTypeRef, n)\n\tC.CFArrayGetValues(aryResult, C.CFRange{0, n}, (*unsafe.Pointer)(unsafe.Pointer(&identRefs[0])))\n\n\tidents := make([]Identity, 0, n)\n\tfor _, identRef := range identRefs {\n\t\tidents = append(idents, newMacIdentity(C.SecIdentityRef(identRef)))\n\t}\n\n\treturn idents, nil\n}", "title": "" }, { "docid": "5c10ffbf34a53c64256554fdfa2ef0e2", "score": "0.477745", "text": "func (si ShardInfo) clone() ShardInfo {\n\tother := si\n\n\tif si.OwnerIDs != nil {\n\t\tother.OwnerIDs = make([]uint64, len(si.OwnerIDs))\n\t\tcopy(other.OwnerIDs, si.OwnerIDs)\n\t}\n\n\treturn other\n}", "title": "" }, { "docid": "5c10ffbf34a53c64256554fdfa2ef0e2", "score": "0.477745", "text": "func (si ShardInfo) clone() ShardInfo {\n\tother := si\n\n\tif si.OwnerIDs != nil {\n\t\tother.OwnerIDs = make([]uint64, len(si.OwnerIDs))\n\t\tcopy(other.OwnerIDs, si.OwnerIDs)\n\t}\n\n\treturn other\n}", "title": "" }, { "docid": "a928149f7f3f65495c409da49f9e1c9c", "score": "0.47747695", "text": "func (in *DxHostedPrivateVirtualInterfaceList) DeepCopy() *DxHostedPrivateVirtualInterfaceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DxHostedPrivateVirtualInterfaceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c6aa532d494d3555b9e95decfb705c90", "score": "0.47725657", "text": "func (in *GCPCredentialsList) DeepCopyInto(out *GCPCredentialsList) {\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([]GCPCredentials, 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": "f31a169bcc65ed987f4ef53cb52c848d", "score": "0.47512606", "text": "func (o CounterReportsList) Copy() elemental.Identifiables {\n\n\tcopy := append(CounterReportsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "98aa22f772f815c70c27fa8652d0c397", "score": "0.4716677", "text": "func (m *MockClient) ListCloned(v0 context.Context) ([]string, error) {\n\tr0, r1 := m.ListClonedFunc.nextHook()(v0)\n\tm.ListClonedFunc.appendCall(ClientListClonedFuncCall{v0, r0, r1})\n\treturn r0, r1\n}", "title": "" }, { "docid": "782337d42c20f8873ea74deeb571a616", "score": "0.47132143", "text": "func (in *WebhookIdentityProviderList) DeepCopy() *WebhookIdentityProviderList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookIdentityProviderList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "32d513312642e73db9622150a2b4c547", "score": "0.4710703", "text": "func (ifs Interfaces) Copy() Interfaces {\n\tifsCopy := NewInterfaces()\n\tfor intf := range ifs {\n\t\tifsCopy.Add(intf)\n\t}\n\treturn ifsCopy\n}", "title": "" }, { "docid": "3ad66668ac5767240bc7a15a246af0d7", "score": "0.4709752", "text": "func (in *SeedList) DeepCopy() *SeedList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SeedList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3ad66668ac5767240bc7a15a246af0d7", "score": "0.4709752", "text": "func (in *SeedList) DeepCopy() *SeedList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SeedList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e2b3889ca39304c6eb4cc46a8ecb455e", "score": "0.4708958", "text": "func (in *StratosAzStgv1List) DeepCopy() *StratosAzStgv1List {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StratosAzStgv1List)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1089a98953f04a982e77a94c06eb580f", "score": "0.47076568", "text": "func (in *AuthServerList) DeepCopy() *AuthServerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthServerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "eecaad3483a24a5e6c745eb07c74af30", "score": "0.46917528", "text": "func dupList(list []*model.Card, targetIDs map[int]int) (newlist []*model.Card) {\n\tfor _, vv := range list {\n\t\tif _, dup := targetIDs[vv.SeasonID]; !dup {\n\t\t\tnewlist = append(newlist, vv)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6908d342d57c70bc48d0dd4545f96351", "score": "0.46911916", "text": "func (m DeployStates) Clone() DeployStates {\n\tc := NewDeployStates()\n\tfor _, v := range m.Snapshot() {\n\t\tc.Add(v.Clone())\n\t}\n\treturn c\n}", "title": "" }, { "docid": "e26014320e641b06eb8c272f357cb89c", "score": "0.4689605", "text": "func (in *UserSSHKeyList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9278b3f3f834bbdc780ad7c7a0ad60b3", "score": "0.46868587", "text": "func (o SparseSSHIdentitiesList) ToPlain() elemental.IdentifiablesList {\n\n\tout := make(elemental.IdentifiablesList, len(o))\n\tfor i := 0; i < len(o); i++ {\n\t\tout[i] = o[i].ToPlain()\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "e799ee6556785f4413bb0c801e139538", "score": "0.4682787", "text": "func (in *HostInstance) DeepCopyInto(out *HostInstance) {\n*out = *in\nif in.InstanceID != nil {\nin, out := &in.InstanceID, &out.InstanceID\n*out = new(string)\n**out = **in\n}\nif in.InstanceType != nil {\nin, out := &in.InstanceType, &out.InstanceType\n*out = new(string)\n**out = **in\n}\nif in.OwnerID != nil {\nin, out := &in.OwnerID, &out.OwnerID\n*out = new(string)\n**out = **in\n}\n}", "title": "" }, { "docid": "268ef0f907960e2c8a44810cfd96c108", "score": "0.46689218", "text": "func (in *ScheduledEchoList) DeepCopy() *ScheduledEchoList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScheduledEchoList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7b244f112fe4bb3d3a12089786c657fc", "score": "0.4667728", "text": "func (in *ActiveMQArtemisSecurityList) DeepCopy() *ActiveMQArtemisSecurityList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ActiveMQArtemisSecurityList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "35c9ea04677c5df84431810483432dd2", "score": "0.46638566", "text": "func (x *ListExpr) Copy() Expr {\n\tn := *x\n\treturn &n\n}", "title": "" }, { "docid": "b7f58728be8d2dfeabed32689f8d252d", "score": "0.46554738", "text": "func currentAgentsCopy() Agents {\n\tcpy := make(Agents)\n\tcurrentAgentsMu.RLock()\n\tdefer currentAgentsMu.RUnlock()\n\tfor k, a := range currentAgents {\n\t\tcpy[k] = a\n\t}\n\treturn cpy\n}", "title": "" }, { "docid": "9733b3a5a8124a9271a39df7a80778ea", "score": "0.46509078", "text": "func (in *UserOAuthAccessTokenList) DeepCopy() *UserOAuthAccessTokenList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UserOAuthAccessTokenList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cd2d4a6666f557034e987ca4c645fe71", "score": "0.46396357", "text": "func (in *IdentityPoolList) DeepCopy() *IdentityPoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityPoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "32811bc178c99095b282763c88471100", "score": "0.46344763", "text": "func (l *List) Copy() *List {\n\tnew_list := &List{}\n\n\tvar n *Listnode\n\tcur := l.Cur\n\n\tfor cur != nil {\n\t\tn = cur.Copy()\n\t\tnew_list.Push_back(n)\n\t\tcur = cur.Next\n\t}\n\n\treturn new_list\n}", "title": "" }, { "docid": "c7718d122bd8968ab9c10bda39dc08d4", "score": "0.46220657", "text": "func (in *VPCList) DeepCopyInto(out *VPCList) {\n*out = *in\nout.TypeMeta = in.TypeMeta\nin.ListMeta.DeepCopyInto(&out.ListMeta)\nif in.Items != nil {\nin, out := &in.Items, &out.Items\n*out = make([]VPC, len(*in))\nfor i := range *in {\n(*in)[i].DeepCopyInto(&(*out)[i])\n}\n}\n}", "title": "" }, { "docid": "d0a67df9b3eafe6f21145526d2026583", "score": "0.46208656", "text": "func (lx *DeferListIterator) Clone() sequence.Iterable {\n\treturn NewListIterator(lx.list)\n}", "title": "" }, { "docid": "e2ad315706f03502f07b6ec9bb053c91", "score": "0.46126541", "text": "func (in *VhostList) DeepCopyInto(out *VhostList) {\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([]Vhost, 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": "936ef6f93638f2ec60ce0bad387aebf3", "score": "0.460878", "text": "func (in *MemcacheInstanceList) DeepCopy() *MemcacheInstanceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MemcacheInstanceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f6c9f2321d88cf0aebfd23be07e28a9f", "score": "0.45909217", "text": "func CopySha256(hash [32]byte) []byte {\n\tvar b []byte\n\tfor _, h := range hash {\n\t\tb = append(b, h)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "f3df1d4a72359a33b4d61be7db6a53c1", "score": "0.45822877", "text": "func (in *AuditingList) DeepCopy() *AuditingList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuditingList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "76abafe30cb24748ee2a511756b4b1dd", "score": "0.45737523", "text": "func copyCardList(source map[int][]*model.Card) (copied map[int][]*model.Card) {\n\tcopied = make(map[int][]*model.Card)\n\tfor k, v := range source {\n\t\tcopied[k] = []*model.Card{}\n\t\tfor _, vcard := range v {\n\t\t\tcopied[k] = append(copied[k], &(*vcard))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "068106f4acfaca9d152d8711c5b07376", "score": "0.4567266", "text": "func Copy(c WorkList) (this WorkList, cpy WorkList) {\n\tthis = c\n\tcpy = c.Copy()\n\treturn\n}", "title": "" }, { "docid": "e202f58b7ad8d135be9baf5d1236b929", "score": "0.45658445", "text": "func (in *OAuthAccessTokenList) DeepCopy() *OAuthAccessTokenList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OAuthAccessTokenList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "704a8368dd28f511d70f51254a063d38", "score": "0.4563834", "text": "func (pmp *PrivateMarketplace) Copy() *PrivateMarketplace {\n\tif pmp == nil {\n\t\treturn nil\n\t}\n\tpmpCopy := *pmp\n\n\tif pmp.Deals != nil {\n\t\tpmpCopy.Deals = make([]*Deal, len(pmp.Deals))\n\t\tfor i, d := range pmp.Deals {\n\t\t\tpmpCopy.Deals[i] = d.Copy()\n\t\t}\n\t}\n\n\tpmpCopy.Extension = util.DeepCopyCopiable(pmp.Extension)\n\treturn &pmpCopy\n}", "title": "" }, { "docid": "35f8008c4024a7e4188746a1b3571c69", "score": "0.45586315", "text": "func (s *DiscoverResult) Clone() *DiscoverResult {\n\tif s == nil {\n\t\treturn nil\n\t}\n\tclone := *s\n\tclone.Addresses = append([]string{}, s.GetAddresses()...)\n\treturn &clone\n}", "title": "" }, { "docid": "95953f9673105b41da3be750c06f22b7", "score": "0.4553652", "text": "func DeepCopySnapList(in snapstore.SnapList) snapstore.SnapList {\n\tout := make(snapstore.SnapList, len(in))\n\tfor i, v := range in {\n\t\tif v != nil {\n\t\t\tvar cpv = *v\n\t\t\tout[i] = &cpv\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "76ead0c556ebd568f77ab87e10ee35a9", "score": "0.45498008", "text": "func (x *StreamingList) DeepCopy() *StreamingList {\n\tif x == nil {\n\t\treturn nil\n\t}\n\tout := new(StreamingList)\n\tx.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ef9d680c185c2e65a163556ab23b8d09", "score": "0.45224297", "text": "func (in *GCPCredentialsList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b8dd14e1fbedfbb8ddc72f0f2657fc8", "score": "0.45198366", "text": "func (in *SMTPCredentialSetList) DeepCopyInto(out *SMTPCredentialSetList) {\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([]SMTPCredentialSet, 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": "" } ]
17f682b00a2b46450cfdb14618b0e217
SetPolicy sets the Policy field's value.
[ { "docid": "acf70f483611d5f3f7b6e66dee5b48af", "score": "0.7837426", "text": "func (s *PutImageRecipePolicyInput) SetPolicy(v string) *PutImageRecipePolicyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "78d606dc9ec809a4f300a530fb202d42", "score": "0.84040195", "text": "func (o *OutgoingIntegrationConfiguration) SetPolicy(v map[string]interface{}) {\n\to.Policy = v\n}", "title": "" }, { "docid": "d07c2a290515fccb9c57b36bca7f8469", "score": "0.8158434", "text": "func (st *SmartToken) SetPolicy(p SmartTokenPolicy) {\n\tst.policy = p\n}", "title": "" }, { "docid": "db796cb3639a95362e4494ac85d123bc", "score": "0.81298214", "text": "func (r *Client) SetPolicy(name, policy string) error {\n\treturn r.client.Sys().PutPolicy(name, policy)\n}", "title": "" }, { "docid": "0c3fc055b1719d7cad04b7fea7f764fe", "score": "0.80436087", "text": "func (s *ReplicateKeyInput) SetPolicy(v string) *ReplicateKeyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "ffe6815777501966f9a74ae2a0455aa5", "score": "0.8006883", "text": "func (s *CreateKeyInput) SetPolicy(v string) *CreateKeyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "4b979910188e95a21c761b04e6490146", "score": "0.7881069", "text": "func (s *GetImageRecipePolicyOutput) SetPolicy(v string) *GetImageRecipePolicyOutput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "20365d72fc54f914b5e6f89a8140000b", "score": "0.7870025", "text": "func (s *GetKeyPolicyOutput) SetPolicy(v string) *GetKeyPolicyOutput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "fae7ef74772b8fd628319c7022963d8c", "score": "0.78694946", "text": "func (s *GetContainerRecipePolicyOutput) SetPolicy(v string) *GetContainerRecipePolicyOutput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "aa3c1c74cef84f5721eba024273f10b5", "score": "0.7849429", "text": "func (s *GetImagePolicyOutput) SetPolicy(v string) *GetImagePolicyOutput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "654f486d9cd45a75e5c8f8af841b9d2f", "score": "0.7836808", "text": "func (s *PutContainerRecipePolicyInput) SetPolicy(v string) *PutContainerRecipePolicyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "d4ed9a113b8fea71ec9a2390d2fca577", "score": "0.7826996", "text": "func (ca *CertificationAuthority) SetPolicy(policy *config.Signing) error {\n\tif !policy.Valid() {\n\t\treturn errors.New(\"invalid policy\")\n\t}\n\n\tpolicyJSON, err := json.Marshal(policy)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ca.sp.SetMetadata([]byte(\"policy\"), policyJSON)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif ca.signer != nil {\n\t\tca.signer.SetPolicy(policy)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9f06a64acc88e665fe787be57e1e78b8", "score": "0.78236043", "text": "func (o *StackSetIAMPolicyResponse) SetPolicy(v IamPolicy) {\n\to.Policy = &v\n}", "title": "" }, { "docid": "b4d8a8b92048f29f5eef000a6a00a475", "score": "0.78130585", "text": "func (s *PutKeyPolicyInput) SetPolicy(v string) *PutKeyPolicyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "6d9e21a609e97348b2cb98be5361c97c", "score": "0.7808135", "text": "func (s *GetComponentPolicyOutput) SetPolicy(v string) *GetComponentPolicyOutput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "a5b4d9611bc6ef4cda86949c56661158", "score": "0.7786845", "text": "func (s *GetContainerPolicyOutput) SetPolicy(v string) *GetContainerPolicyOutput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "59285b7a0be2d906bb8ca852437ddd3f", "score": "0.7742827", "text": "func (s *PutImagePolicyInput) SetPolicy(v string) *PutImagePolicyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "5ed03a73fc2f8bacd9342443a6dfb59d", "score": "0.7700392", "text": "func (s *PutContainerPolicyInput) SetPolicy(v string) *PutContainerPolicyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "7f945a30fdef8bddeddde4e89402a4d9", "score": "0.76993144", "text": "func (s *GetPolicyOutput) SetPolicy(v *Policy) *GetPolicyOutput {\n\ts.Policy = v\n\treturn s\n}", "title": "" }, { "docid": "27c68243f3de540539caa0ac3afc3763", "score": "0.7644114", "text": "func (rc *ResourceConfig) SetPolicy(policy Policy) {\n\ttoFind := nameRef{\n\t\tName: policy.Name,\n\t\tPartition: policy.Partition,\n\t}\n\tfound := false\n\tfor _, polName := range rc.Virtual.Policies {\n\t\tif toFind == polName {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\trc.Virtual.Policies = append(rc.Virtual.Policies, toFind)\n\t}\n\tfor i, pol := range rc.Policies {\n\t\tif pol.Name == policy.Name && pol.Partition == policy.Partition {\n\t\t\trc.Policies[i] = policy\n\t\t\treturn\n\t\t}\n\t}\n\trc.Policies = append(rc.Policies, policy)\n}", "title": "" }, { "docid": "27c68243f3de540539caa0ac3afc3763", "score": "0.7644114", "text": "func (rc *ResourceConfig) SetPolicy(policy Policy) {\n\ttoFind := nameRef{\n\t\tName: policy.Name,\n\t\tPartition: policy.Partition,\n\t}\n\tfound := false\n\tfor _, polName := range rc.Virtual.Policies {\n\t\tif toFind == polName {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\trc.Virtual.Policies = append(rc.Virtual.Policies, toFind)\n\t}\n\tfor i, pol := range rc.Policies {\n\t\tif pol.Name == policy.Name && pol.Partition == policy.Partition {\n\t\t\trc.Policies[i] = policy\n\t\t\treturn\n\t\t}\n\t}\n\trc.Policies = append(rc.Policies, policy)\n}", "title": "" }, { "docid": "57e029561c230d7f0851bb21a2866979", "score": "0.7636547", "text": "func (s *PutComponentPolicyInput) SetPolicy(v string) *PutComponentPolicyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "79289b217732797f2d4ed5886c2e44bf", "score": "0.7596556", "text": "func (p *AwsPolicy) SetPolicy(pd iam.PolicyDocument) {\n\tp.Policy = pd\n\tfor _, s := range pd.Statement {\n\t\tp.PolicyActions = append(p.PolicyActions, s.Action...)\n\t\tp.PolicyResourceActions = append(p.PolicyResourceActions, ResourceAction{\n\t\t\tResources: s.Resource,\n\t\t\tActions: s.Action,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "4918e3271dfe74b5347be31675b4af59", "score": "0.7562081", "text": "func (s *PutPolicyInput) SetPolicy(v *Policy) *PutPolicyInput {\n\ts.Policy = v\n\treturn s\n}", "title": "" }, { "docid": "6248aeca9fcb46ce23a3fb9619f9f768", "score": "0.75305736", "text": "func (s *PutPolicyOutput) SetPolicy(v *Policy) *PutPolicyOutput {\n\ts.Policy = v\n\treturn s\n}", "title": "" }, { "docid": "acaae58181c5fb4a2190b0df27ba1915", "score": "0.75266737", "text": "func (s *PutResourcePolicyInput) SetPolicy(v string) *PutResourcePolicyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "acaae58181c5fb4a2190b0df27ba1915", "score": "0.7523921", "text": "func (s *PutResourcePolicyInput) SetPolicy(v string) *PutResourcePolicyInput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "74adf73d8cd9fba28f1bbbdf1f849beb", "score": "0.74833477", "text": "func (s *GetResourcePoliciesResponseEntry) SetPolicy(v string) *GetResourcePoliciesResponseEntry {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "27006ba613983847b0dd9069942788a9", "score": "0.7476248", "text": "func (s *DescribeResourcePolicyOutput) SetPolicy(v string) *DescribeResourcePolicyOutput {\n\ts.Policy = &v\n\treturn s\n}", "title": "" }, { "docid": "202cd076b2c89d70ad093abcfb9c71d7", "score": "0.74125564", "text": "func (s *RestServer) SetPolicyHandler(handler types.CtrlerIntf) {\n\ts.Lock()\n\tdefer s.Unlock()\n\ts.TpAgent = handler\n}", "title": "" }, { "docid": "98945455cabca5e76dc3e8ec6172a43a", "score": "0.72698027", "text": "func (s *Signin) SetPolicy(_ string) error {\n\treturn fmt.Errorf(\"policy is invalid for GetSessionToken\")\n}", "title": "" }, { "docid": "541154186c74b8a49cb15c3dc902537f", "score": "0.69431674", "text": "func (m *WindowsDefenderApplicationControlSupplementalPolicyDeploymentStatus) SetPolicy(value WindowsDefenderApplicationControlSupplementalPolicyable)() {\n err := m.GetBackingStore().Set(\"policy\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3795a563a4481708271b37f872535de3", "score": "0.6789704", "text": "func (m *PolicyRoot) SetAuthorizationPolicy(value AuthorizationPolicyable)() {\n m.authorizationPolicy = value\n}", "title": "" }, { "docid": "656e4416a811a351ab20092922bd09a0", "score": "0.6607002", "text": "func SetPolicyEnabled(val string) {\n\tmutex.Lock()\n\tenablePolicy = val\n\tmutex.Unlock()\n}", "title": "" }, { "docid": "0c13af263d8f804851285e4c250f7de7", "score": "0.6517753", "text": "func (vpa *Vpa) SetResourcePolicy(resourcePolicy *apisv1.PodResourcePolicy) {\n\n}", "title": "" }, { "docid": "4c817aea312b3b57fc6338e665673391", "score": "0.6452719", "text": "func (_class VMClass) SetProtectionPolicy(sessionID SessionRef, self VMRef, value VMPPRef) (_err error) {\n\tif IsMock {\n\t\treturn _class.SetProtectionPolicyMock(sessionID, self, value)\n\t}\t\n\t_method := \"VM.set_protection_policy\"\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 := convertVMRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_valueArg, _err := convertVMPPRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" }, { "docid": "31effac101b8ee54110de03a6b8f398f", "score": "0.63506407", "text": "func (e *PolicyEnforcedClient) SetPolicyOrder(order policy.MergeOrder) {\n\te.mu.Lock()\n\te.policyOrder = order\n\te.mergePolicies()\n\te.mu.Unlock()\n}", "title": "" }, { "docid": "252f5875b187d87ac21370f0ba7e67fc", "score": "0.6338507", "text": "func (o *FabricPortMode) SetPortPolicy(v FabricPortPolicyRelationship) {\n\to.PortPolicy = &v\n}", "title": "" }, { "docid": "788f996777d9975f2f4997a4a0f7bf0c", "score": "0.62883055", "text": "func (r *MarkovChain) SetGeneratePolicy(p GeneratePolicy) {\n\tr.policy = p\n}", "title": "" }, { "docid": "5937eff416ef83dcf6462b7ec2a5fc4f", "score": "0.6287757", "text": "func (e *Endpoint) SetPolicyRevision(rev uint64) {\n\t// Wait for any in-progress regenerations to finish.\n\te.buildMutex.Lock()\n\tdefer e.buildMutex.Unlock()\n\n\tif err := e.lockAlive(); err != nil {\n\t\treturn\n\t}\n\te.setPolicyRevision(rev)\n\te.unlock()\n}", "title": "" }, { "docid": "5e01e212ee93ac363f8f05df1f43ef18", "score": "0.62817", "text": "func (self *TraitScrolledWindow) SetPolicy(hscrollbar_policy C.GtkPolicyType, vscrollbar_policy C.GtkPolicyType) {\n\tC.gtk_scrolled_window_set_policy(self.CPointer, hscrollbar_policy, vscrollbar_policy)\n\treturn\n}", "title": "" }, { "docid": "02fbe53f0ca73af90ad66ea7ca78d5b5", "score": "0.6258122", "text": "func (a *CasbinAdapter) SavePolicy(model casbinModel.Model) error {\n\treturn nil\n}", "title": "" }, { "docid": "01a5bcf8a652b2db68995d6d2b5ff019", "score": "0.6191908", "text": "func (s *GetMetricPolicyOutput) SetMetricPolicy(v *MetricPolicy) *GetMetricPolicyOutput {\n\ts.MetricPolicy = v\n\treturn s\n}", "title": "" }, { "docid": "d81147d32a6a3b858cad83c5ae8748b7", "score": "0.6162878", "text": "func (e *PolicyEnforcedClient) SetActionPolicy(p policy.ActionPolicy) {\n\te.mu.Lock()\n\te.actionPolicy = policy.Policy(p)\n\te.mergePolicies()\n\te.mu.Unlock()\n}", "title": "" }, { "docid": "17ed211caa2b73993d26c1390e207a16", "score": "0.6159825", "text": "func (m *Notification) SetTargetPolicy(value TargetPolicyEndpointsable)() {\n err := m.GetBackingStore().Set(\"targetPolicy\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5ff8507d0e47e1800a5b054c0a1b6a60", "score": "0.6159592", "text": "func (m *BookingBusiness) SetSchedulingPolicy(value BookingSchedulingPolicyable)() {\n m.schedulingPolicy = value\n}", "title": "" }, { "docid": "beb3cce7f779c3e5936f799bfd56edeb", "score": "0.6135979", "text": "func (m *AccessPackageAssignment) SetAssignmentPolicy(value AccessPackageAssignmentPolicyable)() {\n err := m.GetBackingStore().Set(\"assignmentPolicy\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4cb62de9d630d1b48887951219e16f41", "score": "0.6104976", "text": "func (s *PutMetricPolicyInput) SetMetricPolicy(v *MetricPolicy) *PutMetricPolicyInput {\n\ts.MetricPolicy = v\n\treturn s\n}", "title": "" }, { "docid": "dd9b7c2844376f690ee6f333f423c6dd", "score": "0.6040942", "text": "func (r *ServiceAccount) SetPolicyVerb() string {\n\treturn \"POST\"\n}", "title": "" }, { "docid": "e28f1c5ecd486824d74257b698e07778", "score": "0.6030667", "text": "func (bp *bucketPolicies) SetBucketPolicy(bucket string, pCh policyChange) error {\n\tbp.rwMutex.Lock()\n\tdefer bp.rwMutex.Unlock()\n\n\tif pCh.IsRemove {\n\t\tdelete(bp.bucketPolicyConfigs, bucket)\n\t} else {\n\t\tif pCh.BktPolicy == nil {\n\t\t\treturn errInvalidArgument\n\t\t}\n\t\tbp.bucketPolicyConfigs[bucket] = pCh.BktPolicy\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "563f104a195a328b67570bf707238c41", "score": "0.6009647", "text": "func (ppuo *PermissionsPolicyUpdateOne) SetAssurancePolicy(mpi *models.AssurancePolicyInput) *PermissionsPolicyUpdateOne {\n\tppuo.mutation.SetAssurancePolicy(mpi)\n\treturn ppuo\n}", "title": "" }, { "docid": "f672fd7872ccdf91b8343644a769f92c", "score": "0.5974271", "text": "func (mg *Server) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "8ccb3ce6c34aca74d863acc9effaad3a", "score": "0.5942997", "text": "func (r *ServiceAccount) SetPolicyURL(userBasePath string) string {\n\tnr := r.urlNormalized()\n\tfields := map[string]any{\n\t\t\"project\": *nr.Project,\n\t\t\"name\": *nr.Name,\n\t}\n\treturn dcl.URL(\"projects/{{project}}/serviceAccounts/{{name}}@{{project}}.iam.gserviceaccount.com:setIamPolicy\", nr.basePath(), userBasePath, fields)\n}", "title": "" }, { "docid": "cc8794eecbd0aff5f44094a0799347c8", "score": "0.59363633", "text": "func (nv *NV) AssignPolicy(policy *Policy) error {\n\terr := tspiError(C.Tspi_Policy_AssignToObject(policy.handle, (C.TSS_HOBJECT)(nv.handle)))\n\treturn err\n}", "title": "" }, { "docid": "032e4dc38e3924b6506632ac82901ffa", "score": "0.59245", "text": "func SetQueuePolicy(cli sqsiface.SQSAPI, url string, pol iam.Policy) error {\n\tpolJSON, err := json.Marshal(pol)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"serializing queue policy to JSON: %w\", err)\n\t}\n\n\tattrs := &sqs.SetQueueAttributesInput{\n\t\tQueueUrl: &url,\n\t\tAttributes: aws.StringMap(map[string]string{\n\t\t\tsqs.QueueAttributeNamePolicy: string(polJSON),\n\t\t}),\n\t}\n\n\tif _, err := cli.SetQueueAttributes(attrs); err != nil {\n\t\treturn fmt.Errorf(\"setting attributes of queue %q: %w\", *attrs.QueueUrl, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "276932ddc91644a59c306ed3587b302a", "score": "0.5857281", "text": "func (s *Store) UpdatePolicy(ctx context.Context, ns string, sec string, pType string, nr, or []string) error {\n\tpayload, err := proto.Marshal(&command.UpdatePolicyPayload{\n\t\tSec: sec,\n\t\tPType: pType,\n\t\tNewRule: nr,\n\t\tOldRule: or,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcmd, err := proto.Marshal(&command.Command{\n\t\tType: command.Type_COMMAND_TYPE_UPDATE_POLICY,\n\t\tNs: ns,\n\t\tPayload: payload,\n\t\tMd: nil,\n\t\tCompressed: false,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf := s.raft.Apply(cmd, s.ApplyTimeout)\n\tif e := f.(raft.Future); e.Error() != nil {\n\t\tif e.Error() == raft.ErrNotLeader {\n\t\t\treturn ErrNotLeader\n\t\t}\n\t\treturn e.Error()\n\t}\n\tr := f.Response().(*FSMResponse)\n\treturn r.error\n}", "title": "" }, { "docid": "2f95f47e02daab4d1e7a7e4a1e56f7b6", "score": "0.58568096", "text": "func (a *AbstractDatasetSimilarityEstimator) SetPopulationPolicy(pol DatasetSimilarityPopulationPolicy) {\n\ta.popPolicy = pol\n}", "title": "" }, { "docid": "515f14822869bbc0e1f7c588d2cb2459", "score": "0.58383757", "text": "func (c *PoliciesClient) UpdatePolicy(ctx context.Context, req *iampb.UpdatePolicyRequest, opts ...gax.CallOption) (*UpdatePolicyOperation, error) {\n\treturn c.internalClient.UpdatePolicy(ctx, req, opts...)\n}", "title": "" }, { "docid": "05071f451ffea0aff649485fae235ab2", "score": "0.58171767", "text": "func (mg *MSSQLServer) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "5b09c82c5fd372198982e497d9f252df", "score": "0.58108664", "text": "func SetACLPolicy(network *nwo.Network, channel, policyName, policy string) {\n\ttempDir, err := ioutil.TempDir(\"\", \"aclconfig\")\n\tExpect(err).NotTo(HaveOccurred())\n\tdefer os.RemoveAll(tempDir)\n\n\torderer := network.Orderer(\"orderer\")\n\torg1AdminPeer := network.Peer(\"Org1\", \"peer0\")\n\torg2AdminPeer := network.Peer(\"Org2\", \"peer0\")\n\n\toutputFile := filepath.Join(tempDir, \"updated_config.pb\")\n\tGenerateACLConfigUpdate(network, orderer, channel, policyName, policy, outputFile)\n\n\tsess, err := network.PeerAdminSession(org2AdminPeer, commands.SignConfigTx{File: outputFile})\n\tExpect(err).NotTo(HaveOccurred())\n\tEventually(sess, time.Minute).Should(gexec.Exit(0))\n\n\tSendConfigUpdate(network, org1AdminPeer, channel, outputFile)\n}", "title": "" }, { "docid": "8bfd6004ae9f5aee14a815f8de082e50", "score": "0.5799124", "text": "func (ppu *PermissionsPolicyUpdate) SetAssurancePolicy(mpi *models.AssurancePolicyInput) *PermissionsPolicyUpdate {\n\tppu.mutation.SetAssurancePolicy(mpi)\n\treturn ppu\n}", "title": "" }, { "docid": "cbaa36997695606bca5c710729679228", "score": "0.5788191", "text": "func (a CasbinAdapter) SavePolicy(model model.Model) error {\n\t// 该方法只要通知系统接受更新, 无处理任何内容\n\treturn nil\n}", "title": "" }, { "docid": "6d418ce4800262cad86e73c8c699f3df", "score": "0.5787502", "text": "func (o QueuePolicyOutput) Policy() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *QueuePolicy) pulumi.StringOutput { return v.Policy }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "afa25c66a6c31a9e7b93da59e455f4ff", "score": "0.57850426", "text": "func (s *ParameterInlinePolicy) SetPolicyType(v string) *ParameterInlinePolicy {\n\ts.PolicyType = &v\n\treturn s\n}", "title": "" }, { "docid": "c56bd3d1da4b4eb8ee87cda705b68b8c", "score": "0.5773872", "text": "func (o AuthPolicyOutput) Policy() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AuthPolicy) pulumi.StringOutput { return v.Policy }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d088c3b269855b32bf194db6a0d4aacc", "score": "0.5760359", "text": "func (ppuo *PermissionsPolicyUpdateOne) SetAutomationPolicy(mpi *models.AutomationPolicyInput) *PermissionsPolicyUpdateOne {\n\tppuo.mutation.SetAutomationPolicy(mpi)\n\treturn ppuo\n}", "title": "" }, { "docid": "083effb36e64f4181f7d1ba6c5c2cda0", "score": "0.5758461", "text": "func (c *Client) SetRedirectPolicy(policies ...interface{}) *Client {\n\tfor _, p := range policies {\n\t\tif _, ok := p.(RedirectPolicy); !ok {\n\t\t\tc.log.Errorf(\"%v does not implement resty.RedirectPolicy (missing Apply method)\",\n\t\t\t\tfunctionName(p))\n\t\t}\n\t}\n\n\tc.httpClient.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tfor _, p := range policies {\n\t\t\tif err := p.(RedirectPolicy).Apply(req, via); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil // looks good, go ahead\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "82318905315818984c9022e18e5534ae", "score": "0.5751164", "text": "func (m *AccessPackageAssignmentRequestRequirements) SetPolicyId(value *string)() {\n m.policyId = value\n}", "title": "" }, { "docid": "db1abe77ffdc28751b8482e556655747", "score": "0.57459646", "text": "func (fCache FakeHNSCache) SetPolicy(setID string) *hcn.SetPolicySetting {\n\tfor _, network := range fCache.networks {\n\t\tfor _, policy := range network.Policies {\n\t\t\tif policy.Id == setID {\n\t\t\t\treturn policy\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59a58d176c0032925992bea4e3d04e7f", "score": "0.57214266", "text": "func (s *service) SavePolicy(ctx context.Context, enforcerHandler EnforcerHandler) error {\n\te, err := s.getEnforcer(enforcerHandler)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn e.SavePolicy()\n}", "title": "" }, { "docid": "025bd366c1d042156fdc6bd44ca1ec50", "score": "0.5709072", "text": "func (mg *MSSQLDatabase) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "bb5e2209d9af359dd3791764e886b206", "score": "0.56884485", "text": "func (v *eGLView) SetResolutionPolicy(resolutionPolicy interface{}) {\n\tv.Call(\"setResolutionPolicy\", resolutionPolicy)\n}", "title": "" }, { "docid": "9cadba3c55de9e9b6401b59e1b8c6f3e", "score": "0.5683968", "text": "func (client *Client) ModifyPolicy(request *ModifyPolicyRequest) (_result *ModifyPolicyResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &ModifyPolicyResponse{}\n\t_body, _err := client.ModifyPolicyWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "title": "" }, { "docid": "f406558db92dc61927a8ba3a6fca3349", "score": "0.5677959", "text": "func (o AuditSinkSpecPatchOutput) Policy() PolicyPatchPtrOutput {\n\treturn o.ApplyT(func(v AuditSinkSpecPatch) *PolicyPatch { return v.Policy }).(PolicyPatchPtrOutput)\n}", "title": "" }, { "docid": "f64e77ba06bb7af3cf98f43f062e1d03", "score": "0.5673791", "text": "func (c *CloudFormation) SetStackPolicy(input *SetStackPolicyInput) (*SetStackPolicyOutput, error) {\n\treq, out := c.SetStackPolicyRequest(input)\n\terr := req.Send()\n\treturn out, err\n}", "title": "" }, { "docid": "416ad0205844073b12e19cc80b2ebae3", "score": "0.56734407", "text": "func (o *GetReportsScansParams) SetPolicyID(policyID *string) {\n\to.PolicyID = policyID\n}", "title": "" }, { "docid": "4d4687013baad7678a2aa04dceb81722", "score": "0.5660794", "text": "func (Block) Policy() ent.Policy {\n\treturn authz.NewPolicy(\n\t\tauthz.WithMutationRules(\n\t\t\tauthz.AutomationTemplatesWritePolicyRule(),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "6d7b472484cf13224c295486e6365a51", "score": "0.5659069", "text": "func (c *Client) SetRedirectPolicy(policies ...interface{}) *Client {\n\tfor _, p := range policies {\n\t\tif _, ok := p.(RedirectPolicy); !ok {\n\t\t\tc.Log.Printf(\"ERORR: %v does not implement resty.RedirectPolicy (missing Apply method)\",\n\t\t\t\truntime.FuncForPC(reflect.ValueOf(p).Pointer()).Name())\n\t\t}\n\t}\n\n\tc.httpClient.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tfor _, p := range policies {\n\t\t\terr := p.(RedirectPolicy).Apply(req, via)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil // looks good, go ahead\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "14eabee77ee861fe3f2cde280adb02df", "score": "0.56416315", "text": "func (m *AccessPackageAssignmentRequestRequirements) SetPolicyDescription(value *string)() {\n m.policyDescription = value\n}", "title": "" }, { "docid": "3c16a1b245c414afe37481830c93fed2", "score": "0.564063", "text": "func (s *RowLevelPermissionDataSet) SetPermissionPolicy(v string) *RowLevelPermissionDataSet {\n\ts.PermissionPolicy = &v\n\treturn s\n}", "title": "" }, { "docid": "d35417cc986a41243b153348b46d0028", "score": "0.5635987", "text": "func (o *InlineObject4) SetValidatePolicy(v string) {\n\to.ValidatePolicy = &v\n}", "title": "" }, { "docid": "6ac00b1f14ceccd33ba74551fa28c14f", "score": "0.56348956", "text": "func (a *Adapter) LoadPolicy(model model.Model) error {\n\tif a.filePath == \"\" {\n\t\treturn errors.New(\"invalid file path, file path cannot be empty\")\n\t}\n\n\treturn a.loadPolicyFile(model, persist.LoadPolicyLine)\n}", "title": "" }, { "docid": "919b76517f7419cc92d757976204e865", "score": "0.56342214", "text": "func (a *PoliciesApiService) UpdatePolicy(ctx _context.Context, policyId string) ApiUpdatePolicyRequest {\n\treturn ApiUpdatePolicyRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tpolicyId: policyId,\n\t}\n}", "title": "" }, { "docid": "6c3af478a47abcb4768038c01e590a4d", "score": "0.562107", "text": "func (c *Client) UpdatePolicy(ctx context.Context, params *UpdatePolicyInput, optFns ...func(*Options)) (*UpdatePolicyOutput, error) {\n\tif params == nil {\n\t\tparams = &UpdatePolicyInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"UpdatePolicy\", params, optFns, addOperationUpdatePolicyMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*UpdatePolicyOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "21c6f36ec3fd922a7dfa133483cd8fa8", "score": "0.5620585", "text": "func (h *HRaftDispatcher) UpdatePolicy(sec string, pType string, oldRule, newRule []string) error {\n\trequest := &command.UpdatePolicyRequest{\n\t\tSec: sec,\n\t\tPType: pType,\n\t\tOldRule: oldRule,\n\t\tNewRule: newRule,\n\t}\n\treturn h.httpService.DoUpdatePolicyRequest(request)\n}", "title": "" }, { "docid": "20f8209fb625b11d712eab719634a693", "score": "0.56112057", "text": "func (Organization) Policy() ent.Policy {\n\t/*return authz.NewPolicy(\n\t\tauthz.WithMutationRules(\n\t\t\tauthz.AssuranceTemplatesWritePolicyRule(),\n\t\t),\n\t)*/\n\treturn authz.NewPolicy(\n\t\tauthz.WithMutationRules(\n\t\t\tprivacy.AlwaysAllowRule(),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "c18481a8733975688c67403730310890", "score": "0.5605258", "text": "func (ppuo *PermissionsPolicyUpdateOne) SetWorkforcePolicy(mpi *models.WorkforcePolicyInput) *PermissionsPolicyUpdateOne {\n\tppuo.mutation.SetWorkforcePolicy(mpi)\n\treturn ppuo\n}", "title": "" }, { "docid": "c18481a8733975688c67403730310890", "score": "0.5605258", "text": "func (ppuo *PermissionsPolicyUpdateOne) SetWorkforcePolicy(mpi *models.WorkforcePolicyInput) *PermissionsPolicyUpdateOne {\n\tppuo.mutation.SetWorkforcePolicy(mpi)\n\treturn ppuo\n}", "title": "" }, { "docid": "22033451dd7874fedd50d274873d3bc0", "score": "0.5601735", "text": "func (o *PolicyinventoryJobInfo) SetPolicyId(v string) {\n\to.PolicyId = &v\n}", "title": "" }, { "docid": "ae04ba787b4eb5143aec69a34f00085e", "score": "0.5589446", "text": "func (s *GetComplianceDetailInput) SetPolicyId(v string) *GetComplianceDetailInput {\n\ts.PolicyId = &v\n\treturn s\n}", "title": "" }, { "docid": "4a3c06f4287642ff9e27932d179afe5c", "score": "0.55867255", "text": "func (e *PolicyEnforcedClient) SetGlobalPolicy(p policy.Policy) {\n\te.mu.Lock()\n\te.globalPolicy = p\n\te.mergePolicies()\n\te.mu.Unlock()\n}", "title": "" }, { "docid": "1cfc3c0ce8e711e1acac728ecb623473", "score": "0.55710983", "text": "func (ac *AdminClient) SetGCPolicy(ctx context.Context, table, family string, policy GCPolicy) error {\n\tprefix := ac.clusterPrefix()\n\ttbl, err := ac.tClient.GetTable(ctx, &bttspb.GetTableRequest{\n\t\tName: prefix + \"/tables/\" + table,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfam, ok := tbl.ColumnFamilies[family]\n\tif !ok {\n\t\treturn fmt.Errorf(\"unknown column family %q\", family)\n\t}\n\tfam.GcRule = policy.proto()\n\t_, err = ac.tClient.UpdateColumnFamily(ctx, fam)\n\treturn err\n}", "title": "" }, { "docid": "691fc1561fd6f4266104151d0b574bcb", "score": "0.55502474", "text": "func (s *ParameterHistory) SetPolicies(v []*ParameterInlinePolicy) *ParameterHistory {\n\ts.Policies = v\n\treturn s\n}", "title": "" }, { "docid": "3e37ab07ff87492dc7359e9e6fc89ac7", "score": "0.5543553", "text": "func NewPolicy() *Policy {\n\treturn &Policy{\n\t\tNamespace: make(map[string]*PolicyNamespace),\n\t\tvalidator: makeValidator(),\n\t}\n}", "title": "" }, { "docid": "7882a0e8993ea5eb494050997ea6de27", "score": "0.5537993", "text": "func (self *TraitSpinButton) SetUpdatePolicy(policy C.GtkSpinButtonUpdatePolicy) {\n\tC.gtk_spin_button_set_update_policy(self.CPointer, policy)\n\treturn\n}", "title": "" }, { "docid": "6a174bd255cb50feab436378cf71700a", "score": "0.5530304", "text": "func ValidatePolicy(policy *auth.Policy, authClient authinternalclient.AuthInterface) field.ErrorList {\n\tallErrs := apiMachineryValidation.ValidateObjectMeta(&policy.ObjectMeta, false, ValidatePolicyName, field.NewPath(\"metadata\"))\n\n\tfldSpecPath := field.NewPath(\"spec\")\n\tif err := validation.IsDisplayName(policy.Spec.DisplayName); err != nil {\n\t\tallErrs = append(allErrs, field.Invalid(fldSpecPath.Child(\"displayName\"), policy.Spec.DisplayName, err.Error()))\n\t}\n\n\tif policy.Spec.Type == \"\" {\n\t\tallErrs = append(allErrs, field.Required(fldSpecPath.Child(\"type\"), \"must specify type\"))\n\t} else if policy.Spec.Type != auth.PolicyCustom && policy.Spec.Type != auth.PolicyDefault {\n\t\tallErrs = append(allErrs, field.Invalid(fldSpecPath.Child(\"type\"), policy.Spec.Type, \"must specify one of: `custom` or `default`\"))\n\t}\n\n\tif policy.Spec.Category == \"\" {\n\t\tallErrs = append(allErrs, field.Required(fldSpecPath.Child(\"category\"), policy.Spec.Category))\n\t}\n\n\tfldStmtPath := field.NewPath(\"spec\", \"statement\")\n\tif len(policy.Spec.Statement.Actions) == 0 {\n\t\tallErrs = append(allErrs, field.Required(fldStmtPath.Child(\"actions\"), \"must specify actions\"))\n\t}\n\n\tif len(policy.Spec.Statement.Resources) == 0 {\n\t\tallErrs = append(allErrs, field.Required(fldStmtPath.Child(\"resources\"), \"must specify resources\"))\n\t}\n\n\tif policy.Spec.Statement.Effect == \"\" {\n\t\tallErrs = append(allErrs, field.Required(fldStmtPath.Child(\"effect\"), \"must specify effect\"))\n\t} else if policy.Spec.Statement.Effect != auth.Allow && policy.Spec.Statement.Effect != auth.Deny {\n\t\tallErrs = append(allErrs, field.Invalid(fldStmtPath.Child(\"effect\"), policy.Spec.Statement.Effect, \"must specify one of: `allow` or `deny`\"))\n\t}\n\n\tfldUserPath := field.NewPath(\"status\", \"users\")\n\tfor i, subj := range policy.Status.Users {\n\t\tif subj.ID == \"\" {\n\t\t\tallErrs = append(allErrs, field.Required(fldUserPath, \"must specify subject id \"))\n\t\t\tcontinue\n\t\t}\n\n\t\tif subj.Name == \"\" {\n\t\t\tval, err := authClient.Users().Get(util.CombineTenantAndName(policy.Spec.TenantID, subj.ID), metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\tallErrs = append(allErrs, field.NotFound(fldUserPath, subj.ID))\n\t\t\t\t} else {\n\t\t\t\t\tallErrs = append(allErrs, field.InternalError(fldUserPath, err))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif val.Spec.TenantID != policy.Spec.TenantID {\n\t\t\t\t\tallErrs = append(allErrs, field.Invalid(fldUserPath, subj.ID, \"must in the same tenant with the policy\"))\n\t\t\t\t} else {\n\t\t\t\t\tpolicy.Status.Users[i].Name = val.Spec.Name\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tfldGroupPath := field.NewPath(\"status\", \"groups\")\n\tfor i, subj := range policy.Status.Groups {\n\t\tif subj.ID == \"\" {\n\t\t\tallErrs = append(allErrs, field.Required(fldGroupPath, \"must specify id or name\"))\n\t\t\tcontinue\n\t\t}\n\n\t\tif subj.Name == \"\" {\n\t\t\tval, err := authClient.Groups().Get(util.CombineTenantAndName(policy.Spec.TenantID, subj.ID), metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\tallErrs = append(allErrs, field.NotFound(fldGroupPath, subj.ID))\n\t\t\t\t} else {\n\t\t\t\t\tallErrs = append(allErrs, field.InternalError(fldGroupPath, err))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif val.Spec.TenantID != policy.Spec.TenantID {\n\t\t\t\t\tallErrs = append(allErrs, field.Invalid(fldGroupPath, subj.ID, \"must in the same tenant with the policy\"))\n\t\t\t\t} else {\n\t\t\t\t\tpolicy.Status.Groups[i].Name = val.Spec.DisplayName\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn allErrs\n}", "title": "" }, { "docid": "0bcb8a06ec11c28e4e2be1552649ce25", "score": "0.55300665", "text": "func (o *UpdatePolicyParams) SetPolicyID(policyID string) {\n\to.PolicyID = policyID\n}", "title": "" }, { "docid": "2c1038a52b51b31edadb22efc3e0f5e4", "score": "0.5528378", "text": "func NewPolicy(o *Options) (Policy, error) {\n\tif opt.Policy == NullPolicy {\n\t\treturn nil, nil\n\t}\n\n\tbackend, ok := policies[opt.Policy]\n\tif !ok {\n\t\treturn nil, policyError(\"unknown policy '%s'\", opt.Policy)\n\t}\n\n\tp := &policy{\n\t\tLogger: logger.NewLogger(\"policy\"),\n\t}\n\n\tp.Info(\"creating new policy '%s'...\", backend.Name())\n\tif len(opt.Available) != 0 {\n\t\tp.Info(\" with resource availability constraints:\")\n\t\tfor d := range opt.Available {\n\t\t\tp.Info(\" - %s=%s\", d, ConstraintToString(opt.Available[d]))\n\t\t}\n\t}\n\n\tif len(opt.Reserved) != 0 {\n\t\tp.Info(\" with resource reservation constraints:\")\n\t\tfor d := range opt.Reserved {\n\t\t\tp.Info(\" - %s=%s\", d, ConstraintToString(opt.Reserved[d]))\n\t\t}\n\t}\n\n\tif p.DebugEnabled() {\n\t\tp.Debug(\"*** enabling debugging for %s\", opt.Policy)\n\t\tlogger.Get(opt.Policy).EnableDebug(true)\n\t} else {\n\t\tp.Debug(\"*** leaving debugging for %s alone\", opt.Policy)\n\t}\n\n\tbackendOpts := &BackendOptions{\n\t\tAvailable: opt.Available,\n\t\tReserved: opt.Reserved,\n\t\tAgentCli: o.AgentCli,\n\t\tRdt: o.Rdt,\n\t}\n\tp.backend = backend.CreateFn()(backendOpts)\n\n\treturn p, nil\n}", "title": "" }, { "docid": "05c9e1b46d5d07ab24ce63f0c78276a7", "score": "0.5526021", "text": "func (s *ListComplianceStatusInput) SetPolicyId(v string) *ListComplianceStatusInput {\n\ts.PolicyId = &v\n\treturn s\n}", "title": "" }, { "docid": "349d6dd2ecbda43fdee3eaa4163ca7a4", "score": "0.5525822", "text": "func (d *ConiksDirectory) SetPolicies(epDeadline protocol.Timestamp) {\n\td.policies = protocol.NewPolicies(epDeadline, d.policies.VrfPublicKey)\n}", "title": "" }, { "docid": "7137c38b1152ae210f36598e011e12c5", "score": "0.5521452", "text": "func (s *ParameterInlinePolicy) SetPolicyText(v string) *ParameterInlinePolicy {\n\ts.PolicyText = &v\n\treturn s\n}", "title": "" } ]
f04ecf79f189ee1599de5cd06d90b82f
HasTemplate returns a boolean if a field has been set.
[ { "docid": "4075db2aa5158994e9918a0bb2e31ff8", "score": "0.7494632", "text": "func (o *SdwanTemplateInputsType) HasTemplate() bool {\n\tif o != nil && o.Template != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "990fdbcf17a0511e428a8913ffcba8ab", "score": "0.7799951", "text": "func (o *Task) HasTemplateFields() bool {\n\tif o != nil && o.TemplateFields != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "22751a1e483bf8d75259666df7e8cf9a", "score": "0.7372216", "text": "func (o *HyperflexHypervisorVirtualMachineAllOf) HasTemplate() bool {\n\tif o != nil && o.Template != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2475d0ac59e3f05b39545edfa59448be", "score": "0.67262983", "text": "func (p *Page) HasCardTemplate() bool {\n\treturn p.d.HasCardTemplate\n}", "title": "" }, { "docid": "40c71e82959d9c919ac7918f4ae49c59", "score": "0.651474", "text": "func (r TComponentOnParentHolder) HasTemplates() bool {\n\treturn len(r.h.Templates) > 0\n}", "title": "" }, { "docid": "6d899a93858d7d19c69ac45612dd4ac8", "score": "0.6469186", "text": "func (this Repository) GetIsTemplate() bool { return this.IsTemplate }", "title": "" }, { "docid": "cc067a3e3514098cb740de24eeee5899", "score": "0.64279944", "text": "func (r TComponentOnComponentHolder) HasTemplates() bool {\n\treturn len(r.h.Templates) > 0\n}", "title": "" }, { "docid": "1defb238659a8fee8608f6654882d422", "score": "0.6324782", "text": "func (self *templateEngine) hasTemplate(name string) bool {\n\treturn CheckFile(self.templateFilepath(name))\n}", "title": "" }, { "docid": "aeffc964033f3d273e2bb1337f78a399", "score": "0.6265575", "text": "func (b Bookmarks) HasTemplates() bool {\n\treturn false\n}", "title": "" }, { "docid": "ff49e2bdcbd8cf3709aa617c4870679c", "score": "0.62599635", "text": "func (r TPlatformOnPlatformHolder) HasTemplates() bool {\n\treturn len(r.h.Templates) > 0\n}", "title": "" }, { "docid": "23a5bdc18679df3ddccd5e8a193e58ca", "score": "0.6225822", "text": "func (o *NiatelemetryMsoContractDetailsAllOf) HasTemplateName() bool {\n\tif o != nil && o.TemplateName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "312dc38e6cbad64dbcb7b710f056f7c5", "score": "0.61574244", "text": "func (s *sourceFormat) isSet() bool {\n\treturn len(s.template) > 0\n}", "title": "" }, { "docid": "2b2c07f3b205d3f4a7a6046edc6b7888", "score": "0.6117748", "text": "func (o *UpdateVmTemplateRequest) HasVmTemplateName() bool {\n\tif o != nil && o.VmTemplateName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "39a5343574fb5f2d15b2ee36690c8a0e", "score": "0.6051321", "text": "func PaymentTemplateExists(exec boil.Executor, iD int) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from \\\"payment_template\\\" 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\n\trow := exec.QueryRow(sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: unable to check if payment_template exists\")\n\t}\n\n\treturn exists, nil\n}", "title": "" }, { "docid": "5085cf11cf2ba57a185a19ad8b149a6f", "score": "0.6038942", "text": "func (t *Templates) Has(template string) (interface{}, error) {\n\tvalue, ok := t.items.Load(template)\n\tif !ok || value == nil {\n\t\treturn nil, nil\n\t}\n\ttemplateError, ok := value.(parsedTemplateErrHolder)\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\treturn templateError.template, templateError.err\n}", "title": "" }, { "docid": "87cd0b97ec639b3b3633ef0bdfbe470e", "score": "0.6026425", "text": "func (o *MonitorType) HasTemplatedName() bool {\n\treturn o != nil && o.TemplatedName != nil\n}", "title": "" }, { "docid": "3a1b753b07f21ac9680a57fc334469eb", "score": "0.601516", "text": "func (o *KanbanViewCreateView) HasSingleSelectField() bool {\n\tif o != nil && o.SingleSelectField.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e06bb1b46a8926ec58203a45fbc4d81d", "score": "0.5932363", "text": "func (p *Page) IsTemplate() bool {\n\tcssmatch, _ := regexp.Compile(\"\\\\.css$\")\n\tif cssmatch.FindString(p.Name) == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "01f1eb9e02575e2e6332a72796bc60dd", "score": "0.59152937", "text": "func IsTemplate(query *structs.PreparedQuery) bool {\n\treturn query.Template.Type != \"\"\n}", "title": "" }, { "docid": "c3e3436fa0b09aefc54f9610922d7984", "score": "0.5881262", "text": "func (r *ModuleCreate) HasFields() bool {\n\treturn r.hasFields\n}", "title": "" }, { "docid": "d4d5b1c687bd4e5171d67791673a04ae", "score": "0.58559036", "text": "func (q paymentTemplateQuery) Exists(exec boil.Executor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow(exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if payment_template exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "8b4be1338b4d2ce9c79226199565affa", "score": "0.5797505", "text": "func (f *Form) Has(field string) bool {\n\tx := f.Get(field)\n\tif x == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "96c80d16c3a410aba73bfdcc535ddc13", "score": "0.5757808", "text": "func (o *ControllersUpdateDeploymentRequest) HasResourceSettingsTemplateId() bool {\n\tif o != nil && o.ResourceSettingsTemplateId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7e289527130c2c7287c17ad5fa596001", "score": "0.5754289", "text": "func (o *HyperflexHypervisorVirtualMachineAllOf) GetTemplate() bool {\n\tif o == nil || o.Template == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Template\n}", "title": "" }, { "docid": "3eb7063f637abe3b77daddc617883c4e", "score": "0.5746272", "text": "func (o *UpdateVmTemplateRequest) HasDryRun() bool {\n\tif o != nil && o.DryRun != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "231c0a3ae4490f29dc716015040ecd03", "score": "0.570357", "text": "func (o *ViewForm) HasTaskTitleFieldId() bool {\n\tif o != nil && o.TaskTitleFieldId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ec03e1f7ba623e262d00b3b1bd2cbb51", "score": "0.5658235", "text": "func (o *DirectoryRoleTemplate) HasDisplayName() bool {\n\tif o != nil && o.DisplayName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9d690ef5a7c30cd02e95096f584fc8a6", "score": "0.5608606", "text": "func (tp *TagsPost) Exists() bool {\n\treturn tp._exists\n}", "title": "" }, { "docid": "85be85d4589dc8505732303b7acdd73d", "score": "0.558908", "text": "func (m *Table) HasField(name string) bool {\n\tif _, ok := m.FieldMap[name]; ok {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "39d3e5825f17c006139c085ee9bf5e34", "score": "0.55884904", "text": "func (o *UsageAttributionAggregatesBody) HasField() bool {\n\tif o != nil && o.Field != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "807f6738730e7d012096c5579298f5eb", "score": "0.5581967", "text": "func (f *Form) Has(field string, r *http.Request) bool {\n\tx := f.Get(field)\n\tif x == \"\" {\n\t\tf.Errors.Add(field, \"This form cannot be blank\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4f2b54bfe242a51f8b3b9e5bbce50cba", "score": "0.5570798", "text": "func (o *HyperflexHypervisorVirtualMachineAllOf) GetTemplateOk() (*bool, bool) {\n\tif o == nil || o.Template == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Template, true\n}", "title": "" }, { "docid": "29be58bf75605b09a8c7bb8bd3d71fe1", "score": "0.5566798", "text": "func hasMetadataAttribute(template map[string]interface{}) bool {\n\tmd := template[\"Metadata\"].(map[string]interface{})\n\treturn len(md) != 0\n}", "title": "" }, { "docid": "577b27250e29de4d1a1ab6f2881da0a8", "score": "0.5562441", "text": "func (f FieldHTTPTimeReadonly) Exists() bool {\n\treturn f.h.Get(f.k) != \"\"\n}", "title": "" }, { "docid": "8eda4533c6596703bab6ec2d1a1e50ee", "score": "0.5548578", "text": "func (r *ModuleCreate) HasMeta() bool {\n\treturn r.hasMeta\n}", "title": "" }, { "docid": "7515c71f44b1241f12adc22080201ba0", "score": "0.5545664", "text": "func (o *Task) GetTemplateFieldsOk() (*[]string, bool) {\n\tif o == nil || o.TemplateFields == nil {\n\t\treturn nil, false\n\t}\n\treturn o.TemplateFields, true\n}", "title": "" }, { "docid": "9e2f0fcf3e9870f89b90f04d60a4098a", "score": "0.5521958", "text": "func (o *SdwanTemplateInputsType) HasKey() bool {\n\tif o != nil && o.Key != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "31bcd37edf168cf729053d6a4b5908b5", "score": "0.54679215", "text": "func (o *StorageProjectIsoCreate) HasTag() bool {\n\tif o != nil && o.Tag != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4b435ab21a84a963710a0dbdd605c1b8", "score": "0.5459138", "text": "func (l *InMemLoader) Exists(templatePath string) bool {\n\ttemplatePath = l.normalize(templatePath)\n\tl.lock.RLock()\n\tdefer l.lock.RUnlock()\n\t_, ok := l.files[templatePath]\n\treturn ok\n}", "title": "" }, { "docid": "ebaeeb8763adbc69db56918df00782d6", "score": "0.5446589", "text": "func validateTemplate(fl validator.FieldLevel) bool {\n\tfield := fl.Field()\n\tresult := true\n\tif field.Kind() == reflect.Slice || field.Kind() == reflect.Array {\n\t\tfor i := 0; i < field.Len(); i++ {\n\t\t\tresult = result && isTemplate(field.Index(i).Interface().(string))\n\t\t}\n\t} else {\n\t\tresult = result && isTemplate(field.String())\n\t}\n\treturn result\n}", "title": "" }, { "docid": "1e5e7095fcddce3c41569fa1a3fd1dc8", "score": "0.5415779", "text": "func (o *UpdateVmTemplateRequest) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "70e21ebe792850399c44e8e74301c270", "score": "0.54116607", "text": "func (o *WindowsInformationProtection) HasRightsManagementServicesTemplateId() bool {\n\tif o != nil && o.RightsManagementServicesTemplateId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "555b01402ee28d5e8c6558fb94af6218", "score": "0.53787225", "text": "func (r *TemplatesFile) Has(name string, version string) bool {\n\tfor _, rf := range r.Templates {\n\t\tif rf.Name == name && rf.Version == version {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2812ab7b4c75e5940c058c68f0b3d884", "score": "0.5364854", "text": "func (f *Form) Has(field string, req *http.Request) bool {\n\tif value := req.Form.Get(field); value == \"\" {\n\t\t//f.Errors.Add(field, \"This field cannot be blank\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "2e1ce4bdbaa8870ee7dc3fae7dcf0ef1", "score": "0.53576505", "text": "func (a *action) HasField(names ...string) bool {\n\n\tif len(names) == 0 {\n\t\tpanic(\"please provide top level field\")\n\t}\n\n\tif a.field == nil {\n\t\treturn false\n\t}\n\n\treturn a.field.HasField(names...)\n}", "title": "" }, { "docid": "77b433dd8df665b8ddfb1ff9ba158068", "score": "0.53437924", "text": "func (o *SdwanTemplateInputsType) HasTitle() bool {\n\tif o != nil && o.Title != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3b76891432b180609d6b9ade880f4a41", "score": "0.53354585", "text": "func (s CustomFieldsStore) Has(name string) bool {\n\treturn s[name] != nil\n}", "title": "" }, { "docid": "a689149118bfb6b17c1b64003b223be5", "score": "0.5334489", "text": "func (o *SdwanTemplateInputsType) HasEditable() bool {\n\tif o != nil && o.Editable != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f2e000615eacd808381824eae49b0beb", "score": "0.5331384", "text": "func (o *ViewCustomFieldProject) HasCustomfield() bool {\n\tif o != nil && o.Customfield != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "40830ca6539b0a0a2d30a7f30deb3f9c", "score": "0.53288573", "text": "func (o *ViewForm) HasIsShared() bool {\n\tif o != nil && o.IsShared != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c82614aec4e0fa3511cdca5fdd6a9be3", "score": "0.5306716", "text": "func (o *DirectoryRoleTemplate) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d6297d89af85e54b4e2c10f5fd134510", "score": "0.5306262", "text": "func (f FieldUnixTimeReadonly) Exists() bool {\n\treturn f.h.Get(f.k) != \"\"\n}", "title": "" }, { "docid": "4ef5f314f0e115026d3a9f2120ffa2fe", "score": "0.53028363", "text": "func (o *UpdateVmTemplateRequest) HasTags() bool {\n\tif o != nil && o.Tags != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "01dd273ad8eb2046ce3b78089b77346f", "score": "0.52829796", "text": "func (o *SdwanTemplateInputsType) HasRequired() bool {\n\tif o != nil && o.Required != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "55e195ff11ae2701f20da2574853b6da", "score": "0.52596945", "text": "func (o *ViewCustomFieldProject) HasProject() bool {\n\tif o != nil && o.Project != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9de1e3b72f24b73be681455720a307da", "score": "0.5250119", "text": "func (t *Person) HasUnknownPreview() (ok bool) {\n\treturn t.preview != nil && t.preview[0].unknown_ != nil\n\n}", "title": "" }, { "docid": "b6c0f6f6828289d8ad994d42f2c1bca2", "score": "0.52494276", "text": "func (o *ViewCustomFieldProject) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3e68b37c4cfa28305d780be7ebad3dc8", "score": "0.52376866", "text": "func (o *KanbanViewCreateView) HasCardCoverImageField() bool {\n\tif o != nil && o.CardCoverImageField.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "269dfe1bd99593448040c5abbd994c53", "score": "0.522619", "text": "func (g GitlabProject) HasVariable(key string) bool {\n\t_, ok := g.variables[key]\n\treturn ok\n}", "title": "" }, { "docid": "5370760322fe105628f54fcb52195cf2", "score": "0.5224623", "text": "func (o *ViewForm) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ba4beeaa2f94e53da67f3c4458413c2d", "score": "0.52238244", "text": "func PaymentTemplateExistsG(iD int) (bool, error) {\n\treturn PaymentTemplateExists(boil.GetDB(), iD)\n}", "title": "" }, { "docid": "f13c76bb8e6788ff4983b9569019f21c", "score": "0.51967824", "text": "func (o *Attachments) HasCreateTime() bool {\n\tif o != nil && o.CreateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8c2f7d4f32da01d441bcb1bdb35ea169", "score": "0.5190993", "text": "func (o *ControllersUpdateDeploymentRequest) HasApplicationConfigurationTemplateId() bool {\n\tif o != nil && o.ApplicationConfigurationTemplateId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "98b5851b3769027c07b1e9e220fa9c74", "score": "0.5168213", "text": "func (l *OSFileSystemLoader) Exists(templatePath string) bool {\n\ttemplatePath = filepath.Join(l.dir, filepath.FromSlash(templatePath))\n\tstat, err := os.Stat(templatePath)\n\tif err == nil && !stat.IsDir() {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bce6f81af568ef4ed490a8a544b88846", "score": "0.5152235", "text": "func (o *Ga4ghFusionDetection) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "63df5b09920dba51f68c91bac7ec8fd7", "score": "0.51519907", "text": "func (p resultRow) HasField(n int) bool {\n\treturn len(p) > n\n}", "title": "" }, { "docid": "031df9ee5025007a69e59dd4969da0c8", "score": "0.5149695", "text": "func (o *Tile) HasConfigured() bool {\n\tif o != nil && o.Configured != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f6c213976fec10acfa040269fae14d5c", "score": "0.5140556", "text": "func (f *Form)Has(field string, r *http.Request) bool{\n\tfd := r.Form.Get(field)\n\tif fd == \"\"{\n\t\tf.Errors.Add(field, fmt.Sprintf(\"Field [%s] cannot be blanc\", field))\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "73457f993c57ba9438cb407ea69b162d", "score": "0.51401985", "text": "func (o *AnsibleTowerNotificationConfigAllOf) HasJobTemplateID() bool {\n\tif o != nil && o.JobTemplateID != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cebaf838823f3b5a2a92e2e2099ba6b8", "score": "0.5132309", "text": "func (r *ModuleUpdate) HasFields() bool {\n\treturn r.hasFields\n}", "title": "" }, { "docid": "7a596b460b7830f0f61283ff5937014b", "score": "0.5129665", "text": "func (o *SdwanTemplateInputsType) HasValue() bool {\n\tif o != nil && o.Value != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4383b0beaa48bd415057742744f08524", "score": "0.5129061", "text": "func (t *transportES) checkTemplate(addr *addresspool.Address, name string) (bool, error) {\n\thttpRequest, err := t.createRequest(t.ctx, \"HEAD\", addr, fmt.Sprintf(\"/_template/%s\", name), nil)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\thttpResponse, err := t.getClient(addr).Do(httpRequest)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer func() {\n\t\tbufio.NewReader(httpResponse.Body).WriteTo(io.Discard)\n\t\thttpResponse.Body.Close()\n\t}()\n\tif httpResponse.StatusCode == 200 {\n\t\treturn true, nil\n\t}\n\tif httpResponse.StatusCode != 404 {\n\t\tbody, _ := io.ReadAll(httpResponse.Body)\n\t\treturn false, fmt.Errorf(\"unexpected status: %s [Body: %s]\", httpResponse.Status, body)\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "29769681748cb937e9857aa6eaaecba6", "score": "0.51229566", "text": "func (g GitlabGroup) HasVariable(key string) bool {\n\t_, ok := g.variables[key]\n\treturn ok\n}", "title": "" }, { "docid": "1bcd652583d9507c3fc9b7e31ae50dd6", "score": "0.5119386", "text": "func (user *User) HasTexture() bool {\n\treturn len(user.TextureBlob) > 0\n}", "title": "" }, { "docid": "6056f5a871978fe5538ecf24423e8165", "score": "0.5118793", "text": "func FieldExists(any interface{}, name string) bool {\n\tfield := reflect.ValueOf(any).FieldByName(name)\n\tif field.IsValid() {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "82a56c39dd9ece36a6fc0b0a1081c84a", "score": "0.5117836", "text": "func (o *SgxEpcConfig) HasPrefault() bool {\n\tif o != nil && o.Prefault != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5e9e58271c4e05a0a3a0f645976a4950", "score": "0.51087546", "text": "func (o *SourceType) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "58e3b1552625fd1f2a63353c65ec9f35", "score": "0.5103364", "text": "func (p *Page) Exists() bool {\n\tif p.Source != \"\" {\n\t\treturn true\n\t}\n\t_, err := os.Stat(p.FilePath)\n\treturn err == nil\n}", "title": "" }, { "docid": "eaa6230b2098b6176647417e0f435220", "score": "0.51010257", "text": "func (o *LdapCertificateProvider) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "20285bd0bd8aab3c64553062861ab5b9", "score": "0.5097005", "text": "func (o *ViewCustomFieldProject) HasCreatedBy() bool {\n\tif o != nil && o.CreatedBy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6b016b606ffb6d7b87cdc64df8b6929c", "score": "0.5095776", "text": "func (cfg Configuration) HasMetadata() bool {\n\t_, ok := cfg[metadataKey]\n\treturn ok\n}", "title": "" }, { "docid": "d6489089b01ec2bdddea1a849215e1f2", "score": "0.509246", "text": "func (up *UserProperty) Exists() bool {\n\treturn up._exists\n}", "title": "" }, { "docid": "370dd8d7d354d96c89dc1261e45d7ced", "score": "0.50878304", "text": "func (f *F) HasAttack() bool {\n\treturn f.attack != \"\"\n}", "title": "" }, { "docid": "31358365203400671db9fa382b08bc77", "score": "0.5080135", "text": "func (_class VMClass) GetIsATemplate(sessionID SessionRef, self VMRef) (_retval bool, _err error) {\n\t_method := \"VM.get_is_a_template\"\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 := convertVMRefToXen(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 = convertBoolToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "3ae4e960ff9d5119cba1e6f4ff286aca", "score": "0.5079778", "text": "func (m Quote) HasTransactTime() bool {\n\treturn m.Has(tag.TransactTime)\n}", "title": "" }, { "docid": "0b7b1eca6dede8cb1b86a3895a2ff52f", "score": "0.50664324", "text": "func (o *StorageNetAppStorageVm) HasIsProtected() bool {\n\tif o != nil && o.IsProtected != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2a10f9dadb51e25b3c4c7f24a145c434", "score": "0.5051804", "text": "func (o *BulkStats) HasTransformationComputeMs() bool {\n\tif o != nil && !IsNil(o.TransformationComputeMs) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "43fe640b55a82b364068d5be2a795c7c", "score": "0.50491726", "text": "func (pt *PostModel) HasProjectID() bool {\n\tif pt.ProjectID == 0 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "80442ad646de43ee6e45f1bfc980612e", "score": "0.5047751", "text": "func (o *ViewForm) HasState() bool {\n\tif o != nil && o.State != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "58e8eb71df8f04a05474bf045376a3d6", "score": "0.5042279", "text": "func (p *Page) Has(selector string) bool {\n\thas, err := p.HasE(selector)\n\tutils.E(err)\n\treturn has\n}", "title": "" }, { "docid": "7d49311122d52350a42a3e7874f4f658", "score": "0.50418776", "text": "func (o *LogStreamWidgetDefinition) HasTime() bool {\n\tif o != nil && o.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a8e133ec13451a5b12dee35a7c755205", "score": "0.5032756", "text": "func (o *MobileAppContentFile) HasUploadState() bool {\n\tif o != nil && o.UploadState != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e2cc756eacaed3a4b4934b3597e37db0", "score": "0.50299615", "text": "func (f FieldUnixTime) Exists() bool {\n\treturn f.h.Get(f.k) != \"\"\n}", "title": "" }, { "docid": "a6baa3c27b6b7bb53d6d91a56fdbc550", "score": "0.5029004", "text": "func (m *Message) HasField(fd *desc.FieldDescriptor) bool {\n\tif err := m.checkField(fd); err != nil {\n\t\treturn false\n\t}\n\treturn m.HasFieldNumber(int(fd.GetNumber()))\n}", "title": "" }, { "docid": "d63cae05fe5b4faf588f3fff0dbb2923", "score": "0.502484", "text": "func (x *fastReflection_NoSignerOption) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"NoSignerOption.signer\":\n\t\treturn len(x.Signer) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: NoSignerOption\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message NoSignerOption does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "4bf3048f710ebd89ce5fd94bb7c55006", "score": "0.5024226", "text": "func (q paymentTemplateQuery) ExistsG() (bool, error) {\n\treturn q.Exists(boil.GetDB())\n}", "title": "" }, { "docid": "0e499f1c17eb98922f861977786b7a9c", "score": "0.5023928", "text": "func (o *Group) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "137bc9b43083c357d8a27e1583cf372d", "score": "0.5020157", "text": "func (o *SunburstWidgetDefinition) HasTime() bool {\n\tif o != nil && o.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "88938d0447fb1b6fd8628419fb7ab33e", "score": "0.50191927", "text": "func (o *InlineResponse20060ProjectActivePages) HasTime() bool {\n\tif o != nil && o.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5ffeb09ddd58e826025014aef1efd127", "score": "0.50169563", "text": "func (o *InlineResponse20054ActivePages) HasTime() bool {\n\tif o != nil && o.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bd7ffeb2f8637770d0cfa769c687f85c", "score": "0.50128347", "text": "func (o *Pipeline) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
02e0c9e4c206e52ee72227b6151e4119
NewGetAllUsingGET1NotFound creates a GetAllUsingGET1NotFound with default headers values
[ { "docid": "7d5dbf2263646a2266daf6b5fab009a9", "score": "0.7266113", "text": "func NewGetAllUsingGET1NotFound() *GetAllUsingGET1NotFound {\n\treturn &GetAllUsingGET1NotFound{}\n}", "title": "" } ]
[ { "docid": "d89d88f0d73e02cbe572b4d269779837", "score": "0.6532042", "text": "func NewGetAllUsingGET1Unauthorized() *GetAllUsingGET1Unauthorized {\n\treturn &GetAllUsingGET1Unauthorized{}\n}", "title": "" }, { "docid": "f3d8e5b520739ef86503e3e07dbf03ef", "score": "0.61276305", "text": "func NewGetAllUsingGET1OK() *GetAllUsingGET1OK {\n\treturn &GetAllUsingGET1OK{}\n}", "title": "" }, { "docid": "b42246d0b1758f5d94eefda552bc682a", "score": "0.6012319", "text": "func (a *ProjectControllerApiService) GetUsingGET1(ctx _context.Context, id string) apiGetUsingGET1Request {\n\treturn apiGetUsingGET1Request{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "773bf372e5449b6dd09791fcec0a6409", "score": "0.5880888", "text": "func NewGetCatalogItemUsingGET1NotFound() *GetCatalogItemUsingGET1NotFound {\n\treturn &GetCatalogItemUsingGET1NotFound{}\n}", "title": "" }, { "docid": "f1b56421188ef4dfd1b930433cfb6cb1", "score": "0.58218366", "text": "func NewGetByNameUsingGETNotFound() *GetByNameUsingGETNotFound {\n\treturn &GetByNameUsingGETNotFound{}\n}", "title": "" }, { "docid": "660008cfddf0b7ef7c67b7b5986d2f19", "score": "0.5712281", "text": "func NewGetAllUsingGET1Forbidden() *GetAllUsingGET1Forbidden {\n\treturn &GetAllUsingGET1Forbidden{}\n}", "title": "" }, { "docid": "98240ef89d0db49f01e3a436def0d84f", "score": "0.56242985", "text": "func NewGetAllEndpointsUsingGETNotFound() *GetAllEndpointsUsingGETNotFound {\n\treturn &GetAllEndpointsUsingGETNotFound{}\n}", "title": "" }, { "docid": "14c8e649d39f03a9e2ef8acb6d5e81e2", "score": "0.5483506", "text": "func NewGetCatalogItemUsingGET1Unauthorized() *GetCatalogItemUsingGET1Unauthorized {\n\treturn &GetCatalogItemUsingGET1Unauthorized{}\n}", "title": "" }, { "docid": "1c2d1372824e09c434118d94e5087d22", "score": "0.54134077", "text": "func NewGetConfigurationSourceTreeUsingGET1NotFound() *GetConfigurationSourceTreeUsingGET1NotFound {\n\treturn &GetConfigurationSourceTreeUsingGET1NotFound{}\n}", "title": "" }, { "docid": "e35a699d5ee060df24742293f1fca6bc", "score": "0.5398993", "text": "func (a *PipelineTemplatesControllerApiService) ListUsingGET(ctx _context.Context) apiListUsingGETRequest {\n\treturn apiListUsingGETRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "380fe6fbfa0191c2b24b94aaee0ffe55", "score": "0.5307161", "text": "func NewGetByNameUsingGET3NotFound() *GetByNameUsingGET3NotFound {\n\treturn &GetByNameUsingGET3NotFound{}\n}", "title": "" }, { "docid": "d82ba0e3df1c34a1b0c9f98d6628b685", "score": "0.52987427", "text": "func (a *Client) ListBlueprintRequestsUsingGET1(params *ListBlueprintRequestsUsingGET1Params, opts ...ClientOption) (*ListBlueprintRequestsUsingGET1OK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListBlueprintRequestsUsingGET1Params()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listBlueprintRequestsUsingGET_1\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/blueprint/api/blueprint-requests\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListBlueprintRequestsUsingGET1Reader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListBlueprintRequestsUsingGET1OK)\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 listBlueprintRequestsUsingGET_1: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "b38a00db428004f3d3a0f7fbb49f8ca6", "score": "0.52499163", "text": "func (c *Client) GetWithHeader(url string, header map[string]string, returnType int, result interface{}) (err error) {\n\tcode, _, err := c.Request(\"GET\", url, header, nil, returnType, result)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif code != http.StatusOK {\n\t\treturn fmt.Errorf(\"http response code; %v\", code)\n\t}\n\treturn\n}", "title": "" }, { "docid": "73e511eda1453617f601d7687b61ef01", "score": "0.52302104", "text": "func NewGetChildrenUsingGETNotFound() *GetChildrenUsingGETNotFound {\n\treturn &GetChildrenUsingGETNotFound{}\n}", "title": "" }, { "docid": "e1a0536ab4357a457754d44ffcea2233", "score": "0.5210973", "text": "func TestGetAllDataNoToken(t *testing.T) {\n\n\tvar routers = []struct {\n\t\tendpoint string\n\t\tmethod string\n\t\texpected int\n\t}{\n\t\t{\"/v1/purchase-invoice\", \"GET\", http.StatusBadRequest},\n\t}\n\n\tng := tester.New()\n\tfor _, ep := range routers {\n\t\tng.Method = ep.method\n\t\tng.Path = ep.endpoint\n\t\tng.Run(test.Router(), func(res tester.HTTPResponse, req tester.HTTPRequest) {\n\t\t\tassert.Equal(t, ep.expected, res.Code, fmt.Sprintf(\"Should has 'endpoint %s' with method '%s'\", ep.endpoint, ep.method))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "8175e7f6daf7b1608c5cc68b8ae81503", "score": "0.5169809", "text": "func NewGetOneDefault(code int) *GetOneDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetOneDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "8c3c256c8d197313e96be0bc53a0303c", "score": "0.5166136", "text": "func NewGetExecutionsByNameUsingGETNotFound() *GetExecutionsByNameUsingGETNotFound {\n\treturn &GetExecutionsByNameUsingGETNotFound{}\n}", "title": "" }, { "docid": "e56c8f4887feff2ff41a853b67fa60a0", "score": "0.5156762", "text": "func (a *Client) GetAllUsingGET10(params *GetAllUsingGET10Params, opts ...ClientOption) (*GetAllUsingGET10OK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAllUsingGET10Params()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getAllUsingGET_10\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/codestream/api/user-operations\",\n\t\tProducesMediaTypes: []string{\"*/*\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetAllUsingGET10Reader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetAllUsingGET10OK)\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 getAllUsingGET_10: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "609ef4a259f07190cd686577a29a8d70", "score": "0.51517916", "text": "func NewGetByNameUsingGETUnauthorized() *GetByNameUsingGETUnauthorized {\n\treturn &GetByNameUsingGETUnauthorized{}\n}", "title": "" }, { "docid": "6b5c2b1dd7dc331f523743ea36c630e6", "score": "0.5133364", "text": "func NewGetRequestUsingGETNotFound() *GetRequestUsingGETNotFound {\n\treturn &GetRequestUsingGETNotFound{}\n}", "title": "" }, { "docid": "ab96bc1f124dd33539bf193a43fa3b05", "score": "0.5119732", "text": "func NewHelloUsingGETNotFound() *HelloUsingGETNotFound {\n\treturn &HelloUsingGETNotFound{}\n}", "title": "" }, { "docid": "4ecb7fa8a59b05f5c572d05dc9acfae3", "score": "0.5114643", "text": "func (cust *Customer) All(queryParams map[string]interface{}, extraHeaders map[string]string) (map[string]interface{}, error) {\n\turl := fmt.Sprintf(\"/%s%s\", constants.VERSION_V1, constants.CUSTOMER_URL)\n\treturn cust.Request.Get(url, queryParams, extraHeaders)\n}", "title": "" }, { "docid": "d19315380b8b58209a13e00f1a91606f", "score": "0.5089115", "text": "func NewGetCurrenciesUsingGETNotFound() *GetCurrenciesUsingGETNotFound {\n\treturn &GetCurrenciesUsingGETNotFound{}\n}", "title": "" }, { "docid": "3a745cffa29e891a2194910507240d4b", "score": "0.50703716", "text": "func newGets(c *StokV1alpha1Client, namespace string) *gets {\n\treturn &gets{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "35e0f038bbf44500ee67d6cfcccb4dc2", "score": "0.5052521", "text": "func NewGetEndpointTilesUsingGETNotFound() *GetEndpointTilesUsingGETNotFound {\n\treturn &GetEndpointTilesUsingGETNotFound{}\n}", "title": "" }, { "docid": "ff50a8f00b06aaa89fa0fab6df6afc9c", "score": "0.50518197", "text": "func NewGetAddressesUsingGETNotFound() *GetAddressesUsingGETNotFound {\n\treturn &GetAddressesUsingGETNotFound{}\n}", "title": "" }, { "docid": "d9e20016eb8eb5c5c4ebd5680070eedf", "score": "0.504015", "text": "func (it *DefaultApi) ListsMembersCreateAllGet(_client swagger.FetchClient, _request *DefaultApiListsMembersCreateAllGetRequest, result interface{}) error {\n\tif !_client.NewValidator(_request.ListId, _request.ListId == nil).Required(true).Valid(_client) {\n\t\treturn errors.New(0, \"Missing the required parameter 'ListId' when calling ListsMembersCreateAllGet\")\n\t}\n\tif !_client.NewValidator(_request.Slug, _request.Slug == nil).Required(true).Valid(_client) {\n\t\treturn errors.New(0, \"Missing the required parameter 'Slug' when calling ListsMembersCreateAllGet\")\n\t}\n\tif !_client.NewValidator(_request.OwnerScreenName, _request.OwnerScreenName == nil).Valid(_client) {\n\t\treturn errors.New(0, \"Missing the required parameter 'OwnerScreenName' when calling ListsMembersCreateAllGet\")\n\t}\n\tif !_client.NewValidator(_request.OwnerId, _request.OwnerId == nil).Valid(_client) {\n\t\treturn errors.New(0, \"Missing the required parameter 'OwnerId' when calling ListsMembersCreateAllGet\")\n\t}\n\tif !_client.NewValidator(_request.UserId, _request.UserId == nil).Valid(_client) {\n\t\treturn errors.New(0, \"Missing the required parameter 'UserId' when calling ListsMembersCreateAllGet\")\n\t}\n\tif !_client.NewValidator(_request.ScreenName, _request.ScreenName == nil).Valid(_client) {\n\t\treturn errors.New(0, \"Missing the required parameter 'ScreenName' when calling ListsMembersCreateAllGet\")\n\t}\n\n\t// create path and map variables\n\t{\n\t\tlocalVarPath := strings.Replace(\"/lists/members/create_all\", \"{format}\", \"json\", -1)\n\t\t_client.SetApiPath(utils.AddPath(it.BasePath, localVarPath))\n\t\t_client.SetMethod(strings.ToUpper(\"Get\"))\n\t}\n\n\tif _request.ListId != nil {\n\t\t_client.AddQueryParam(\"list_id\", utils.ParameterToString(_request.ListId))\n\t}\n\tif _request.Slug != nil {\n\t\t_client.AddQueryParam(\"slug\", utils.ParameterToString(_request.Slug))\n\t}\n\tif _request.OwnerScreenName != nil {\n\t\t_client.AddQueryParam(\"owner_screen_name\", utils.ParameterToString(_request.OwnerScreenName))\n\t}\n\tif _request.OwnerId != nil {\n\t\t_client.AddQueryParam(\"owner_id\", utils.ParameterToString(_request.OwnerId))\n\t}\n\tif _request.UserId != nil {\n\t\t_client.AddQueryParam(\"user_id\", utils.ParameterToString(_request.UserId))\n\t}\n\tif _request.ScreenName != nil {\n\t\t_client.AddQueryParam(\"screen_name\", utils.ParameterToString(_request.ScreenName))\n\t}\n\n\treturn _client.Fetch(result)\n}", "title": "" }, { "docid": "3debe9d681139dee11d7aac4b2d35bb2", "score": "0.50357646", "text": "func (httpGet *ContainerHttpGet) Initialize_From_ContainerHttpGet_STATUS(source *ContainerHttpGet_STATUS) error {\n\n\t// HttpHeaders\n\tif source.HttpHeaders != nil {\n\t\thttpHeaderList := make([]HttpHeader, len(source.HttpHeaders))\n\t\tfor httpHeaderIndex, httpHeaderItem := range source.HttpHeaders {\n\t\t\t// Shadow the loop variable to avoid aliasing\n\t\t\thttpHeaderItem := httpHeaderItem\n\t\t\tvar httpHeader HttpHeader\n\t\t\terr := httpHeader.Initialize_From_HttpHeader_STATUS(&httpHeaderItem)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"calling Initialize_From_HttpHeader_STATUS() to populate field HttpHeaders\")\n\t\t\t}\n\t\t\thttpHeaderList[httpHeaderIndex] = httpHeader\n\t\t}\n\t\thttpGet.HttpHeaders = httpHeaderList\n\t} else {\n\t\thttpGet.HttpHeaders = nil\n\t}\n\n\t// Path\n\thttpGet.Path = genruntime.ClonePointerToString(source.Path)\n\n\t// Port\n\thttpGet.Port = genruntime.ClonePointerToInt(source.Port)\n\n\t// Scheme\n\tif source.Scheme != nil {\n\t\tscheme := ContainerHttpGet_Scheme(*source.Scheme)\n\t\thttpGet.Scheme = &scheme\n\t} else {\n\t\thttpGet.Scheme = nil\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "0c340e54096a9d194e906d2095f25208", "score": "0.50343114", "text": "func (handler TestHandler) GET(path string, headers map[string]string) TestResponse {\n return handler.request(http.MethodGet, path, headers)\n}", "title": "" }, { "docid": "6ad4edc3f945719faf2086bf3ed4b9e5", "score": "0.50089025", "text": "func NewListBlueprintsUsingGET1Unauthorized() *ListBlueprintsUsingGET1Unauthorized {\n\treturn &ListBlueprintsUsingGET1Unauthorized{}\n}", "title": "" }, { "docid": "eebd7530e2adc09ac2a903acb35aa5ae", "score": "0.5004575", "text": "func GetListsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ListsController, listID string, topBottom bool) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", topBottom)}\n\t\tquery[\"top_bottom\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/lists/%v\", listID),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"list_id\"] = []string{fmt.Sprintf(\"%v\", listID)}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", topBottom)}\n\t\tprms[\"top_bottom\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ListsTest\"), rw, req, prms)\n\tgetCtx, _err := app.NewGetListsContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.Get(getCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "99073435755b122bb3dba81a84cadca8", "score": "0.4995918", "text": "func (a DefaultApi) GetClusters(authorization string, xRequestID string, xGiantSwarmActivity string, xGiantSwarmCmdLine string) ([]V4ClusterListItem, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Get\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/v4/clusters/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"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}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// header params \"Authorization\"\n\tlocalVarHeaderParams[\"Authorization\"] = a.Configuration.APIClient.ParameterToString(authorization, \"\")\n\t// header params \"X-Request-ID\"\n\tlocalVarHeaderParams[\"X-Request-ID\"] = a.Configuration.APIClient.ParameterToString(xRequestID, \"\")\n\t// header params \"X-Giant-Swarm-Activity\"\n\tlocalVarHeaderParams[\"X-Giant-Swarm-Activity\"] = a.Configuration.APIClient.ParameterToString(xGiantSwarmActivity, \"\")\n\t// header params \"X-Giant-Swarm-CmdLine\"\n\tlocalVarHeaderParams[\"X-Giant-Swarm-CmdLine\"] = a.Configuration.APIClient.ParameterToString(xGiantSwarmCmdLine, \"\")\n\tvar successPayload = new([]V4ClusterListItem)\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: \"GetClusters\", 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": "5763c0e3714c1a1960694fa53ab4003b", "score": "0.498092", "text": "func NewGetNotFound() *GetNotFound {\n\n\treturn &GetNotFound{}\n}", "title": "" }, { "docid": "b1cfbfd7a50ac8061cd62c2e83aab80c", "score": "0.49780285", "text": "func GetAll(w http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "99fe8c9f859689cbb7ebadb5c2c58fa3", "score": "0.49775273", "text": "func NewNotFound() (int, http.Header, interface{}, error) {\n\treturn http.StatusNotFound, nil, nil, NotFoundError{ErrContentNotFound}\n}", "title": "" }, { "docid": "33bb2a173ac7c4405b5a53d1eb65af54", "score": "0.49639863", "text": "func NewGetNotFound() *GetNotFound {\n\treturn &GetNotFound{}\n}", "title": "" }, { "docid": "33bb2a173ac7c4405b5a53d1eb65af54", "score": "0.49639863", "text": "func NewGetNotFound() *GetNotFound {\n\treturn &GetNotFound{}\n}", "title": "" }, { "docid": "d9e69da906c324b289259aabf4f6b046", "score": "0.49630332", "text": "func (a *Client) ListUsingGET(params *ListUsingGETParams, opts ...ClientOption) (*ListUsingGETOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListUsingGETParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listUsingGET\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/cmx/api/resources/k8s/clusters\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListUsingGETReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListUsingGETOK)\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 listUsingGET: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "ad4576b30cfcc30823a7756687d43a7c", "score": "0.4953302", "text": "func NewGetApisNotFound() *GetApisNotFound {\n\n\treturn &GetApisNotFound{}\n}", "title": "" }, { "docid": "d7bb2a855f563020637b0ab631532c38", "score": "0.49504602", "text": "func (a *DeviceManagementGroupsV1ApiService) ListGroupsUsingGET1(ctx _context.Context) ApiListGroupsUsingGET1Request {\n\treturn ApiListGroupsUsingGET1Request{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "8301d20abf89df656c8d909b16d9bc04", "score": "0.4950211", "text": "func getUrl(w http.ResponseWriter, r *http.Request) {\n\tkey := strings.TrimPrefix(r.URL.Path, \"/api/v1/\")\n\n\tfor _, x := range data{\n\t\tif x.Key == key{\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t_, err := io.WriteString(w, x.Url)\n\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\tw.WriteHeader(http.StatusNotFound)\n\treturn\n}", "title": "" }, { "docid": "f57df85bb9dbbb28b06cd04c768ecb54", "score": "0.49490806", "text": "func GetAll(client *speedycloud.ServiceClient) GetResult {\n var res GetResult\n _, res.Err = client.Post(listURL(client), bytes.NewBufferString(\"\"), &res.Body, nil)\n\n return res\n}", "title": "" }, { "docid": "a55c2334d1081943d13e9ed2c84bb42b", "score": "0.4945825", "text": "func NewGetPaymentInfosUsingGETNotFound() *GetPaymentInfosUsingGETNotFound {\n\treturn &GetPaymentInfosUsingGETNotFound{}\n}", "title": "" }, { "docid": "6f4ce4bdeffcde936b955aaf02ca1a5d", "score": "0.49377334", "text": "func ListEventsBadRequest1(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.EventsController, page int, q string, sort string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{q}\n\t\tquery[\"q\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{sort}\n\t\tquery[\"sort\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/events/new\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{q}\n\t\tprms[\"q\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{sort}\n\t\tprms[\"sort\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"EventsTest\"), rw, req, prms)\n\tlistCtx, err := app.NewListEventsContext(goaCtx, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.List(listCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %s, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 400 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 400\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got %+v, expected instance of error\", resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "418c97a6f375a8ebcd1bb1a501438635", "score": "0.49368116", "text": "func GetAll() {}", "title": "" }, { "docid": "f0593a4e0b8375c7de408cb894477fe5", "score": "0.49360642", "text": "func NewGetCartEntriesUsingGETNotFound() *GetCartEntriesUsingGETNotFound {\n\treturn &GetCartEntriesUsingGETNotFound{}\n}", "title": "" }, { "docid": "b6a745c521362ee45ac09d6976796382", "score": "0.49328086", "text": "func (a *OrdersApiService) V1OrdersGet(ctx _context.Context, localVarOptionals *V1OrdersGetOpts) ([]Order, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []Order\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/orders\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.ExchangeId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"exchange_id\", parameterToString(localVarOptionals.ExchangeId.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\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "2bc0aaff7295921971aa479f6a6c2e87", "score": "0.492728", "text": "func (a *ProjectControllerApiService) AllUsingGET3(ctx _context.Context) apiAllUsingGET3Request {\n\treturn apiAllUsingGET3Request{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "2080284c2ca1384f9a3c3b10a207810c", "score": "0.49258572", "text": "func getTestRequests() []struct {\n\tverb string\n\tURL string\n\tbody string\n} {\n\trequests := []struct {\n\t\tverb string\n\t\tURL string\n\t\tbody string\n\t}{\n\t\t// Normal methods on pods\n\t\t{\"GET\", \"/api/v1beta1/pods\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/pods/a\", \"\"},\n\t\t{\"POST\", \"/api/v1beta1/pods\", aPod},\n\t\t{\"PUT\", \"/api/v1beta1/pods\", aPod},\n\t\t{\"GET\", \"/api/v1beta1/pods\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/pods/a\", \"\"},\n\t\t{\"DELETE\", \"/api/v1beta1/pods\", \"\"},\n\n\t\t// Non-standard methods (not expected to work,\n\t\t// but expected to pass/fail authorization prior to\n\t\t// failing validation.\n\t\t{\"PATCH\", \"/api/v1beta1/pods/a\", \"\"},\n\t\t{\"OPTIONS\", \"/api/v1beta1/pods\", \"\"},\n\t\t{\"OPTIONS\", \"/api/v1beta1/pods/a\", \"\"},\n\t\t{\"HEAD\", \"/api/v1beta1/pods\", \"\"},\n\t\t{\"HEAD\", \"/api/v1beta1/pods/a\", \"\"},\n\t\t{\"TRACE\", \"/api/v1beta1/pods\", \"\"},\n\t\t{\"TRACE\", \"/api/v1beta1/pods/a\", \"\"},\n\t\t{\"NOSUCHVERB\", \"/api/v1beta1/pods\", \"\"},\n\n\t\t// Normal methods on services\n\t\t{\"GET\", \"/api/v1beta1/services\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/services/a\", \"\"},\n\t\t{\"POST\", \"/api/v1beta1/services\", aService},\n\t\t{\"PUT\", \"/api/v1beta1/services\", aService},\n\t\t{\"GET\", \"/api/v1beta1/services\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/services/a\", \"\"},\n\t\t{\"DELETE\", \"/api/v1beta1/services\", \"\"},\n\n\t\t// Normal methods on replicationControllers\n\t\t{\"GET\", \"/api/v1beta1/replicationControllers\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/replicationControllers/a\", \"\"},\n\t\t{\"POST\", \"/api/v1beta1/replicationControllers\", aRC},\n\t\t{\"PUT\", \"/api/v1beta1/replicationControllers\", aRC},\n\t\t{\"GET\", \"/api/v1beta1/replicationControllers\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/replicationControllers/a\", \"\"},\n\t\t{\"DELETE\", \"/api/v1beta1/replicationControllers\", \"\"},\n\n\t\t// Normal methods on endpoints\n\t\t{\"GET\", \"/api/v1beta1/endpoints\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/endpoints/a\", \"\"},\n\t\t{\"POST\", \"/api/v1beta1/endpoints\", aEndpoints},\n\t\t{\"PUT\", \"/api/v1beta1/endpoints\", aEndpoints},\n\t\t{\"GET\", \"/api/v1beta1/endpoints\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/endpoints/a\", \"\"},\n\t\t{\"DELETE\", \"/api/v1beta1/endpoints\", \"\"},\n\n\t\t// Normal methods on minions\n\t\t{\"GET\", \"/api/v1beta1/minions\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/minions/a\", \"\"},\n\t\t{\"POST\", \"/api/v1beta1/minions\", aMinion},\n\t\t{\"PUT\", \"/api/v1beta1/minions\", aMinion},\n\t\t{\"GET\", \"/api/v1beta1/minions\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/minions/a\", \"\"},\n\t\t{\"DELETE\", \"/api/v1beta1/minions\", \"\"},\n\n\t\t// Normal methods on events\n\t\t{\"GET\", \"/api/v1beta1/events\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/events/a\", \"\"},\n\t\t{\"POST\", \"/api/v1beta1/events\", aEvent},\n\t\t{\"PUT\", \"/api/v1beta1/events\", aEvent},\n\t\t{\"GET\", \"/api/v1beta1/events\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/events/a\", \"\"},\n\t\t{\"DELETE\", \"/api/v1beta1/events\", \"\"},\n\n\t\t// Normal methods on bindings\n\t\t{\"GET\", \"/api/v1beta1/events\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/events/a\", \"\"},\n\t\t{\"POST\", \"/api/v1beta1/events\", aBinding},\n\t\t{\"PUT\", \"/api/v1beta1/events\", aBinding},\n\t\t{\"GET\", \"/api/v1beta1/events\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/events/a\", \"\"},\n\t\t{\"DELETE\", \"/api/v1beta1/events\", \"\"},\n\n\t\t// Non-existent object type.\n\t\t{\"GET\", \"/api/v1beta1/foo\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/foo/a\", \"\"},\n\t\t{\"POST\", \"/api/v1beta1/foo\", `{\"foo\": \"foo\"}`},\n\t\t{\"PUT\", \"/api/v1beta1/foo\", `{\"foo\": \"foo\"}`},\n\t\t{\"GET\", \"/api/v1beta1/foo\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/foo/a\", \"\"},\n\t\t{\"DELETE\", \"/api/v1beta1/foo\", \"\"},\n\n\t\t// Operations\n\t\t{\"GET\", \"/api/v1beta1/operations\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/operations/1234567890\", \"\"},\n\n\t\t// Special verbs on pods\n\t\t{\"GET\", \"/api/v1beta1/proxy/pods/a\", \"\"},\n\t\t{\"GET\", \"/api/v1beta1/redirect/pods/a\", \"\"},\n\t\t// TODO: test .../watch/..., which doesn't end before the test timeout.\n\n\t\t// Non-object endpoints\n\t\t{\"GET\", \"/\", \"\"},\n\t\t{\"GET\", \"/healthz\", \"\"},\n\t\t{\"GET\", \"/versions\", \"\"},\n\t}\n\treturn requests\n}", "title": "" }, { "docid": "5f2ee19d262bf82e79aceb34f5e40efb", "score": "0.4925545", "text": "func ItemsGET(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tvar result *model.Result\n\tvar err error\n\n\tkind := item.Kind(ps.ByName(\"kind\"))\n\tif !kind.IsValid() {\n\t\ts := &Status{}\n\t\ts.NotFound(\"Kind not found\").Render(w)\n\t\treturn\n\t}\n\n\topts := &item.Options{Sort: getSort(\"-_modified\", r)}\n\topts.Limit, opts.Offset = getLimitOffset(r)\n\nLoop:\n\tfor p, v := range r.URL.Query() {\n\t\tswitch p {\n\t\tcase \"id\":\n\t\t\tq, err := url.QueryUnescape(v[0])\n\t\t\tif err != nil {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(fmt.Sprintf(\"Query string error: %s\", err.Error())).Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif len(q) < 24 {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(\"ID is not valid\").Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tids := strings.Split(q, \",\")\n\t\t\tif len(ids) > 100 {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(\"ID limit exceeded\").Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tresult, err = item.GetByIDs(ids, kind, opts)\n\t\t\tif err != nil {\n\t\t\t\ts := &Status{}\n\t\t\t\tswitch err {\n\t\t\t\tcase model.ErrInvalidInput:\n\t\t\t\t\ts.UnprocessableEntity(\"Query contains an invalid ID\").Render(w)\n\t\t\t\tcase model.ErrInternalError:\n\t\t\t\t\ts.InternalServerError(\"Network or database error\").Render(w)\n\t\t\t\tdefault:\n\t\t\t\t\ts.InternalServerError(\"Internal error\").Render(w)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tbreak Loop\n\t\tcase \"text\":\n\t\t\ttxt, err := url.QueryUnescape(v[0])\n\t\t\tif err != nil {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(fmt.Sprintf(\"Query string error: %s\", err.Error())).Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tresult, err = item.GetByText(txt, opts, kind)\n\t\t\tif err != nil {\n\t\t\t\thandleError(err, w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tbreak Loop\n\t\t}\n\t}\n\n\tif result == nil {\n\t\tqs := make(map[string]interface{})\n\n\t\tswitch kind {\n\t\tcase item.KindArmor:\n\t\t\terr = getQueryType(r.URL, qs)\n\t\t\terr = getQueryArmorClass(r.URL, qs)\n\t\tcase item.KindFirearm:\n\t\t\terr = getQueryType(r.URL, qs)\n\t\t\terr = getQueryClass(r.URL, qs)\n\t\t\terr = getQueryCaliber(r.URL, qs)\n\t\tcase item.KindTacticalrig:\n\t\t\terr = getQueryArmorClass(r.URL, qs)\n\t\tcase item.KindAmmunition:\n\t\t\terr = getQueryType(r.URL, qs)\n\t\t\terr = getQueryCaliber(r.URL, qs)\n\t\tcase item.KindMagazine:\n\t\t\terr = getQueryCaliber(r.URL, qs)\n\t\tcase item.KindMedical, item.KindFood, item.KindGrenade, item.KindClothing, item.KindModificationMuzzle, item.KindModificationDevice, item.KindModificationSight, item.KindModificationSightSpecial, item.KindModificationGoggles:\n\t\t\terr = getQueryType(r.URL, qs)\n\t\t}\n\t\tif err != nil {\n\t\t\ts := &Status{}\n\t\t\ts.BadRequest(fmt.Sprintf(\"Query string error: %s\", err.Error())).Render(w)\n\t\t\treturn\n\t\t}\n\n\t\tresult, err = item.GetAll(qs, kind, opts)\n\t\tif err != nil {\n\t\t\thandleError(err, w)\n\t\t\treturn\n\t\t}\n\t}\n\n\tview.RenderJSON(result, http.StatusOK, w)\n}", "title": "" }, { "docid": "7763d6aa2d26db2f836eb70de6b4a030", "score": "0.49135834", "text": "func (a *TaskControllerApiService) GetTaskUsingGET1(ctx _context.Context, id string) apiGetTaskUsingGET1Request {\n\treturn apiGetTaskUsingGET1Request{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "5b829ef3102ed580495b14815267fc83", "score": "0.4909082", "text": "func NewGetTerraformVersionUsingGETNotFound() *GetTerraformVersionUsingGETNotFound {\n\treturn &GetTerraformVersionUsingGETNotFound{}\n}", "title": "" }, { "docid": "b167eff43ff8966d08ea017fad7b261f", "score": "0.49026647", "text": "func NewGetTerraformConfigurationSourceCommitListUsingGET1Unauthorized() *GetTerraformConfigurationSourceCommitListUsingGET1Unauthorized {\n\treturn &GetTerraformConfigurationSourceCommitListUsingGET1Unauthorized{}\n}", "title": "" }, { "docid": "499de0f0b41c5233a84e940f12527073", "score": "0.48996377", "text": "func NewGetNotFound(body *GetNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "2d05579ecc60cc788cbcfd54052af802", "score": "0.48983487", "text": "func Get(url string, response interface{}) (int, error) {\n request, err := http.NewRequest(\"GET\", url, bytes.NewReader([]byte{}))\n if err != nil {\n return 0, err\n }\n for key, value := range RequestHeaders {\n request.Header.Set(key,value)\n }\n var client = &http.Client{Timeout: 30 * time.Second}\n resp, err := client.Do(request)\n if err != nil {\n if resp != nil {\n return resp.StatusCode, err\n }\n return 0, err\n }\n read, err := ioutil.ReadAll(resp.Body)\n if err != nil {\n return resp.StatusCode, err\n }\n resp.Body.Close()\n err = json.Unmarshal(read,response)\n if err != nil {\n return resp.StatusCode, err\n }\n return resp.StatusCode, nil\n}", "title": "" }, { "docid": "ff357c9ed1db57d2c30d66f87a18abf0", "score": "0.48919713", "text": "func NewGetEventLogsUsingGETNotFound() *GetEventLogsUsingGETNotFound {\n\treturn &GetEventLogsUsingGETNotFound{}\n}", "title": "" }, { "docid": "dcacc988bdea2d21a39e6f55e535353d", "score": "0.4889427", "text": "func NewGetOneNotFound() *GetOneNotFound {\n\n\treturn &GetOneNotFound{}\n}", "title": "" }, { "docid": "9cfd0d060b3d346ea9ee5c363e73b20b", "score": "0.48882708", "text": "func NewGetRequestUsingGET2NotFound() *GetRequestUsingGET2NotFound {\n\treturn &GetRequestUsingGET2NotFound{}\n}", "title": "" }, { "docid": "f54b4076952c05b89c69bbb8f5f47269", "score": "0.48830903", "text": "func GetPercentileListsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ListsController, listID string, fromTop string, range_ int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{fromTop}\n\t\tquery[\"from_top\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(range_)}\n\t\tquery[\"range\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/lists/%v/percentile\", listID),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"list_id\"] = []string{fmt.Sprintf(\"%v\", listID)}\n\t{\n\t\tsliceVal := []string{fromTop}\n\t\tprms[\"from_top\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(range_)}\n\t\tprms[\"range\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ListsTest\"), rw, req, prms)\n\tgetPercentileCtx, _err := app.NewGetPercentileListsContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.GetPercentile(getPercentileCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "2ab91c977e3804b5b2f2a74ecf914a9b", "score": "0.4882218", "text": "func ItemIndexGET(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tvar err error\n\tvar i interface{}\n\n\tsearch := r.URL.Query().Get(\"search\")\n\tswitch {\n\tcase len(search) > 0:\n\t\ttxt, err := url.QueryUnescape(search)\n\t\tif err != nil {\n\t\t\ts := &Status{}\n\t\t\ts.BadRequest(fmt.Sprintf(\"Query string error: %s\", err)).Render(w)\n\t\t\treturn\n\t\t}\n\n\t\tif l := len(txt); l < 3 || l > 32 {\n\t\t\ts := &Status{}\n\t\t\ts.BadRequest(\"Query string has an invalid length\").Render(w)\n\t\t\treturn\n\t\t}\n\n\t\tif !isAlnumBlankPunct(txt) {\n\t\t\ts := &Status{}\n\t\t\ts.BadRequest(\"Query string contains invalid characters\").Render(w)\n\t\t\treturn\n\t\t}\n\n\t\topts := &item.Options{}\n\t\topts.Limit, opts.Offset = getLimitOffset(r)\n\n\t\ti, err = item.GetByText(txt, opts)\n\t\tif err != nil {\n\t\t\thandleError(err, w)\n\t\t\treturn\n\t\t}\n\tdefault:\n\t\tvar skipKinds bool\n\n\t\tif skip := r.URL.Query().Get(\"skipKinds\"); len(skip) > 0 {\n\t\t\tif skip == \"1\" {\n\t\t\t\tskipKinds = true\n\t\t\t}\n\t\t}\n\n\t\ti, err = item.GetIndex(skipKinds)\n\t\tif err != nil {\n\t\t\thandleError(err, w)\n\t\t\treturn\n\t\t}\n\t}\n\n\tview.RenderJSON(i, http.StatusOK, w)\n}", "title": "" }, { "docid": "40b9432d698eb8c686dd34fb303412fb", "score": "0.4868063", "text": "func (a *Client) NearestUsingGET1(params *NearestUsingGET1Params, authInfo runtime.ClientAuthInfoWriter) (*NearestUsingGET1OK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewNearestUsingGET1Params()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"nearestUsingGET_1\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v2/measurements/nearest\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &NearestUsingGET1Reader{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.(*NearestUsingGET1OK)\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 nearestUsingGET_1: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "1f69c89c2d34c7d8422a81ed0abdb0fd", "score": "0.48648995", "text": "func NewGetAllVariablesUsingGETNotFound() *GetAllVariablesUsingGETNotFound {\n\treturn &GetAllVariablesUsingGETNotFound{}\n}", "title": "" }, { "docid": "da0b5a3e015f5cbd0d3de49a03d92d6e", "score": "0.48612538", "text": "func NewGetAllEndpointsUsingGETUnauthorized() *GetAllEndpointsUsingGETUnauthorized {\n\treturn &GetAllEndpointsUsingGETUnauthorized{}\n}", "title": "" }, { "docid": "c6062d843045edde7674640fa34a5daf", "score": "0.48511901", "text": "func NewGetAllExternalRolesUsingGETNotFound() *GetAllExternalRolesUsingGETNotFound {\n\treturn &GetAllExternalRolesUsingGETNotFound{}\n}", "title": "" }, { "docid": "940582dd6641a139f876ceda407197a5", "score": "0.483683", "text": "func (h *Hosttemplates) Get(url, endpoint, folder string, data []string) (e error) {\n\n\t// accept bad certs\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\tDisableKeepAlives: true,\n\t}\n\tclient := &http.Client{Transport: tr}\n\t// Not available in Go<1.3\n\t//client.Timeout = 8 * 1e9\n\n\tfor strings.HasSuffix(url, \"/\") {\n\t\turl = strings.TrimSuffix(url, \"/\")\n\t}\n\tfor strings.HasSuffix(endpoint, \"/\") {\n\t\turl = strings.TrimSuffix(endpoint, \"/\")\n\t}\n\n\t// Construct url, http://1.2.3.4/rest/show/hosts?json={\"folder\":\"local\",...}\n\tfullUrl := url + \"/\" + endpoint + \"?json={\\\"folder\\\":\\\"\" + folder + \"\\\"\"\n\tdataStr, err := FormatData(data, \"services\")\n\tif err != nil {\n\t\ttxt := fmt.Sprintf(\"Could not format data. Check the '-d' option.\")\n\t\treturn HttpError{txt}\n\t}\n\tif dataStr != \"\" {\n\t\tfullUrl += \",\" + dataStr\n\t}\n\tfullUrl += \"}\"\n\n\t//fmt.Printf(\"URL=%s\\n\", fullUrl)\n\n\t//fmt.Printf(\"%s\\n\", url+\"/\"+endpoint)\n\t//resp, err := client.Get(fullUrl)\n\treq, err := http.NewRequest(\"GET\", fullUrl, nil)\n\tif len(h.username) > 0 {\n\t\treq.SetBasicAuth(h.username, h.password)\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\ttxt := fmt.Sprintf(\"Could not send REST request ('%s').\", err.Error())\n\t\treturn HttpError{txt}\n\t}\n\n\tdefer resp.Body.Close()\n\n\tvar body []byte\n\tif b, err := ioutil.ReadAll(resp.Body); err != nil {\n\t\ttxt := fmt.Sprintf(\"Error reading Body ('%s').\", err.Error())\n\t\treturn HttpError{txt}\n\t} else {\n\t\tbody = b\n\t}\n\n\tif resp.StatusCode != 200 {\n\n\t\tresponse, _ := UrlDecode(string(body))\n\t\ttxt := fmt.Sprintf(\"Status (%d): %s\", resp.StatusCode, response)\n\t\treturn HttpError{txt}\n\n\t} else {\n\n\t\tvar generic interface{}\n\t\tif err := json.Unmarshal(body, &generic); err != nil {\n\t\t\ttxt := fmt.Sprintf(\"Status (%d) Error decoding JSON (%s).\",\n\t\t\t\tresp.StatusCode, err.Error())\n\t\t\treturn HttpError{txt}\n\t\t}\n\t\tgenericReply := generic.([]interface{})\n\n\t\t//fmt.Printf(\"%s\\n\", body)\n\n\t\tfor _, j := range genericReply {\n\t\t\thosttemplate := hosttemplate{}\n\t\t\tfor _, j2 := range j.([]interface{}) {\n\t\t\t\tcontent := j2.(map[string]interface{})\n\t\t\t\tfor k, v := range content {\n\t\t\t\t\tswitch k {\n\t\t\t\t\tcase \"name\":\n\t\t\t\t\t\thosttemplate.name = v.(string)\n\t\t\t\t\tcase \"use\":\n\t\t\t\t\t\thosttemplate.use = v.(string)\n\t\t\t\t\tcase \"contacts\":\n\t\t\t\t\t\thosttemplate.contacts = v.(string)\n\t\t\t\t\tcase \"contactgroups\":\n\t\t\t\t\t\thosttemplate.contactgroups = v.(string)\n\t\t\t\t\tcase \"normchecki\":\n\t\t\t\t\t\thosttemplate.normchecki = v.(string)\n\t\t\t\t\tcase \"checkinterval\":\n\t\t\t\t\t\thosttemplate.checkinterval = v.(string)\n\t\t\t\t\tcase \"retryinterval\":\n\t\t\t\t\t\thosttemplate.retryinterval = v.(string)\n\t\t\t\t\tcase \"notifperiod\":\n\t\t\t\t\t\thosttemplate.notifperiod = v.(string)\n\t\t\t\t\tcase \"notifopts\":\n\t\t\t\t\t\thosttemplate.notifopts = v.(string)\n\t\t\t\t\tcase \"disable\":\n\t\t\t\t\t\thosttemplate.disable = v.(string)\n\t\t\t\t\tcase \"checkperiod\":\n\t\t\t\t\t\thosttemplate.checkperiod = v.(string)\n\t\t\t\t\tcase \"maxcheckattempts\":\n\t\t\t\t\t\thosttemplate.maxcheckattempts = v.(string)\n\t\t\t\t\tcase \"checkcommand\":\n\t\t\t\t\t\thosttemplate.checkcommand, _ = UrlDecode(v.(string))\n\t\t\t\t\tcase \"notifinterval\":\n\t\t\t\t\t\thosttemplate.notifinterval = v.(string)\n\t\t\t\t\tcase \"passivechecks\":\n\t\t\t\t\t\thosttemplate.passivechecks = v.(string)\n\t\t\t\t\tcase \"obsessoverhost\":\n\t\t\t\t\t\thosttemplate.obsessoverhost = v.(string)\n\t\t\t\t\tcase \"checkfreshness\":\n\t\t\t\t\t\thosttemplate.checkfreshness = v.(string)\n\t\t\t\t\tcase \"freshnessthresh\":\n\t\t\t\t\t\thosttemplate.freshnessthresh = v.(string)\n\t\t\t\t\tcase \"eventhandler\":\n\t\t\t\t\t\thosttemplate.eventhandler = v.(string)\n\t\t\t\t\tcase \"eventhandlerenabled\":\n\t\t\t\t\t\thosttemplate.eventhandlerenabled = v.(string)\n\t\t\t\t\tcase \"lowflapthresh\":\n\t\t\t\t\t\thosttemplate.lowflapthresh = v.(string)\n\t\t\t\t\tcase \"highflapthresh\":\n\t\t\t\t\t\thosttemplate.highflapthresh = v.(string)\n\t\t\t\t\tcase \"flapdetectionenabled\":\n\t\t\t\t\t\thosttemplate.flapdetectionenabled = v.(string)\n\t\t\t\t\tcase \"flapdetectionoptions\":\n\t\t\t\t\t\thosttemplate.flapdetectionoptions = v.(string)\n\t\t\t\t\tcase \"processperfdata\":\n\t\t\t\t\t\thosttemplate.processperfdata = v.(string)\n\t\t\t\t\tcase \"retainstatusinfo\":\n\t\t\t\t\t\thosttemplate.retainstatusinfo = v.(string)\n\t\t\t\t\tcase \"retainnonstatusinfo\":\n\t\t\t\t\t\thosttemplate.retainnonstatusinfo = v.(string)\n\t\t\t\t\tcase \"firstnotifdelay\":\n\t\t\t\t\t\thosttemplate.firstnotifdelay = v.(string)\n\t\t\t\t\tcase \"notifications_enabled\":\n\t\t\t\t\t\thosttemplate.notifications_enabled = v.(string)\n\t\t\t\t\tcase \"stalkingoptions\":\n\t\t\t\t\t\thosttemplate.stalkingoptions = v.(string)\n\t\t\t\t\tcase \"notes\":\n\t\t\t\t\t\thosttemplate.notes = v.(string)\n\t\t\t\t\tcase \"notes_url\":\n\t\t\t\t\t\thosttemplate.notes_url = v.(string)\n\t\t\t\t\tcase \"icon_image\":\n\t\t\t\t\t\thosttemplate.icon_image = v.(string)\n\t\t\t\t\tcase \"icon_image_alt\":\n\t\t\t\t\t\thosttemplate.icon_image_alt = v.(string)\n\t\t\t\t\tcase \"vrml_image\":\n\t\t\t\t\t\thosttemplate.vrml_image = v.(string)\n\t\t\t\t\tcase \"statusmap_image\":\n\t\t\t\t\t\thosttemplate.statusmap_image = v.(string)\n\t\t\t\t\tcase \"coords2d\":\n\t\t\t\t\t\thosttemplate.coords2d = v.(string)\n\t\t\t\t\tcase \"coords3d\":\n\t\t\t\t\t\thosttemplate.coords3d = v.(string)\n\t\t\t\t\tcase \"action_url\":\n\t\t\t\t\t\thosttemplate.action_url, _ = UrlDecode(v.(string))\n\t\t\t\t\tcase \"customvars\":\n\t\t\t\t\t\thosttemplate.customvars = v.(string)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\th.hosttemplates = append(h.hosttemplates, hosttemplate)\n\t\t}\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "0be02587d49ef9625f622a18fa6f0b49", "score": "0.48339444", "text": "func (t *Transfer) All(queryParams map[string]interface{}, extraHeaders map[string]string) (map[string]interface{}, error) {\n\turl := fmt.Sprintf(\"/%s%s\", constants.VERSION_V1, constants.TRANSFER_URL)\n\treturn t.Request.Get(url, queryParams, extraHeaders)\n}", "title": "" }, { "docid": "d28f5f0e2133d33d40dbd9a3d31f4a70", "score": "0.4833905", "text": "func (store UfStore) GetAll(page_num int, page_size int) []models.UFResponse {\n\t// calcular a paginacao\n\tskips := page_size * (page_num - 1)\n\n\t// fazer a busca no banco de dados\n\tvar b []models.UFResponse\n\titer := store.C.Find(nil).Skip(skips).Limit(page_size).Sort(\"codigo\").Iter()\n\n\tresult := models.UFResponse{}\n\t// Uf adaptado para listar somente os campos a serem exibidos\n\tUf := models.UFResponse{}\n\tfor iter.Next(&result) {\n\t\t// adiciona os links\n\t\tlinks := []commons.Link{commons.Link{Name:\"self\",Method:\"GET\",Href:\"/ibge/v3/Ufs/\"+strconv.Itoa(result.Codigo)}}\n\t\tUf.ID = result.ID\n\t\tUf.Codigo = result.Codigo\n\t\tUf.Nome = result.Nome\n\t\tUf.Sigla = result.Sigla\n\t\tUf.Links = links\n\t\t// anexa o documento a lista\n\t\tb = append(b, Uf)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "aad223aaaa99bb3085a7a14a3c66820e", "score": "0.48235497", "text": "func TestListObjectsV1Resources(t *testing.T) {\n\ttestCases := []struct {\n\t\tvalues url.Values\n\t\tprefix, marker, delimiter string\n\t\tmaxKeys int\n\t\tencodingType string\n\t}{\n\t\t{\n\t\t\tvalues: url.Values{\n\t\t\t\t\"prefix\": []string{\"photos/\"},\n\t\t\t\t\"marker\": []string{\"test\"},\n\t\t\t\t\"delimiter\": []string{SlashSeparator},\n\t\t\t\t\"max-keys\": []string{\"100\"},\n\t\t\t\t\"encoding-type\": []string{\"gzip\"},\n\t\t\t},\n\t\t\tprefix: \"photos/\",\n\t\t\tmarker: \"test\",\n\t\t\tdelimiter: SlashSeparator,\n\t\t\tmaxKeys: 100,\n\t\t\tencodingType: \"gzip\",\n\t\t},\n\t\t{\n\t\t\tvalues: url.Values{\n\t\t\t\t\"prefix\": []string{\"photos/\"},\n\t\t\t\t\"marker\": []string{\"test\"},\n\t\t\t\t\"delimiter\": []string{SlashSeparator},\n\t\t\t\t\"encoding-type\": []string{\"gzip\"},\n\t\t\t},\n\t\t\tprefix: \"photos/\",\n\t\t\tmarker: \"test\",\n\t\t\tdelimiter: SlashSeparator,\n\t\t\tmaxKeys: maxObjectList,\n\t\t\tencodingType: \"gzip\",\n\t\t},\n\t}\n\n\tfor i, testCase := range testCases {\n\t\tprefix, marker, delimiter, maxKeys, encodingType, argsErr := getListObjectsV1Args(testCase.values)\n\t\tif argsErr != ErrNone {\n\t\t\tt.Errorf(\"Test %d: argument parsing failed, got %v\", i+1, argsErr)\n\t\t}\n\t\tif prefix != testCase.prefix {\n\t\t\tt.Errorf(\"Test %d: Expected %s, got %s\", i+1, testCase.prefix, prefix)\n\t\t}\n\t\tif marker != testCase.marker {\n\t\t\tt.Errorf(\"Test %d: Expected %s, got %s\", i+1, testCase.marker, marker)\n\t\t}\n\t\tif delimiter != testCase.delimiter {\n\t\t\tt.Errorf(\"Test %d: Expected %s, got %s\", i+1, testCase.delimiter, delimiter)\n\t\t}\n\t\tif maxKeys != testCase.maxKeys {\n\t\t\tt.Errorf(\"Test %d: Expected %d, got %d\", i+1, testCase.maxKeys, maxKeys)\n\t\t}\n\t\tif encodingType != testCase.encodingType {\n\t\t\tt.Errorf(\"Test %d: Expected %s, got %s\", i+1, testCase.encodingType, encodingType)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "765974bd12b3771cc8b141decc65c829", "score": "0.48200217", "text": "func (a *Client) GetBlueprintRequestUsingGET1(params *GetBlueprintRequestUsingGET1Params, opts ...ClientOption) (*GetBlueprintRequestUsingGET1OK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetBlueprintRequestUsingGET1Params()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getBlueprintRequestUsingGET_1\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/blueprint/api/blueprint-requests/{requestId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetBlueprintRequestUsingGET1Reader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetBlueprintRequestUsingGET1OK)\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 getBlueprintRequestUsingGET_1: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "88390d4c2e1bc8a44588f7959ed4ead7", "score": "0.48109287", "text": "func (cache *lru) GetWithHeaders(url url.URL) (fi *bytes.Buffer, h http.Header, err error) {\n\tcache.Lock()\n\tdefer cache.Unlock()\n\n\tfi, h, err = cache.getResource(url)\n\treturn\n}", "title": "" }, { "docid": "94d986aa1f0f91ce41b2bbca5ed6ff06", "score": "0.4808355", "text": "func DefaultHeaders() map[string]string {\n headers := make(map[string]string)\n headers[\"Content-Type\"] = \"application/json\"\n headers[\"Connection\"] = \"close\"\n return headers\n}", "title": "" }, { "docid": "ccb2e301c6fa3d24ab97ac5315a1c8c4", "score": "0.47998017", "text": "func get(u string) (*http.Response,error){\n client := http.Client{}\n req, _ := http.NewRequest(\"GET\", u,nil)\n h:=get_headers()\n for k,v := range h{\n \t req.Header.Add(k, v)\n }\n\t return client.Do(req)\n}", "title": "" }, { "docid": "129b1bce670ccc313de0d4ec7139c363", "score": "0.4798761", "text": "func SearchDefaultRouter(resp *http.Response) error {\n return fmt.Errorf(\"status code %d\", resp.StatusCode)\n}", "title": "" }, { "docid": "d07fef0b6864f11deb96d94e3e670248", "score": "0.47978932", "text": "func SearchDefaultRouter(resp *http.Response, _ interface{}) error {\n\treturn fmt.Errorf(\"status code %d\", resp.StatusCode)\n}", "title": "" }, { "docid": "00cc7a4fb80ad7fb2953a0bfaf260127", "score": "0.47958335", "text": "func NewGetUsingGET3NotFound() *GetUsingGET3NotFound {\n\treturn &GetUsingGET3NotFound{}\n}", "title": "" }, { "docid": "384c1ff70bfb8b0df47acfca47b0ae8b", "score": "0.4792815", "text": "func (h Handler) makeGetOne(v Injection) http.HandlerFunc {\n\n\ttype APIDocs struct {\n\t\tResolutionValue struct{}\n\t}\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tparams := mux.Vars(r)\n\t\tmtx.Lock()\n\t\titem, ok := v.Nearby[params[\"id\"]]\n\t\tmtx.Unlock()\n\t\tif ok {\n\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t} else {\n\t\t\tio.WriteString(w, \"null\")\n\t\t}\n\t})\n}", "title": "" }, { "docid": "45a8f73254a9e24cf8bbd12b73de553d", "score": "0.4783428", "text": "func ItemsGET(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tvar result *model.Result\n\tvar err error\n\n\tkind := item.Kind(ps.ByName(\"kind\"))\n\tif !kind.IsValid() {\n\t\ts := &Status{}\n\t\ts.NotFound(\"Kind not found\").Render(w)\n\t\treturn\n\t}\n\n\topts := &item.Options{Sort: getSort(\"-_modified\", r)}\n\topts.Limit, opts.Offset = getLimitOffset(r)\n\nLoop:\n\tfor p, v := range r.URL.Query() {\n\t\tswitch p {\n\t\tcase \"id\":\n\t\t\tq, err := url.QueryUnescape(v[0])\n\t\t\tif err != nil {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(fmt.Sprintf(\"Query string error: %s\", err)).Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif len(q) < 24 {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(\"ID is not valid\").Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tids := strings.Split(q, \",\")\n\t\t\tif len(ids) > 100 {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(\"ID limit exceeded\").Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tresult, err = item.GetByIDs(ids, kind, opts)\n\t\t\tif err != nil {\n\t\t\t\ts := &Status{}\n\t\t\t\tswitch err {\n\t\t\t\tcase model.ErrInvalidInput:\n\t\t\t\t\ts.UnprocessableEntity(\"Query contains an invalid ID\").Render(w)\n\t\t\t\tcase model.ErrInternalError:\n\t\t\t\t\ts.InternalServerError(\"Network or database error\").Render(w)\n\t\t\t\tdefault:\n\t\t\t\t\ts.InternalServerError(\"Internal error\").Render(w)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tbreak Loop\n\t\tcase \"text\":\n\t\t\ttxt, err := url.QueryUnescape(v[0])\n\t\t\tif err != nil {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(fmt.Sprintf(\"Query string error: %s\", err)).Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif l := len(txt); l < 3 || l > 32 {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(\"Query string has an invalid length\").Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif !isAlnumBlankPunct(txt) {\n\t\t\t\ts := &Status{}\n\t\t\t\ts.BadRequest(\"Query string contains invalid characters\").Render(w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tresult, err = item.GetByText(txt, opts, kind)\n\t\t\tif err != nil {\n\t\t\t\thandleError(err, w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tbreak Loop\n\t\t}\n\t}\n\n\tif result == nil {\n\t\tfilter := model.Filter{}\n\n\t\tswitch kind {\n\t\tcase item.KindArmor:\n\t\t\terr = filter.AddString(\"type\", r.URL.Query().Get(\"type\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr = filter.AddInt(\"armor.class\", r.URL.Query().Get(\"armor.class\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr = filter.AddString(\"armor.material.name\", r.URL.Query().Get(\"armor.material.name\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase item.KindFirearm:\n\t\t\terr = filter.AddString(\"type\", r.URL.Query().Get(\"type\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr = filter.AddString(\"class\", r.URL.Query().Get(\"class\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr = filter.AddString(\"caliber\", r.URL.Query().Get(\"caliber\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase item.KindTacticalrig:\n\t\t\terr = filter.AddInt(\"armor.class\", r.URL.Query().Get(\"armor.class\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr = filter.AddString(\"armor.material.name\", r.URL.Query().Get(\"armor.material.name\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase item.KindAmmunition:\n\t\t\terr = filter.AddString(\"type\", r.URL.Query().Get(\"type\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr = filter.AddString(\"caliber\", r.URL.Query().Get(\"caliber\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase item.KindMagazine:\n\t\t\terr = filter.AddString(\"caliber\", r.URL.Query().Get(\"caliber\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase item.KindMedical, item.KindFood, item.KindGrenade, item.KindClothing, item.KindModificationMuzzle, item.KindModificationDevice, item.KindModificationSight, item.KindModificationSightSpecial, item.KindModificationGoggles:\n\t\t\terr = filter.AddString(\"type\", r.URL.Query().Get(\"type\"))\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\ts := &Status{}\n\t\t\ts.BadRequest(fmt.Sprintf(\"Query string error: %s\", err)).Render(w)\n\t\t\treturn\n\t\t}\n\n\t\tresult, err = item.GetAll(filter, kind, opts)\n\t\tif err != nil {\n\t\t\thandleError(err, w)\n\t\t\treturn\n\t\t}\n\t}\n\n\tview.RenderJSON(result, http.StatusOK, w)\n}", "title": "" }, { "docid": "1ed9f1f7992b72963a2fab58af88211a", "score": "0.478173", "text": "func (a *DeviceManagementGroupsV1ApiService) GetGroupUsingGET1(ctx _context.Context, id string) ApiGetGroupUsingGET1Request {\n\treturn ApiGetGroupUsingGET1Request{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "b73b4d38ae5315310cf10f189bb7003c", "score": "0.47815818", "text": "func (a *Client) GetPoliciesUsingGET1(params *GetPoliciesUsingGET1Params, opts ...ClientOption) (*GetPoliciesUsingGET1OK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetPoliciesUsingGET1Params()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getPoliciesUsingGET_1\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/policy/api/policies\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetPoliciesUsingGET1Reader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetPoliciesUsingGET1OK)\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 getPoliciesUsingGET_1: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "43a9a8a8a3b52eafad6f8bbf8a3387d3", "score": "0.47780573", "text": "func ListEventsOK1(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.EventsController, page int, q string, sort string) (http.ResponseWriter, app.EventCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{q}\n\t\tquery[\"q\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{sort}\n\t\tquery[\"sort\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/events/new\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{q}\n\t\tprms[\"q\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{sort}\n\t\tprms[\"sort\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"EventsTest\"), rw, req, prms)\n\tlistCtx, err := app.NewListEventsContext(goaCtx, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.List(listCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %s, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.EventCollection\n\tif resp != nil {\n\t\tvar ok bool\n\t\tmt, ok = resp.(app.EventCollection)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"invalid response media: got %+v, expected instance of app.EventCollection\", resp)\n\t\t}\n\t\terr = mt.Validate()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "9b16e6aa335dffb614101d79897507c4", "score": "0.47774684", "text": "func addNonBulkRequestHeaders(req *http.Request, reqID uuid.UUID) {\n\t// Info: https://github.com/CMSgov/beneficiary-fhir-data/blob/master/docs/request-audit-headers.md\n\taddDefaultRequestHeaders(req, reqID)\n}", "title": "" }, { "docid": "1934a9ecd5d6170fc6ae50da022e33c6", "score": "0.47679573", "text": "func (h Handler) makeGetOne(v NearbyInjection) http.HandlerFunc {\n\n\ttype APIDocs struct {\n\t\tResolutionValue struct{}\n\t}\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tparams := mux.Vars(r)\n\t\tmtx.Lock()\n\t\titem, ok := v.Nearby[params[\"id\"]]\n\t\tmtx.Unlock()\n\t\tif ok {\n\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t} else {\n\t\t\tio.WriteString(w, \"null\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bb0256393ba41609039b829b96f5344a", "score": "0.4764827", "text": "func NewGetPageDataUsingGETNotFound() *GetPageDataUsingGETNotFound {\n\treturn &GetPageDataUsingGETNotFound{}\n}", "title": "" }, { "docid": "042268965bc8bc1b8c8bf001b6bab17c", "score": "0.4763576", "text": "func (cache *lfu) GetWithHeaders(url url.URL) (fi *bytes.Buffer, h http.Header, err error) {\n\tcache.Lock()\n\tdefer cache.Unlock()\n\n\tfi, h, err = cache.getResource(url)\n\treturn\n}", "title": "" }, { "docid": "af8dd12ea990c104b8fa06ce66b12923", "score": "0.47615147", "text": "func NewGetTodosNotFound() *GetTodosNotFound {\n\treturn &GetTodosNotFound{}\n}", "title": "" }, { "docid": "88b5d2a0517c3b4fe8867e40555bbca4", "score": "0.4757328", "text": "func ItemIndexGET(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tvar err error\n\tvar i interface{}\n\n\tsearch := r.URL.Query().Get(\"search\")\n\tswitch {\n\tcase len(search) > 0:\n\t\ttxt, err := url.QueryUnescape(search)\n\t\tif err != nil {\n\t\t\ts := &Status{}\n\t\t\ts.BadRequest(fmt.Sprintf(\"Query string error: %s\", err.Error())).Render(w)\n\t\t\treturn\n\t\t}\n\n\t\topts := &item.Options{}\n\t\topts.Limit, opts.Offset = getLimitOffset(r)\n\n\t\ti, err = item.GetByText(txt, opts)\n\t\tif err != nil {\n\t\t\thandleError(err, w)\n\t\t\treturn\n\t\t}\n\tdefault:\n\t\tvar skipKinds bool\n\n\t\tif skip := r.URL.Query().Get(\"skipKinds\"); len(skip) > 0 {\n\t\t\tif skip == \"1\" {\n\t\t\t\tskipKinds = true\n\t\t\t}\n\t\t}\n\n\t\ti, err = item.GetIndex(skipKinds)\n\t\tif err != nil {\n\t\t\thandleError(err, w)\n\t\t\treturn\n\t\t}\n\t}\n\n\tview.RenderJSON(i, http.StatusOK, w)\n}", "title": "" }, { "docid": "764a4b745e28a6ed997e43694593b057", "score": "0.47563913", "text": "func ListEventsUnauthorized1(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.EventsController, page int, q string, sort string) http.ResponseWriter {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tquery[\"page\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{q}\n\t\tquery[\"q\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{sort}\n\t\tquery[\"sort\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/events/new\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(page)}\n\t\tprms[\"page\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{q}\n\t\tprms[\"q\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{sort}\n\t\tprms[\"sort\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"EventsTest\"), rw, req, prms)\n\tlistCtx, err := app.NewListEventsContext(goaCtx, service)\n\tif err != nil {\n\t\tpanic(\"invalid test data \" + err.Error()) // bug\n\t}\n\n\t// Perform action\n\terr = ctrl.List(listCtx)\n\n\t// Validate response\n\tif err != nil {\n\t\tt.Fatalf(\"controller returned %s, logs:\\n%s\", err, logBuf.String())\n\t}\n\tif rw.Code != 401 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 401\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "title": "" }, { "docid": "e9c3387518ca39aae83cc922e8f9814d", "score": "0.4750328", "text": "func NewGetOneCallDefault(code int) *GetOneCallDefault {\n\treturn &GetOneCallDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "f91d112fbde8586e42afd694626116fd", "score": "0.4741803", "text": "func NewGetAll() *api.BaseAPI {\n\tgetAllPermissionsAPI := api.NewBaseAPI(http.MethodGet, permissionEndpoint+\"permission\"+returnFields, nil, new([]Permission))\n\treturn getAllPermissionsAPI\n}", "title": "" }, { "docid": "1cae082d12f1942d33bfaddd847edcff", "score": "0.47383225", "text": "func (serv fileAPI) GetAll() string {\n\t// 400 Bad request\n\tserv.ResponseBuilder().SetResponseCode(400).Overide(true)\n\treturn \"\"\n}", "title": "" }, { "docid": "b4ce81a1e587540d58de1887f3368528", "score": "0.47376043", "text": "func NewGetByNameUsingGET3Unauthorized() *GetByNameUsingGET3Unauthorized {\n\treturn &GetByNameUsingGET3Unauthorized{}\n}", "title": "" }, { "docid": "d8720ea1c4320fa508dfc7e7581ec74d", "score": "0.47300774", "text": "func (a *Client) GetAllUsersUsingGET(params *GetAllUsersUsingGETParams, authInfo runtime.ClientAuthInfoWriter) (*GetAllUsersUsingGETOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAllUsersUsingGETParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getAllUsersUsingGET\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/lcm/authzn/api/users\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetAllUsersUsingGETReader{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.(*GetAllUsersUsingGETOK)\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 getAllUsersUsingGET: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "864fb08bf6af50b1efc05eccd00feaa8", "score": "0.47230238", "text": "func (a *DeviceManagementGroupsV1ApiService) ListGroupsUsingGET1Execute(r ApiListGroupsUsingGET1Request) ([]Group, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []Group\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DeviceManagementGroupsV1ApiService.ListGroupsUsingGET1\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/deviceMgt/groups\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.xAPIKEY == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"xAPIKEY is required and must be specified\")\n\t}\n\n\tif r.limit != nil {\n\t\tlocalVarQueryParams.Add(\"limit\", parameterToString(*r.limit, \"\"))\n\t}\n\tif r.offset != nil {\n\t\tlocalVarQueryParams.Add(\"offset\", parameterToString(*r.offset, \"\"))\n\t}\n\tif r.parentId != nil {\n\t\tlocalVarQueryParams.Add(\"parentId\", parameterToString(*r.parentId, \"\"))\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 r.xTotalCount != nil {\n\t\tlocalVarHeaderParams[\"X-Total-Count\"] = parameterToString(*r.xTotalCount, \"\")\n\t}\n\tlocalVarHeaderParams[\"X-API-KEY\"] = parameterToString(*r.xAPIKEY, \"\")\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ErrorResponseWeb\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorResponseWeb\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": "80e82b52dc60f85fd1a0ecdbd6d9e1af", "score": "0.47187293", "text": "func (p *API) HandlerStaticGetAll() func(c IHttpContext) {\n\tanonymous := func(c IHttpContext) {\n\t\tc.Header(\"Content-type\", \"application/json\")\n\t\tdata, err := p.GetAll()\n\t\tif err != nil {\n\t\t\tc.String(400, \"{\\\"message\\\":\\\"\\\"}\")\n\t\t\treturn\n\t\t}\n\t\tc.IndentedJSON(200, data)\n\t}\n\treturn anonymous\n}", "title": "" }, { "docid": "b2eccf58377924ae958d8fe31e99f25e", "score": "0.4714582", "text": "func NotFoundDefault(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(404)\n}", "title": "" }, { "docid": "870ed5c32f9887f9fbba9ad67128ef3b", "score": "0.4714381", "text": "func NewGetBlueprintResourcesPlanUsingGET1NotFound() *GetBlueprintResourcesPlanUsingGET1NotFound {\n\treturn &GetBlueprintResourcesPlanUsingGET1NotFound{}\n}", "title": "" }, { "docid": "8b0b68807fec17f274c26c3e523127f2", "score": "0.47118056", "text": "func ListPodsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.PodsController, limit int, offset int) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tquery[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(offset)}\n\t\tquery[\"offset\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/pods\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(limit)}\n\t\tprms[\"limit\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{strconv.Itoa(offset)}\n\t\tprms[\"offset\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"PodsTest\"), rw, req, prms)\n\tlistCtx, _err := app.NewListPodsContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.List(listCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "4a37741935d5ac9e3d2eb0bd180c4821", "score": "0.46889135", "text": "func NewGetUsingGET4NotFound() *GetUsingGET4NotFound {\n\treturn &GetUsingGET4NotFound{}\n}", "title": "" }, { "docid": "786c1a7e9792581e988ab40bdb234841", "score": "0.4688678", "text": "func getListObjectsV1URL(endPoint, bucketName, prefix, maxKeys, encodingType string) string {\n\tqueryValue := url.Values{}\n\tif maxKeys != \"\" {\n\t\tqueryValue.Set(\"max-keys\", maxKeys)\n\t}\n\tif encodingType != \"\" {\n\t\tqueryValue.Set(\"encoding-type\", encodingType)\n\t}\n\treturn makeTestTargetURL(endPoint, bucketName, prefix, queryValue)\n}", "title": "" }, { "docid": "a6061aef925d4cc40abe4b53efc89319", "score": "0.4688442", "text": "func (a *PipelineTemplatesControllerApiService) GetUsingGET(ctx _context.Context, id string) apiGetUsingGETRequest {\n\treturn apiGetUsingGETRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" } ]
b7ea42c084c01bba7549a428e308f2b3
NoPager builds a valid pager corresponding to "no pager" ie: a pager that returns all the results in one page
[ { "docid": "5cc4bd8bd03da656d3f3cd963c5778e5", "score": "0.8238735", "text": "func NoPager() Pager {\n\treturn Pager{}\n}", "title": "" } ]
[ { "docid": "13e1657cbf6967d8ef6277f6987e7ebc", "score": "0.6019818", "text": "func NewPager(n, skip, limit int) *Pager {\n\tp := Pager{\n\t\tOffset: skip,\n\t\tTake: limit,\n\t\tTotal: n,\n\t}\n\tif p.Offset >= p.Total {\n\t\tp.Take = 0\n\t\treturn &p\n\t}\n\tif p.Total-p.Offset < p.Take {\n\t\tp.Take = p.Total - p.Offset\n\t}\n\treturn &p\n}", "title": "" }, { "docid": "9ace703d4c4d668f57c0156031fcd918", "score": "0.5834607", "text": "func defaultPaging() *Paging {\n\treturn &Paging{limit: 0, offset: 0, sortBy: \"\", descending: false, after: \"\"}\n}", "title": "" }, { "docid": "ab407495f302e4bfd33c75867bb0b948", "score": "0.58183753", "text": "func ByQueryNoHidden(c *gin.Context, pagenum int) (search structs.TorrentParam, tor []models.Torrent, count int, err error) {\n\tsearch, tor, count, err = ByQuery(c, pagenum, true, false, false, true)\n\treturn\n}", "title": "" }, { "docid": "4e531216fead83c3a3b64f9b366a62ed", "score": "0.57178944", "text": "func NewPager(page, pageSize int) Pager {\n\tif page == 0 && pageSize == 0 {\n\t\treturn PagerDefault\n\t}\n\treturn Pager{\n\t\tPage: page,\n\t\tPageSize: pageSize,\n\t}\n}", "title": "" }, { "docid": "545990eb4c9198a88b87fb688fa1686d", "score": "0.55573547", "text": "func ByQueryNoCount(c *gin.Context, pagenum int) (search structs.TorrentParam, tor []models.Torrent, err error) {\n\tsearch, tor, _, err = ByQuery(c, pagenum, false, false, false, false)\n\treturn\n}", "title": "" }, { "docid": "3deebd4af632c31b877e9748216b80fe", "score": "0.5547487", "text": "func assertNoResultsOnPage(e *ptesting.Environment) {\n\t// NOTE: pulumi returns with exit code 0 in this scenario.\n\tout, err := e.RunCommand(\"pulumi\", \"stack\", \"history\", \"--page-size\", \"1\", \"--page\", \"10000000\")\n\tassert.Equal(e.T, \"\", err)\n\tassert.Equal(e.T, \"No stack updates found on page '10000000'\\n\", out)\n}", "title": "" }, { "docid": "c6d663d93d60d16931262f9fa85f6b3e", "score": "0.54399383", "text": "func NewPager(total int64, request *ViewRequest) (Pager, error) {\n\tpager := Pager{\n\t\tHasNext: false,\n\t\tHasPrevious: false,\n\t\tTotalCount: int32(total),\n\t\tNrPages: 0,\n\t\tPageCurrent: request.GetPage(),\n\t\tPageNext: 0,\n\t\tPagePrevious: 0,\n\t\tPageSize: request.GetPageSize(),\n\t\tActiveFilename: request.GetFilename(),\n\t\tActiveSortKey: int32(request.GetSortKey()),\n\t\tPaging: request.GetPaging(),\n\t}\n\tif pager.TotalCount > 0 && pager.PageSize != 0 {\n\t\tpager.NrPages = (pager.TotalCount / pager.PageSize)\n\t\tif pager.TotalCount%pager.PageSize != 0 {\n\t\t\tpager.NrPages++\n\t\t}\n\t}\n\n\tpager.setPaging()\n\n\treturn pager, nil\n}", "title": "" }, { "docid": "ee205033e30f18d947b8cbeb37f361ee", "score": "0.5430776", "text": "func RenderNoContentWithPagination(ctx context.Context, w http.ResponseWriter, pagination lib_pagination.Pagination) {\n\theader := SetHeaderWithXLc(ctx, w, &pagination, nil, nil)\n\tw.WriteHeader(http.StatusNoContent)\n\tLogResponse(ctx, http.StatusNoContent, header, nil, nil)\n}", "title": "" }, { "docid": "415662200416927c048a590e5c818407", "score": "0.5404642", "text": "func ByQueryNoUser(c *gin.Context, pagenum int) (search structs.TorrentParam, tor []models.Torrent, count int, err error) {\n\tsearch, tor, count, err = ByQuery(c, pagenum, true, false, false, false)\n\treturn\n}", "title": "" }, { "docid": "4f5c47f8138bd659809745c4198303e3", "score": "0.5386382", "text": "func (w *pagingWriter) PageMaybe(cancel func()) {\n\tif w.mode != pagingWriterNormal {\n\t\treturn\n\t}\n\tdlvpager := os.Getenv(\"DELVE_PAGER\")\n\tif dlvpager == \"\" {\n\t\tif stdout, _ := w.w.(*os.File); stdout != nil {\n\t\t\tif !isatty.IsTerminal(stdout.Fd()) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif strings.ToLower(os.Getenv(\"TERM\")) == \"dumb\" {\n\t\t\treturn\n\t\t}\n\t}\n\tw.mode = pagingWriterMaybe\n\tw.pager = dlvpager\n\tif w.pager == \"\" {\n\t\tw.pager = os.Getenv(\"PAGER\")\n\t\tif w.pager == \"\" {\n\t\t\tw.pager = \"more\"\n\t\t}\n\t}\n\tw.lastnl = true\n\tw.cancel = cancel\n\tw.getWindowSize()\n}", "title": "" }, { "docid": "c7c23213756364b010c317914b939872", "score": "0.50967807", "text": "func (ui *UI) ClearPager() {\n\tui.pager.ClearText()\n\tui.updateScrollStatus()\n\tui.DisableFollowMode()\n}", "title": "" }, { "docid": "9a6c7a83e5653f5d892d916fce2a4f46", "score": "0.5045708", "text": "func NoFilter(t.FilterableContainer) bool { return true }", "title": "" }, { "docid": "2a6df8942d5ce0b577e16fb69ec3186d", "score": "0.5034537", "text": "func (query ScanQueryBuilder) NoFields() ScanQueryBuilder {\n\tquery.opts = append(query.opts, newTileCmd(\"NOFIELDS\"))\n\treturn query\n}", "title": "" }, { "docid": "ad542deea46b7c4b1b055fa940da9926", "score": "0.5034008", "text": "func RenderNoData(c *gin.Context, code int, mess string) {\n\tRender(c, code, mess, nil)\n}", "title": "" }, { "docid": "d93052169ee02dd4fc9cc63300668769", "score": "0.4991266", "text": "func (page InstancePoolListResultPage) NotDone() bool {\n\treturn !page.iplr.IsEmpty()\n}", "title": "" }, { "docid": "94ce61ccec54f9608d5f46d5837e64e3", "score": "0.49554297", "text": "func (page AdministratorListResultPage) NotDone() bool {\n\treturn !page.alr.IsEmpty()\n}", "title": "" }, { "docid": "bf5d062fcc661f1f89e8f584e2ede5e6", "score": "0.49347353", "text": "func Pager(defaultCreatePager bool, defaultPagerID string) 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\tpagerID := request.URL.Query().Get(\"pagerID\")\n\t\t\tif pagerID == \"\" {\n\t\t\t\tpagerID = defaultPagerID\n\t\t\t}\n\n\t\t\tcreatePager, err := strconv.ParseBool(request.URL.Query().Get(\"createPager\"))\n\t\t\tif err != nil {\n\t\t\t\tcreatePager = defaultCreatePager\n\t\t\t}\n\n\t\t\tctxPager := context.WithValue(request.Context(), pagerIDKey, pagerID)\n\t\t\tctxSize := context.WithValue(ctxPager, createPagerKey, createPager)\n\t\t\tnext.ServeHTTP(writer, request.WithContext(ctxSize))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "928da9a70a0e1c9e67b7753dc1e932b1", "score": "0.49275059", "text": "func NoProgress(g *types.Cmd) {\n\tg.AddOptions(\"--no-progress\")\n}", "title": "" }, { "docid": "ca967cbb15f4c261167a0d59e75c106c", "score": "0.49033785", "text": "func New(page int, limit int) Pager {\n\treturn Pager{\n\t\tPage: page,\n\t\tLimit: limit,\n\t}\n}", "title": "" }, { "docid": "4c0b60d54ad93a731d43489b7bb6b162", "score": "0.49002576", "text": "func NewNoBenchlist() Manager {\n\treturn &noBenchlist{}\n}", "title": "" }, { "docid": "2ce3f081a5cadd8d0975555f3b827172", "score": "0.48996842", "text": "func (page ManagedInstanceListResultPage) NotDone() bool {\n\treturn !page.milr.IsEmpty()\n}", "title": "" }, { "docid": "1e6a0b056bebedf6256735cc7fa82aa1", "score": "0.4854641", "text": "func NoSummary(g *types.Cmd) {\n\tg.AddOptions(\"--no-summary\")\n}", "title": "" }, { "docid": "ce5aa5b571320bc37638f07c214a961f", "score": "0.48536912", "text": "func (v *Window) SetSkipPagerHint(setting bool) {\n\tC.gtk_window_set_skip_pager_hint(v.native(), gbool(setting))\n}", "title": "" }, { "docid": "ce5aa5b571320bc37638f07c214a961f", "score": "0.48536912", "text": "func (v *Window) SetSkipPagerHint(setting bool) {\n\tC.gtk_window_set_skip_pager_hint(v.native(), gbool(setting))\n}", "title": "" }, { "docid": "718029fb48b69ef16bfe09e14208bd2c", "score": "0.4847925", "text": "func (page UsageListResultPage) NotDone() bool {\n\treturn !page.ulr.IsEmpty()\n}", "title": "" }, { "docid": "44e711654342f25009eaa6fa2b475fdc", "score": "0.4838749", "text": "func (b *Builder) NoWebpage() *Builder {\n\tb.noWebpage = true\n\treturn b\n}", "title": "" }, { "docid": "45f57dd4310a2f01155819559f672040", "score": "0.48354784", "text": "func DefaultPerPage() int64 {\n\treturn 25\n}", "title": "" }, { "docid": "5d8f5178d506220bc42660336f1562a6", "score": "0.48248383", "text": "func (page ListPoolsResultPage) NotDone() bool {\n\treturn !page.lpr.IsEmpty()\n}", "title": "" }, { "docid": "78a206f9ff45f5184be6d5603847705a", "score": "0.48071188", "text": "func (page ManagedInstanceVulnerabilityAssessmentListResultPage) NotDone() bool {\n\treturn !page.mivalr.IsEmpty()\n}", "title": "" }, { "docid": "367c6d635e4b809d56d58920107f7a21", "score": "0.4805893", "text": "func (page ListResultPage) NotDone() bool {\n\treturn !page.lr.IsEmpty()\n}", "title": "" }, { "docid": "367c6d635e4b809d56d58920107f7a21", "score": "0.4805893", "text": "func (page ListResultPage) NotDone() bool {\n\treturn !page.lr.IsEmpty()\n}", "title": "" }, { "docid": "b1f9d545b50772082b9844da33cc6d54", "score": "0.48039865", "text": "func (p Pager) Pager() *urlstruct.Pager {\n\tmaxLimit := p.PageSize\n\tif maxLimit > defaultNoLimit {\n\t\tmaxLimit = defaultNoLimit\n\t} else if maxLimit == 0 {\n\t\tmaxLimit = defaultMaxLimit\n\t}\n\tpager := &urlstruct.Pager{\n\t\tLimit: p.PageSize,\n\t\tMaxLimit: maxLimit,\n\t}\n\n\tpager.SetPage(p.Page)\n\n\treturn pager\n}", "title": "" }, { "docid": "89b793ec19bddb8f25431bff6d7ebc28", "score": "0.47941512", "text": "func DefaultPage() int64 {\n\treturn 1\n}", "title": "" }, { "docid": "f2af2bbe40af1f60c229de82fc24b227", "score": "0.4784584", "text": "func BuildPagination(c *gin.Context) Pagination {\n\tpageStr := c.Query(\"page\")\n\tpageSizeStr := c.Query(\"pageSize\")\n\tsort := c.Query(\"sort\")\n\n\tvar all bool\n\tif pageSizeStr == \"Infinity\" {\n\t\tall = true\n\t}\n\n\tpage, err := strconv.Atoi(pageStr)\n\tif err != nil || page <= 0 {\n\t\tpage = 1\n\t}\n\n\tpageSize, err := strconv.Atoi(pageSizeStr)\n\tif err != nil || pageSize <= 0 {\n\t\tpageSize = 10\n\t}\n\n\treturn Pagination{\n\t\tPage: page,\n\t\tSort: sort,\n\t\tPageSize: pageSize,\n\t\tOffset: (page - 1) * pageSize,\n\t\tAll: all,\n\t}\n}", "title": "" }, { "docid": "0471206fd4012a14d239a37ea6521b16", "score": "0.4772697", "text": "func Pager(args url.Values, count interface{}, argPrefix string, rowsMax, around, edge int64) *[]Page {\n\titemCount := cast.ToInt64(count)\n\n\trowLimit := valWithDefaultInt64(args, argPrefix+\"lim\", rowsMax)\n\trowOffset := valWithDefaultInt64(args, argPrefix+\"off\", 0)\n\n\tpn := paginate.FromLimitOffset(rowLimit, rowOffset, itemCount)\n\tpageCurrent := rowOffset/rowLimit + 1\n\tp := []Page{}\n\tp = append(p, Page{IsPrev: true, Allowed: pn.CanPrev(), ID: pn.Prev(), Href: \"\"})\n\tfor _, pi := range pn.Pages(around, edge) {\n\t\tp = append(p, Page{Allowed: pi != pageCurrent, ID: pi, Href: \"\"})\n\t}\n\tp = append(p, Page{IsNext: true, Allowed: pn.CanNext(), ID: pn.Next(), Href: \"\"})\n\n\tif rowLimit != rowsMax {\n\t\targs.Set(argPrefix+\"lim\", cast.ToString(rowLimit))\n\t} else {\n\t\targs.Del(argPrefix + \"lim\")\n\t}\n\n\tfor i := range p {\n\t\tif p[i].ID > 1 {\n\t\t\targs.Set(argPrefix+\"off\", cast.ToString(rowLimit*(p[i].ID-1)))\n\t\t} else {\n\t\t\targs.Del(argPrefix + \"off\")\n\t\t}\n\t\tp[i].Href = \"?\" + args.Encode()\n\t}\n\treturn &p\n}", "title": "" }, { "docid": "a411e883c83d97d0d98ed7d472279959", "score": "0.4746315", "text": "func (page ManagedInstanceOperationListResultPage) NotDone() bool {\n\treturn !page.miolr.IsEmpty()\n}", "title": "" }, { "docid": "010f81f57e29485852473f2be663bdcb", "score": "0.4743382", "text": "func (page DeviceListResultPage) NotDone() bool {\n\treturn !page.dlr.IsEmpty()\n}", "title": "" }, { "docid": "046287ceeff4a32745fd01b186484a1b", "score": "0.47217113", "text": "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "title": "" }, { "docid": "046287ceeff4a32745fd01b186484a1b", "score": "0.47217113", "text": "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "title": "" }, { "docid": "046287ceeff4a32745fd01b186484a1b", "score": "0.47217113", "text": "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "title": "" }, { "docid": "046287ceeff4a32745fd01b186484a1b", "score": "0.47217113", "text": "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "title": "" }, { "docid": "046287ceeff4a32745fd01b186484a1b", "score": "0.47217113", "text": "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "title": "" }, { "docid": "046287ceeff4a32745fd01b186484a1b", "score": "0.47217113", "text": "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "title": "" }, { "docid": "046287ceeff4a32745fd01b186484a1b", "score": "0.47217113", "text": "func (page OperationListResultPage) NotDone() bool {\n\treturn !page.olr.IsEmpty()\n}", "title": "" }, { "docid": "d1e3f4f6c981b4008c92fcb10aba6cef", "score": "0.47139117", "text": "func (page VendorListResultPage) NotDone() bool {\n\treturn !page.vlr.IsEmpty()\n}", "title": "" }, { "docid": "81ec61da823db1c4e63f23ba0e7b2bfb", "score": "0.4709083", "text": "func (page ListPage) NotDone() bool {\n\treturn !page.l.IsEmpty()\n}", "title": "" }, { "docid": "6229141747f1dd4116f2699cd24503d6", "score": "0.4705258", "text": "func (page RegistryListResultPage) NotDone() bool {\n\treturn !page.rlr.IsEmpty()\n}", "title": "" }, { "docid": "bd6f818825a9891dc55d69a99a2f637e", "score": "0.47000182", "text": "func (page ApplicationListResultPage) NotDone() bool {\n\treturn !page.alr.IsEmpty()\n}", "title": "" }, { "docid": "8187d08650882e55993f23159dd2ea74", "score": "0.46988004", "text": "func (m *ResearchMutation) ResetPAGENUMBER() {\n\tm._PAGE_NUMBER = nil\n\tm.add_PAGE_NUMBER = nil\n}", "title": "" }, { "docid": "f1b284b1bd2c444770989328a0c7a505", "score": "0.46751118", "text": "func (iter BrowseNextResponseAPIModelIterator) NotDone() bool {\n return iter.page.NotDone() && iter.i < len(iter. page.Values())\n }", "title": "" }, { "docid": "a1744870c3c6eedc3f0bcc798c708a11", "score": "0.46651897", "text": "func (reporter *DefaultReporter) NoCommand() {\n\treporter.Usage()\n}", "title": "" }, { "docid": "262205c6ab53529326a2deab4e668439", "score": "0.46648994", "text": "func NoopQuerier() Querier {\n\treturn &noopQuerier{}\n}", "title": "" }, { "docid": "0b60a08884e600abe155b357f89b4ca5", "score": "0.4658237", "text": "func (page PrivateLinkServiceListResultPage) NotDone() bool {\n\treturn !page.plslr.IsEmpty()\n}", "title": "" }, { "docid": "cf8b19beb10ceb04df3389563b49413e", "score": "0.4656835", "text": "func NoDirListing(h httputils.ContextHandler) httputils.ContextHandler {\n\treturn func(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\t\turlPath := r.URL.Path\n\n\t\tif urlPath == \"\" || strings.HasSuffix(urlPath, \"/\") {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn nil\n\t\t}\n\n\t\treturn h(ctx, w, r)\n\t}\n}", "title": "" }, { "docid": "2ebd05be7eece8af815370dbc92b088b", "score": "0.4647006", "text": "func (page AccountListResultPage) NotDone() bool {\n\treturn !page.alr.IsEmpty()\n}", "title": "" }, { "docid": "b629953bea3e49b46e708640caf8462e", "score": "0.464464", "text": "func (page ManagedDatabaseListResultPage) NotDone() bool {\n\treturn !page.mdlr.IsEmpty()\n}", "title": "" }, { "docid": "760d51db8ea1e72f53cdc385b21f64ba", "score": "0.46443385", "text": "func (page PublishedItemListResponseAPIModelPage) NotDone() bool {\n return !page.pilram.IsEmpty()\n }", "title": "" }, { "docid": "26817d09af4c294f3d5ebdfc0cf48d87", "score": "0.46273136", "text": "func New(fn ListPageFunc) *ListPager {\n\treturn &ListPager{\n\t\tPageSize: defaultPageSize,\n\t\tPageFn: fn,\n\t\tFullListIfExpired: true,\n\t}\n}", "title": "" }, { "docid": "d491f0c93a6f61db6c3f6f7cc0b23a9f", "score": "0.46231318", "text": "func (page ManagedInstanceLongTermRetentionPolicyListResultPage) NotDone() bool {\n\treturn !page.miltrplr.IsEmpty()\n}", "title": "" }, { "docid": "df0d9a3db77bf31f92c75ae3f7157153", "score": "0.46113682", "text": "func (iter PagedModelDataCollectionIterator) NotDone() bool {\n\treturn iter.page.NotDone() && iter.i < len(iter.page.Values())\n}", "title": "" }, { "docid": "c567c4458cf797c43244a5216770407d", "score": "0.4603057", "text": "func (page ContainerListPage) NotDone() bool {\n\treturn !page.cl.IsEmpty()\n}", "title": "" }, { "docid": "7615a1c3066f61af8c16618ce943c8aa", "score": "0.459344", "text": "func (iter ListPoolsResultIterator) NotDone() bool {\n\treturn iter.page.NotDone() && iter.i < len(iter.page.Values())\n}", "title": "" }, { "docid": "d882b04ae3e5f798b2d7d958985f88b5", "score": "0.4588821", "text": "func (page HostPoolListPage) NotDone() bool {\n\treturn !page.hpl.IsEmpty()\n}", "title": "" }, { "docid": "bf898a898da010f18991dadec5a404d0", "score": "0.45835054", "text": "func DisplayBlankPooled(context echo.Context) error {\n\treturn displayBlank(context, true)\n}", "title": "" }, { "docid": "9feb4e6c96eefcf9efdb64fb68bc0a03", "score": "0.45779857", "text": "func (page PagedModelDataCollectionPage) NotDone() bool {\n\treturn !page.pmdc.IsEmpty()\n}", "title": "" }, { "docid": "8a09dfa99a05645574502aaf370790ad", "score": "0.45749068", "text": "func (p Pager) Enabled() bool {\n\treturn p.Limit > 0\n}", "title": "" }, { "docid": "0a873f08fbd941a3c7754789c7efa324", "score": "0.4573829", "text": "func (d *dialect) page(p runtime.Page) string {\n\tif p.Limit == 0 { // why would someone ask for a page of zero size?\n\t\treturn \"\"\n\t}\n\tstmt := fmt.Sprintf(\"LIMIT %d\", p.Limit)\n\tif p.Offset != 0 {\n\t\tstmt += fmt.Sprintf(\" OFFSET %d\", p.Offset)\n\t}\n\treturn stmt\n}", "title": "" }, { "docid": "a87ba308dffba96c3980a7edeb2f070c", "score": "0.45722246", "text": "func (page KeyListResultPage) NotDone() bool {\n\treturn !page.klr.IsEmpty()\n}", "title": "" }, { "docid": "a87ba308dffba96c3980a7edeb2f070c", "score": "0.45722246", "text": "func (page KeyListResultPage) NotDone() bool {\n\treturn !page.klr.IsEmpty()\n}", "title": "" }, { "docid": "aadd8220d410542f432881ea35233c80", "score": "0.45695487", "text": "func (l *List) ResetPages() {\n\tl.pages = []Page{}\n\tfor offset := 0; offset < l.length(); offset += l.height() {\n\t\tlimit := l.height()\n\t\tif offset+limit > l.length() {\n\t\t\tlimit = l.length() % l.height()\n\t\t}\n\t\tl.pages = append(l.pages, Page{offset, limit})\n\t}\n}", "title": "" }, { "docid": "20484a1a0c9b712757251200dd662799", "score": "0.4566414", "text": "func (page ClusterListResultPage) NotDone() bool {\n\treturn !page.clr.IsEmpty()\n}", "title": "" }, { "docid": "055f37798dc7b0b7fd7eadc86cdf4c9c", "score": "0.4566343", "text": "func (page MonitoringTagRulesListResponsePage) NotDone() bool {\n\treturn !page.mtrlr.IsEmpty()\n}", "title": "" }, { "docid": "a765986d786c3d714a7cfe089f73e6bc", "score": "0.4555217", "text": "func DisplayUnBlankPooled(context echo.Context) error {\n\treturn displayUnBlank(context, true)\n}", "title": "" }, { "docid": "73b984f57513ab444822b9ff61cf414c", "score": "0.45524406", "text": "func (page SensitivityLabelListResultPage) NotDone() bool {\n\treturn !page.sllr.IsEmpty()\n}", "title": "" }, { "docid": "9b5961273566acf45226d4b1078d903b", "score": "0.45448956", "text": "func (page OperationsListPage) NotDone() bool {\n\treturn !page.ol.IsEmpty()\n}", "title": "" }, { "docid": "f49ffffd930519b634216dee7bbc45dc", "score": "0.45445913", "text": "func (page PaginatedWebServicesListPage) NotDone() bool {\n\treturn !page.pwsl.IsEmpty()\n}", "title": "" }, { "docid": "f7f4de0d6d5addd0cb21b4d9eceb174d", "score": "0.45342228", "text": "func (paged *paged) unlinkPages(p* page) error {\n first, last := p, p\n\n for ;last.nextPage != NoPage; {\n if next, err := paged.getPage(last.nextPage); err == nil {\n last = next\n } else {\n return err\n }\n }\n \n if lastFreePage := paged.getLastFreePage(); lastFreePage != NoPage {\n if lastPage, err := paged.getPage(lastFreePage); err == nil {\n lastPage.setNextPage(p.pageNumber)\n } else {\n return err \n }\n } \n \n if paged.getFirstFreePage() == NoPage {\n paged.setFirstFreePage(first.pageNumber)\n }\n \n paged.setLastFreePage(last.pageNumber)\n\n return nil\n}", "title": "" }, { "docid": "5f36cb341d032d8a582c49d9fc00c0c1", "score": "0.45341846", "text": "func (page WorkspaceListResultPage) NotDone() bool {\n\treturn !page.wlr.IsEmpty()\n}", "title": "" }, { "docid": "db0022e53117b2490a334a0c6d62f719", "score": "0.45270842", "text": "func (s *scopeStack) noexport() {}", "title": "" }, { "docid": "b30bb1ebee2970a6e54c6d6776cde29f", "score": "0.45252553", "text": "func (client *LabsClient) NewListAllPager(billingAccountName string, billingProfileName string, options *LabsClientListAllOptions) *runtime.Pager[LabsClientListAllResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[LabsClientListAllResponse]{\n\t\tMore: func(page LabsClientListAllResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *LabsClientListAllResponse) (LabsClientListAllResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listAllCreateRequest(ctx, billingAccountName, billingProfileName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn LabsClientListAllResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn LabsClientListAllResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn LabsClientListAllResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listAllHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "ac9819792db3ab70d32aad5ec842a885", "score": "0.45240232", "text": "func (page WorkloadNetworkVMGroupsListPage) NotDone() bool {\n\treturn !page.wnvgl.IsEmpty()\n}", "title": "" }, { "docid": "c6c50a6dd08281801de2ed9f97cecfe4", "score": "0.45177004", "text": "func (page CertificateListResultPage) NotDone() bool {\n\treturn !page.clr.IsEmpty()\n}", "title": "" }, { "docid": "c6c50a6dd08281801de2ed9f97cecfe4", "score": "0.45177004", "text": "func (page CertificateListResultPage) NotDone() bool {\n\treturn !page.clr.IsEmpty()\n}", "title": "" }, { "docid": "0e7e6103eba208f2896db4e4c53d4045", "score": "0.4512923", "text": "func (page BrowseNextResponseAPIModelPage) NotDone() bool {\n return !page.bnram.IsEmpty()\n }", "title": "" }, { "docid": "df858c7c2b3c8a595d2a66c4c0685044", "score": "0.45108038", "text": "func (iter PublishedItemListResponseAPIModelIterator) NotDone() bool {\n return iter.page.NotDone() && iter.i < len(iter. page.Values())\n }", "title": "" }, { "docid": "aa00d2526abe230bc9d60f17468b9666", "score": "0.4510679", "text": "func NoContent(ctx *gin.Context) {\n\tEmpty(ctx, http.StatusNoContent)\n}", "title": "" }, { "docid": "ed1afcb45d7f659fc896c5f80abca0d2", "score": "0.45039243", "text": "func NewNoAllocs() *NoAllocs {\n\tvar m NoAllocs\n\treturn &m\n}", "title": "" }, { "docid": "f3adc2be3b71766949736af89a161a56", "score": "0.45023847", "text": "func (iter AdministratorListResultIterator) NotDone() bool {\n\treturn iter.page.NotDone() && iter.i < len(iter.page.Values())\n}", "title": "" }, { "docid": "6fa3acb5f9b70467770a87255c04e024", "score": "0.45004445", "text": "func (client *SavingsPlanClient) NewListAllPager(options *SavingsPlanClientListAllOptions) *runtime.Pager[SavingsPlanClientListAllResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SavingsPlanClientListAllResponse]{\n\t\tMore: func(page SavingsPlanClientListAllResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SavingsPlanClientListAllResponse) (SavingsPlanClientListAllResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listAllCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SavingsPlanClientListAllResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn SavingsPlanClientListAllResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SavingsPlanClientListAllResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listAllHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "aab24bc9202b02278b8e0bc62f3342a0", "score": "0.4497879", "text": "func (page ServerVulnerabilityAssessmentListResultPage) NotDone() bool {\n\treturn !page.svalr.IsEmpty()\n}", "title": "" }, { "docid": "932e476fa15083560cabbbe81f8595c5", "score": "0.4497273", "text": "func (m *metadata) noexport() {}", "title": "" }, { "docid": "39a56f801ccf2b3ee28f25f396799943", "score": "0.44934678", "text": "func GetPager(r *http.Request) Pager {\n\n\tpage, _ := strconv.Atoi(r.URL.Query().Get(\"page\"))\n\tsize, _ := strconv.Atoi(r.URL.Query().Get(\"size\"))\n\n\tmaxSize := PaginationMaxSize\n\tif size > maxSize || size <= 0 {\n\t\tsize = maxSize\n\t}\n\n\tif page <= 0 {\n\t\tpage = 1\n\t}\n\n\toffset := (page - 1) * size\n\n\treturn Pager{\n\t\tPage: page,\n\t\tSize: size,\n\t\tOffSet: offset,\n\t}\n}", "title": "" }, { "docid": "9b018c083960fa23a7e8a97333540409", "score": "0.44922602", "text": "func (c *cursor) Nil() bool {\n\treturn c.page == 0\n}", "title": "" }, { "docid": "0395230c46d5b31c9d42b47ab7062004", "score": "0.44899374", "text": "func Noop() Manager {\n\treturn &noopManager{}\n}", "title": "" }, { "docid": "e903d1e4d093563d9ea5fca4b3c2e398", "score": "0.4488853", "text": "func (page OperationListPage) NotDone() bool {\n\treturn !page.ol.IsEmpty()\n}", "title": "" }, { "docid": "e903d1e4d093563d9ea5fca4b3c2e398", "score": "0.4488853", "text": "func (page OperationListPage) NotDone() bool {\n\treturn !page.ol.IsEmpty()\n}", "title": "" }, { "docid": "e903d1e4d093563d9ea5fca4b3c2e398", "score": "0.4488853", "text": "func (page OperationListPage) NotDone() bool {\n\treturn !page.ol.IsEmpty()\n}", "title": "" }, { "docid": "d68ac435ccd18a874fb09b2613d0283e", "score": "0.44874662", "text": "func (page UserListPage) NotDone() bool {\n\treturn !page.ul.IsEmpty()\n}", "title": "" }, { "docid": "ccac6e6716cd6bfab335518462d79dc3", "score": "0.44821763", "text": "func GetPager() string {\n\tif runtime.GOOS == \"windows\" {\n\t\treturn \"\"\n\t}\n\tpager := os.Getenv(\"PAGER\")\n\tif pager == \"\" && cmdExists(\"less\") {\n\t\tpager = \"less -r\"\n\t}\n\treturn pager\n}", "title": "" }, { "docid": "9b46d3bb30b4f2a5d4cc2604e88e2a2d", "score": "0.44818333", "text": "func (p *Parser) ParseZeroPage(line *lexer.Line, mode string) *node.Node {\n\tnode := node.NewNode()\n\tvar integerValue string\n\tspew.Dump(line.CurrentIndex)\n\tspew.Dump(len(line.Tokens))\n\tnode.Instruction = line.CurrentToken().Type\n\n\t//check if a label is used\n\tif line.NextToken().Type == \"string\" {\n\t\tlabel := p.getLabelByName(line.CurrentToken().Value)\n\t\tintegerValue = strconv.Itoa(label.Pos)\n\t\tline.Advance()\n\t} else {\n\n\t\tline.Expect([]string{\"dollar\"})\n\t\tline.Advance()\n\n\t\tline.Expect([]string{\"integer\"})\n\t\tline.Advance()\n\t\tintegerValue = line.CurrentToken().Value\n\t}\n\n\tif mode == \"x\" || mode == \"y\" {\n\t\tline.ExpectSequence([][]string{\n\t\t\t{\"comma\"},\n\t\t\t{\"character\"},\n\t\t})\n\t\tnode.Opcode = getOpcodeForZeroPage(node.Instruction, mode)<<8 | byte.StringToByteSequence(integerValue)[0]\n\t\treturn node\n\t}\n\n\tnode.Opcode = getOpcodeForZeroPage(node.Instruction, \"0\")<<8 | byte.StringToByteSequence(integerValue)[0]\n\treturn node\n}", "title": "" } ]
9c476baaeec2ef9ad09427120f9ee8b6
SetManagedAppRegistrations sets the managedAppRegistrations property value. Zero or more managed app registrations that belong to the user.
[ { "docid": "f5fc0d31e37bac5af09e422f03a4b365", "score": "0.79301393", "text": "func (m *User) SetManagedAppRegistrations(value []ManagedAppRegistrationable)() {\n err := m.GetBackingStore().Set(\"managedAppRegistrations\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" } ]
[ { "docid": "a77bd3ee778a87078c208b802af3073c", "score": "0.77466017", "text": "func (m *DeviceAppManagement) SetManagedAppRegistrations(value []ManagedAppRegistrationable)() {\n err := m.GetBackingStore().Set(\"managedAppRegistrations\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0cb96eba180469971a9f0e228721e8c3", "score": "0.6634203", "text": "func (m *User) GetManagedAppRegistrations()([]ManagedAppRegistrationable) {\n val, err := m.GetBackingStore().Get(\"managedAppRegistrations\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]ManagedAppRegistrationable)\n }\n return nil\n}", "title": "" }, { "docid": "dd35154f960c68fd2eeb6786e6e32f1b", "score": "0.6425819", "text": "func (m *DeviceAppManagement) GetManagedAppRegistrations()([]ManagedAppRegistrationable) {\n val, err := m.GetBackingStore().Get(\"managedAppRegistrations\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]ManagedAppRegistrationable)\n }\n return nil\n}", "title": "" }, { "docid": "432ca9e2c4f214befa4c3b18d7f6b670", "score": "0.5101594", "text": "func (m *User) SetManagedDevices(value []ManagedDeviceable)() {\n err := m.GetBackingStore().Set(\"managedDevices\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0ca192e9c50f2e52af7c07c34e0199d0", "score": "0.49877822", "text": "func (m *DeviceAppManagement) SetManagedAppPolicies(value []ManagedAppPolicyable)() {\n err := m.GetBackingStore().Set(\"managedAppPolicies\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1f3dedcb3bfb26d15fb105f1b240b40d", "score": "0.49598294", "text": "func (m *TargetedManagedAppConfiguration) SetApps(value []ManagedMobileAppable)() {\n m.apps = value\n}", "title": "" }, { "docid": "89a51ebae177055375c3cf8e6a588786", "score": "0.48658124", "text": "func (m *User) SetRegisteredDevices(value []DirectoryObjectable)() {\n err := m.GetBackingStore().Set(\"registeredDevices\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "33acb2ed9a28e940b21e7178caaeb1fd", "score": "0.47396362", "text": "func (m *DeviceManagement) SetManagedDevices(value []ManagedDeviceable)() {\n err := m.GetBackingStore().Set(\"managedDevices\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b9cf1f8816fa0678ab340a198994f377", "score": "0.47077", "text": "func (m *DeviceAppManagement) SetMobileAppConfigurations(value []ManagedDeviceMobileAppConfigurationable)() {\n err := m.GetBackingStore().Set(\"mobileAppConfigurations\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "bf939a3d21b632bfcc2f35bc40f58932", "score": "0.46829328", "text": "func (m *DeviceAppManagement) SetTargetedManagedAppConfigurations(value []TargetedManagedAppConfigurationable)() {\n err := m.GetBackingStore().Set(\"targetedManagedAppConfigurations\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c42f25974ce8d1a2d07d083c65a96156", "score": "0.46457854", "text": "func (m *DeviceAppManagement) SetDefaultManagedAppProtections(value []DefaultManagedAppProtectionable)() {\n err := m.GetBackingStore().Set(\"defaultManagedAppProtections\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "92a562ef2be8fea4d48730452ee3b48e", "score": "0.46321362", "text": "func (m *DeviceAppManagement) SetIosManagedAppProtections(value []IosManagedAppProtectionable)() {\n err := m.GetBackingStore().Set(\"iosManagedAppProtections\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a77c24cc4cee8ef846b2f866902c63c3", "score": "0.4546993", "text": "func (m *ManagedDevice) SetDetectedApps(value []DetectedAppable)() {\n err := m.GetBackingStore().Set(\"detectedApps\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f49cab4b48100f980894fb0179d4462f", "score": "0.45269707", "text": "func (m *VirtualEventRegistrant) SetRegistrationQuestionAnswers(value []VirtualEventRegistrationQuestionAnswerable)() {\n err := m.GetBackingStore().Set(\"registrationQuestionAnswers\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "eddd49d36c02ca20cb15976ca32d685f", "score": "0.45142823", "text": "func WithManagedInitializers(i ...ManagedInitializer) ManagedReconcilerOption {\n\treturn func(r *ManagedReconciler) {\n\t\tr.managed.ManagedInitializer = InitializerChain(i)\n\t}\n}", "title": "" }, { "docid": "1cb52cb4701b9e086375be517c39a1fd", "score": "0.4503967", "text": "func (a *AppRegistration) 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 \"appId\":\n\t\t\terr = unpopulate(val, \"AppID\", &a.AppID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"appSecretSettingName\":\n\t\t\terr = unpopulate(val, \"AppSecretSettingName\", &a.AppSecretSettingName)\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": "1dbe5fd6a70f79d39e26c866904b94bc", "score": "0.4427293", "text": "func (o *APIApp) SetAppAppTokensG(ctx context.Context, insert bool, related ...*AppToken) error {\n\treturn o.SetAppAppTokens(ctx, boil.GetContextDB(), insert, related...)\n}", "title": "" }, { "docid": "1ba68c9255c3af78715842b33fbdca2b", "score": "0.4425323", "text": "func (m *ManagedDevice) SetManagedDeviceMobileAppConfigurationStates(value []ManagedDeviceMobileAppConfigurationStateable)() {\n err := m.GetBackingStore().Set(\"managedDeviceMobileAppConfigurationStates\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "22e035cd937dd7f654308b0f28f5507e", "score": "0.4417951", "text": "func (m *DeviceManagement) SetDetectedApps(value []DetectedAppable)() {\n err := m.GetBackingStore().Set(\"detectedApps\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f72cad590f18ebaf5530aa0afa2754b2", "score": "0.44060707", "text": "func (c *Client) TransferRegistrations(close bool) (fab.EventSnapshot, error) {\n\tif !close {\n\t\treturn c.Transfer()\n\t}\n\n\tvar snapshot fab.EventSnapshot\n\tvar err error\n\tc.close(func() {\n\t\tlogger.Debug(\"Stopping dispatcher and taking snapshot of all registrations...\")\n\t\tsnapshot, err = c.StopAndTransfer()\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"An error occurred while stopping dispatcher and taking snapshot: %s\", err)\n\t\t}\n\t})\n\n\treturn snapshot, err\n}", "title": "" }, { "docid": "6ce66557efba671179a6e85fa41b06e1", "score": "0.4388172", "text": "func existingRegistrations() bool {\n\treturn true\n}", "title": "" }, { "docid": "0aaf032c5a15428f7bf870b51c0a3e8a", "score": "0.4372064", "text": "func (m *User) SetAppRoleAssignments(value []AppRoleAssignmentable)() {\n err := m.GetBackingStore().Set(\"appRoleAssignments\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a7c81f9002f8e985b80494f61b43f4a5", "score": "0.43358517", "text": "func UnmarshalNotificationsRegistration(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(NotificationsRegistration)\n\terr = core.UnmarshalPrimitive(m, \"instance_crn\", &obj.InstanceCrn)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_name\", &obj.SourceName)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_description\", &obj.SourceDescription)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "368f2bd2d15fdf7dbccb84147c8cbbbb", "score": "0.4317338", "text": "func (o *TargetedManagedAppConfiguration) GetApps() []MicrosoftGraphManagedMobileApp {\n\tif o == nil || o.Apps == nil {\n\t\tvar ret []MicrosoftGraphManagedMobileApp\n\t\treturn ret\n\t}\n\treturn *o.Apps\n}", "title": "" }, { "docid": "e99309b5e7891c5e8baa9e200f6f68a2", "score": "0.43082863", "text": "func (o *TargetedManagedAppConfiguration) SetApps(v []MicrosoftGraphManagedMobileApp) {\n\to.Apps = &v\n}", "title": "" }, { "docid": "25bb1f71dac51a99b6b6181d4dca7a93", "score": "0.43020242", "text": "func (o *NiatelemetryMsoSiteDetailsAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "6a24a1336a4160f5ff409961e6f32d44", "score": "0.42681012", "text": "func (o *ManagementInterfaceAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "62d476eea48c49fe9a95872bd32d06ea", "score": "0.42637503", "text": "func (c *Client) SetRegistrationIds(registrationIds []string) {\n\tc.Message.RegistrationIds = append(c.Message.RegistrationIds, registrationIds...)\n}", "title": "" }, { "docid": "aaf8d428196c6aa1746993994f84bae6", "score": "0.42314", "text": "func (a *App001) Registries() RegistryRefSpecs {\n\treturn a.spec.Registries\n}", "title": "" }, { "docid": "70f320d012ef358ccb4583e36b09b1ea", "score": "0.42222202", "text": "func (m *User) GetManagedDevices()([]ManagedDeviceable) {\n val, err := m.GetBackingStore().Get(\"managedDevices\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]ManagedDeviceable)\n }\n return nil\n}", "title": "" }, { "docid": "6727ea126103231d98ce6f5377e133ba", "score": "0.42165938", "text": "func (o ReportSettingPropertiesPtrOutput) Regions() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ReportSettingProperties) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Regions\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1c41ae290b6ea60fc78f3a2a6699adf3", "score": "0.4204243", "text": "func (m *DeviceAppManagement) SetManagedAppStatuses(value []ManagedAppStatusable)() {\n err := m.GetBackingStore().Set(\"managedAppStatuses\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "af91d0dfd47963fbd5079f1817a32a11", "score": "0.41774976", "text": "func (*OAuth2ServiceImpl) handleRegistrationPermissions(registration *oauthserver.ExternalServiceRegistration) ([]ac.Permission, []ac.Permission) {\n\tselfPermissions := []ac.Permission{}\n\timpersonatePermissions := []ac.Permission{}\n\n\tif registration.Self.Enabled {\n\t\tselfPermissions = append(selfPermissions, registration.Self.Permissions...)\n\t}\n\tif registration.Impersonation.Enabled {\n\t\trequiredForToken := []ac.Permission{\n\t\t\t{Action: ac.ActionUsersRead, Scope: oauthserver.ScopeGlobalUsersSelf},\n\t\t\t{Action: ac.ActionUsersPermissionsRead, Scope: oauthserver.ScopeUsersSelf},\n\t\t}\n\t\tif registration.Impersonation.Groups {\n\t\t\trequiredForToken = append(requiredForToken, ac.Permission{Action: ac.ActionTeamsRead, Scope: oauthserver.ScopeTeamsSelf})\n\t\t}\n\t\timpersonatePermissions = append(requiredForToken, registration.Impersonation.Permissions...)\n\t\tselfPermissions = append(selfPermissions, ac.Permission{Action: ac.ActionUsersImpersonate, Scope: ac.ScopeUsersAll})\n\t}\n\treturn selfPermissions, impersonatePermissions\n}", "title": "" }, { "docid": "5a23a3b2e949ba9375c4ba4e05ef7334", "score": "0.41772178", "text": "func WithManagedConnectionPublishers(p ...ManagedConnectionPublisher) ManagedReconcilerOption {\n\treturn func(r *ManagedReconciler) {\n\t\tr.managed.ManagedConnectionPublisher = PublisherChain(p)\n\t}\n}", "title": "" }, { "docid": "acb73ba295f05d9c1b461fa138bc4bfc", "score": "0.41667327", "text": "func (o *StoragePureSnapshotScheduleAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "544fc8cd6d408d6ac2e656330601556d", "score": "0.4163017", "text": "func (m *Directory) SetFederationConfigurations(value []IdentityProviderBaseable)() {\n err := m.GetBackingStore().Set(\"federationConfigurations\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "30441c4b36bba1b28e8d2bf67f65c491", "score": "0.4161667", "text": "func (o *ServiceBrokerAuthRegistrationParams) SetRegions(regions []string) {\n\to.Regions = regions\n}", "title": "" }, { "docid": "dc762f776ae2ef4cda6608a8f54d5d39", "score": "0.41604733", "text": "func (eth *ExchangeWallet) RegFeeConfirmations(ctx context.Context, coinID dex.Bytes) (confs uint32, err error) {\n\tvar txHash common.Hash\n\tcopy(txHash[:], coinID)\n\treturn eth.node.transactionConfirmations(ctx, txHash)\n}", "title": "" }, { "docid": "48c65748aa1ae776a1b9c4ed9deeeafe", "score": "0.41594785", "text": "func (m *APIRegistrationManager) RegisterVersions(availableVersions []schema.GroupVersion) {\n\tfor _, v := range availableVersions {\n\t\tm.registeredVersions[v] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "c146a04a72d2363a996574b51f76dd74", "score": "0.41396222", "text": "func (o *StorageVirtualDriveAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "13be1f65358f7b4a2affd6e71dd0ab0a", "score": "0.4126764", "text": "func (m *DeviceAppManagement) SetMobileApps(value []MobileAppable)() {\n err := m.GetBackingStore().Set(\"mobileApps\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "547bb4d840ed99d70be1260ec45b9e85", "score": "0.41226918", "text": "func (m *AndroidDeviceOwnerGeneralDeviceConfiguration) SetKioskModeManagedFolders(value []AndroidDeviceOwnerKioskModeManagedFolderable)() {\n err := m.GetBackingStore().Set(\"kioskModeManagedFolders\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "02055fc1adfedd7be6bfe1ad2221c036", "score": "0.41194364", "text": "func (o *KubernetesNodeAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "945190c163914b1ac26853b32095f769", "score": "0.41143662", "text": "func (o *BiosBootDeviceAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "ebb07096da62523182ad8c89c3a83a1f", "score": "0.4094769", "text": "func (o *EquipmentTransceiverAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "d4753ccab487099e67255aecae84ffe6", "score": "0.4086842", "text": "func (o *AssetDeviceContractInformationAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "730fc36d63f0be3935df504edcf4848b", "score": "0.40838447", "text": "func (m *ManagedDevice) SetUsersLoggedOn(value []LoggedOnUserable)() {\n err := m.GetBackingStore().Set(\"usersLoggedOn\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f6f1067da3138a76dd67eefc66d9f375", "score": "0.40823886", "text": "func (m *CredentialUserRegistrationCount) SetUserRegistrationCounts(value []UserRegistrationCountable)() {\n err := m.GetBackingStore().Set(\"userRegistrationCounts\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0b63f1f9dc57f9e5bdbe2e21ea9b1f81", "score": "0.40799567", "text": "func (o *GraphicsCard) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "376ab74f3d957db26d4d22c95ba0190b", "score": "0.40783793", "text": "func RegisterPermissions(l *olog.Logger) {\n\t// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.\n\t// https://github.com/owncloud/ocis-proxy/issues/38\n\tservice := settings.NewBundleService(\"com.owncloud.api.settings\", mclient.DefaultClient)\n\n\tpermissionRequests := generateAccountManagementPermissionsRequests()\n\tfor i := range permissionRequests {\n\t\tres, err := service.AddSettingToBundle(context.Background(), &permissionRequests[i])\n\t\tbundleID := permissionRequests[i].BundleId\n\t\tif err != nil {\n\t\t\tl.Err(err).Str(\"bundle\", bundleID).Str(\"setting\", permissionRequests[i].Setting.Id).Msg(\"error adding setting to bundle\")\n\t\t} else {\n\t\t\tl.Info().Str(\"bundle\", bundleID).Str(\"setting\", res.Setting.Id).Msg(\"successfully added setting to bundle\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58d106cba928f1b63293b61a3a451940", "score": "0.40765968", "text": "func (o *MemoryPersistentMemoryConfigResult) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "d5bca4e0fe650efb13e806db10731f57", "score": "0.40728053", "text": "func (dc *dexConnection) setRegConfirms(confs uint32) {\n\tdc.regConfMtx.Lock()\n\tdefer dc.regConfMtx.Unlock()\n\tif confs == regConfirmationsPaid {\n\t\t// A nil regConfirms indicates that there is no pending registration.\n\t\tdc.regConfirms = nil\n\t\treturn\n\t}\n\tdc.regConfirms = &confs\n}", "title": "" }, { "docid": "4bc2facf12811c545afb8de58d88912b", "score": "0.40666485", "text": "func (o RegistrationDefinitionPropertiesOutput) ManagedByTenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RegistrationDefinitionProperties) string { return v.ManagedByTenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4b9cc2dfe9b8fd65d68fa1d946f7afd2", "score": "0.40612203", "text": "func (a *MeActionsApiService) MeWipeManagedAppRegistrationsByDeviceTag(ctx _context.Context, inlineObject317 InlineObject317) (*_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 + \"/me/wipeManagedAppRegistrationsByDeviceTag\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &inlineObject317\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\tif localVarHTTPResponse.StatusCode == 0 {\n\t\t\tvar v OdataError\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "369f0756202feae259af78a0e5f2531f", "score": "0.40560794", "text": "func (*AdminServiceApiV1) NewNotificationsRegistration(instanceCrn string) (_model *NotificationsRegistration, err error) {\n\t_model = &NotificationsRegistration{\n\t\tInstanceCrn: core.StringPtr(instanceCrn),\n\t}\n\terr = core.ValidateStruct(_model, \"required parameters\")\n\treturn\n}", "title": "" }, { "docid": "fcecf4d7da39cdf5e7efb62b6f679c3b", "score": "0.40542704", "text": "func (o *NiatelemetryApicPerformanceDataAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "c6b5f9277b53ef28cf2069e2b3321b22", "score": "0.4053705", "text": "func (m *TargetedManagedAppConfiguration) GetApps()([]ManagedMobileAppable) {\n return m.apps\n}", "title": "" }, { "docid": "805e0175df259f4985b4825db4f5e4bc", "score": "0.40502533", "text": "func (o *StorageEnclosureDiskSlotEpAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "40914f4fd3f4852dffbe4314f845b0f8", "score": "0.4048802", "text": "func (m *DeviceAppManagement) GetManagedAppPolicies()([]ManagedAppPolicyable) {\n val, err := m.GetBackingStore().Get(\"managedAppPolicies\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]ManagedAppPolicyable)\n }\n return nil\n}", "title": "" }, { "docid": "3b5bf326b87a808f824e75795f08b916", "score": "0.40474087", "text": "func (o *AdapterHostFcInterface) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "6a0f3bc9cde38f9f7c14698f7768f2f1", "score": "0.40444013", "text": "func (m *DeviceManagement) SetDeviceEnrollmentConfigurations(value []DeviceEnrollmentConfigurationable)() {\n err := m.GetBackingStore().Set(\"deviceEnrollmentConfigurations\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8190e0aec81916a3ad0f4c2ec2febaac", "score": "0.4040687", "text": "func (o *NiatelemetryNexusDashboardMemoryDetailsAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "33230e37ef354c9335677b92b38f0084", "score": "0.4025479", "text": "func (o ReportSettingPropertiesOutput) Regions() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ReportSettingProperties) []string { return v.Regions }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "69888c7d0364308e9cc9d497e73dc775", "score": "0.4010719", "text": "func (m *DeviceAppManagement) SetMdmWindowsInformationProtectionPolicies(value []MdmWindowsInformationProtectionPolicyable)() {\n err := m.GetBackingStore().Set(\"mdmWindowsInformationProtectionPolicies\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "96485201462bed4d07a4687961a74596", "score": "0.40070707", "text": "func PossibleManagedIdentityTypesValues() []ManagedIdentityTypes {\n\treturn []ManagedIdentityTypes{SystemAssigned, UserAssigned}\n}", "title": "" }, { "docid": "d657ada6b1ff44379127da37f7497cc9", "score": "0.4002513", "text": "func (o *NiatelemetryMsoSiteDetailsAllOf) GetRegisteredDevice() AssetDeviceRegistrationRelationship {\n\tif o == nil || o.RegisteredDevice == nil {\n\t\tvar ret AssetDeviceRegistrationRelationship\n\t\treturn ret\n\t}\n\treturn *o.RegisteredDevice\n}", "title": "" }, { "docid": "71d1e9a9fb667d8c8595af66014259d4", "score": "0.39946073", "text": "func (app *AppFeature) AppFeatureRegisterCmder() cmder.Cmder {\n\treturn &AppFeatureRegister{AppFeature: app}\n}", "title": "" }, { "docid": "0527867706da1f8b0692008019b76d5a", "score": "0.39679986", "text": "func (o *ServiceBrokerAuthRegistrationParams) WithRegions(regions []string) *ServiceBrokerAuthRegistrationParams {\n\to.SetRegions(regions)\n\treturn o\n}", "title": "" }, { "docid": "26100a5164c9ed7d06a152ef432fcca8", "score": "0.3966966", "text": "func (o *AutoscalerCountMsg) SetCalculatedInstances(v int32) {\n\to.CalculatedInstances = &v\n}", "title": "" }, { "docid": "24626077c855bf732a52ab309732f922", "score": "0.39571458", "text": "func (m *GroupLifecyclePolicy) SetManagedGroupTypes(value *string)() {\n err := m.GetBackingStore().Set(\"managedGroupTypes\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3d6b9a6ad795f6b4a4ca80ab4ff752b2", "score": "0.39375094", "text": "func (m *DeviceAppManagement) GetDefaultManagedAppProtections()([]DefaultManagedAppProtectionable) {\n val, err := m.GetBackingStore().Get(\"defaultManagedAppProtections\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]DefaultManagedAppProtectionable)\n }\n return nil\n}", "title": "" }, { "docid": "8d8a40a8a363e6abfbdd8c351674118e", "score": "0.39371482", "text": "func (m *AndroidDeviceOwnerGeneralDeviceConfiguration) SetFactoryResetDeviceAdministratorEmails(value []string)() {\n err := m.GetBackingStore().Set(\"factoryResetDeviceAdministratorEmails\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a7bd585ca2fd7fd24a8c476d12aa76e0", "score": "0.3934289", "text": "func (app *App) HandleListRegistryIntegrations(w http.ResponseWriter, r *http.Request) {\n\tregistries := ints.PorterRegistryIntegrations\n\n\tw.WriteHeader(http.StatusOK)\n\n\tif err := json.NewEncoder(w).Encode(&registries); err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "b66a9dbe366e84413ee3e7158d2ab9a0", "score": "0.39296785", "text": "func NewPartnerRegistrationsClient(con *arm.Connection, subscriptionID string) *PartnerRegistrationsClient {\n\treturn &PartnerRegistrationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID}\n}", "title": "" }, { "docid": "77b498365afba8b32e8bb533d60d6a5a", "score": "0.39265493", "text": "func (m *ManagedDeviceMobileAppConfiguration) SetAssignments(value []ManagedDeviceMobileAppConfigurationAssignmentable)() {\n m.assignments = value\n}", "title": "" }, { "docid": "3230535de3166c2112da43fd22f87102", "score": "0.39213532", "text": "func (a *LEAdvertisingManager1) SetSupportedInstances(v byte) error {\n\treturn a.SetProperty(\"SupportedInstances\", v)\n}", "title": "" }, { "docid": "3a516cd8e0d185e10efc537046f7aa7d", "score": "0.3920374", "text": "func (m *ManagedDevice) SetUsers(value []Userable)() {\n err := m.GetBackingStore().Set(\"users\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "901cb7cab81b0a367de3c1eb1120656e", "score": "0.39190167", "text": "func (b *ImageRegistryStatusApplyConfiguration) WithGenerations(values ...*v1.GenerationStatusApplyConfiguration) *ImageRegistryStatusApplyConfiguration {\n\tfor i := range values {\n\t\tif values[i] == nil {\n\t\t\tpanic(\"nil value passed to WithGenerations\")\n\t\t}\n\t\tb.Generations = append(b.Generations, *values[i])\n\t}\n\treturn b\n}", "title": "" }, { "docid": "62faa4853ff0e8b8120f9d0f37a4a98b", "score": "0.39077112", "text": "func (o *APIApp) SetAppAppTokens(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*AppToken) error {\n\tquery := \"update `app_tokens` set `app_id` = null where `app_id` = ?\"\n\tvalues := []interface{}{o.ID}\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.AppAppTokens {\n\t\t\tqueries.SetScanner(&rel.AppID, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.App = nil\n\t\t}\n\n\t\to.R.AppAppTokens = nil\n\t}\n\treturn o.AddAppAppTokens(ctx, exec, insert, related...)\n}", "title": "" }, { "docid": "be8e5cf12da5427a1c7d499046974150", "score": "0.38937017", "text": "func (m *DeviceManagement) SetDeviceConfigurations(value []DeviceConfigurationable)() {\n err := m.GetBackingStore().Set(\"deviceConfigurations\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4eee8b5f2351f4ce82a1db3e16ded306", "score": "0.38893014", "text": "func (m *ManagedDeviceMobileAppConfiguration) SetTargetedMobileApps(value []string)() {\n m.targetedMobileApps = value\n}", "title": "" }, { "docid": "c3554f1f09bfe78f6b93bee99991ee1e", "score": "0.388714", "text": "func (o *NetworkVpcPeerAllOf) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "9fc0941c4faf872a8e3e32bfff587dad", "score": "0.38784727", "text": "func (s *RemoveDraftAppVersionResourceMappingsInput) SetAppRegistryAppNames(v []*string) *RemoveDraftAppVersionResourceMappingsInput {\n\ts.AppRegistryAppNames = v\n\treturn s\n}", "title": "" }, { "docid": "349e56b7c536effa7ff106dbde83fd2b", "score": "0.38756672", "text": "func (m *Teamwork) SetWorkforceIntegrations(value []WorkforceIntegrationable)() {\n err := m.GetBackingStore().Set(\"workforceIntegrations\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6b94327af390bc94b2d59ef9ae821ee1", "score": "0.38736388", "text": "func ApplicationsRegenerateSecret(ctx *context.Context) {\n\tctx.Data[\"Title\"] = ctx.Tr(\"settings\")\n\tctx.Data[\"PageIsAdminApplications\"] = true\n\n\toa := newOAuth2CommonHandlers()\n\toa.RegenerateSecret(ctx)\n}", "title": "" }, { "docid": "96602403c26cddb5bef7a46c7a2f75a3", "score": "0.38733834", "text": "func (m *AndroidDeviceOwnerGeneralDeviceConfiguration) SetPersonalProfilePersonalApplications(value []AppListItemable)() {\n err := m.GetBackingStore().Set(\"personalProfilePersonalApplications\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b14626c26c3f840d7bca4539752ae929", "score": "0.38726598", "text": "func AddRelatedPropertyGeneratorsForManagedServiceIdentity(gens map[string]gopter.Gen) {\n\tgens[\"UserAssignedIdentities\"] = gen.SliceOf(UserAssignedIdentityDetailsGenerator())\n}", "title": "" }, { "docid": "102df20673a2f91c0987e4220ffd1170", "score": "0.3871148", "text": "func PossibleManagedHsmSKUFamilyValues() []ManagedHsmSKUFamily {\n\treturn []ManagedHsmSKUFamily{\n\t\tManagedHsmSKUFamilyB,\n\t}\n}", "title": "" }, { "docid": "7c8cbf91d916b2a2270229f0738ea1e6", "score": "0.3866056", "text": "func (o *IaasServiceRequest) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "6a6e5f03cc925b1d9554d8684b8b4079", "score": "0.3866011", "text": "func (o *VirtualizationVirtualNetwork) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "e52a85f730a0e17ff38218141b5ee97e", "score": "0.38636324", "text": "func (m *ManagedDevice) SetAzureADRegistered(value *bool)() {\n err := m.GetBackingStore().Set(\"azureADRegistered\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1ffe043904df0bc056f5dfc53e76c843", "score": "0.38630933", "text": "func (m *IdentityContainer) SetIdentityProviders(value []IdentityProviderBaseable)() {\n m.identityProviders = value\n}", "title": "" }, { "docid": "7701accf92b78f12a17fde3046b42d12", "score": "0.3862526", "text": "func (m *ProjectRoles) SetAdministrators(val PrincipalRoleAssignment) {\n\tm.administratorsField = val\n}", "title": "" }, { "docid": "2b2b13db36c6501a4b258ac5b0712168", "score": "0.38575247", "text": "func (m *User) GetRegisteredDevices()([]DirectoryObjectable) {\n val, err := m.GetBackingStore().Get(\"registeredDevices\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]DirectoryObjectable)\n }\n return nil\n}", "title": "" }, { "docid": "d323a4f51c41494300464cd279cf061f", "score": "0.38569835", "text": "func PossibleManagedInstanceProxyOverrideValues() []ManagedInstanceProxyOverride {\n\treturn []ManagedInstanceProxyOverride{ManagedInstanceProxyOverrideDefault, ManagedInstanceProxyOverrideProxy, ManagedInstanceProxyOverrideRedirect}\n}", "title": "" }, { "docid": "a8745d9029368945d6b45ceb29102327", "score": "0.38556418", "text": "func (o *StorageFlexFlashController) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" }, { "docid": "9965946e3f0e0688aa74bbc45d3363c3", "score": "0.38544825", "text": "func handleHealthCheckRegistrations(subscribeForRegisteredChecks health.SubscribeForRegisteredChecks, subscribeForCheckResults health.SubscribeForCheckResults, checkResults health.CheckResults, metricRegisterer prometheus.Registerer, lc fx.Lifecycle, logger *zerolog.Logger) {\n\tdone := make(chan struct{})\n\tlogHealthCheckRegistered := eventlog.NewLogger(HealthCheckRegisteredEvent, logger, zerolog.NoLevel)\n\tlogHealthCheckGaugeRegistrationError := eventlog.NewLogger(HealthCheckGaugeRegistrationErrorEvent, logger, zerolog.ErrorLevel)\n\thealthCheckRegistered := subscribeForRegisteredChecks()\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-done:\n\t\t\t\treturn\n\t\t\tcase registeredCheck, ok := <-healthCheckRegistered.Chan():\n\t\t\t\tif ok {\n\t\t\t\t\tlogHealthCheckRegistered(&healthCheck{registeredCheck, nil}, \"health check registered\")\n\t\t\t\t\tif err := registerHealthCheckGauge(done, registeredCheck, subscribeForCheckResults, checkResults, metricRegisterer); err != nil {\n\t\t\t\t\t\t// this should never happen\n\t\t\t\t\t\tlogHealthCheckGaugeRegistrationError(&healthCheck{registeredCheck, err}, \"health check failed to register\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\tlc.Append(fx.Hook{\n\t\tOnStop: func(context.Context) error {\n\t\t\tclose(done)\n\t\t\treturn nil\n\t\t},\n\t})\n}", "title": "" }, { "docid": "7c757a80d777f6eb7364a3465d6819cf", "score": "0.38494977", "text": "func (o *TechsupportmanagementTechSupportStatus) SetDeviceRegistration(v AssetDeviceRegistrationRelationship) {\n\to.DeviceRegistration = &v\n}", "title": "" }, { "docid": "479842edbd934862358e6cba2407f6ff", "score": "0.38396502", "text": "func (o GoogleCloudIdentitytoolkitAdminV2AllowlistOnlyPtrOutput) AllowedRegions() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *GoogleCloudIdentitytoolkitAdminV2AllowlistOnly) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.AllowedRegions\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "cb0c953248b775f01f5c98e595dd5c3a", "score": "0.38386196", "text": "func (o *BootDeviceBootSecurity) SetRegisteredDevice(v AssetDeviceRegistrationRelationship) {\n\to.RegisteredDevice = &v\n}", "title": "" } ]
9c339a680b0208ca83f468e9b702b5e7
AuthByRefreshToken mocks base method.
[ { "docid": "65c819c022c66e225b9b2ff24d727508", "score": "0.78997713", "text": "func (m *MockAuthServiceClient) AuthByRefreshToken(arg0 context.Context, arg1 *authv1.AuthByRefreshTokenRequest, arg2 ...grpc.CallOption) (*authv1.AuthByRefreshTokenResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"AuthByRefreshToken\", varargs...)\n\tret0, _ := ret[0].(*authv1.AuthByRefreshTokenResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
[ { "docid": "03e15eb2cbb1a713adb1d28a960f3430", "score": "0.69847155", "text": "func TestRefreshTokenAuthorization(t *testing.T) {\n\tserver := ultradnsAuthMockServer(t)\n\tdefer server.Close()\n\n\tauth := NewAuthorization(validUsername, validPassword)\n\tauth.BaseURL = server.URL\n\tclient := &http.Client{\n\t\tTimeout: 1 * time.Second,\n\t}\n\n\terr := auth.Authorize(client)\n\tassert.NoError(t, err)\n\trefreshToken := auth.RefreshToken\n\tassert.NotEqual(t, refreshToken, \"\")\n\n\t// Clear out username/password to ensure that we can't use them.\n\tauth.Lock()\n\tauth.Username = \"\"\n\tauth.Password = \"\"\n\tauth.TokenExpires = 0\n\tauth.Unlock()\n\n\t// Reauthorize, ensure that the refresh token has changed\n\terr = auth.Authorize(client)\n\tassert.NoError(t, err)\n\tassert.NotEqual(t, refreshToken, \"\")\n\tassert.NotEqual(t, refreshToken, auth.RefreshToken)\n}", "title": "" }, { "docid": "e48acf03488d57eb526a59867c970066", "score": "0.68986565", "text": "func (m *MockExpiringHashInterface) Refresh(arg0 context.Context) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Refresh\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "fc5bc76666144191d1de38f47484c247", "score": "0.67181313", "text": "func (m *MockSessionManager) Refresh() {\n\tm.ctrl.Call(m, \"Refresh\")\n}", "title": "" }, { "docid": "bb50c7e9b11457a56b244058b713f087", "score": "0.66054523", "text": "func AuthenticateRefreshToken(r *http.Request) (jwt.MapClaims, error) {\n\treturn Authenticate(r, os.Getenv(RefreshClientSecret))\n}", "title": "" }, { "docid": "06a046372dd9f94166ea381c6f0642c5", "score": "0.6450213", "text": "func (_m *Service) GetAuthRefresh(ctx context.Context, refreshToken string) *oauth2.GoogleAuthResponse {\n\tret := _m.Called(ctx, refreshToken)\n\n\tvar r0 *oauth2.GoogleAuthResponse\n\tif rf, ok := ret.Get(0).(func(context.Context, string) *oauth2.GoogleAuthResponse); ok {\n\t\tr0 = rf(ctx, refreshToken)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*oauth2.GoogleAuthResponse)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "1137507517c58641ca5faad98d3c895f", "score": "0.64302677", "text": "func (_m *TokenService) Refresh(refreshToken string) (*models.TokenDetails, error) {\n\tret := _m.Called(refreshToken)\n\n\tvar r0 *models.TokenDetails\n\tif rf, ok := ret.Get(0).(func(string) *models.TokenDetails); ok {\n\t\tr0 = rf(refreshToken)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*models.TokenDetails)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(refreshToken)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "7958eb2498af4c69452d3323d9a3dedc", "score": "0.64194155", "text": "func (_m *UserService) RefreshAuthorizationToken(id uuid.UUID) (string, error) {\n\tret := _m.Called(id)\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func(uuid.UUID) string); ok {\n\t\tr0 = rf(id)\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(uuid.UUID) error); ok {\n\t\tr1 = rf(id)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "5f0521b16998542060192fc4ff43a81d", "score": "0.63889223", "text": "func (_m *IOAuthProvider) RefreshToken(ctx context.Context, t string) (*mockery.Employee, error) {\n\tret := _m.Called(ctx, t)\n\n\tvar r0 *mockery.Employee\n\tif rf, ok := ret.Get(0).(func(context.Context, string) *mockery.Employee); ok {\n\t\tr0 = rf(ctx, t)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*mockery.Employee)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string) error); ok {\n\t\tr1 = rf(ctx, t)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "6ebb24d4db2ad3a8079cb3c20e590b7e", "score": "0.6282169", "text": "func (mock *JWTProviderMock) GenerateRefreshTokenCalls() []struct {\n\tEmail string\n} {\n\tvar calls []struct {\n\t\tEmail string\n\t}\n\tmock.lockGenerateRefreshToken.RLock()\n\tcalls = mock.calls.GenerateRefreshToken\n\tmock.lockGenerateRefreshToken.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b505f1f5fa947f2398a74ee108198935", "score": "0.6217479", "text": "func (_m *AuthService) Refresh(_a0 context.Context, _a1 string) (int64, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 int64\n\tif rf, ok := ret.Get(0).(func(context.Context, string) int64); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tr0 = ret.Get(0).(int64)\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string) error); ok {\n\t\tr1 = rf(_a0, _a1)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "69133ddf0ea0422c69c26ed2c37c90b9", "score": "0.621603", "text": "func TestAccKeycloakApiClientRefresh(t *testing.T) {\n\tctx := context.Background()\n\n\tfor _, requiredEnvironmentVariable := range requiredEnvironmentVariables {\n\t\tif value := os.Getenv(requiredEnvironmentVariable); value == \"\" {\n\t\t\tt.Fatalf(\"%s must be set before running acceptance tests.\", requiredEnvironmentVariable)\n\t\t}\n\t}\n\n\tif v := os.Getenv(\"KEYCLOAK_CLIENT_SECRET\"); v == \"\" {\n\t\tif v := os.Getenv(\"KEYCLOAK_USER\"); v == \"\" {\n\t\t\tt.Fatal(\"KEYCLOAK_USER must be set for acceptance tests\")\n\t\t}\n\t\tif v := os.Getenv(\"KEYCLOAK_PASSWORD\"); v == \"\" {\n\t\t\tt.Fatal(\"KEYCLOAK_PASSWORD must be set for acceptance tests\")\n\t\t}\n\t}\n\n\t// Convert KEYCLOAK_CLIENT_TIMEOUT to int\n\tclientTimeout, err := strconv.Atoi(os.Getenv(\"KEYCLOAK_CLIENT_TIMEOUT\"))\n\tif err != nil {\n\t\tt.Fatal(\"KEYCLOAK_CLIENT_TIMEOUT must be an integer\")\n\t}\n\n\tkeycloakClient, err := NewKeycloakClient(ctx, os.Getenv(\"KEYCLOAK_URL\"), \"\", os.Getenv(\"KEYCLOAK_CLIENT_ID\"), os.Getenv(\"KEYCLOAK_CLIENT_SECRET\"), os.Getenv(\"KEYCLOAK_REALM\"), os.Getenv(\"KEYCLOAK_USER\"), os.Getenv(\"KEYCLOAK_PASSWORD\"), true, clientTimeout, \"\", false, \"\", false, map[string]string{\n\t\t\"foo\": \"bar\",\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"%s\", err)\n\t}\n\n\t// skip test if running 12.x or greater\n\tif v, _ := keycloakClient.VersionIsGreaterThanOrEqualTo(ctx, Version_12); v {\n\t\tt.Skip()\n\t}\n\n\trealmName := \"terraform-\" + acctest.RandString(10)\n\trealm := &Realm{\n\t\tRealm: realmName,\n\t\tId: realmName,\n\t}\n\n\terr = keycloakClient.NewRealm(ctx, realm)\n\tif err != nil {\n\t\tt.Fatalf(\"%s\", err)\n\t}\n\n\tvar oldAccessToken, oldRefreshToken, oldTokenType string\n\n\t// A following GET for this realm will result in a 403, so we should save the current access and refresh token\n\tif keycloakClient.clientCredentials.GrantType == \"client_credentials\" {\n\t\toldAccessToken = keycloakClient.clientCredentials.AccessToken\n\t\toldRefreshToken = keycloakClient.clientCredentials.RefreshToken\n\t\toldTokenType = keycloakClient.clientCredentials.TokenType\n\t}\n\n\t_, err = keycloakClient.GetRealm(ctx, realmName) // This should not fail since it will automatically refresh and try again\n\tif err != nil {\n\t\tt.Fatalf(\"%s\", err)\n\t}\n\n\t// Clean up - the realm doesn't need to exist in order for us to assert against the refreshed tokens\n\terr = keycloakClient.DeleteRealm(ctx, realmName)\n\tif err != nil {\n\t\tt.Fatalf(\"%s\", err)\n\t}\n\n\tif keycloakClient.clientCredentials.GrantType == \"client_credentials\" {\n\t\tnewAccessToken := keycloakClient.clientCredentials.AccessToken\n\t\tnewRefreshToken := keycloakClient.clientCredentials.RefreshToken\n\t\tnewTokenType := keycloakClient.clientCredentials.TokenType\n\n\t\tif oldAccessToken == newAccessToken {\n\t\t\tt.Fatalf(\"expected access token to update after refresh\")\n\t\t}\n\n\t\tif oldRefreshToken == newRefreshToken {\n\t\t\tt.Fatalf(\"expected refresh token to update after refresh\")\n\t\t}\n\n\t\tif oldTokenType != newTokenType {\n\t\t\tt.Fatalf(\"expected token type to remain the same after refresh\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "61b2ac00cb6c94dab22c0ec9ebc7da29", "score": "0.6211627", "text": "func TestRefreshToken(t *testing.T) {\n\taz := &AzureCSTextToSpeech{SubscriptionKey: \"ThisIsMySubscriptionKeyAndToBeToken\"}\n\n\tts := httptest.NewServer(\n\t\thttp.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t// return the SubscriptionKey as the token, for test case only.\n\t\t\tw.Write([]byte(az.SubscriptionKey))\n\t\t}),\n\t)\n\tdefer ts.Close()\n\taz.tokenRefreshURL = ts.URL\n\terr := az.refreshToken()\n\n\tassert.NoError(t, err, \"should not return an error\")\n\tassert.Equal(t, az.SubscriptionKey, az.accessToken, \"values should be equal\")\n}", "title": "" }, { "docid": "cba562cdb7e7dd008e93ffedf49051e5", "score": "0.61725324", "text": "func (m *MockClient) RefreshCoordinator(arg0 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshCoordinator\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9320459bd43bf6a5c552932000013394", "score": "0.6137968", "text": "func (mr *MockAuthServiceClientMockRecorder) AuthByRefreshToken(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, \"AuthByRefreshToken\", reflect.TypeOf((*MockAuthServiceClient)(nil).AuthByRefreshToken), varargs...)\n}", "title": "" }, { "docid": "4a074a52653f8ed73c9190b39242180d", "score": "0.6099792", "text": "func (m *MockClient) RefreshMetadata(arg0 ...string) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{}\n\tfor _, a := range arg0 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"RefreshMetadata\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "fa97c4eabd18418903e7ba86bc6456bc", "score": "0.6073551", "text": "func (j *JwtAPI) RequestTokenByRefreshToken(rtoken string) (Token, error) {\n\terr := j.requestTokenByRefreshToken(rtoken)\n\tif err != nil {\n\t\treturn Token{}, err\n\t}\n\n\tj.logDebug(\"RequestTokenByRefreshToken\", \"API Object's refresh-token is (%s)\", j.GetToken().RefreshToken)\n\treturn j.GetToken(), nil\n}", "title": "" }, { "docid": "1ba927f69181f695dc4bd747244699ef", "score": "0.6060816", "text": "func (m *MockPopularRefresher) RefreshAll() error {\n\tret := m.ctrl.Call(m, \"RefreshAll\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "0085c24afe1c4b43c1d92806072b8179", "score": "0.60131097", "text": "func (m *MockPopularRefresher) Refresh(view comic.MaterializedView) error {\n\tret := m.ctrl.Call(m, \"Refresh\", view)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "45678ffda6b37ad1da77b0cc25d9e53c", "score": "0.60119945", "text": "func (acc *AccountController) Refresh(w http.ResponseWriter, r *http.Request) {\n\tmapToken := map[string]string{}\n\tif err := json.NewDecoder(r.Body).Decode(&mapToken); err != nil {\n\t\tu.RespondWithError(w, http.StatusUnprocessableEntity, u.Message(false, \"Invalid Map token\"))\n\t\treturn\n\t}\n\trefreshToken := mapToken[\"refresh_token\"]\n\ttoken, err := jwt.Parse(refreshToken, func(token *jwt.Token) (interface{}, error) {\n\t\t//Make sure that the token method conform to \"SigningMethodHMAC\"\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t}\n\t\treturn []byte(util.GetEnv().RefreshSecret), nil\n\t})\n\tif err != nil {\n\t\tu.RespondWithError(w, http.StatusUnauthorized, u.Message(false, \"Refresh Token has expired\"))\n\t\treturn\n\t}\n\t//is token valid?\n\tif _, ok := token.Claims.(jwt.Claims); !ok && !token.Valid {\n\t\tu.RespondWithError(w, http.StatusUnauthorized, u.Message(false, fmt.Sprintf(\"%v\", err)))\n\t\treturn\n\t}\n\t//Since token is valid, get the uuid:\n\tclaims, ok := token.Claims.(jwt.MapClaims) //the token claims should conform to MapClaims\n\tif ok && token.Valid {\n\t\trefreshUUID, ok := claims[\"refresh_uuid\"].(string) //convert the interface to string\n\t\tif !ok {\n\t\t\tu.RespondWithError(w, http.StatusUnprocessableEntity, u.Message(false, fmt.Sprintf(\"%v\", err)))\n\t\t\treturn\n\t\t}\n\t\tuserID, err := claims[\"account_id\"].(string)\n\t\tif !err {\n\t\t\tu.RespondWithError(w, http.StatusUnprocessableEntity, u.Message(false, \"Error occured\"))\n\t\t\treturn\n\t\t}\n\t\t//Delete the previous Refresh Token\n\t\tdelErr := acc.accServ.DeleteAuth(refreshUUID)\n\t\tif delErr != nil { //if any goes wrong\n\t\t\tu.RespondWithError(w, http.StatusUnauthorized, u.Message(false, \"Unauthorized\"))\n\t\t\treturn\n\t\t}\n\t\t//Create new pairs of refresh and access tokens\n\t\tts, createErr := acc.accServ.CreateToken(userID)\n\t\tif createErr != nil {\n\t\t\tu.RespondWithError(w, http.StatusForbidden, u.Message(false, createErr.Error()))\n\t\t\treturn\n\t\t}\n\t\t//save the tokens metadata to redis\n\t\tsaveErr := acc.accServ.CreateAuth(userID, ts)\n\t\tif saveErr != nil {\n\t\t\tu.RespondWithError(w, http.StatusForbidden, u.Message(false, saveErr.Error()))\n\t\t\treturn\n\t\t}\n\t\ttokens := map[string]string{\n\t\t\t\"access_token\": ts.AccessToken,\n\t\t\t\"refresh_token\": ts.RefreshToken,\n\t\t}\n\t\tu.RespondWithJSON(w, http.StatusCreated, tokens)\n\t} else {\n\t\tu.RespondWithJSON(w, http.StatusUnauthorized, \"refresh expired\")\n\t}\n}", "title": "" }, { "docid": "48e3cbb0baeec2fc96f16f2a42f7f38a", "score": "0.5995741", "text": "func (_m *ServiceAuth) RefreshToken(ctx context.Context, payload auth_service.TokenRequest) <-chan golibshared.Result {\n\tret := _m.Called(ctx, payload)\n\n\tvar r0 <-chan golibshared.Result\n\tif rf, ok := ret.Get(0).(func(context.Context, auth_service.TokenRequest) <-chan golibshared.Result); ok {\n\t\tr0 = rf(ctx, payload)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(<-chan golibshared.Result)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "e535630ea99a58c8db9ee4a3fe4d6951", "score": "0.5985549", "text": "func (m *MockServiceendpointClient) GetServiceEndpointsWithRefreshedAuthentication(arg0 context.Context, arg1 serviceendpoint.GetServiceEndpointsWithRefreshedAuthenticationArgs) (*[]serviceendpoint.ServiceEndpoint, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetServiceEndpointsWithRefreshedAuthentication\", arg0, arg1)\n\tret0, _ := ret[0].(*[]serviceendpoint.ServiceEndpoint)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1d76314d7000a7cb860b843f841b8e3a", "score": "0.5984725", "text": "func TestIntegrationRefreshTokenInitWorkflow(t *testing.T) {\n\thostURLConfig := idp.HostURLConfig{TenantScoped: true, Tenant: testutils.TestTenant, Region: testutils.TestRegion}\n\t// get a new refresh token\n\ttr := idp.NewPKCERetriever(NativeClientID, NativeAppRedirectURI, idp.DefaultRefreshScope, TestUsername, TestPassword, IdpHostTenantScoped, \"\", hostURLConfig)\n\tctx, err := tr.GetTokenContext()\n\trequire.Emptyf(t, err, \"Error validating using access token generated from PKCE flow: %s\", err)\n\trequire.NotNil(t, ctx)\n\n\ttr_refresh := idp.NewRefreshTokenRetriever(NativeClientID, idp.DefaultRefreshScope, ctx.RefreshToken, IdpHostTenantScoped, \"\", hostURLConfig)\n\tclient, err := sdk.NewClient(&services.Config{\n\t\tTokenRetriever: tr_refresh,\n\t\tHost: testutils.TestSplunkCloudHost,\n\t\tTenant: testutils.TestTenant,\n\t\tTimeout: testutils.TestTimeOut,\n\t})\n\trequire.Emptyf(t, err, \"Error initializing client: %s\", err)\n\n\tinput := identity.ValidateTokenQueryParams{Include: []identity.ValidateTokenincludeEnum{\"principal\", \"tenant\"}}\n\tinfo, err := client.IdentityService.ValidateToken(&input)\n\tassert.Emptyf(t, err, \"Error validating using access token generated from refresh token: %s\", err)\n\tassert.NotNil(t, info)\n}", "title": "" }, { "docid": "dc78d71434893835ee37bc965c492cd5", "score": "0.5945927", "text": "func (_m *IUserService) RefreshToken(ctx context.Context, userID string) (string, error) {\n\tret := _m.Called(ctx, userID)\n\n\tvar r0 string\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(context.Context, string) (string, error)); ok {\n\t\treturn rf(ctx, userID)\n\t}\n\tif rf, ok := ret.Get(0).(func(context.Context, string) string); ok {\n\t\tr0 = rf(ctx, userID)\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\tif rf, ok := ret.Get(1).(func(context.Context, string) error); ok {\n\t\tr1 = rf(ctx, userID)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "de887b55552089293c149e9a36ca663e", "score": "0.59449905", "text": "func (i *IAMService) RefreshToken() error {\n\ttoken := i.newToken()\n\ttoken.Claims[\"refresh_token\"] = i.client.CurrentRefreshToken\n\t// fmt.Println(\"token:\", token)\n\treturn i.auth(token)\n}", "title": "" }, { "docid": "930ac7c0357fb0521de643464ae6d787", "score": "0.5938178", "text": "func (suite *TenantTestSuite) TestTenantRefreshUserToken() {\n\n\tjsonOutput := `{\n \"status\": {\n \"message\": \"User api key succesfully renewed\",\n \"code\": \"200\"\n },\n \"data\": {\n \"api_key\": \"{{APIKEY}}\"\n }\n}`\n\trequest, _ := http.NewRequest(\"POST\", \"/api/v2/admin/tenants/6ac7d684-1f8e-4a02-a502-720e8f11e50b/users/acb74194-553a-11e9-8647-d663bd873d93/renew_api_key\", strings.NewReader(\"\"))\n\trequest.Header.Set(\"x-api-key\", suite.clientkey)\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\tresponse := httptest.NewRecorder()\n\n\tsuite.router.ServeHTTP(response, request)\n\n\tcode := response.Code\n\toutput := response.Body.String()\n\n\t// check that the element has actually been Deleted\n\t// connect to mongodb\n\tsession, err := mgo.Dial(suite.cfg.MongoDB.Host)\n\tdefer session.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// try to retrieve item\n\tvar result Tenant\n\tc := session.DB(suite.cfg.MongoDB.Db).C(\"tenants\")\n\terr = c.Find(bson.M{\"id\": \"6ac7d684-1f8e-4a02-a502-720e8f11e50b\"}).One(&result)\n\n\ttoken := \"\"\n\tfor _, usr := range result.Users {\n\t\tif usr.ID == \"acb74194-553a-11e9-8647-d663bd873d93\" {\n\t\t\ttoken = usr.APIkey\n\t\t}\n\t}\n\n\tsuite.Equal(200, code, \"Internal Server Error\")\n\t//Compare the expected and actual xml response\n\tsuite.Equal(strings.Replace(jsonOutput, \"{{APIKEY}}\", token, 1), output, \"Response body mismatch\")\n\n}", "title": "" }, { "docid": "9e3748e3fbfd3b17cf20b0ca68ae7cef", "score": "0.59306175", "text": "func (m *MockITwitterAPI) GenBearerToken(APIKey, APISecret string) string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GenBearerToken\", APIKey, APISecret)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "283cbf6b4a6173e669b461342a7fe9e3", "score": "0.592888", "text": "func RefreshTokenAuth(refreshToken string) (string, string, error) {\n\trToken, err := refreshTokenAuth.RefreshToken(refreshToken)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tclaims, _ := refreshTokenAuth.ParseToken(rToken.Token)\n\taToken, _ := accessTokenAuth.GenerateToken(claims.(float64))\n\treturn rToken.Token, aToken.Token, nil\n}", "title": "" }, { "docid": "3b6a2912606211cb6ebb30cb0e1db135", "score": "0.5901845", "text": "func (a *Authenticator) refreshToken(prev *internal.Token, lifetime time.Duration) (*internal.Token, error) {\n\treturn a.authToken.compareAndRefresh(a.ctx, compareAndRefreshOp{\n\t\tlock: &a.lock,\n\t\tprev: prev,\n\t\tlifetime: lifetime,\n\t\trefreshCb: func(ctx context.Context, prev *internal.Token) (*internal.Token, error) {\n\t\t\t// In Actor mode, need to make sure we have a sufficiently fresh base\n\t\t\t// token first, since it's needed to call \"acting\" API to get a new auth\n\t\t\t// token for the target service account. 1 min should be more than enough\n\t\t\t// to make an RPC.\n\t\t\tvar base *internal.Token\n\t\t\tif a.actingMode() != actingModeNone {\n\t\t\t\tvar err error\n\t\t\t\tif base, err = a.getBaseTokenLocked(ctx, time.Minute); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn a.authToken.renewToken(ctx, prev, base)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "6095302ecffeae6e613837d943ba766d", "score": "0.58971167", "text": "func (h *horizonClient) refresh(ctx context.Context) error {\n\trequest := RefreshTokenRequest{h.tokens.RefreshToken}\n\tres, err := h.client.R().SetContext(ctx).SetBody(request).Post(refreshPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !res.IsSuccess() {\n\t\tswitch res.StatusCode() {\n\t\tcase http.StatusBadRequest:\n\t\t\treturn errTokenExpired\n\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unexpected HTTP response: %d %s\", res.StatusCode(), string(res.Body()))\n\t\t}\n\t}\n\n\tvar accessToken AccessToken\n\terr = json.Unmarshal(res.Body(), &accessToken)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unmarshal JSON access token response\")\n\t}\n\n\ttoken := accessToken.AccessToken\n\th.tokens.AccessToken = token\n\th.client.SetAuthToken(token)\n\th.logger.Debug(\"auth token refresh successful\")\n\treturn nil\n}", "title": "" }, { "docid": "9df9e82defb9ba005081826b20b2eabf", "score": "0.589518", "text": "func VerifyRefreshToken(next echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\ttoken := c.Get(\"user\").(*jwt.Token)\n\t\tclaims := token.Claims.(jwt.MapClaims)\n\t\tID := claims[\"ID\"].(string)\n\t\tPw := claims[\"Pw\"].(string)\n\t\tc.Set(\"ID\", ID)\n\t\tc.Set(\"Pw\", Pw)\n\t\treturn next(c)\n\t}\n}", "title": "" }, { "docid": "4fefa71e8f1923bf99eed83a0212ced3", "score": "0.5875952", "text": "func (m *MockAPIs) RefreshSGIDs(arg0 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshSGIDs\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "231d288a0300260a4fcc8d86bb31f1c5", "score": "0.58631384", "text": "func (m *testDBRepo) UpdateRefreshToken(id int, rfToken string) error {\n\tif id == 1 {\n\t\treturn nil\n\t}\n\treturn errors.New(\"some errors\")\n}", "title": "" }, { "docid": "3c9e43459f9b47e8a21b39a9dc1f6002", "score": "0.5861694", "text": "func checkRefreshToken(refreshToken string) (interface{}, error) {\n\ttoken, err := jwt.Parse(refreshToken, func(token *jwt.Token) (interface{}, error) {\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, fmt.Errorf(\"An error occurred\")\n\t\t}\n\t\treturn refreshSigningKey, nil\n\t})\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\treturn claims[\"client\"], nil\n\t}\n\treturn \"\", errors.New(\"Credentials not provided\")\n}", "title": "" }, { "docid": "d2fcacfd0974ba6eed208079f6a2898f", "score": "0.58297414", "text": "func (m *Repository) RefreshToken(w http.ResponseWriter, r *http.Request) {\n\tmapToken := map[string]string{}\n\n\t//Read json file into memory with limits on json file size\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\n\t//Check for errors in body of json file\n\tif err := r.Body.Close(); err != nil {\n\t\tlog.Print(err)\n\t}\n\n\t//Unmarshal json into mapToken\n\tif err := json.Unmarshal(body, &mapToken); err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tif err := json.NewEncoder(w).Encode(err); err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t}\n\trefreshToken := mapToken[\"refresh_token\"]\n\n\t//verify the token\n\ttoken, err := jwt.Parse(refreshToken, func(token *jwt.Token) (interface{}, error) {\n\t\t//Make sure that the token method conform to \"SigningMethodHMAC\"\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t}\n\t\treturn []byte(os.Getenv(\"REFRESH_SECRET\")), nil\n\t})\n\n\t//if there is an error, the token must have expired\n\tif err != nil {\n\t\tvar errReponse models.ErrReponse\n\t\terrReponse.Error = \"authorisation error\"\n\t\terrReponse.Description = err.Error()\n\t\terrReponse.Code = 401\n\n\t\tjsonErrReponse, err := json.Marshal(errReponse)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\n\t\t//Set response headers and write JSON as response\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(401)\n\t\tw.Write(jsonErrReponse)\n\t\treturn\n\t}\n\n\t//check if the token is valid\n\tif _, ok := token.Claims.(jwt.Claims); !ok && !token.Valid {\n\t\tvar errReponse models.ErrReponse\n\t\terrReponse.Error = \"authorisation error\"\n\t\terrReponse.Description = err.Error()\n\t\terrReponse.Code = 401\n\n\t\tjsonErrReponse, err := json.Marshal(errReponse)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\n\t\t//Set response headers and write JSON as response\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(401)\n\t\tw.Write(jsonErrReponse)\n\t\treturn\n\t}\n\n\t//Since token is valid, get the uuid:\n\tclaims, ok := token.Claims.(jwt.MapClaims) //the token claims should conform to MapClaims\n\tif ok && token.Valid {\n\t\trefreshUuid, ok := claims[\"refresh_uuid\"].(string) //convert the interface to string\n\t\tif !ok {\n\t\t\tvar errReponse models.ErrReponse\n\t\t\terrReponse.Error = \"authorisation error\"\n\t\t\terrReponse.Description = err.Error()\n\t\t\terrReponse.Code = 401\n\n\t\t\tjsonErrReponse, err := json.Marshal(errReponse)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\n\t\t\t//Set response headers and write JSON as response\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(401)\n\t\t\tw.Write(jsonErrReponse)\n\t\t\treturn\n\t\t}\n\n\t\tuserId, err := strconv.ParseUint(fmt.Sprintf(\"%.f\", claims[\"user_id\"]), 10, 64)\n\t\tif err != nil {\n\t\t\tvar errReponse models.ErrReponse\n\t\t\terrReponse.Error = \"authorisation error\"\n\t\t\terrReponse.Description = err.Error()\n\t\t\terrReponse.Code = 422\n\n\t\t\tjsonErrReponse, err := json.Marshal(errReponse)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\n\t\t\t//Set response headers and write JSON as response\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(422)\n\t\t\tw.Write(jsonErrReponse)\n\t\t\treturn\n\t\t}\n\n\t\t//Delete the previous Refresh Token\n\t\tdeleted, delErr := auth.DeleteAuth(refreshUuid)\n\t\tif delErr != nil || deleted == 0 { //if any goes wrong\n\t\t\tvar errReponse models.ErrReponse\n\t\t\terrReponse.Error = \"authorisation error\"\n\t\t\terrReponse.Description = err.Error()\n\t\t\terrReponse.Code = 401\n\n\t\t\tjsonErrReponse, err := json.Marshal(errReponse)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\n\t\t\t//Set response headers and write JSON as response\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(401)\n\t\t\tw.Write(jsonErrReponse)\n\t\t\treturn\n\t\t}\n\n\t\t//Create new pairs of refresh and access tokens\n\t\tts, createErr := auth.CreateToken(userId)\n\t\tif createErr != nil {\n\t\t\tvar errReponse models.ErrReponse\n\t\t\terrReponse.Error = \"authorisation error\"\n\t\t\terrReponse.Description = err.Error()\n\t\t\terrReponse.Code = 403\n\n\t\t\tjsonErrReponse, err := json.Marshal(errReponse)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\n\t\t\t//Set response headers and write JSON as response\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(403)\n\t\t\tw.Write(jsonErrReponse)\n\t\t\treturn\n\t\t}\n\n\t\t//save the tokens metadata to redis\n\t\tsaveErr := auth.CreateAuth(userId, ts)\n\t\tif saveErr != nil {\n\t\t\tvar errReponse models.ErrReponse\n\t\t\terrReponse.Error = \"authorisation error\"\n\t\t\terrReponse.Description = err.Error()\n\t\t\terrReponse.Code = 403\n\n\t\t\tjsonErrReponse, err := json.Marshal(errReponse)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\n\t\t\t//Set response headers and write JSON as response\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(403)\n\t\t\tw.Write(jsonErrReponse)\n\t\t\treturn\n\t\t}\n\n\t\ttokens := map[string]string{\n\t\t\t\"access_token\": ts.AccessToken,\n\t\t\t\"refresh_token\": ts.RefreshToken,\n\t\t}\n\n\t\tjsonTokens, err := json.Marshal(tokens)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(200)\n\t\tw.Write([]byte(jsonTokens))\n\t\treturn\n\t} else {\n\t\tvar errReponse models.ErrReponse\n\t\terrReponse.Error = \"authorisation error\"\n\t\terrReponse.Description = err.Error()\n\t\terrReponse.Code = 401\n\n\t\tjsonErrReponse, err := json.Marshal(errReponse)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\n\t\t//Set response headers and write JSON as response\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(401)\n\t\tw.Write(jsonErrReponse)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "fcd76127e30f0f26c386c6014457e601", "score": "0.5828688", "text": "func TestLoginWithNoRefresh(t *testing.T) {\n\tg := NewGomegaWithT(t)\n\n\tdata := fmt.Sprintf(`\n\t{\n\t\t\"username\": \"%s\",\n\t\t\"password\": \"%s\",\n\t\t\"scopes\": []\n\t}`, cfg.User1, cfg.User1Pswd)\n\n\tsignature, _ := Signature(data, cfg.AppSecret)\n\n\trequest.Post(\"/auth/login\").\n\t\tSetHeader(\"X-Identifo-ClientID\", cfg.AppID).\n\t\tSetHeader(\"Digest\", \"SHA-256=\"+signature).\n\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\tBodyString(data).\n\t\tExpect(t).\n\t\t// AssertFunc(dumpResponse).\n\t\tAssertFunc(validateJSON(func(data map[string]interface{}) error {\n\t\t\tg.Expect(data).To(MatchKeys(IgnoreExtras|IgnoreMissing, Keys{\n\t\t\t\t\"access_token\": Not(BeZero()),\n\t\t\t\t\"refresh_token\": BeZero(),\n\t\t\t}))\n\t\t\treturn nil\n\t\t})).\n\t\tType(\"json\").\n\t\tStatus(200).\n\t\tJSONSchema(\"../test/artifacts/api/jwt_token_scheme.json\").\n\t\tDone()\n}", "title": "" }, { "docid": "2ff544b4abf370c5e4b29ee3ec9c9790", "score": "0.5825288", "text": "func AuthRefresh(c *gin.Context) {\n\trecord := session.Current(c)\n\n\ttoken := token.New(token.SessToken, record.Username)\n\tresult, err := token.SignExpiring(record.Hash, config.Session.Expire)\n\n\tif err != nil {\n\t\tlogrus.Warnf(\"Failed to refresh token. %s\", err)\n\n\t\tc.JSON(\n\t\t\thttp.StatusUnauthorized,\n\t\t\tgin.H{\n\t\t\t\t\"status\": http.StatusUnauthorized,\n\t\t\t\t\"message\": \"Failed to refresh token\",\n\t\t\t},\n\t\t)\n\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tc.JSON(\n\t\thttp.StatusOK,\n\t\tresult,\n\t)\n}", "title": "" }, { "docid": "fec5499b43423b0ec18956469d81ad51", "score": "0.5782769", "text": "func GenRefreshToken(namespaceName, namespaceRefreshKey, maxRefreshokenTTL, username string, timeout string) (bool, string, error) {\n\tisAuthorized, err := isTimeoutAuthorized(timeout, maxRefreshokenTTL)\n\tif err != nil {\n\t\temo.ParamError(err)\n\t\treturn false, \"\", err\n\t}\n\tif !isAuthorized {\n\t\temo.ParamError(\"Unauthorized timeout\", timeout)\n\t\treturn false, \"\", nil\n\t}\n\tto, err := tparse.ParseNow(time.RFC3339, \"now+\"+timeout)\n\tclaims := standardRefreshClaims(namespaceName, username, to)\n\tt := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttoken, err := t.SignedString([]byte(namespaceRefreshKey))\n\tif err != nil {\n\t\temo.EncryptError(err)\n\t\treturn false, \"\", err\n\t}\n\treturn true, token, nil\n}", "title": "" }, { "docid": "ce61d2f8a8a858b7e73bbc76afa1f7a4", "score": "0.57757086", "text": "func (mgm *tokenManager) GenerateUnsignedUserRefreshToken(ctx context.Context, refreshToken string, identity *repository.Identity) (*jwt.Token, error) {\n\ttoken := jwt.New(jwt.SigningMethodRS256)\n\ttoken.Header[\"kid\"] = mgm.userAccountPrivateKey.KeyID\n\n\toldClaims, err := mgm.ParseToken(ctx, refreshToken)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\treq := goa.ContextRequest(ctx)\n\tif req == nil {\n\t\treturn nil, errors.New(\"missing request in context\")\n\t}\n\n\tauthOpenshiftIO := rest.AbsoluteURL(req, \"\", mgm.config)\n\topenshiftIO, err := rest.ReplaceDomainPrefixInAbsoluteURL(req, \"\", \"\", mgm.config)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tclaims := token.Claims.(jwt.MapClaims)\n\tclaims[\"jti\"] = uuid.NewV4().String()\n\tiat := time.Now().Unix()\n\tvar exp int64 // Offline tokens do not expire\n\ttyp := \"Offline\"\n\tif oldClaims.ExpiresAt != 0 {\n\t\texp = iat + mgm.config.GetRefreshTokenExpiresIn()\n\t\ttyp = \"Refresh\"\n\t}\n\tclaims[\"exp\"] = exp\n\tclaims[\"nbf\"] = 0\n\tclaims[\"iat\"] = iat\n\tclaims[\"iss\"] = authOpenshiftIO\n\tclaims[\"aud\"] = openshiftIO\n\tclaims[\"typ\"] = typ\n\tclaims[\"auth_time\"] = 0\n\n\tif identity != nil {\n\t\tclaims[\"sub\"] = identity.ID.String()\n\t} else {\n\t\t// populate claims for user details in refresh token for api_client as we don't have identity in db for it\n\t\tclaims[\"sub\"] = oldClaims.Subject\n\t\tclaims[\"email_verified\"] = oldClaims.EmailVerified\n\t\tclaims[\"name\"] = oldClaims.Name\n\t\tclaims[\"preferred_username\"] = oldClaims.Username\n\t\tclaims[\"given_name\"] = oldClaims.GivenName\n\t\tclaims[\"family_name\"] = oldClaims.FamilyName\n\t\tclaims[\"email\"] = oldClaims.Email\n\t}\n\n\tclaims[\"azp\"] = oldClaims.Audience\n\tclaims[\"session_state\"] = oldClaims.SessionState\n\n\treturn token, nil\n}", "title": "" }, { "docid": "d1404ccde99a9120bd440a16febb0f63", "score": "0.57459706", "text": "func (auth *Auth) RefreshToken(refreshToken string) (string, string, error) {\n\ttoken, err := jwt.Parse(refreshToken, func(token *jwt.Token) (interface{}, error) {\n\t\t//Make sure that the token method conform to \"SigningMethodHMAC\"\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t}\n\t\treturn []byte(auth.config.RefreshSecret), nil\n\t})\n\t//if there is an error, the token must have expired\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\t//is token valid?\n\tif _, ok := token.Claims.(jwt.Claims); !ok && !token.Valid {\n\t\treturn \"\", \"\", ErrInvalidToken\n\t}\n\t//Since token is valid, get the uuid:\n\tclaims, ok := token.Claims.(jwt.MapClaims) //the token claims should conform to MapClaims\n\tif ok && token.Valid {\n\t\trefreshUUID, ok := claims[\"refresh_uuid\"].(string) //convert the interface to string\n\t\tif !ok {\n\t\t\treturn \"\", \"\", ErrInvalidToken\n\t\t}\n\t\tuserID, err := strconv.ParseUint(fmt.Sprintf(\"%.f\", claims[\"user_id\"]), 10, 64)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", ErrInvalidToken\n\t\t}\n\t\t//Delete the previous Refresh Token\n\t\tif err := auth.claim.RemoveClaim(&models.Claim{Key: refreshUUID}); err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\t//Create new pairs of refresh and access tokens\n\t\tts, createErr := auth.CreateToken(uint(userID))\n\t\tif createErr != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t\treturn ts.AccessToken, ts.RefreshToken, nil\n\t}\n\treturn \"\", \"\", err\n}", "title": "" }, { "docid": "304e831b1091c5ee398a69aca52d276c", "score": "0.5744467", "text": "func (mgm *tokenManager) GenerateUnsignedUserRefreshTokenForAPIClient(ctx context.Context, accessToken string) (*jwt.Token, error) {\n\ttoken := jwt.New(jwt.SigningMethodRS256)\n\ttoken.Header[\"kid\"] = mgm.userAccountPrivateKey.KeyID\n\n\ttokenClaims, err := mgm.ParseToken(ctx, accessToken)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\treq := goa.ContextRequest(ctx)\n\tif req == nil {\n\t\treturn nil, errors.New(\"missing request in context\")\n\t}\n\n\tauthOpenshiftIO := rest.AbsoluteURL(req, \"\", mgm.config)\n\topenshiftIO, err := rest.ReplaceDomainPrefixInAbsoluteURL(req, \"\", \"\", mgm.config)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tclaims := token.Claims.(jwt.MapClaims)\n\tclaims[\"jti\"] = uuid.NewV4().String()\n\tiat := time.Now().Unix()\n\texp := iat + mgm.config.GetRefreshTokenExpiresIn()\n\ttyp := \"Refresh\"\n\tclaims[\"exp\"] = exp\n\tclaims[\"nbf\"] = 0\n\tclaims[\"iat\"] = iat\n\tclaims[\"iss\"] = authOpenshiftIO\n\tclaims[\"aud\"] = openshiftIO\n\tclaims[\"typ\"] = typ\n\tclaims[\"auth_time\"] = 0\n\n\t// populate claims for user details in refresh token for api_client\n\tclaims[\"sub\"] = tokenClaims.Subject\n\tclaims[\"email_verified\"] = tokenClaims.EmailVerified\n\tclaims[\"name\"] = tokenClaims.Name\n\tclaims[\"preferred_username\"] = tokenClaims.Username\n\tclaims[\"given_name\"] = tokenClaims.GivenName\n\tclaims[\"family_name\"] = tokenClaims.FamilyName\n\tclaims[\"email\"] = tokenClaims.Email\n\n\t// ToDo - Do we need azp claim?\n\tclaims[\"azp\"] = tokenClaims.Audience\n\tclaims[\"session_state\"] = tokenClaims.SessionState\n\n\treturn token, nil\n}", "title": "" }, { "docid": "038471e5be565916c20f4335fb1c2a12", "score": "0.5743466", "text": "func TestUnmarshalTokenRefreshResponse(t *testing.T) {\n\t// This JSON has stray whitespace which is preserved from the source docs.\n\texampleJSON := `{\n \"access_token\": \"Rc7JE8P7XUgSCPogLOx2VLMfITqQQrjg\",\n \"token_type\": \"Bearer\",\n \"expires_in\": 3599,\n \"refresh_token\": \"og2Obost3ucRo1ofo0EDoslGltmFMe2g\",\n \"scope\": \"smartWrite\" \n} `\n\twant := &TokenRefreshResponse{\n\t\tAccessToken: \"Rc7JE8P7XUgSCPogLOx2VLMfITqQQrjg\",\n\t\tTokenType: \"Bearer\",\n\t\tExpiresIn: TokenDuration{Duration: time.Second * 3599},\n\t\tRefreshToken: \"og2Obost3ucRo1ofo0EDoslGltmFMe2g\",\n\t\tScope: ScopeSmartWrite,\n\t}\n\n\tgot := &TokenRefreshResponse{}\n\tif err := json.Unmarshal([]byte(exampleJSON), got); err != nil {\n\t\tt.Errorf(\"got unexpected error: %v\", err)\n\t}\n\tif !reflect.DeepEqual(got, want) {\n\t\tt.Errorf(\"got: %+v, wanted: %+v\", got, want)\n\t}\n}", "title": "" }, { "docid": "4ad6e945c70e854851de2aa34a18c798", "score": "0.5737736", "text": "func (m *MockDynamicHelper) RefreshAPIResources() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshAPIResources\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "368e22a747176b66dc5a54e17b2a1a30", "score": "0.5714022", "text": "func getTokenRefresh(c *gin.Context) {\n\tdata := []byte(TokenRefreshResp)\n\n\tvar body library.Token\n\t_ = json.Unmarshal(data, &body)\n\n\tc.JSON(http.StatusOK, body)\n}", "title": "" }, { "docid": "c13e507b340a89fc990198e40cb1f1ee", "score": "0.57094127", "text": "func BearerTokensFromRefresh(refreshToken string) (*models.BearerToken, error) {\n\ttoken, err := getRefreshTokenFromDB(refreshToken)\n\tif err == pg.ErrNoRows {\n\t\treturn nil, errors.New(\"No such refresh token\")\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccessToken, err := oauth.GenerateAccessToken(token.UserID, token.Roles, refreshToken)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &models.BearerToken{\n\t\tAccessToken: accessToken,\n\t\tType: \"bearer\",\n\t\tRefreshToken: refreshToken,\n\t}, nil\n}", "title": "" }, { "docid": "41200c6c16f48e48f0ba5f430d021314", "score": "0.5705611", "text": "func TestOAuthRequestTokenEndpoint(t *testing.T) {\n\t// Set up server\n\tmasterOptions, err := testserver.DefaultMasterOptions()\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\n\tdefer testserver.CleanupMasterEtcd(t, masterOptions)\n\n\tclusterAdminKubeConfig, err := testserver.StartConfiguredMaster(masterOptions)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\n\tclientConfig, err := testutil.GetClusterAdminClientConfig(clusterAdminKubeConfig)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\n\tanonConfig := restclient.AnonymousClientConfig(clientConfig)\n\ttransport, err := restclient.TransportFor(anonConfig)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\n\t// Hit the token request endpoint\n\tmasterURL, err := url.Parse(clientConfig.Host)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tmasterURL.Path = \"/oauth/token/request\"\n\n\t_, tokenHeaderLocation := checkNewReqAndRoundTrip(t, transport, masterURL.String(), false, http.StatusFound)\n\n\tif len(tokenHeaderLocation) == 0 {\n\t\tt.Fatalf(\"no Location header\")\n\t}\n\n\tauthRedirect, err := url.Parse(tokenHeaderLocation)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error %v\", err)\n\t}\n\n\t_, authHeaderLocation := checkNewReqAndRoundTrip(t, transport, authRedirect.String(), true, http.StatusFound)\n\n\tif len(authHeaderLocation) == 0 {\n\t\tt.Fatalf(\"no Location header\")\n\t}\n\n\tdisplayResp, _ := checkNewReqAndRoundTrip(t, transport, authHeaderLocation, false, http.StatusOK)\n\tapiToken := getTokenFromDisplay(t, displayResp)\n\n\t// Verify use of the bearer token\n\tuserConfig := restclient.AnonymousClientConfig(clientConfig)\n\tuserConfig.BearerToken = apiToken\n\tuserClient, err := userclient.NewForConfig(userConfig)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %v\", err)\n\t}\n\n\tuser, err := userClient.Users().Get(\"~\", metav1.GetOptions{})\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tif user.Name != \"foo\" {\n\t\tt.Fatalf(\"expected foo as the user, got %v\", user.Name)\n\t}\n}", "title": "" }, { "docid": "2ceab8d788e7d81dc45381162ff40780", "score": "0.56981707", "text": "func (mte *MytokenEntry) InitRefreshToken(rt string) error {\n\tmte.refreshToken = rt\n\tmte.encryptionKey = cryptutils.RandomBytes(32)\n\ttmp, err := cryptutils.AESEncrypt(mte.refreshToken, mte.encryptionKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmte.rtEncrypted = tmp\n\tjwt, err := mte.Token.ToJWT()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttmp, err = cryptutils.AES256Encrypt(base64.StdEncoding.EncodeToString(mte.encryptionKey), jwt)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmte.encryptionKeyEncrypted = tmp\n\treturn nil\n}", "title": "" }, { "docid": "9c6529fe9acfd38a12ae2cc47d1b3b03", "score": "0.5682731", "text": "func (s *Server) refreshToken(ctx *fiber.Ctx) error {\n\ts.logs.WithField(\"func\", \"refresh_token_api.go -> refreshToken()\").Debug()\n\tvar req refreshTokenRequest\n\n\tif err := ctx.BodyParser(&req); err != nil {\n\t\ts.logs.WithError(err).Warn(\"cannot decode parameters\")\n\t\tstatus = http.StatusBadRequest\n\t\treturn ctx.Status(status).JSON(errorResponse(status, err))\n\t}\n\tif errs := s.validate.validateRequests(&req); len(errs) > 0 {\n\t\ts.logs.Warn(\"request data is invalid\")\n\t\tstatus = http.StatusBadRequest\n\t\treturn ctx.Status(status).JSON(errs)\n\t}\n\ts.logs.WithFields(logrus.Fields{\n\t\t\"deviceID\": req.DeviceID,\n\t}).Debug()\n\n\t// We ensure that a new token is not issued until enough time has elapsed\n\t// In this case, a new token will only be issued if the old token is within\n\t// 30 seconds of expiry. Otherwise, return a bad request status\n\tauthPayload := ctx.Locals(authorizationPayloadKey).(*auth.AccessPayload)\n\tif time.Unix(authPayload.EXP, 0).Sub(time.Now()) > 30*time.Second {\n\t\tstatus = http.StatusBadRequest\n\t\treturn ctx.Status(status).JSON(errorResponse(status, errors.New(\"access token not expired\")))\n\t}\n\tpayload, err := s.token.VerifyRefreshToken(req.RefreshToken)\n\tif err != nil {\n\t\t// if the token has expired the user will need to re-login otherwise we will update the old refresh token and create a new pair\n\t\tif errors.Is(err, auth.ErrExpiredToken) {\n\t\t\trefreshErr := fmt.Errorf(\"refresh token for user %s is expired\", payload.SUB)\n\t\t\ts.logs.WithError(err).Warn(refreshErr)\n\t\t\tstatus = http.StatusUnauthorized\n\t\t\treturn ctx.Status(status).JSON(errorResponse(status, errors.New(\"refresh token is expired login required\")))\n\n\t\t}\n\t\ts.logs.WithError(err).Warn(\"refresh token verification failed\")\n\t\tstatus = http.StatusUnauthorized\n\t\treturn ctx.Status(status).JSON(errorResponse(status, err))\n\t}\n\targs := db.GetSessionsParams{\n\t\tUserID: model.UserID(payload.SUB),\n\t\tDeviceID: req.DeviceID,\n\t\tRefreshToken: req.RefreshToken,\n\t}\n\tsession, err := s.repo.GetSession(ctx.Context(), args)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\ts.logs.WithError(err).Warn(err)\n\t\t\tstatus = http.StatusNotFound\n\t\t\treturn ctx.Status(status).JSON(errorResponse(status, errors.New(\"session not found\")))\n\t\t}\n\t\ts.logs.WithError(err).Warn(err)\n\t\tstatus = http.StatusInternalServerError\n\t\treturn ctx.Status(status).JSON(errorResponse(status, err))\n\t}\n\t// verify if user still exists in our database\n\tuser, err := s.repo.GetUserByID(ctx.Context(), session.UserID)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\ts.logs.WithError(err).Warn(err)\n\t\t\tstatus = http.StatusNotFound\n\t\t\treturn ctx.Status(status).JSON(errorResponse(status, userNotFound))\n\t\t}\n\t\ts.logs.WithError(err).Warn(err)\n\t\tstatus = http.StatusInternalServerError\n\t\treturn ctx.Status(status).JSON(errorResponse(status, err))\n\t}\n\n\taccessToken, exp, refreshToken, rexp, err := s.tokenCredentials(user)\n\tif err != nil {\n\t\ts.logs.WithError(err).Warn()\n\t\tstatus = http.StatusInternalServerError\n\t\treturn ctx.Status(status).JSON(errorResponse(status, err))\n\t}\n\n\targ := db.SaveRefreshTokenParams{\n\t\tUserID: user.ID,\n\t\tDeviceID: req.DeviceID, // value shall be passed currently random string\n\t\tRefreshToken: refreshToken,\n\t\tExpiresAt: rexp,\n\t}\n\n\tif err = s.repo.SaveRefreshToken(ctx.Context(), arg); err != nil {\n\t\ts.logs.WithError(err).Warn(\"unable to save refresh token\")\n\t\tstatus = http.StatusBadRequest\n\t\treturn ctx.Status(status).JSON(err)\n\t}\n\n\tresp := ResponseTokens{\n\t\tToken: auth.TokenAccess{\n\t\t\tAccessToken: accessToken,\n\t\t\tRefreshToken: refreshToken,\n\t\t\tAccessTokenExpiresAt: exp,\n\t\t},\n\t\tUser: user,\n\t}\n\ts.logs.WithField(\"user_id\", user.ID).Debug(\"tokens generated successfully\")\n\treturn ctx.Status(http.StatusOK).JSON(resp)\n}", "title": "" }, { "docid": "8fe3d23bf9e9838f328ca3898cfd7af6", "score": "0.5680602", "text": "func (m *MockKafkaAdmin) RefreshTopics() error {\n\tret := m.ctrl.Call(m, \"RefreshTopics\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "40c8ba32803154d7c0dd4aa4aa9f5f1d", "score": "0.5666368", "text": "func RefreshToken(r *http.Request) (int64, error) {\n\ttoken, err := VerifyToken(r, RefreshSecret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tclaims, ok := token.Claims.(jwt.MapClaims) //the token claims should conform to MapClaims\n\tif ok && token.Valid {\n\t\trefreshUuid, ok := claims[\"refresh_uuid\"].(string) //convert the interface to string\n\t\tif !ok {\n\t\t\treturn 0, errors.New(\"Can not get refresh_uuid \")\n\t\t}\n\n\t\tuserId, err := strconv.ParseInt(fmt.Sprintf(\"%.f\", claims[\"user_id\"]), 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\t//Delete the previous Refresh Token\n\t\tdeleted, delErr := DeleteAuth(refreshUuid)\n\t\tif delErr != nil || deleted == 0 { //if any goes wrong\n\t\t\treturn 0, delErr\n\t\t}\n\n\t\treturn userId, nil\n\t}\n\n\treturn 0, errors.New(\"refresh expired\")\n}", "title": "" }, { "docid": "34d44a0d3f72698e1a90b364eb505f21", "score": "0.5632206", "text": "func TestIntegrationRefreshTokenRetryWorkflow(t *testing.T) {\n\t// get a new refresh token\n\thostURLConfig := idp.HostURLConfig{TenantScoped: false, Tenant: testutils.TestTenant, Region: testutils.TestRegion}\n\ttr := idp.NewPKCERetriever(NativeClientID, NativeAppRedirectURI, idp.DefaultRefreshScope, TestUsername, TestPassword, IdpHostTenantScoped, \"\", hostURLConfig)\n\tctx, err := tr.GetTokenContext()\n\trequire.Emptyf(t, err, \"Error validating using access token generated from PKCE flow: %s\", err)\n\trequire.NotNil(t, ctx)\n\n\ttr_refresh := &retryTokenRetriever{TR: idp.NewRefreshTokenRetriever(NativeClientID, idp.DefaultRefreshScope, ctx.RefreshToken, IdpHostTenantScoped, \"\", hostURLConfig)}\n\tclient, err := sdk.NewClient(&services.Config{\n\t\tTokenRetriever: tr_refresh,\n\t\tHost: testutils.TestSplunkCloudHost,\n\t\tTenant: testutils.TestTenant,\n\t\tTimeout: testutils.TestTimeOut,\n\t})\n\trequire.Emptyf(t, err, \"Error initializing client: %s\", err)\n\n\tsourcetype := \"sourcetype:refreshtokentest\"\n\tsource := \"manual-events\"\n\thost := client.GetURL(\"\").RequestURI()\n\tbody := make(map[string]interface{})\n\tbody[\"event\"] = \"refreshtokentest\"\n\ttimeValue := int64(1529945001)\n\tattributes := make(map[string]interface{})\n\tattributes1 := make(map[string]interface{})\n\tattributes1[\"testKey\"] = \"testValue\"\n\tattributes[\"testkey2\"] = attributes1\n\n\ttestIngestEvent := ingest.Event{\n\t\tHost: &host,\n\t\tBody: body,\n\t\tSourcetype: &sourcetype,\n\t\tSource: &source,\n\t\tTimestamp: &timeValue,\n\t\tAttributes: attributes}\n\n\t_, err = client.IngestService.PostEvents([]ingest.Event{testIngestEvent})\n\tassert.Emptyf(t, err, \"Error ingesting test event using refresh token: %s\", err)\n}", "title": "" }, { "docid": "f303a41375fa284ff39d55e3445bca3f", "score": "0.5625794", "text": "func (r *CredentialsResolver) refreshOAuthTokens(expiredTokens oauth_tokens.OAuthTokens) (oauth_tokens.OAuthTokens, error) {\n\n\tcognitoConfig, err := cognito_config.LoadFromFile(r.ConfigDir + \"/\" + CognitoConfigFile)\n\n\tcognitoIdentityProvider := cognitoidentityprovider.New(r.AwsSession)\n\n\tauthInput := new(cognitoidentityprovider.InitiateAuthInput)\n\tauthInput.SetAuthFlow(cognitoidentityprovider.AuthFlowTypeRefreshTokenAuth)\n\tauthInput.SetClientId(cognitoConfig.ClientID)\n\tauthInput.SetAuthParameters(map[string]*string{\n\t\tcognitoidentityprovider.AuthFlowTypeRefreshToken: &expiredTokens.RefreshToken,\n\t})\n\tauthOutput, err := cognitoIdentityProvider.InitiateAuth(authInput)\n\tif err != nil {\n\t\treturn oauth_tokens.OAuthTokens{}, errors.Wrap(err, \"Failed to refresh oauth2 tokens\")\n\t}\n\n\ttokens := r.extractTokensFromAuthResult(authOutput.AuthenticationResult)\n\t// We don't get a refresh token for a refresh auth request, so add it back.\n\ttokens.RefreshToken = expiredTokens.RefreshToken\n\n\terr = oauth_tokens.SaveToFile(r.ConfigDir+\"/\"+OAuthTokensFile, tokens)\n\tif err != nil {\n\t\treturn oauth_tokens.OAuthTokens{}, errors.Wrap(err, \"Failed to save oauth2 tokens\")\n\t}\n\n\treturn tokens, nil\n}", "title": "" }, { "docid": "515fb255292128a927700f04f181f042", "score": "0.5624942", "text": "func (_m *MockAuth) DeleteRefresh(refreshUUID string) error {\n\tret := _m.Called(refreshUUID)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(refreshUUID)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "1e6a1854429007f02ced402abb275e49", "score": "0.5608836", "text": "func (ps passwordStore) SetRefreshToken(u *url.URL, service string, token string) {\n}", "title": "" }, { "docid": "1e6a1854429007f02ced402abb275e49", "score": "0.5608836", "text": "func (ps passwordStore) SetRefreshToken(u *url.URL, service string, token string) {\n}", "title": "" }, { "docid": "e60738f55b76e2f1beadddb75826ab82", "score": "0.560805", "text": "func (a *Auth) Refresh(w http.ResponseWriter, r *http.Request) {\n\tt, err := verifyToken(r)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\tc, ok := t.Claims.(jwt.MapClaims)\n\tif !ok {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t}\n\n\tfmt.Println(c)\n}", "title": "" }, { "docid": "915514b4b0ca090ceb3e35bf77449225", "score": "0.5599946", "text": "func (ac *AuthController) RefreshToken(c *gin.Context) {\n\ttype RefreshTokenParams struct {\n\t\tRefreshToken string `json:\"refresh_token\"`\n\t}\n\n\t//Read base64 private key\n\tencodedKey := []byte(config.GetString(c, \"rsa_private\"))\n\n\tvar refreshTokenParams RefreshTokenParams\n\tif err := c.Bind(&refreshTokenParams); err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, helpers.ErrorWithCode(\"invalid_input\", \"Failed to bind the body data\", err))\n\t\treturn\n\t}\n\n\tclaims, err := helpers.ValidateJwtToken(refreshTokenParams.RefreshToken, encodedKey, \"refresh\")\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, helpers.ErrorWithCode(\"invalid_token\", \"the given token is invalid\", err))\n\t\treturn\n\t}\n\n\taccessToken, err := helpers.GenerateAccessToken(encodedKey, claims[\"sub\"].(string))\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusInternalServerError, helpers.ErrorWithCode(\"token_generation_failed\", \"Could not generate the access token\", err))\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"token\": accessToken})\n}", "title": "" }, { "docid": "50049aa67292355c00e2f21cdf85c911", "score": "0.55769885", "text": "func (uc *securityTokenUseCase) GenRefreshToken(userID string) (auth.SecurityToken, error) {\n\tduration := time.Hour * time.Duration(48)\n\ttoken, err := uc.security.GenToken(\n\t\tuserID,\n\t\tauth.RefreshTokenType,\n\t\ttime.Now().Unix(),\n\t\ttime.Now().Add(duration).Unix(),\n\t)\n\tif err != nil {\n\t\treturn auth.SecurityToken{}, errors.New(\"could not generate refresh token\")\n\t}\n\n\trefreshToken := auth.SecurityToken{\n\t\tID: uuid.New().String(),\n\t\tUserID: userID,\n\t\tToken: token,\n\t\tType: auth.RefreshTokenType,\n\t\tCreatedAt: time.Now(),\n\t\tUpdatedAt: time.Now(),\n\t}\n\tif err = uc.securityTokenRepo.CreateOrUpdateToken(&refreshToken); err != nil {\n\t\treturn auth.SecurityToken{}, errors.New(\"could not create or update refresh token\")\n\t}\n\n\treturn refreshToken, nil\n}", "title": "" }, { "docid": "cdf804292b8c2e5c83bbc75edaf7abcb", "score": "0.55662745", "text": "func (s *authService) Refresh(tokenStr string) (*models.TokenDetails, error) {\n\tclaims, err := s.ExtractTokenMetadata(tokenStr, common.Config.RefreshSecret)\n\tif err != nil {\n\t\treturn nil, err // no need to log, ExtractTokenMetadata does it\n\t}\n\n\t// remove previous token from the database\n\trefreshUuid := claims.Uuid\n\tif err := s.repo.Delete(refreshUuid); err != nil {\n\t\tlog.Errorf(\"Couldn't refresh the token; unable to delete previous one: %v\", err)\n\t\treturn nil, fmt.Errorf(\"Couldn't to refresh the token; unable to delete the previous one\")\n\t}\n\n\taccessDetails := &models.AccessDetails{\n\t\tUsername: claims.Username,\n\t\tIsAdmin: claims.IsAdmin,\n\t}\n\t// create new token\n\ttoken, err := s.GenerateJWT(accessDetails)\n\tif err != nil {\n\t\treturn nil, err // no need to log, GenerateJWT does it\n\t}\n\n\t// save new token to the database\n\tif err := s.repo.Save(accessDetails.Username, token); err != nil {\n\t\tlog.Errorf(\"Couldn't refresh the token; unable to save both tokens to the database: %v\", err)\n\t\treturn nil, fmt.Errorf(\"Couldn't refresh the token; unable to save the access and refresh token to the database\")\n\t}\n\n\tlog.Infof(\"Successfully refresh the token for %s\", claims.Username)\n\treturn token, nil\n}", "title": "" }, { "docid": "8a55abd2a34cef778e723d830796a8f3", "score": "0.5559428", "text": "func (c *Client) TokenRefresh() error {\n\tif c.iamClient == nil {\n\t\treturn fmt.Errorf(\"invalid IAM client, cannot refresh token\")\n\t}\n\treturn c.iamClient.TokenRefresh()\n}", "title": "" }, { "docid": "61923471fea3521bc35922a78f00a25c", "score": "0.55568415", "text": "func Refresh(w http.ResponseWriter, r *http.Request) {\n\t// Get request body\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Println(\"Error at refresh, read body failed \", err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Get jwt token\n\tvar jsonData map[string]interface{}\n\tif err := json.Unmarshal(body, &jsonData); err != nil {\n\t\tlog.Println(\"Error at refresh, unmarshal json failed for body \", body)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Parse token string, get new token\n\ttknStr := jsonData[\"token\"].(string)\n\tclaims := &Claims{}\n\tjwtKey := jwthelper.GetJWTKey()\n\ttkn, err := jwt.ParseWithClaims(tknStr, claims, func(token *jwt.Token) (interface{}, error) {\n\t\treturn jwtKey, nil\n\t})\n\t// Check for errors when parsing\n\tif err != nil {\n\t\tif err == jwt.ErrSignatureInvalid {\n\t\t\tlog.Println(\"Error at refresh, sig invalid\", err)\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t\tlog.Println(\"Error at refresh, couldn't parse claim \", err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tif !tkn.Valid {\n\t\tlog.Println(\"Error at refresh, token invalid\")\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t// Only allow refresh if under 1 min expiry\n\tif time.Unix(claims.ExpiresAt, 0).Sub(time.Now()) > 60*time.Second {\n\t\tlog.Println(\"Error at refresh, not time yet to refresh \")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\texpirationTime := time.Now().Add(5 * time.Minute)\n\tclaims.ExpiresAt = expirationTime.Unix()\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttokenString, err := token.SignedString(jwtKey)\n\tif err != nil {\n\t\tlog.Println(\"Error at refresh, while creating jwt token string \", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlog.Println(\"Refresh jwt success for user_id\", claims.ID)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write([]byte(`{\"token\":\"` + tokenString + `\"}`))\n}", "title": "" }, { "docid": "0cc65611f247e539e35fe7df9a715cc1", "score": "0.55304605", "text": "func (ts *TokenStore) GetByRefresh(refresh string) (oauth2.TokenInfo, error) {\n\tbasicID := ts.getBasicID(refresh)\n\treturn ts.getData(basicID)\n}", "title": "" }, { "docid": "4a2a7570a32384545b6af48b020892db", "score": "0.5500952", "text": "func (t *tokenWithProvider) refreshTokenWithRetries(ctx context.Context, prev, base *internal.Token) (tok *internal.Token, err error) {\n\terr = retry.Retry(ctx, transient.Only(retryParams), func() error {\n\t\ttok, err = t.provider.RefreshToken(ctx, prev, base)\n\t\treturn err\n\t}, retry.LogCallback(ctx, \"token-refresh\"))\n\treturn\n}", "title": "" }, { "docid": "faa6a05c23e3bfa7e98e3296cbae10fa", "score": "0.54896444", "text": "func OAuth2RefreshTokenGrantFactory(config *Config, storage interface{}, strategy interface{}) interface{} {\n\treturn &struct {\n\t\t*oauth2.RefreshTokenGrantHandler\n\t\t*oauth2.CoreValidator\n\t}{\n\t\tRefreshTokenGrantHandler: &oauth2.RefreshTokenGrantHandler{\n\t\t\tAccessTokenStrategy: strategy.(oauth2.AccessTokenStrategy),\n\t\t\tRefreshTokenStrategy: strategy.(oauth2.RefreshTokenStrategy),\n\t\t\tRefreshTokenGrantStorage: storage.(oauth2.RefreshTokenGrantStorage),\n\t\t\tAccessTokenLifespan: config.GetAccessTokenLifespan(),\n\t\t},\n\t\tCoreValidator: &oauth2.CoreValidator{\n\t\t\tCoreStrategy: strategy.(oauth2.CoreStrategy),\n\t\t\tCoreStorage: storage.(oauth2.CoreStorage),\n\t\t\tScopeStrategy: fosite.HierarchicScopeStrategy,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7a89d49e58d3ecd0dce18e45b92ad83d", "score": "0.54891783", "text": "func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {\n\treturn nil, errors.New(\"Refresh token is not provided by cas\")\n}", "title": "" }, { "docid": "dcd80903f6fc9ab9059f4c8121a4461e", "score": "0.54815394", "text": "func RefreshToken(relyingParty rp.RelyingParty, clientSecret, refreshToken string) (*oauth2.Token, error) {\n\tconst noClientSecret = \"\" // don't specify client secret when client_assertion is used for client authentication\n\n\t// ask authorization server for token refresh\n\topts := []oauth2.AuthCodeOption{\n\t\toauth2.SetAuthURLParam(\"grant_type\", \"refresh_token\"),\n\t\toauth2.SetAuthURLParam(\"refresh_token\", refreshToken),\n\t}\n\n\t// OAuthConfig().Exchange uses HttpClient extracted from ctx and we use dedicated Authrorization:basic header removing client for x.509 keys auth so need to set it here\n\tctx := context.WithValue(context.Background(), oauth2.HTTPClient, relyingParty.HttpClient())\n\n\t// client authenticates itself using client_assertion (x.509 private-public keys)\n\tif relyingParty.Signer() != nil {\n\t\taudience := []string{\n\t\t\trelyingParty.Issuer(), // original audience by Zitadel\n\t\t\trelyingParty.OAuthConfig().Endpoint.TokenURL, // but Okta requires TokenURL in audience, and this is in accordance with client_assertion spec\n\t\t}\n\t\tassertion, err := oidc_client.SignedJWTProfileAssertion(relyingParty.OAuthConfig().ClientID, audience, time.Hour, relyingParty.Signer())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to build assertion: %w\", err)\n\t\t}\n\t\topts = append(opts, rp.WithClientAssertionJWT(assertion)()...)\n\t\treturn relyingParty.OAuthConfig().Exchange(ctx, noClientSecret, opts...)\n\t}\n\n\t// client authenticates itself using client secret\n\treturn relyingParty.OAuthConfig().Exchange(context.Background(), clientSecret, opts...)\n}", "title": "" }, { "docid": "39ac7c4d91c30259d8ad0c4af931b053", "score": "0.54807884", "text": "func RefreshToken(claims *corev2.Claims) (*jwt.Token, string, error) {\n\t// Create a unique identifier for the token\n\tjti, err := GenJTI()\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tclaims.Id = jti\n\n\ttoken := jwt.NewWithClaims(signingMethod, claims)\n\n\t// Determine which key to use to sign the token\n\tvar key interface{}\n\tif signingMethod == jwt.SigningMethodHS256 {\n\t\tkey = secret\n\t} else {\n\t\tkey = privateKey\n\t}\n\n\t// Sign the token\n\ttokenString, err := token.SignedString(key)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\treturn token, tokenString, nil\n}", "title": "" }, { "docid": "9a3091c5783296778a3293fda8f5b1f6", "score": "0.54770637", "text": "func (_m *Client) RefreshCoordinator(consumerGroup string) error {\n\tret := _m.Called(consumerGroup)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(consumerGroup)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "cc2cfafa14b7d681649bb3e63ebdb028", "score": "0.5463489", "text": "func GenerateRefreshToken(email string) *RefreshToken {\n\t//Refresh token have a life span of 200 years\n\treturn &RefreshToken{Email: email, ID: GenerateTokenID(), ExpiredTime: time.Now().AddDate(200, 0, 0)}\n}", "title": "" }, { "docid": "c2cf2e332ba4513936bb2d5c35be782e", "score": "0.5449994", "text": "func (_m *Client) RefreshMetadata(topics ...string) error {\n\t_va := make([]interface{}, len(topics))\n\tfor _i := range topics {\n\t\t_va[_i] = topics[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(...string) error); ok {\n\t\tr0 = rf(topics...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "5f2a16c2d4b11bdb3b3ed4d39c04e6ac", "score": "0.54370713", "text": "func (tm *TokenManager) refreshToken() (*TokenInfo, error) {\n\tbuilder := NewRequestBuilder(POST).\n\t\tConstructHTTPURL(tm.iamURL, nil, nil)\n\n\tbuilder.AddHeader(CONTENT_TYPE, DefaultContentType).\n\t\tAddHeader(Accept, APPLICATION_JSON)\n\n\tbuilder.AddFormData(\"grant_type\", \"\", \"\", RefreshTokenGrantType).\n\t\tAddFormData(\"refresh_token\", \"\", \"\", tm.tokenInfo.RefreshToken)\n\n\treq, err := builder.Build(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn tm.request(req)\n}", "title": "" }, { "docid": "620e7deab634210815d6c2f25298ca63", "score": "0.5420665", "text": "func (m *testDBRepo) IsValidRefreshToken(id int, rfToken string) bool {\n\n\treturn true\n}", "title": "" }, { "docid": "8c214354913aff4025cc002316009372", "score": "0.5417824", "text": "func (m *MockAdminHandler) RefreshWorkflowTasks(arg0 context.Context, arg1 *types.RefreshWorkflowTasksRequest) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshWorkflowTasks\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d27668e63525d1b74e58c1baaa3bdf41", "score": "0.5414597", "text": "func (t *TokenRetriever) Refresh(ctx context.Context, system string) (TokenResponse, error) {\n\t// get stored refresh token:\n\trefreshToken, err := t.Secrets.Get(SecretsNamespace, system)\n\tif err != nil {\n\t\treturn TokenResponse{}, fmt.Errorf(\"cannot get the stored refresh token: %w\", err)\n\t}\n\tif refreshToken == \"\" {\n\t\treturn TokenResponse{}, errors.New(\"cannot use the stored refresh token: the token is empty\")\n\t}\n\t// get access token:\n\tr, err := t.Client.PostForm(t.Authenticator.OauthTokenEndpoint, url.Values{\n\t\t\"grant_type\": {\"refresh_token\"},\n\t\t\"client_id\": {t.Authenticator.ClientID},\n\t\t\"refresh_token\": {refreshToken},\n\t})\n\tif err != nil {\n\t\treturn TokenResponse{}, fmt.Errorf(\"cannot get a new access token from the refresh token: %w\", err)\n\t}\n\n\tdefer r.Body.Close()\n\tif r.StatusCode != http.StatusOK {\n\t\tb, _ := io.ReadAll(r.Body)\n\t\tres := struct {\n\t\t\tDescription string `json:\"error_description\"`\n\t\t}{}\n\t\tif json.Unmarshal(b, &res) == nil {\n\t\t\treturn TokenResponse{}, errors.New(strings.ToLower(strings.TrimSuffix(res.Description, \".\")))\n\t\t}\n\t\treturn TokenResponse{}, fmt.Errorf(\"cannot get a new access token from the refresh token: %s\", string(b))\n\t}\n\n\tvar res TokenResponse\n\terr = json.NewDecoder(r.Body).Decode(&res)\n\tif err != nil {\n\t\treturn TokenResponse{}, fmt.Errorf(\"cannot decode response: %w\", err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "373a3deb796973062888cffcb8049cfa", "score": "0.5407679", "text": "func (j *JwtManager) GenerateRefreshToken(user *pb.User) (string, error) {\n\tuserClaims := &UserClaims{\n\t\tUsername: user.Username,\n\t\tID: user.Id,\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tExpiresAt: time.Now().Add(time.Minute * j.refreshTokenDuration).Unix(),\n\t\t},\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, userClaims)\n\n\treturn token.SignedString([]byte(j.secret))\n}", "title": "" }, { "docid": "711ca1bb4ed0560c87ff761d6ee7d5ac", "score": "0.53924537", "text": "func (_m *Client) RefreshTransactionCoordinator(transactionID string) error {\n\tret := _m.Called(transactionID)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(transactionID)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "06007a6abec959ec9ceceae248693142", "score": "0.539208", "text": "func (c *Client) RefreshToken() (auth AuthToken, err error) {\n\tif c.debug {\n\t\tlog.Printf(\"[marketo/RefreshToken] start\")\n\t\tdefer func() {\n\t\t\tlog.Print(\"[marketo/RefreshToken] DONE\")\n\t\t}()\n\t}\n\t// Make request for token\n\tresp, err := c.authClient.Get(c.identityEndpoint)\n\tif err != nil {\n\t\treturn auth, errors.New(\"Unable to get Market auth token\")\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn auth, errors.New(\"Server error getting marketo auth token\")\n\t\t}\n\t\treturn auth, fmt.Errorf(\"authentication error: %d %s\", resp.StatusCode, body)\n\t}\n\n\tif err := json.NewDecoder(resp.Body).Decode(&auth); err != nil {\n\t\treturn auth, errors.New(\"Unable to decode marketo error token\")\n\t}\n\tif c.debug {\n\t\tlog.Printf(\"[marketo/RefreshToken] New token: %v\", auth)\n\t}\n\tc.authLock.Lock()\n\tdefer c.authLock.Unlock()\n\tc.auth = &auth\n\tc.restRoundTripper.token = auth.AccessToken\n\tc.tokenExpiresAt = time.Now().Add(time.Duration(auth.ExpiresIn) * time.Second)\n\treturn auth, nil\n}", "title": "" }, { "docid": "ecdf9fb7604dfb676913fa1eb2f636b1", "score": "0.5385842", "text": "func (m *MockStorageProvider) LoadLatestAuthenticationLogs(username string, fromDate time.Time) ([]models.AuthenticationAttempt, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LoadLatestAuthenticationLogs\", username, fromDate)\n\tret0, _ := ret[0].([]models.AuthenticationAttempt)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5c43385606416f816c0ccfa252a81651", "score": "0.53765154", "text": "func RefreshLogin() {\n\thttpClient := &http.Client{Timeout: time.Second * 10}\n\tpostData, _ := json.Marshal(map[string]string{\n\t\t\"client_id\": ClientID,\n\t\t\"client_secret\": ClientSecret,\n\t\t\"grant_type\": \"refresh_token\",\n\t\t\"redirect_uri\": RedirectURI,\n\t\t\"refresh_token\": RefreshToken,\n\t})\n\tfor {\n\t\tlog.Println(\"Getting new Google access_token\")\n\t\tres, err := httpClient.Post(\n\t\t\t\"https://www.googleapis.com/oauth2/v4/token\",\n\t\t\t\"application/json\",\n\t\t\tbytes.NewBuffer(postData),\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Println(\"ERROR: Could not login to Google.\")\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tvar authData Authorization\n\t\tbody, _ := ioutil.ReadAll(res.Body)\n\t\terr = json.Unmarshal(body, &authData)\n\t\tres.Body.Close()\n\t\tif err != nil {\n\t\t\tlog.Println(\"ERROR: Invalid response object from Google\")\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tAccessToken = fmt.Sprintf(\"Bearer %s\", authData.AccessToken)\n\t\ttime.Sleep(time.Minute * 45)\n\t}\n}", "title": "" }, { "docid": "4603609dbf23df7f95a2a826832e947a", "score": "0.5365241", "text": "func (ts *TokenStore) GetByRefresh(refresh string) (ti oauth2.TokenInfo, err error) {\n\tbasicID, err := ts.getBasicID(ts.tcfg.RefreshCName, refresh)\n\tif err != nil && basicID == \"\" {\n\t\treturn\n\t}\n\tti, err = ts.getData(basicID)\n\treturn\n}", "title": "" }, { "docid": "e53e024b4498aa445a95cc526fbf9df2", "score": "0.5364034", "text": "func (a *AuthenticationClient) RefreshAccessToken(ctx context.Context) (*corev2.Tokens, error) {\n\tvar accessClaims *corev2.Claims\n\n\t// Get the access token claims\n\tif value := ctx.Value(corev2.AccessTokenClaims); value != nil {\n\t\taccessClaims = value.(*corev2.Claims)\n\t} else {\n\t\treturn nil, corev2.ErrInvalidToken\n\t}\n\n\t// Get the refresh token claims\n\tif value := ctx.Value(corev2.RefreshTokenClaims); value == nil {\n\t\treturn nil, corev2.ErrInvalidToken\n\t}\n\n\t// Get the refresh token string\n\tvar refreshTokenString string\n\tif value := ctx.Value(corev2.RefreshTokenString); value != nil {\n\t\trefreshTokenString = value.(string)\n\t} else {\n\t\treturn nil, corev2.ErrInvalidToken\n\t}\n\n\t// Ensure backward compatibility by filling the provider claims if missing\n\tif accessClaims.Provider.ProviderID == \"\" || accessClaims.Provider.UserID == \"\" {\n\t\taccessClaims.Provider.ProviderID = basic.Type\n\t\taccessClaims.Provider.UserID = accessClaims.Subject\n\t}\n\n\t// Ensure backward compatibility with Sensu Go 5.1.1, since the provider type\n\t// was used in the provider ID\n\tif accessClaims.Provider.ProviderID == \"basic/default\" {\n\t\taccessClaims.Provider.ProviderID = basic.Type\n\t}\n\n\t// Refresh the user claims\n\tclaims, err := a.auth.Refresh(ctx, accessClaims)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Ensure the 'system:users' group is present\n\tclaims.Groups = append(claims.Groups, \"system:users\")\n\n\t// Add the issuer URL\n\tif issuer := ctx.Value(jwt.IssuerURLKey); issuer != nil {\n\t\tclaims.Issuer = issuer.(string)\n\t}\n\n\t// Issue a new access token\n\t_, accessTokenString, err := jwt.AccessToken(claims)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &corev2.Tokens{\n\t\tAccess: accessTokenString,\n\t\tExpiresAt: claims.ExpiresAt,\n\t\tRefresh: refreshTokenString,\n\t}, nil\n}", "title": "" }, { "docid": "f4e6e9ea9f042bdd0f8f047542250c22", "score": "0.5362881", "text": "func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {\n\treturn nil, errors.New(\"Refresh token is not provided by Shopify\")\n}", "title": "" }, { "docid": "0e7df8cbbbe9dbe205e932267ce02705", "score": "0.53475684", "text": "func (c ClientAgent) RefreshToken(refreshToken, scope string) (*Authorization, error) {\n\treturn c.doTokenRequest(url.Values{\n\t\t\"grant_type\": []string{\"refresh_token\"},\n\t\t\"refresh_token\": []string{refreshToken},\n\t\t\"scope\": []string{scope},\n\t})\n}", "title": "" }, { "docid": "bff78b58e7a9902aca118455b037ea52", "score": "0.53393286", "text": "func (ac *Client) RefreshAuthToken() error {\n\turl := fmt.Sprintf(\"%s%s\", ac.IssuerID, \"?grant_type=client_credentials\")\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"[RefreshAuthToken] Failed to create a GET request\")\n\t}\n\treq.SetBasicAuth(ac.ClientID, ac.ClientSecret)\n\tac.dumpRequest(req)\n\n\tres, err := http.DefaultClient.Do(req)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"[RefreshAuthToken] Failed to execute a GET request\")\n\t}\n\n\tdefer res.Body.Close()\n\tac.dumpResponse(res)\n\n\tif res.StatusCode != 200 {\n\t\tbody, err := ioutil.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, fmt.Sprintf(\"[RefreshAuthToken] RefreshAuthToken failed, and the response body could not be read. Status code: %d\", res.StatusCode))\n\t\t}\n\t\treturn fmt.Errorf(\"[RefreshAuthToken] RefreshAuthToken request returned %d. Body: %s\", res.StatusCode, string(body))\n\t}\n\n\tvar uaaResponse UAAResponse\n\terr = json.NewDecoder(res.Body).Decode(&uaaResponse)\n\tif err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"[RefreshAuthToken] Failed to decode response. Status code: %d\", res.StatusCode))\n\n\t}\n\tac.Token = fmt.Sprintf(\"bearer %s\", uaaResponse.AccessToken)\n\treturn nil\n}", "title": "" }, { "docid": "5b95f5710bac294b8a6f8f4ef0f07ceb", "score": "0.5339232", "text": "func (o *OIDC) fetchRefreshSession(ctx context.Context, treq *tokenRequest) (*sessionV2, error) {\n\turefresh, err := unmarshalToken(treq.RefreshToken)\n\tif err != nil {\n\t\treturn nil, &oauth2.TokenError{ErrorCode: oauth2.TokenErrorCodeInvalidRequest, Description: \"invalid refresh token\", Cause: err}\n\t}\n\n\tsess, err := getSession(ctx, o.smgr, urefresh.SessionId)\n\tif err != nil {\n\t\treturn nil, &httpError{Code: http.StatusInternalServerError, Message: \"internal error\", CauseMsg: \"failed to get session from storage\", Cause: err}\n\t}\n\tif sess == nil {\n\t\treturn nil, &oauth2.TokenError{ErrorCode: oauth2.TokenErrorCodeInvalidGrant, Description: \"token expired\", Cause: err}\n\t}\n\n\tif sess.RefreshToken == nil {\n\t\treturn nil, &oauth2.TokenError{ErrorCode: oauth2.TokenErrorCodeInvalidGrant, Description: \"no refresh token issued for session\"}\n\t}\n\n\tif o.now().After(sess.Expiry) || o.now().After(sess.RefreshToken.Expiry) {\n\t\tif err := o.smgr.DeleteSession(ctx, sess.ID); err != nil {\n\t\t\treturn nil, &httpError{Code: http.StatusInternalServerError, Message: \"internal error\", CauseMsg: \"failed to delete session from storage\", Cause: err}\n\t\t}\n\t\treturn nil, &oauth2.TokenError{ErrorCode: oauth2.TokenErrorCodeInvalidGrant, Description: \"token expired\"}\n\t}\n\n\tok, err := tokensMatch(urefresh, sess.RefreshToken)\n\tif err != nil {\n\t\treturn nil, &oauth2.TokenError{ErrorCode: oauth2.TokenErrorCodeInvalidRequest, Description: \"invalid refresh token\", Cause: err}\n\t}\n\tif !ok {\n\t\t// if we're passed an invalid refresh token, assume we're under attack and drop the session\n\t\tif err := o.smgr.DeleteSession(ctx, sess.ID); err != nil {\n\t\t\treturn nil, &httpError{Code: http.StatusInternalServerError, Message: \"internal error\", CauseMsg: \"failed to delete session from storage\", Cause: err}\n\t\t}\n\t\treturn nil, &oauth2.TokenError{ErrorCode: oauth2.TokenErrorCodeInvalidGrant, Description: \"invalid refresh token\", Cause: err}\n\t}\n\n\t// Drop the current token, it's been redeemed. The caller can decide to\n\t// issue a new one.\n\tsess.RefreshToken = nil\n\n\treturn sess, nil\n}", "title": "" }, { "docid": "f55039ddb576763cc7ae0ce69619cbbe", "score": "0.53384924", "text": "func doTokenAuth(ctx context.Context, apiSrv *rest.Client, loginTokenBase64 string) (token oauth2.Token, tokenEndpoint string, err error) {\n\tloginTokenBytes, err := base64.RawURLEncoding.DecodeString(loginTokenBase64)\n\tif err != nil {\n\t\treturn token, \"\", err\n\t}\n\n\t// decode login token\n\tvar loginToken api.LoginToken\n\tdecoder := json.NewDecoder(bytes.NewReader(loginTokenBytes))\n\terr = decoder.Decode(&loginToken)\n\tif err != nil {\n\t\treturn token, \"\", err\n\t}\n\n\t// retrieve endpoint urls\n\topts := rest.Opts{\n\t\tMethod: \"GET\",\n\t\tRootURL: loginToken.WellKnownLink,\n\t}\n\tvar wellKnown api.WellKnown\n\t_, err = apiSrv.CallJSON(ctx, &opts, nil, &wellKnown)\n\tif err != nil {\n\t\treturn token, \"\", err\n\t}\n\n\t// prepare out token request with username and password\n\tvalues := url.Values{}\n\tvalues.Set(\"client_id\", defaultClientID)\n\tvalues.Set(\"grant_type\", \"password\")\n\tvalues.Set(\"password\", loginToken.AuthToken)\n\tvalues.Set(\"scope\", \"openid offline_access\")\n\tvalues.Set(\"username\", loginToken.Username)\n\tvalues.Encode()\n\topts = rest.Opts{\n\t\tMethod: \"POST\",\n\t\tRootURL: wellKnown.TokenEndpoint,\n\t\tContentType: \"application/x-www-form-urlencoded\",\n\t\tBody: strings.NewReader(values.Encode()),\n\t}\n\n\t// do the first request\n\tvar jsonToken api.TokenJSON\n\t_, err = apiSrv.CallJSON(ctx, &opts, nil, &jsonToken)\n\tif err != nil {\n\t\treturn token, \"\", err\n\t}\n\n\ttoken.AccessToken = jsonToken.AccessToken\n\ttoken.RefreshToken = jsonToken.RefreshToken\n\ttoken.TokenType = jsonToken.TokenType\n\ttoken.Expiry = time.Now().Add(time.Duration(jsonToken.ExpiresIn) * time.Second)\n\treturn token, wellKnown.TokenEndpoint, err\n}", "title": "" }, { "docid": "ff91c4c441e87ea93f0ad6d01e16c4f0", "score": "0.5329443", "text": "func (m *MockClient) RefreshController() (*sarama.Broker, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshController\")\n\tret0, _ := ret[0].(*sarama.Broker)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b83c8340ac34ab334f924f3c9ca3a427", "score": "0.5323105", "text": "func (m *MockAccessTokenStore) Get(token string) (*AccessToken, error) {\n\tret := m.ctrl.Call(m, \"Get\", token)\n\tret0, _ := ret[0].(*AccessToken)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9360d713a0077d969201be7476ed2fce", "score": "0.53224915", "text": "func RefreshToken(writer rest.ResponseWriter, request *rest.Request) {\n\ttkn, cerber := Token(request), Cerber(request)\n\tif tkn == nil {\n\t\tUnauthorizedJWT(writer, request, nil)\n\t\treturn\n\t}\n\n\tnewToken, err := cerber.RefreshToken(tkn)\n\tif err != nil {\n\t\tUnauthorizedJWT(writer, request, err)\n\t\treturn\n\t}\n\n\twriter.WriteJson(loginResponse{newToken})\n}", "title": "" }, { "docid": "b3518b3a75ebc67f52a40741cf96986b", "score": "0.53210896", "text": "func (ur *UserRepository) GetByRefreshToken(ctx context.Context, token string) (*model.User, *model.RefreshToken, error) {\n\tquery := `FOR rt IN refreshTokens\n\tFILTER rt.token == @token LIMIT 0, 1\n\tFOR u IN users\n\t\tFILTER u._key == rt.user_id\n\t\tRETURN {user: u, refresh: rt}`\n\tbindVars := map[string]interface{}{\n\t\t\"token\": token,\n\t}\n\ttype res struct {\n\t\tUser *model.User `json:\"user\"`\n\t\tRefresh *model.RefreshToken `json:\"refresh\"`\n\t}\n\tresStruct := &res{}\n\t_, err := (*ur.Conn).Query(ctx, query, bindVars, resStruct)\n\tif err != nil {\n\t\terrMsg := err.Error()\n\t\tif e.ErrorCode(err) == e.ENOTFOUND {\n\t\t\terrMsg = \"Refresh Token not found\"\n\t\t}\n\t\treturn nil, nil, &e.Error{Message: errMsg, Op: \"UserRepository.GetByRefreshToken\", Err: err}\n\t}\n\tlog.Printf(\"r str: %+v\", resStruct)\n\treturn resStruct.User, resStruct.Refresh, nil\n}", "title": "" }, { "docid": "70543e83153e399a243e11f2f39c34f1", "score": "0.53152204", "text": "func NewJwtRefreshTokenGeneratorFunc(cfg config.Configuration) auth.RefreshTokenGeneratorFunc {\n\topt := jwtOptions{\n\t\tSecretKeyBytes: []byte(cfg.JwtSecretKey),\n\t\tExpiresInSec: time.Duration(cfg.JwtRefreshExpiresInSec),\n\t}\n\n\treturn func(userID int64) (string, error) {\n\t\tclaims := jwtClaims{\n\t\t\tgenerateStandardClaims(opt, userID),\n\t\t\t\"refresh\", // TokenType\n\t\t}\n\n\t\treturn createToken(opt, claims)\n\t}\n}", "title": "" }, { "docid": "2792e2168da4ee870122f4bb6ef54c87", "score": "0.5315023", "text": "func (o *OAuth2Token) HasRefreshToken() bool {\n\tif o != nil && o.RefreshToken != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2e3c31ab8ff47cef599778e4a5fed034", "score": "0.5306654", "text": "func getAuthenticateFromToken(c *gin.Context) {\n\tdata := []byte(TokenRefreshResp)\n\terr := \"error\"\n\n\ttoken := c.Request.Header.Get(\"Token\")\n\tif len(token) == 0 {\n\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, types.Error{Message: &err})\n\t}\n\n\tvar body library.Token\n\t_ = json.Unmarshal(data, &body)\n\n\tc.JSON(http.StatusOK, body)\n}", "title": "" }, { "docid": "d5b5ef028540c02b4fd00cd77061b331", "score": "0.5305925", "text": "func (s *Store) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error) {\n\tif refresh == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tquery := fmt.Sprintf(\"SELECT * FROM %s WHERE refresh=? LIMIT 1\", s.tableName)\n\tvar item StoreItem\n\terr := s.db.SelectOne(&item, query, refresh)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn s.toTokenInfo(item.Data), nil\n}", "title": "" }, { "docid": "4162ce7ed3441705e56139e726072f2c", "score": "0.5304547", "text": "func AuthenticateRefreshJWT(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\ttoken, claims, err := jwtauth.FromContext(r.Context())\n\t\tif err != nil {\n\t\t\tlogging.GetLogEntry(r).Warn(err)\n\t\t\trender.Render(w, r, ErrUnauthorized(ErrTokenUnauthorized))\n\t\t\treturn\n\t\t}\n\t\tif !token.Valid {\n\t\t\trender.Render(w, r, ErrUnauthorized(ErrTokenExpired))\n\t\t\treturn\n\t\t}\n\n\t\t// Token is authenticated, parse refresh token string\n\t\tvar c RefreshClaims\n\t\terr = c.ParseClaims(claims)\n\t\tif err != nil {\n\t\t\tlogging.GetLogEntry(r).Error(err)\n\t\t\trender.Render(w, r, ErrUnauthorized(ErrInvalidRefreshToken))\n\t\t\treturn\n\t\t}\n\t\t// Set refresh token string on context\n\t\tctx := context.WithValue(r.Context(), ctxRefreshToken, c.Token)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" }, { "docid": "a00be78f6087b832e547850bad7c546d", "score": "0.5304016", "text": "func (t *RefreshTokenRepository) RevokeRefreshToken(ctx context.Context,tokenId string) {\n\n}", "title": "" }, { "docid": "52a3b152cb0dcd85d7668d1e0457a482", "score": "0.5289664", "text": "func TestClaimRefreshExpire(t *testing.T) {\n\tcoordinator1, client := setupEtcd(t)\n\tcoordinator1.ClaimTTL = 3\n\tdefer coordinator1.Close()\n\tif err := coordinator1.Init(newCtx(t, \"coordinator1\")); err != nil {\n\t\tt.Fatalf(\"Unexpected error initialzing coordinator: %v\", err)\n\t}\n\tcoord1ResultChannel := make(chan string)\n\n\tmclient := NewClient(namespace, client)\n\ttask := \"testclaimrefreshexpire\"\n\n\tgo func() {\n\t\t//Watch blocks, so we need to test it in its own go routine.\n\t\ttaskId, err := coordinator1.Watch()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"coordinator1.Watch() returned an err: %v\", err)\n\t\t}\n\t\tt.Logf(\"We got a task id from the coordinator1.Watch() res:%s\", taskId)\n\n\t\tcoordinator1.Claim(taskId)\n\t\tcoord1ResultChannel <- taskId\n\t}()\n\n\terr := mclient.SubmitTask(task)\n\tif err != nil {\n\t\tt.Fatalf(\"Error submitting a task to metafora via the client. Error:\\n%v\", err)\n\t}\n\n\t// Step 1: Make sure we picked up and claimed the task before moving on...\n\tselect {\n\tcase taskId := <-coord1ResultChannel:\n\t\tif taskId != task {\n\t\t\tt.Fatalf(\"coordinator1.Watch() test failed: We received the incorrect taskId. Got [%s] Expected[%s]\", taskId, task)\n\t\t}\n\tcase <-time.After(time.Second * 5):\n\t\tt.Fatalf(\"coordinator1.Watch() test failed: The testcase timed out after 5 seconds.\")\n\t}\n\n\t// Start a second coordinator and make sure it can't claim our task.\n\tcoordinator2 := NewEtcdCoordinator(\"node2\", namespace, client).(*EtcdCoordinator)\n\tcoordinator2.ClaimTTL = 3\n\tdefer coordinator2.Close()\n\tif err := coordinator2.Init(newCtx(t, \"coordinator2\")); err != nil {\n\t\tt.Fatalf(\"Unexpected error initialzing coordinator: %v\", err)\n\t}\n\tcoord2ResultChannel := make(chan string)\n\tgo func() {\n\t\ttaskId, err := coordinator2.Watch()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"coordinator2.Watch() returned an err: %v\", err)\n\t\t}\n\t\tt.Logf(\"We got a task id from the coordinator2.Watch() res:%s\", taskId)\n\t\tcoordinator2.Claim(taskId)\n\t\tcoord2ResultChannel <- taskId\n\t}()\n\n\t// make sure we still have the claim after 2 seconds\n\tselect {\n\tcase taskId := <-coord2ResultChannel:\n\t\tt.Fatalf(\"coordinator2.Watch() test failed: We received a taskId when we shouldn't have. Got [%s]\", taskId)\n\tcase <-time.After(5 * time.Second):\n\t}\n\n\t// This should shut down coordinator1's task watcher and refresher, so that all its tasks are returned\n\t// and coordinator2 should pick them up.\n\tt.Log(\"Coordinator1 trying to shutdown coordinator1. \")\n\tgo func() {\n\t\t// The only way to tell when coord.Close() finishes is by waiting for a Watch()\n\t\t// to exit.\n\t\tcoordinator1.Watch()\n\t\tcoord1ResultChannel <- \"\"\n\t}()\n\tcoordinator1.Close()\n\t<-coord1ResultChannel\n\tt.Log(\"Coordinator1 was closed, so its tasks should shortly become available again. \")\n\n\t// Now that coordinator1 is shutdown coordinator2 should recover its tasks.\n\tselect {\n\tcase taskId := <-coord2ResultChannel:\n\t\tif taskId != task {\n\t\t\tt.Fatalf(\"coordinator2.Watch() test failed: We received the incorrect taskId. Got [%s] Expected[%s]\", taskId, task)\n\t\t}\n\tcase <-time.After(time.Second * 5):\n\t\tt.Fatalf(\"coordinator2.Watch() test failed: The testcase timed out before coordinator2 recovered coordinator1's tasks.\")\n\t}\n}", "title": "" }, { "docid": "70d2f226aa4ac5286e126badb1234265", "score": "0.528416", "text": "func (ah *AuthHandler) Refresh(context *gin.Context) {\n\ttokenData := context.MustGet(\"Token\").(map[string]string)\n\n\tjwtToken, error := ah.AuthService.GenerateJWTTokenForUser(tokenData[\"user_guid\"], tokenData[\"user_phone_no\"], tokenData[\"device_uuid\"])\n\n\tif error != nil {\n\t\terrorCode, _ := strconv.Atoi(error.Error.Status)\n\t\tcontext.JSON(errorCode, error)\n\t\treturn\n\t}\n\n\tcontext.JSON(http.StatusOK, gin.H{\"data\": jwtToken})\n}", "title": "" }, { "docid": "72c20de892656ba805efbfa09aee2092", "score": "0.52824795", "text": "func (me *TokenRepository) GetByRefreshToken(ctx context.Context, refreshToken string) (*account.Token, error) {\n\tstatement := dbx.NewStatement(\"SELECT * FROM token WHERE refresh_token = :refresh_token\")\n\tstatement.AddParameter(\"refresh_token\", refreshToken)\n\n\trows, err := me.db.QueryStatementContext(ctx, statement)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar retrievedToken *account.Token\n\n\tfor rows.Next() {\n\t\tretrievedToken = &account.Token{}\n\t\terr := rows.Scan(&retrievedToken.ID, &retrievedToken.AccessToken, &retrievedToken.RefreshToken, &retrievedToken.RequestedCount, &retrievedToken.Blacklisted, &retrievedToken.ExpiredAt, &retrievedToken.CreatedAt, &retrievedToken.UpdatedAt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn retrievedToken, nil\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "ea644317ce8d03e13ecbaeeca0f789ba", "score": "0.5279901", "text": "func createGoogleRefreshToken(endpoint string, reqData models.GoogleLinkedinTokenRequest) (err error, respData []byte) {\n\t// Client\n\tclient := pester.New()\n\tclient.KeepLog = true\n\n\tlog.Infof(\"reqData.GrantType - %s\", reqData.GrantType)\n\t// make request data in url value form\n\tparams := url.Values{}\n\tparams.Add(\"client_id\", reqData.ClientId)\n\tparams.Add(\"client_secret\", reqData.ClientSecret)\n\tparams.Add(\"refresh_token\", reqData.RefreshToken)\n\tparams.Add(\"grant_type\", reqData.GrantType)\n\n\tlog.Info(params.Encode())\n\t// Request object with POST method\n\treq, err := http.NewRequest(\"POST\", endpoint, bytes.NewBufferString(params.Encode()))\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\t// Response\n\tvar resp *http.Response\n\tresp, err = http.DefaultClient.Do(req)\n\tif nil != err {\n\t\tlog.Errorf(\"createGoogleLinkedinToken() Unable to call token API err=%+v\", err)\n\t\treturn\n\t}\n\n\t// Read response body data\n\tstatus := resp.StatusCode\n\trespData, err = ioutil.ReadAll(resp.Body)\n\tif nil != err {\n\t\tlog.Errorf(\"createGoogleLinkedinToken() Unable to read response err=%+v\", err)\n\t\treturn\n\t} else if status != 200 {\n\t\tlog.Errorf(\"createGoogleLinkedinToken() something went wrong statusCode=%d, msg=%s\", status, string(respData))\n\t\terr = fmt.Errorf(\"Something went wrong statusCode=%d, msg=%s\", status, string(respData))\n\t}\n\treturn\n}", "title": "" }, { "docid": "4c35c1955661db62bc0c6acb388a8834", "score": "0.5277156", "text": "func (a *API) RefreshTokenGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\tconfig := a.getConfig(ctx)\n\tinstanceID := getInstanceID(ctx)\n\ttokenStr := r.FormValue(\"refresh_token\")\n\tcookie := r.Header.Get(useCookieHeader)\n\n\tif tokenStr == \"\" {\n\t\treturn oauthError(\"invalid_request\", \"refresh_token required\")\n\t}\n\n\tuser, token, err := models.FindUserWithRefreshToken(a.db, tokenStr)\n\tif err != nil {\n\t\tif models.IsNotFoundError(err) {\n\t\t\treturn oauthError(\"invalid_grant\", \"Invalid Refresh Token\")\n\t\t}\n\t\treturn internalServerError(err.Error())\n\t}\n\n\tif token.Revoked {\n\t\ta.clearCookieToken(ctx, w)\n\t\treturn oauthError(\"invalid_grant\", \"Invalid Refresh Token\").WithInternalMessage(\"Possible abuse attempt: %v\", r)\n\t}\n\n\tvar tokenString string\n\tvar newToken *models.RefreshToken\n\n\terr = a.db.Transaction(func(tx *storage.Connection) error {\n\t\tvar terr error\n\t\tif terr = models.NewAuditLogEntry(tx, instanceID, user, models.TokenRefreshedAction, nil); terr != nil {\n\t\t\treturn terr\n\t\t}\n\n\t\tnewToken, terr = models.GrantRefreshTokenSwap(tx, user, token)\n\t\tif terr != nil {\n\t\t\treturn internalServerError(terr.Error())\n\t\t}\n\n\t\ttokenString, terr = generateAccessToken(user, time.Second*time.Duration(config.JWT.Exp), config.JWT.Secret)\n\t\tif terr != nil {\n\t\t\treturn internalServerError(\"error generating jwt token\").WithInternalError(terr)\n\t\t}\n\n\t\tif cookie != \"\" && config.Cookie.Duration > 0 {\n\t\t\tif terr = a.setCookieToken(config, tokenString, cookie == useSessionCookie, w); terr != nil {\n\t\t\t\treturn internalServerError(\"Failed to set JWT cookie. %s\", terr)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tmetering.RecordLogin(\"token\", user.ID, instanceID)\n\treturn sendJSON(w, http.StatusOK, &AccessTokenResponse{\n\t\tToken: tokenString,\n\t\tTokenType: \"bearer\",\n\t\tExpiresIn: config.JWT.Exp,\n\t\tRefreshToken: newToken.Token,\n\t})\n}", "title": "" } ]
4fe30df977850d7df82914781adcd658
Contains returns a boolean indicating if value that is being held is present in given 'ListNotificationChannelsRequest'
[ { "docid": "2d46dc26f2b288b5669224843891fc1c", "score": "0.5581859", "text": "func (fpaiv *ListNotificationChannelsRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *ListNotificationChannelsRequest) bool {\n\tslice := fpaiv.ListNotificationChannelsRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" } ]
[ { "docid": "fc1abac4cd7204f720282b9eae56966c", "score": "0.6102572", "text": "func (fpaivs *ListNotificationChannelsResponse_FieldSubPathArrayItemValue) ContainsValue(source *ListNotificationChannelsResponse) bool {\n\tswitch fpaivs.Selector() {\n\tcase ListNotificationChannelsResponse_FieldPathSelectorNotificationChannels:\n\t\treturn false // repeated/map field\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListNotificationChannelsResponse: %d\", fpaivs.Selector()))\n\t}\n}", "title": "" }, { "docid": "1658f60cb568d0b29855ad934a263e42", "score": "0.5761491", "text": "func (fpaivs *BatchGetNotificationChannelsResponse_FieldSubPathArrayItemValue) ContainsValue(source *BatchGetNotificationChannelsResponse) bool {\n\tswitch fpaivs.Selector() {\n\tcase BatchGetNotificationChannelsResponse_FieldPathSelectorNotificationChannels:\n\t\treturn false // repeated/map field\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetNotificationChannelsResponse: %d\", fpaivs.Selector()))\n\t}\n}", "title": "" }, { "docid": "42ddef2b14589430ed6c8eb18058ef0b", "score": "0.5741925", "text": "func (fpaivs *CreateNotificationChannelRequest_FieldSubPathArrayItemValue) ContainsValue(source *CreateNotificationChannelRequest) bool {\n\tswitch fpaivs.Selector() {\n\tcase CreateNotificationChannelRequest_FieldPathSelectorNotificationChannel:\n\t\treturn fpaivs.subPathItemValue.(notification_channel.NotificationChannel_FieldPathArrayItemValue).ContainsValue(source.GetNotificationChannel())\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for CreateNotificationChannelRequest: %d\", fpaivs.Selector()))\n\t}\n}", "title": "" }, { "docid": "20d679c251cd0baa130c1221b2f961a4", "score": "0.5729885", "text": "func (fpaivs *WatchNotificationChannelsResponse_FieldSubPathArrayItemValue) ContainsValue(source *WatchNotificationChannelsResponse) bool {\n\tswitch fpaivs.Selector() {\n\tcase WatchNotificationChannelsResponse_FieldPathSelectorPageTokenChange:\n\t\treturn fpaivs.subPathItemValue.(WatchNotificationChannelsResponsePageTokenChange_FieldPathArrayItemValue).ContainsValue(source.GetPageTokenChange())\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchNotificationChannelsResponse: %d\", fpaivs.Selector()))\n\t}\n}", "title": "" }, { "docid": "32ad3a682bc216aa37e25e753abd4c5d", "score": "0.5670932", "text": "func (fpaivs *UpdateNotificationChannelRequest_FieldSubPathArrayItemValue) ContainsValue(source *UpdateNotificationChannelRequest) bool {\n\tswitch fpaivs.Selector() {\n\tcase UpdateNotificationChannelRequest_FieldPathSelectorNotificationChannel:\n\t\treturn fpaivs.subPathItemValue.(notification_channel.NotificationChannel_FieldPathArrayItemValue).ContainsValue(source.GetNotificationChannel())\n\tcase UpdateNotificationChannelRequest_FieldPathSelectorCas:\n\t\treturn fpaivs.subPathItemValue.(UpdateNotificationChannelRequestCAS_FieldPathArrayItemValue).ContainsValue(source.GetCas())\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateNotificationChannelRequest: %d\", fpaivs.Selector()))\n\t}\n}", "title": "" }, { "docid": "2c00b5b7922bdd1cb5c2e7c0f91285a3", "score": "0.5377617", "text": "func (fpaiv *ListNotificationChannelsResponse_FieldTerminalPathArrayItemValue) ContainsValue(source *ListNotificationChannelsResponse) bool {\n\tslice := fpaiv.ListNotificationChannelsResponse_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ecfa4bfb4a18fb6c354f825ffd533ae7", "score": "0.5272275", "text": "func InStatusList(x string) bool {\n\tls := []string{\"drafted\", \"published\", \"deleted\"}\n\tfor _, s := range ls {\n\t\tif x == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "075d156d48470c0ea536ffbb3c245e61", "score": "0.5260482", "text": "func (fpaiv *BatchGetNotificationChannelsRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *BatchGetNotificationChannelsRequest) bool {\n\tslice := fpaiv.BatchGetNotificationChannelsRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "03486e917d13f13572ee2910a30b1a64", "score": "0.5246161", "text": "func (mh *MqttTransport) isChannelInterested(chanName string, topic string, addr *Address, msg *FimpMessage) bool {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Error(\"<MqttAd> Filter CRASHED with error :\", r)\n\t\t}\n\t}()\n\n\tfilterFunc, ok := mh.subFilterFuncs[chanName]\n\tif ok {\n\t\treturn filterFunc(topic, addr, msg)\n\t}\n\tfilter, ok := mh.subFilters[chanName]\n\tif !ok {\n\t\t// no filters has been set\n\t\treturn true\n\t}\n\n\tif utils.RouteIncludesTopic(filter.Topic, topic) &&\n\t\t(msg.Service == filter.Service || filter.Service == \"*\") &&\n\t\t(msg.Type == filter.Interface || filter.Interface == \"*\") {\n\t\treturn true\n\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f25d4ea71cdee0e77ec9329310b87cb2", "score": "0.5217598", "text": "func (fpaiv *GetNotificationChannelRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *GetNotificationChannelRequest) bool {\n\tslice := fpaiv.GetNotificationChannelRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1a1345aebbcfdc424e7c7cf337e82bd8", "score": "0.51837486", "text": "func (fpaiv *DeleteNotificationChannelRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *DeleteNotificationChannelRequest) bool {\n\tslice := fpaiv.DeleteNotificationChannelRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d756df1340a628ffe9b3c7b2aea15c9a", "score": "0.51668096", "text": "func (fpaiv *WatchNotificationChannelsRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *WatchNotificationChannelsRequest) bool {\n\tslice := fpaiv.WatchNotificationChannelsRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ed405fe199e4aca6db63f3110a81d376", "score": "0.51531696", "text": "func (fpaiv *CreateNotificationChannelRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *CreateNotificationChannelRequest) bool {\n\tslice := fpaiv.CreateNotificationChannelRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f0503f19b7bd03f484db9a836de15b10", "score": "0.51455295", "text": "func (channel *Channel) ContainsHandlers() bool {\n return len(channel.eventHandlers) > 0\n}", "title": "" }, { "docid": "d6715253034ef3cc50d0f943907c7e46", "score": "0.5141421", "text": "func (fpaiv *UpdateNotificationChannelRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *UpdateNotificationChannelRequest) bool {\n\tslice := fpaiv.UpdateNotificationChannelRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ab47a2bfc160d7c33985befca23fecb1", "score": "0.51155055", "text": "func (c *centrifugeImpl) subscribed(channel string) bool {\n\tc.subsMutex.RLock()\n\t_, ok := c.subs[channel]\n\tc.subsMutex.RUnlock()\n\treturn ok\n}", "title": "" }, { "docid": "aaf75792223e4ee6a27938a407fa845c", "score": "0.51015186", "text": "func (fpaiv *BatchGetNotificationChannelsResponse_FieldTerminalPathArrayItemValue) ContainsValue(source *BatchGetNotificationChannelsResponse) bool {\n\tslice := fpaiv.BatchGetNotificationChannelsResponse_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d5afba4847b8a51c8ecf0108e857f20f", "score": "0.5101121", "text": "func isSubscribed(user string, list string) bool {\n\taddressObj, err := mail.ParseAddress(user)\n\tif err != nil {\n\t\tlog.Printf(\"DATABASE_ERROR Error=%q\\n\", err.Error())\n\t\tos.Exit(0)\n\t}\n\texists := false\n\terr = gDB.QueryRow(\"SELECT 1 FROM subscriptions WHERE user=? AND list=?\", addressObj.Address, list).Scan(&exists)\n\n\tif err == sql.ErrNoRows {\n\t\treturn false\n\t} else if err != nil {\n\t\tlog.Printf(\"DATABASE_ERROR Error=%q\\n\", err.Error())\n\t\tos.Exit(0)\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "bc29effefce8b66bc503d73e2bbabf79", "score": "0.50817317", "text": "func (c Capabilities) Contains(capp string) bool {\n\treturn c.Get(capp) != nil\n}", "title": "" }, { "docid": "2c02faea50b207cc165ab8cc24c721d3", "score": "0.5064259", "text": "func (fpaiv *WatchNotificationChannelRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *WatchNotificationChannelRequest) bool {\n\tslice := fpaiv.WatchNotificationChannelRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "00e18d3bc35306faa4668a4bf2685ab6", "score": "0.50619185", "text": "func (s *Server) Contains(ctx context.Context, request *api.ContainsRequest) (*api.ContainsResponse, error) {\n\tlog.Info(\"Received ContainRequest:\", request)\n\telements, err := redis.Strings(s.DoCommand(request.Header, commands.LRANGE, request.Header.Name.Name, 0, -1))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcontain := false\n\tfor _, element := range elements {\n\t\tif element == request.Value {\n\t\t\tcontain = true\n\t\t}\n\t}\n\n\tresponseHeader := &headers.ResponseHeader{\n\t\tSessionID: request.Header.SessionID,\n\t\tStatus: headers.ResponseStatus_OK,\n\t}\n\tresponse := &api.ContainsResponse{\n\t\tHeader: responseHeader,\n\t\tContains: contain,\n\t}\n\tlog.Info(\"Sent ContainsResponse\", response)\n\treturn response, nil\n}", "title": "" }, { "docid": "b489da696cc40f62546c2c68163a477b", "score": "0.50376636", "text": "func contains(floorRequestsList []float64, e float64) bool {\n\tfor _, a := range floorRequestsList {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "125445e7f6744360b8431a448b5e9fb0", "score": "0.5010051", "text": "func inActiveList(sj batchv2alpha1.CronJob, uid types.UID) bool {\n\tfor _, j := range sj.Status.Active {\n\t\tif j.UID == uid {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "56535a05253f8f1320295bd711a4d84d", "score": "0.4970484", "text": "func (fpaiv *WatchNotificationChannelsResponsePageTokenChange_FieldTerminalPathArrayItemValue) ContainsValue(source *WatchNotificationChannelsResponse_PageTokenChange) bool {\n\tslice := fpaiv.WatchNotificationChannelsResponsePageTokenChange_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a1fbc2e0fc4ab5596368fa92d09f4814", "score": "0.49643534", "text": "func (fpaiv *WatchNotificationChannelsResponse_FieldTerminalPathArrayItemValue) ContainsValue(source *WatchNotificationChannelsResponse) bool {\n\tslice := fpaiv.WatchNotificationChannelsResponse_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "df75f15891652c50e35cca799c41b14e", "score": "0.49536547", "text": "func containsChartConfig(list []*v1alpha1.ChartConfig, item *v1alpha1.ChartConfig) bool {\n\tfor _, l := range list {\n\t\tif item.Name == l.Name && item.Namespace == l.Namespace {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "07faf23fe2fa3c18dc3d4f629e3d5a19", "score": "0.49403533", "text": "func (sn *SettingNotifications) Exists() bool {\n\treturn sn._exists\n}", "title": "" }, { "docid": "271ae5533a869e56dd4bf04a2e091daa", "score": "0.49366266", "text": "func (n *NotificationsMap) Matches(bucketID, objectID string) []string {\n\tn.mutex.Lock()\n\tdefer n.mutex.Unlock()\n\n\t// Iterate over all notifications and check if they match.\n\tret := []string{}\n\tfor notifyID, regexes := range n.notifications {\n\t\tnotifyBucketID, objectPrefix := splitNotificationID(notifyID)\n\t\tif bucketID == notifyBucketID && strings.HasPrefix(objectID, objectPrefix) {\n\t\t\tret = append(ret, getChannelIDsFromRegexps(notifyID, objectID, regexes)...)\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "accdb8dc23ac21d65da38b28eb34881a", "score": "0.4908486", "text": "func (srv *clonesrv_t) was_pending(kvmsg *kvmsg.Kvmsg) bool {\n\tuuid1, _ := kvmsg.GetUuid()\n\tfor i, msg := range srv.pending {\n\t\tif uuid2, _ := msg.GetUuid(); uuid1 == uuid2 {\n\t\t\tsrv.pending = append(srv.pending[:i], srv.pending[i+1:]...)\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d6fa1e9aa476abd142c3a11ce31721fd", "score": "0.48958236", "text": "func (q QueueImpl) Contains(key interface{}) bool {\n\tfor _, k := range q.Key {\n\t\tif key == k {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "816a7007e43a639366cccebaebb78b9e", "score": "0.48749533", "text": "func contains(collection []string, item ddapi.Monitor) bool {\n\tfor _, name := range collection {\n\t\tif name == *item.Name {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8e848fb6f7ff35c8c93fe68a57ee84ec", "score": "0.48575693", "text": "func (fpaiv *WatchNotificationChannelResponse_FieldTerminalPathArrayItemValue) ContainsValue(source *WatchNotificationChannelResponse) bool {\n\tslice := fpaiv.WatchNotificationChannelResponse_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bc2b5f5ed23d79e8b9cf6f8846392e3d", "score": "0.4834927", "text": "func (me TRequestTypeEnum) IsSubscription() bool { return me.String() == \"subscription\" }", "title": "" }, { "docid": "8a29f523e838adbe53e016d76ec8d47c", "score": "0.48140958", "text": "func (fpaivs *UpdateNotificationChannelRequestCAS_FieldSubPathArrayItemValue) ContainsValue(source *UpdateNotificationChannelRequest_CAS) bool {\n\tswitch fpaivs.Selector() {\n\tcase UpdateNotificationChannelRequestCAS_FieldPathSelectorConditionalState:\n\t\treturn fpaivs.subPathItemValue.(notification_channel.NotificationChannel_FieldPathArrayItemValue).ContainsValue(source.GetConditionalState())\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateNotificationChannelRequest_CAS: %d\", fpaivs.Selector()))\n\t}\n}", "title": "" }, { "docid": "5ec5073790f195ef2be7a69d1b48b2df", "score": "0.48064396", "text": "func (m *eventAPIManager) Exists(customerID string, integrationInstanceID string, refType string, refID string, scope sdk.WebHookScope) bool {\n\n\tdbid := m.webhookCacheKey(customerID, integrationInstanceID, refType, refID, scope)\n\tif val, ok := m.cache.Get(dbid); ok && val != nil {\n\t\treturn ok\n\t}\n\tclient := m.createGraphql(customerID)\n\tswitch scope {\n\tcase sdk.WebHookScopeProject:\n\t\tprojectID := work.NewProjectID(customerID, refID, refType)\n\t\twebhook, err := work.FindProjectWebhook(client, work.NewProjectWebhookID(customerID, projectID))\n\t\tif err == nil && webhook != nil && webhook.RefID == refID {\n\t\t\tm.cache.SetDefault(dbid, *webhook.URL)\n\t\t\treturn true\n\t\t}\n\tcase sdk.WebHookScopeRepo:\n\t\trepoID := sourcecode.NewRepoID(customerID, refType, refID)\n\t\twebhook, err := sourcecode.FindRepoWebhook(client, sourcecode.NewRepoWebhookID(customerID, repoID))\n\t\tif err == nil && webhook != nil && webhook.RefID == refID {\n\t\t\tm.cache.SetDefault(dbid, *webhook.URL)\n\t\t\treturn true\n\t\t}\n\tcase sdk.WebHookScopeOrg:\n\t\tinstance, err := agent.FindIntegrationInstance(client, integrationInstanceID)\n\t\tif err == nil && instance != nil && instance.Webhooks != nil {\n\t\t\tfor _, webhook := range instance.Webhooks {\n\t\t\t\tif (webhook.RefID == nil && refID == \"\") || (webhook.RefID != nil && *webhook.RefID == refID) {\n\t\t\t\t\tm.cache.SetDefault(dbid, *webhook.URL)\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "67e5996d095d3f30430b6e26dfa0d32b", "score": "0.47993508", "text": "func TestListChannels(t *testing.T) {\n\talice, dir := testBotSetup(t, \"alice\")\n\tdefer testBotTeardown(t, alice, dir)\n\tteamChannel := getTeamChatChannel(t, \"acme\")\n\tchannels, err := alice.ListChannels(teamChannel.Name)\n\trequire.NoError(t, err)\n\trequire.True(t, len(channels) > 0)\n\tchannelFound := false\n\tfor _, channel := range channels {\n\t\tif channel == teamChannel.TopicName {\n\t\t\tchannelFound = true\n\t\t\tbreak\n\t\t}\n\t}\n\trequire.True(t, channelFound)\n}", "title": "" }, { "docid": "56556d3da2bd832d28fa3b0c34e0b7bd", "score": "0.47939783", "text": "func (wg *watcherGroup) contains(key string) bool {\n\t_, ok := wg.keyWatchers[key]\n\treturn ok || wg.ranges.Intersects(adt.NewStringAffinePoint(key))\n}", "title": "" }, { "docid": "c3819a08ad9adb7139210811017926c6", "score": "0.47852394", "text": "func (fpaiv *UpdateNotificationChannelRequestCAS_FieldTerminalPathArrayItemValue) ContainsValue(source *UpdateNotificationChannelRequest_CAS) bool {\n\tslice := fpaiv.UpdateNotificationChannelRequestCAS_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2a6a8fb33ba4d72be44983bc1d5dd00f", "score": "0.47704455", "text": "func (r Request) IsNotification() bool {\n\tif r.ID == nil {\n\t\treturn true\n\t}\n\n\tswitch v := r.ID.(type) {\n\tcase string:\n\t\treturn v == \"0\"\n\tcase float64:\n\t\treturn v == 0\n\tdefault:\n\t\tpanic(fmt.Errorf(\"id has unexpected type\"))\n\t}\n}", "title": "" }, { "docid": "f91be3492c2c2eb41c4eaa149520b718", "score": "0.47643146", "text": "func channelsListMine(service *youtube.Service, part string) *youtube.ChannelListResponse {\n\tcall := service.Channels.List(part)\n\tcall = call.Mine(true)\n\tresponse, err := call.Do()\n\thandleError(err, \"\")\n\treturn response\n}", "title": "" }, { "docid": "4662bd6e5ad627e8212659e537ff1161", "score": "0.4753127", "text": "func InList(list []interface{}, key string) bool {\n\tfor _, item := range list {\n\t\tif strings.Contains(key, fmt.Sprintf(\"%s\", item)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ee68b845eaeaec6141d57a383d363f52", "score": "0.47434103", "text": "func channelsListMine(service *youtube.Service, part []string) *youtube.ChannelListResponse {\n\tcall := service.Channels.List(part)\n\tcall = call.Mine(true)\n\tresponse, err := call.Do()\n\thandleError(err, \"\")\n\treturn response\n}", "title": "" }, { "docid": "742fcad8413bf3c7cb38f9890bcec09f", "score": "0.4722904", "text": "func (c *Client) getHasSubscribed(start, limit int) ([]*subold.Subscriber, error) {\n\tt := time.Now().Add(-1 * 100 * 365 * 24 * time.Hour)\n\tvar results []*subold.Subscriber\n\t_, err := c.db.QueryFilter(c.ctx, kind, start, limit, \"SignUpDatetime>\", t, &results)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "23ce55894a294d63802d92c929bc28a4", "score": "0.46978188", "text": "func (q *Queue) Has(pc uint32) bool {\n\tidx := q.set[pc]\n\treturn idx < uint32(len(q.list)) && q.list[idx] == pc\n}", "title": "" }, { "docid": "a80eafb971612ac379370877e5809380", "score": "0.4678517", "text": "func (l *List) Contains(value interface{}) (bool, error) {\n\tfor _, v := range l.values {\n\t\tif v == value {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "ffedce9ed2f29aba6f9a5d4ef5a96cf7", "score": "0.46743518", "text": "func (d *feedDatabase) Contains(key string) bool {\n\td.RLock()\n\t_, ok := d.known[key]\n\td.RUnlock()\n\n\tif ok {\n\t\treturn true\n\t}\n\n\td.Lock()\n\tdefer d.Unlock()\n\n\td.known[key] = struct{}{}\n\treturn false\n}", "title": "" }, { "docid": "b6d3075c4c70b1f92e8bda31bd15e139", "score": "0.4668064", "text": "func (c *Cache) Contains(context string, keys ...string) bool {\n\tkey := parseKeys(keys)\n\tc.mux.RLock()\n\tdefer c.mux.RUnlock()\n\tvar contained bool\n\tif c.hasAnyContext && context == \"\" {\n\t\t_, contained = c.cacheAnyContext[key]\n\t} else {\n\t\t_, contained = c.cache[context+\":\"+key]\n\t}\n\treturn contained\n}", "title": "" }, { "docid": "38eeb9fbd3111e19eae8c6791c8e1c89", "score": "0.46673107", "text": "func (_BaasFounder *BaasFounderCaller) HasFounderReceivedTokens(opts *bind.CallOpts, founderId *big.Int) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _BaasFounder.contract.Call(opts, out, \"hasFounderReceivedTokens\", founderId)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1c40546f5e5111a7d49196a9b2e3dfb6", "score": "0.46663645", "text": "func (m Messages) Contains(message Message) bool {\n\tfor _, msg := range m {\n\t\tif msg.Timestamp == message.Timestamp && msg.Message == message.Message {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5b4c6b9359db0941b0be29236be548cc", "score": "0.46556807", "text": "func (l *LFU) Contains(key interface{}) bool {\n\tl.lock.RLock()\n\tdefer l.lock.RUnlock()\n\t_, ok := l.items[key]\n\treturn ok\n}", "title": "" }, { "docid": "f60948eeb933a14717be2fe8cbdd8a01", "score": "0.46467474", "text": "func hasMatchingStatus(isOnline bool, statusFilter []pb.GetDevicesRequest_Status) bool {\n\tif len(statusFilter) == 0 {\n\t\treturn true\n\t}\n\tfor _, f := range statusFilter {\n\t\tswitch f {\n\t\tcase pb.GetDevicesRequest_ONLINE:\n\t\t\tif isOnline {\n\t\t\t\treturn true\n\t\t\t}\n\t\tcase pb.GetDevicesRequest_OFFLINE:\n\t\t\tif !isOnline {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "19a54f4f3328f7f1dbfd6481d23c87c5", "score": "0.46434543", "text": "func (r *Requests) Contains(containerID ids.ID) bool {\n\t_, ok := r.idToReq[containerID]\n\treturn ok\n}", "title": "" }, { "docid": "3b5eacdc758f8d78421d9aeb5bf869c5", "score": "0.46318492", "text": "func (set *Blacklistset) Contains(key sigAlg.PublicKey, thresh int) bool {\n\tnbStrikes, isPresent := set.Strikes[string(key)]\n\tif !isPresent {\n\t\treturn false\n\t}\n\n\treturn nbStrikes > thresh\n}", "title": "" }, { "docid": "b16b765fad74f1ca0ff2002891409dac", "score": "0.46178243", "text": "func (h Headers) contains(list []string, query string) bool {\n for _, l := range list {\n // TODO probably a better way to do this\n if strings.ToLower(l) == strings.ToLower(query) {\n return true\n }\n }\n return false\n}", "title": "" }, { "docid": "69cfb26b328ff173346e88910bd6a5ff", "score": "0.4600686", "text": "func contains(s []Logger, e Logger) bool {\n\tfor _, a := range s {\n\t\tif reflect.DeepEqual(a, e) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6dce2a3249f6d287a72bb72d02e35672", "score": "0.45971283", "text": "func (m DerivativeSecurityListRequest) HasSubscriptionRequestType() bool {\n\treturn m.Has(tag.SubscriptionRequestType)\n}", "title": "" }, { "docid": "34f6ac639b6806488ac978f463568633", "score": "0.45924422", "text": "func contains(val int) bool {\n\tfor _, d := range played {\n\t\tif d == val {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0437572c7d7cd60b128ba7d841c0b3ef", "score": "0.4581222", "text": "func (b *JWTAuthBackend) IsInBlacklist(token string) bool {\n\tok := store.GetToken(token)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "6fb30b8f941bb16dbb4533e104241346", "score": "0.4579177", "text": "func (model MultipleBSCPairModel) HasChannel(name1, name2 string) bool {\n\tchs, ok := model.Channels[name1]\n\tif !ok {\n\t\treturn false\n\t}\n\t_, ok = chs[name2]\n\treturn ok\n}", "title": "" }, { "docid": "3bba893c3b60904f20b3afef10428889", "score": "0.45757565", "text": "func (r *redisV) Contains(key string) bool {\n\tctx := context.Background()\n\treturn r.driver.Exists(ctx, key).Val() == 1\n}", "title": "" }, { "docid": "62db399ae39e3ba83e6fd86ffd09d43f", "score": "0.4574263", "text": "func (p *SessionPool) notify(s *Session) (notified bool) {\n\tfor el := p.waitq.Front(); el != nil; el = p.waitq.Front() {\n\t\t// Some goroutine is waiting for a session.\n\t\t//\n\t\t// It could be in this states:\n\t\t// 1) Reached the select code and awaiting for a value in channel.\n\t\t// 2) Reached the select code but already in branch of context\n\t\t// cancelation. In this case it is locked on p.mu.Lock().\n\t\t// 3) Not reached the select code and thus not reading yet from the\n\t\t// channel.\n\t\t//\n\t\t// For cases (2) and (3) we close the channel to signal that goroutine\n\t\t// missed something and may want to retry (especially for case (3)).\n\t\t//\n\t\t// After that we taking a next waiter and repeat the same.\n\t\tch := p.waitq.Remove(el).(*chan *Session)\n\t\tselect {\n\t\tcase *ch <- s:\n\t\t\t// Case (1).\n\t\t\treturn true\n\t\tdefault:\n\t\t\t// Case (2) or (3).\n\t\t\tclose(*ch)\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "444f2ea7b6344b3c7ddc1e466cd18d1c", "score": "0.4572411", "text": "func (v *viewInternal) isSubscribed() bool {\n\treturn atomic.LoadUint32(&v.subscribed) == 1\n}", "title": "" }, { "docid": "9c8b51135fd826c4535dfc6059366da8", "score": "0.4571659", "text": "func contains(list []string, value string) (found bool) {\n\tfound = false\n\tfor _, a := range list {\n\t\tif a == value {\n\t\t\tfound = true\n\t\t}\n\t}\n\treturn found\n}", "title": "" }, { "docid": "36008ee0c117033a663c48f93cc60f96", "score": "0.4560933", "text": "func (*ListNotificationChannelsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_monitoring_v3_notification_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "ee849585808743f44015287cb133dc29", "score": "0.45468414", "text": "func (b *Blacklist) Contains(hash string) bool {\n for _, blacklistedHash := range b.Hashes {\n if blacklistedHash == hash {\n return true\n }\n }\n\n return false\n}", "title": "" }, { "docid": "237c31a2aebcda54aec3b3cbd2d2e5c4", "score": "0.4538725", "text": "func (rlic *redisLayerInfoCache) Contains(ctx context.Context, repo string, dgst digest.Digest) (bool, error) {\n\tconn := rlic.pool.Get()\n\tdefer conn.Close()\n\n\tctxu.GetLogger(ctx).Debugf(\"(*redisLayerInfoCache).Contains(%q, %q)\", repo, dgst)\n\treturn redis.Bool(conn.Do(\"SISMEMBER\", rlic.repositoryBlobSetKey(repo), dgst))\n}", "title": "" }, { "docid": "f0612941037c95467df2dbffc1f0c709", "score": "0.4535743", "text": "func (h *HealthChecker) Contains(app *mesos.TaskID) bool {\n\t_, ok := h.register[app.GetValue()]\n\treturn ok\n}", "title": "" }, { "docid": "511d2f2e103ed98a32b793507bf05c3a", "score": "0.4533174", "text": "func isInBlacklist(queue string, blacklist []string) bool {\n\tfor _, word := range blacklist {\n\t\tif strings.Contains(queue, word) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "259fd516e2165d3e8f677fbfcb632c44", "score": "0.4532898", "text": "func Contains(usrValue interface{}, validValues []interface{}) (bool, error) {\n\tfor _, v := range validValues {\n\t\tok, err := contains(v, usrValue)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif ok {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "cdfce317dec965e9de67dff387a6b58e", "score": "0.4531048", "text": "func (pm *PeerMap) Contains(pk PeerKey) bool {\n\tpm.RLock()\n\tdefer pm.RUnlock()\n\t_, exists := pm.Peers[pk]\n\treturn exists\n}", "title": "" }, { "docid": "39f7b3f78fe86940e28880f31e356626", "score": "0.4529664", "text": "func (fpaiv *CreatePreCommittedResourceChangeLogsRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *CreatePreCommittedResourceChangeLogsRequest) bool {\n\tslice := fpaiv.CreatePreCommittedResourceChangeLogsRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a11c97fdd35eda5b9b0123a8dbb12fa8", "score": "0.4529155", "text": "func (o *MicrosoftGraphIosGeneralDeviceConfiguration) HasNotificationsBlockSettingsModification() bool {\n\tif o != nil && o.NotificationsBlockSettingsModification != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d38c06cfbec21a1f79bb387005834783", "score": "0.45285836", "text": "func (r *Registry) Contains(name string) bool {\n\t_, ok := r.collection[name]\n\n\treturn ok\n}", "title": "" }, { "docid": "a8f698deb173a233ec88301c23471ead", "score": "0.45199114", "text": "func IsPending() bool {\r\n\treturn len(Pending()) > 0\r\n}", "title": "" }, { "docid": "744b9719a79f147fcb8f7c41c690341f", "score": "0.4518729", "text": "func (_BaasFounder *BaasFounderCallerSession) HasFounderReceivedTokens(founderId *big.Int) (bool, error) {\n\treturn _BaasFounder.Contract.HasFounderReceivedTokens(&_BaasFounder.CallOpts, founderId)\n}", "title": "" }, { "docid": "2fec1afd74779f8f7909a002631526fd", "score": "0.4516042", "text": "func Contains(list, value cty.Value) (cty.Value, error) {\n\treturn ContainsFunc.Call([]cty.Value{list, value})\n}", "title": "" }, { "docid": "27b8797a590b087a727d888f745140dd", "score": "0.451598", "text": "func (_BaasFounder *BaasFounderSession) HasFounderReceivedTokens(founderId *big.Int) (bool, error) {\n\treturn _BaasFounder.Contract.HasFounderReceivedTokens(&_BaasFounder.CallOpts, founderId)\n}", "title": "" }, { "docid": "fc75eb2870feb8181cef090750844ea2", "score": "0.45143428", "text": "func (l *Lobby) Contains(id string) bool {\n\tl.Protect.Lock()\n\tdefer l.Protect.Unlock()\n\t_, exists := l.contains[id]\n\treturn exists\n}", "title": "" }, { "docid": "3a7d3fb78205d415e9e9f4f38146d3d2", "score": "0.45128456", "text": "func (reminder Reminder) hasActiveReminder(chatId int64) bool {\n\t_, present := GlobalUserJobs[chatId]\n\treturn present\n}", "title": "" }, { "docid": "f7b65ad8df42e1fcf5b8de1eb279997e", "score": "0.4512823", "text": "func (o *CapabilitySwitchNetworkLimitsAllOf) HasMaximumFcPortChannels() bool {\n\tif o != nil && o.MaximumFcPortChannels != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "83857afe2e611c9b9ff72ab7d0632e8a", "score": "0.45030975", "text": "func contains(value string, values []string) bool {\n\tfor _, v := range values {\n\t\tif value == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e53098cb75b12758109bb1344bad08bf", "score": "0.45003083", "text": "func TestIn(t *testing.T) {\n\n\tu := NewUserManager()\n\tu.add(\"bob\", \"test\")\n\tu.add(\"bob\", \"test2\")\n\tu.add(\"bill\", \"test3\")\n\n\tc := u.In(\"bob\")\n\n\tif len(c) != 2 {\n\t\tt.Error(\"bob was not in exactly 2 channels\")\n\t}\n\n\tif !(c[0] == \"test\" || c[1] == \"test\") {\n\t\tt.Error(\"test not in channel list\")\n\t}\n\tif !(c[0] == \"test2\" || c[1] == \"test2\") {\n\t\tt.Error(\"test2 not in channel list\")\n\t}\n}", "title": "" }, { "docid": "1c1e48f6538445b061b85e5a8519187d", "score": "0.4494148", "text": "func (fpaiv *PlanAssignmentRequestRequestUnassign_FieldTerminalPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_Request_Unassign) bool {\n\tslice := fpaiv.PlanAssignmentRequestRequestUnassign_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "72d0b0f1be8b27ae2858020ac4934545", "score": "0.44940034", "text": "func isChannelUsable(channel misc.Channel, guild *discordgo.Guild) (misc.Channel, bool) {\n\n\t// Checks if channel exists and if it's optin\n\tfor guildIndex := range guild.Channels {\n\t\tfor roleIndex := range guild.Roles {\n\t\t\tif guild.Roles[roleIndex].Position < misc.GuildMap[guild.ID].GuildConfig.OptInUnder.Position &&\n\t\t\t\tguild.Roles[roleIndex].Position > misc.GuildMap[guild.ID].GuildConfig.OptInAbove.Position &&\n\t\t\t\tguild.Channels[guildIndex].Name == guild.Roles[roleIndex].Name {\n\t\t\t\tchannel.Optin = true\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tchannel.Optin = false\n\t\t\t}\n\t\t}\n\t\tif guild.Channels[guildIndex].Name == channel.Name &&\n\t\t\tguild.Channels[guildIndex].ID == channel.ChannelID {\n\t\t\tchannel.Exists = true\n\t\t\tbreak\n\t\t} else {\n\t\t\tchannel.Exists = false\n\t\t}\n\t}\n\tmisc.GuildMap[guild.ID].ChannelStats[channel.ChannelID] = &channel\n\n\tif channel.Exists {\n\t\treturn channel, true\n\t}\n\treturn channel, false\n}", "title": "" }, { "docid": "14781d407bb72f7459a572eae7cf718a", "score": "0.44924888", "text": "func (fpaiv *ListResourceChangeLogsRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *ListResourceChangeLogsRequest) bool {\n\tslice := fpaiv.ListResourceChangeLogsRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "cb9936e1760a751d92cfbf89d8b07399", "score": "0.44798896", "text": "func (w *Wallet) Contains(account accounts.Account) bool {\n\tif pairing := w.Hub.pairing(w); pairing != nil {\n\t\t_, ok := pairing.Accounts[account.Address]\n\t\treturn ok\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e81a53bf50f52e37625ebaaa8e193185", "score": "0.44788492", "text": "func hasKeysInValues(set map[string]string, values []string) bool {\n\t// We only support a single value in the array\n\t// e.g. linux in (check.subscriptions)\n\tif len(values) != 1 {\n\t\treturn false\n\t}\n\tif !hasKey(set, values[0]) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0852a49f21c0c1c6e63eea1d7928a50b", "score": "0.44784823", "text": "func (o *DeviceManagementPartner) HasWhenPartnerDevicesWillBeRemovedDateTime() bool {\n\tif o != nil && o.WhenPartnerDevicesWillBeRemovedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3bcaa81ea7e3dba7327706d0d3056199", "score": "0.44730896", "text": "func (onl *OrderNotifyLog) Exists() bool { //order_notify_log\n\treturn onl._exists\n}", "title": "" }, { "docid": "327dd7989ee4e8830f89e3f94d866f1e", "score": "0.44725734", "text": "func (w *Whitelist) Contains(key string) (ok bool) {\n\tif ix := strings.Index(key, \"_\"); ix > -1 {\n\t\t_, ok = w.list[key[:ix]]\n\t}\n\treturn\n}", "title": "" }, { "docid": "0df5182cec83a62f9c301230d0909b03", "score": "0.44706336", "text": "func (c *Cache) InCache(name string, value string ) (bool) {\n if s, e := c.seenfiles[name]; e {\n for _,v := range s {\n if v == value {\n return true\n }\n }\n return false\n } else {\n return false\n }\n}", "title": "" }, { "docid": "62f5da70cbb209205385d0812ecf7eab", "score": "0.4467082", "text": "func SlackIDIn(vs ...string) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldSlackID), v...))\n\t})\n}", "title": "" }, { "docid": "57afc32a77f89fe037f13bbcdd864100", "score": "0.44661328", "text": "func IsUnderRateLimit(_db *gorm.DB, userAddress string) bool {\n\n\t// Getting current local time of machine\n\tnow := time.Now()\n\n\t// Segregating into parts required\n\tvar (\n\t\tday = now.Day()\n\t\tmonth = now.Month()\n\t\tyear = now.Year()\n\t)\n\n\tvar count int64\n\n\tif err := _db.Model(&DeliveryHistory{}).\n\t\tWhere(\"delivery_history.client = ? and extract(day from delivery_history.ts) = ? and extract(month from delivery_history.ts) = ? and extract(year from delivery_history.ts) = ?\", userAddress, day, month, year).\n\t\tCount(&count).Error; err != nil {\n\t\treturn false\n\t}\n\n\t// Compare it with allowed rate count per 24 hours, of plan user is subscribed to\n\treturn count < int64(GetAllowedDeliveryCountByAddress(_db, common.HexToAddress(userAddress)))\n}", "title": "" }, { "docid": "9d50bcea40e75eca5114c196161827c3", "score": "0.44608462", "text": "func (m FXCMNewsRequest) HasSubscriptionRequestType() bool {\n\treturn m.Has(tag.SubscriptionRequestType)\n}", "title": "" }, { "docid": "5bf9ff6f2eebd2cb711c014f451be857", "score": "0.44603243", "text": "func (g *Gui) isBlacklisted(k Key) bool {\n\tfor _, j := range g.blacklist {\n\t\tif j == k {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "59aec1325a0d9698be7794026c8343ae", "score": "0.4459641", "text": "func (fl opArgFlags) contains(x opArgFlag) bool {\n\t// Each argument is specified using 8 bits with 0x0 indicating the end of the\n\t// argument list\n\tfor ; fl&0xf != 0; fl >>= 8 {\n\t\tif opArgFlag(fl&0xf) == x {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "018a86d8943ec8ac5718fdb77b316b37", "score": "0.4457968", "text": "func (fpaiv *ListLogsRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *ListLogsRequest) bool {\n\tslice := fpaiv.ListLogsRequest_FieldTerminalPath.Get(source)\n\tfor _, v := range slice {\n\t\tif asProtoMsg, ok := fpaiv.value.(proto.Message); ok {\n\t\t\tif proto.Equal(asProtoMsg, v.(proto.Message)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if reflect.DeepEqual(v, fpaiv.value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d98129fd2f0a47d83445ef4db70293df", "score": "0.44562837", "text": "func (o *UpdateUser) HasApplicationNotificationSubscriptions() bool {\n\tif o != nil && o.ApplicationNotificationSubscriptions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c3c53bc44ab31492305899a9242fa847", "score": "0.44492358", "text": "func HasFormpaymentchannelWith(preds ...predicate.Orderonline) predicate.Paymentchannel {\n\treturn predicate.Paymentchannel(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(FormpaymentchannelInverseTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, FormpaymentchannelTable, FormpaymentchannelColumn),\n\t\t)\n\t\tsqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {\n\t\t\tfor _, p := range preds {\n\t\t\t\tp(s)\n\t\t\t}\n\t\t})\n\t})\n}", "title": "" }, { "docid": "3f2034f2364ace9b239dd33f4e682235", "score": "0.44484812", "text": "func (s IssuerKeySet) Contains(key IssuerKey) bool {\n\t_, ok := s[key]\n\treturn ok\n}", "title": "" } ]
88060e1c12cea56518d02ef557f02ebd
ReadFromDir method provides reading from dir with tile pictures Returns slice of Photo objects
[ { "docid": "c54e38ba3fd53d74394e1f947dc00fbd", "score": "0.7977989", "text": "func ReadFromDir(path string) []Photo {\n\tphotos := []Photo{}\n\tlog.Print(fmt.Sprintf(\"Try to read tile pictures from dir %s\", path))\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif path[len(path)-1] != '/' {\n\t\tpath = path + \"/\"\n\t}\n\tfor _, data := range files {\n\t\timg, _ := os.Open(path + data.Name())\n\t\tdecoded, _, _ := image.Decode(img)\n\t\tbounds := decoded.Bounds()\n\t\tphotos = append(photos,\n\t\t\tgetAverageRGBWithPicture(decoded, uint(bounds.Max.X), uint(bounds.Max.Y)))\n\t\timg.Close()\n\t}\n\treturn photos\n}", "title": "" } ]
[ { "docid": "c76c4693f262f26207b111293d180061", "score": "0.5834305", "text": "func ls_imgs(dir string) []fileinfowrapper {\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\t//log.Fatalf(\"dir: %s, err: %s\", dir, err)\n\t\tlog.Println(err)\n\t}\n\tvar fileinfos []fileinfowrapper\n\tfor _, file := range files {\n\t\tif file.IsDir() {\n\t\t\t//if the file is a directory, recursively add the directory's contents\n\t\t\tfileinfos = append(fileinfos, ls_imgs(file.Name())...)\n\t\t} else {\n\t\t\tfullpath := strings.Join([]string{dir, file.Name()}, \"/\")\n\t\t\tbuf, err := ioutil.ReadFile(fullpath)\n\t\t\tif err != nil { //something went terribly wrong with reading the file\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\tif filetype.IsImage(buf) { //only list image files, reject others\n\t\t\t\tf, err := os.Open(fullpath)\n\t\t\t\tif err != nil { //something went terribly wrong with reading the file\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t\tloc, err := time.LoadLocation(\"\") //use utc time by default\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//preload tm with a dummy date, before when we'd have many digital photos\n\t\t\t\ttm := time.Date(2000, time.January, 1, 1, 1, 1, 1, loc)\n\t\t\t\tx, err := exif.Decode(f)\n\t\t\t\tif err != nil { //if exif loads improperly (i.e. header missing)\n\t\t\t\t\t//we will keep the default date\n\t\t\t\t\tlog.Printf(\"Error in file %s: %s\\n\", fullpath, err)\n\t\t\t\t} else { //if exif loads properly, get the date\n\t\t\t\t\ttm, err = x.DateTime()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"Error in file %s: %s\\n\", fullpath, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//now we generate a hash, which might be useful for checking for\n\t\t\t\t//duplicates\n\t\t\t\t/*\n\t\t\t\t\tbuff, err := ioutil.ReadFile(fullpath)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t\thasher := sha256.New()\n\t\t\t\t\thasher.Write(buff)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t\t//put hex.EncodeToString(hasher.Sum(nil)) in struct if necessary\n\t\t\t\t*/\n\n\t\t\t\tfileinfo := fileinfowrapper{file, fullpath, \"\", tm}\n\t\t\t\tfileinfos = append(fileinfos, fileinfo)\n\t\t\t}\n\t\t}\n\t}\n\treturn fileinfos\n}", "title": "" }, { "docid": "34eb782fb465a7ce73b7a70a0765686b", "score": "0.5360244", "text": "func openReadDir(dir string, entries []File) []fs.DirEntry {\n\ti := sort.Search(len(entries), func(i int) bool {\n\t\tidir, _, _ := split(entries[i].NameInArchive)\n\t\treturn idir >= dir\n\t})\n\tj := sort.Search(len(entries), func(j int) bool {\n\t\tjdir, _, _ := split(entries[j].NameInArchive)\n\t\treturn jdir > dir\n\t})\n\tdirs := make([]fs.DirEntry, j-i)\n\tfor idx := range dirs {\n\t\tdirs[idx] = fs.FileInfoToDirEntry(entries[i+idx])\n\t}\n\treturn dirs\n}", "title": "" }, { "docid": "5d74d3240246ae817b46985437f79663", "score": "0.52884084", "text": "func parseDir(dirName string, desiredColor string) []imageInfo {\n\n\tdir, err := os.Open(dirName)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tfiles, err := dir.Readdir(-1)\n\n\timages := make([]imageInfo, 0)\n\n\t//check each file to be an image and have corect color\n\tfor _, image := range files {\n\t\timageName := image.Name()\n\t\timageExt := imageName[len(imageName)-4:]\n\t\tif imageExt == \".png\" || imageExt == \".jpg\" {\n\t\t\tfmt.Printf(\"Scanning: %s\\n\", imageName)\n\t\t\tcolor, size := parseImage(dirName + imageName)\n\n\t\t\tif desiredColor == color {\n\t\t\t\timages = append(images, imageInfo{imageName, color, size})\n\t\t\t}\n\n\t\t}\n\t}\n\n\t//use the implemented sort interface\n\tsort.Sort(ByColorValue(images))\n\n\treturn images\n}", "title": "" }, { "docid": "279ed7e65a9ea1a3edd12f86ee4ffe6d", "score": "0.5203698", "text": "func (d *docker) Read(id string, srcPaths []string) ([]*types.File, error) {\n\tfiles := []*types.File{}\n\n\tfor _, p := range srcPaths {\n\t\trc, _, err := d.cli.CopyFromContainer(d.ctx, id, p)\n\t\tif err != nil && !client.IsErrNotFound(err) {\n\t\t\treturn nil, fmt.Errorf(\"failed copying from container: %w\", err)\n\t\t}\n\n\t\t// File does not exist.\n\t\tif rc == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfs, err := tarToFiles(rc)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed extracting file %s from archive: %w\", p, err)\n\t\t}\n\n\t\tif err := rc.Close(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed closing file: %w\", err)\n\t\t}\n\n\t\tfs[0].Path = p\n\n\t\tfiles = append(files, fs[0])\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "7402806d1f4269cd74666dbd8e3d2a5a", "score": "0.5192051", "text": "func DataLoadImages(r io.Reader) ([][]byte, int, int) {\n header := [4]int32{}\n binary.Read(r, binary.BigEndian, &header)\n images := make([][]byte, header[1])\n width, height := int(header[2]), int(header[3])\n for i := 0; i < len(images); i++ {\n images[i] = make([]byte, width * height)\n r.Read(images[i])\n }\n return images, width, height\n}", "title": "" }, { "docid": "0ce830495e81d0a8869ba33ad019b982", "score": "0.51500654", "text": "func ReadDirFils(tar Dot, dirname string) Dot {\n\tmyName := \"ReadDirFils\"\n\n\tif dirs, ok := readDir(tar, myName, dirname); ok {\n\t\tfor _, info := range dirs {\n\t\t\tif !info.IsDir() {\n\t\t\t\tc := lookupDot(tar, info.Name())\n\t\t\t\tc.Tag(info)\n\t\t\t}\n\t\t}\n\t}\n\treturn tar\n}", "title": "" }, { "docid": "5ec4b47d4530871fb1293bedeb728a9c", "score": "0.51472646", "text": "func List() ([]models.Image, error) {\n\tbaseDir := getBaseDirectory()\n\tif _,err := os.Stat(baseDir); err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get base directory image\")\n\t}\n\tfiles, err := ioutil.ReadDir(baseDir)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, fmt.Sprintf(\"unable to read dir: %s\", baseDir))\n\t}\n\timages := []models.Image{}\n\tfor _, f := range files {\n\t\tif f.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tif !strings.HasSuffix(f.Name(), \".json\") {\n\t\t\tcontinue\n\t\t}\n\t\timg, err := prepareImage(path.Join(baseDir, f.Name()))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to get prepared image\")\n\t\t}\n\t\timg.Path = f.Name()\n\t\timages = append(images, img)\n\n\t}\n\treturn images, nil\n}", "title": "" }, { "docid": "a09b792905f1634fd5986fd008ab0ddc", "score": "0.51436806", "text": "func (d SubDir) ReadDir(intr fs.Intr) ([]fuse.Dirent, fuse.Error) {\n\t// List of directory entries to return\n\tdirectories := make([]fuse.Dirent, 0)\n\n\t// If at root of filesystem, fetch indexes\n\tif d.Root {\n\t\t// If empty, wait for indexes to be available\n\t\tif len(indexCache) == 0 {\n\t\t\t<-indexChan\n\t\t}\n\n\t\t// Get index from cache\n\t\tindex := indexCache\n\n\t\t// Iterate indices\n\t\tfor _, i := range index {\n\t\t\t// Iterate all artists\n\t\t\tfor _, a := range i.Artist {\n\t\t\t\t// Map artist's name to directory\n\t\t\t\tnameToDir[a.Name] = SubDir{\n\t\t\t\t\tID: a.ID,\n\t\t\t\t\tRoot: false,\n\t\t\t\t}\n\n\t\t\t\t// Create a directory entry\n\t\t\t\tdir := fuse.Dirent{\n\t\t\t\t\tName: a.Name,\n\t\t\t\t\tType: fuse.DT_Dir,\n\t\t\t\t}\n\n\t\t\t\t// Append entry\n\t\t\t\tdirectories = append(directories, dir)\n\t\t\t}\n\t\t}\n\n\t\treturn directories, nil\n\t}\n\n\t// Not at filesystem root, so get this directory's contents\n\tcontent, err := subsonic.GetMusicDirectory(d.ID)\n\tif err != nil {\n\t\tlog.Printf(\"subfs: failed to retrieve directory %d: %s\", d.ID, err.Error())\n\t\treturn nil, fuse.ENOENT\n\t}\n\n\t// Check for unique, available cover art IDs\n\tcoverArt := set.New()\n\n\t// List of bad characters which should be replaced in filenames\n\tbadChars := []string{\"/\", \"\\\\\"}\n\n\t// Iterate all returned directories\n\tfor _, dir := range content.Directories {\n\t\t// Check for any characters which may cause trouble with filesystem display\n\t\tfor _, b := range badChars {\n\t\t\tdir.Title = strings.Replace(dir.Title, b, \"_\", -1)\n\t\t}\n\n\t\t// Create a directory entry\n\t\tentry := fuse.Dirent{\n\t\t\tName: dir.Title,\n\t\t\tType: fuse.DT_Dir,\n\t\t}\n\n\t\t// Add SubDir directory to lookup map\n\t\tnameToDir[dir.Title] = SubDir{\n\t\t\tID: dir.ID,\n\t\t\tRoot: false,\n\t\t}\n\n\t\t// Check for cover art\n\t\tcoverArt.Add(dir.CoverArt)\n\n\t\t// Append to list\n\t\tdirectories = append(directories, entry)\n\t}\n\n\t// Iterate all returned audio\n\tfor _, a := range content.Audio {\n\n\t\t// Check for lossless and lossy transcode\n\t\ttranscodes := []struct {\n\t\t\tsuffix string\n\t\t\tsize int64\n\t\t}{\n\t\t\t{a.Suffix, a.Size},\n\t\t\t{a.TranscodedSuffix, 0},\n\t\t}\n\n\t\tfor _, t := range transcodes {\n\t\t\t// If suffix is empty (source is lossy), skip this file\n\t\t\tif t.suffix == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Mark file as lossless by default\n\t\t\tlossless := true\n\n\t\t\t// If size is empty (transcode to lossy), estimate it and mark as lossy\n\t\t\tif t.size == 0 {\n\t\t\t\tlossless = false\n\n\t\t\t\t// Since we have no idea what Subsonic's transcoding settings are, we will estimate\n\t\t\t\t// using MP3 CBR 320 as our benchmark, being that it will likely over-estimate\n\t\t\t\t// Thanks: http://www.jeffreysward.com/editorials/mp3size.htm\n\t\t\t\tt.size = ((a.DurationRaw * 320) / 8) * 1024\n\t\t\t}\n\n\t\t\t// Predefined audio filename format\n\t\t\taudioFormat := fmt.Sprintf(\"%02d - %s - %s.%s\", a.Track, a.Artist, a.Title, t.suffix)\n\n\t\t\t// Check for any characters which may cause trouble with filesystem display\n\t\t\tfor _, b := range badChars {\n\t\t\t\taudioFormat = strings.Replace(audioFormat, b, \"_\", -1)\n\t\t\t}\n\n\t\t\t// Create a directory entry\n\t\t\tdir := fuse.Dirent{\n\t\t\t\tName: audioFormat,\n\t\t\t\tType: fuse.DT_File,\n\t\t\t}\n\n\t\t\t// Add SubFile file to lookup map\n\t\t\tnameToFile[dir.Name] = SubFile{\n\t\t\t\tID: a.ID,\n\t\t\t\tCreated: a.Created,\n\t\t\t\tFileName: audioFormat,\n\t\t\t\tIsVideo: false,\n\t\t\t\tLossless: lossless,\n\t\t\t\tSize: t.size,\n\t\t\t}\n\n\t\t\t// Check for cover art\n\t\t\tcoverArt.Add(a.CoverArt)\n\n\t\t\t// Append to list\n\t\t\tdirectories = append(directories, dir)\n\t\t}\n\t}\n\n\t// Iterate all returned video\n\tfor _, v := range content.Video {\n\t\t// Predefined video filename format\n\t\tvideoFormat := fmt.Sprintf(\"%s.%s\", v.Title, v.Suffix)\n\n\t\t// Check for any characters which may cause trouble with filesystem display\n\t\tfor _, b := range badChars {\n\t\t\tvideoFormat = strings.Replace(videoFormat, b, \"_\", -1)\n\t\t}\n\n\t\t// Create a directory entry\n\t\tdir := fuse.Dirent{\n\t\t\tName: videoFormat,\n\t\t\tType: fuse.DT_File,\n\t\t}\n\n\t\t// Add SubFile file to lookup map\n\t\tnameToFile[dir.Name] = SubFile{\n\t\t\tID: v.ID,\n\t\t\tCreated: v.Created,\n\t\t\tFileName: videoFormat,\n\t\t\tSize: v.Size,\n\t\t\tIsVideo: true,\n\t\t}\n\n\t\t// Check for cover art\n\t\tcoverArt.Add(v.CoverArt)\n\n\t\t// Append to list\n\t\tdirectories = append(directories, dir)\n\t}\n\n\t// Iterate all cover art\n\tfor _, e := range coverArt.Enumerate() {\n\t\t// Type-hint to int64\n\t\tc := e.(int64)\n\t\tcoverArtFormat := fmt.Sprintf(\"%d.jpg\", c)\n\n\t\t// Create a directory entry\n\t\tdir := fuse.Dirent{\n\t\t\tName: coverArtFormat,\n\t\t\tType: fuse.DT_File,\n\t\t}\n\n\t\t// Add SubFile file to lookup map\n\t\tnameToFile[dir.Name] = SubFile{\n\t\t\tID: c,\n\t\t\tFileName: coverArtFormat,\n\t\t\tIsArt: true,\n\t\t}\n\n\t\t// Append to list\n\t\tdirectories = append(directories, dir)\n\t}\n\n\t// Return all directory entries\n\treturn directories, nil\n}", "title": "" }, { "docid": "9a9788f1a6b60d733636b64696e8951d", "score": "0.5131553", "text": "func (th *ThrottledListDir) ReadDir(dirname string) ([]os.FileInfo, error) {\n\tdefer th.mtx.Unlock()\n\tvar count int32\n\tfor {\n\t\tth.mtx.Lock()\n\t\tcount = atomic.LoadInt32(&th.count)\n\t\tif count < MAXCALLS {\n\t\t\tatomic.AddInt32(&th.count, 1)\n\t\t\tfiles, err := ioutil.ReadDir(dirname)\n\t\t\tatomic.AddInt32(&th.count, -1)\n\t\t\treturn files, err\n\t\t}\n\t\tth.mtx.Unlock()\n\t\ttime.Sleep(10 * time.Microsecond)\n\t}\n}", "title": "" }, { "docid": "04fb15971b006d0f4ac5b263970b899d", "score": "0.51168054", "text": "func (st *TLphotos_photosSlice) ReadFrom(_is *codec.Reader) error {\n\tvar err error\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\tst.ResetDefault()\n\n\terr = st.Data.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = err\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "title": "" }, { "docid": "7c6caa121478c843017b1b06bca6c0ef", "score": "0.5110878", "text": "func (dir *SpaceDirectory) ReadDir(ctx context.Context) ([]DirEntryOps, error) {\n\tchildrenEntries, err := dir.fs.store.GetChildren(ctx, dir.entry.Path())\n\tif err != nil {\n\t\treturn nil, syscall.ENOENT\n\t}\n\n\tvar result []DirEntryOps\n\tfor _, entry := range childrenEntries {\n\t\tif entry.IsDir() {\n\t\t\tresult = append(result, &SpaceDirectory{\n\t\t\t\tfs: dir.fs,\n\t\t\t\tentry: entry,\n\t\t\t})\n\t\t} else {\n\t\t\tresult = append(result, &SpaceFile{\n\t\t\t\tfs: dir.fs,\n\t\t\t\tentry: entry,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "6b6aa128e68dea5a9ee4a0c80622e077", "score": "0.50937027", "text": "func (l *Local) Read(path string, thumbs map[string][2]int) map[string]string {\n\tdata := make(map[string]string)\n\tdata[\"original\"] = path\n\n\tfor size := range thumbs {\n\t\tdata[size] = util.GetThumbLocation(path, size)\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "29ce58d31e759dcaf2244330e447485c", "score": "0.50877", "text": "func (fs *RedisFS) ReadDir(path string) ([]os.FileInfo, error) {\n\tif err := fs.ValidatePath(path); err != nil {\n\t\treturn nil, &os.PathError{Op: \"readdir\", Path: path, Err: err}\n\t}\n\tpath, err := filepath.Abs(path)\n\tCheck(err)\n\t_, fi, err := fs.fileInfo(path)\n\tif err != nil {\n\t\treturn nil, &os.PathError{Op: \"readdir\", Path: path, Err: err}\n\t}\n\tif fi == nil || !fi.IsDir() {\n\t\treturn nil, &os.PathError{Op: \"readdir\", Path: path, Err: ErrNotDirectory}\n\t}\n\n\tfis, err := fi.getChildren()\n\tif err != nil {\n\t\treturn nil, &os.PathError{Op: \"readdir\", Path: path, Err: err}\n\t}\n\tf := make([]os.FileInfo, len(fis))\n\tfor i := 0; i < len(fis); i++ {\n\t\tf[i] = fis[i]\n\t}\n\tsort.Sort(byName(f))\n\treturn f, nil\n}", "title": "" }, { "docid": "22643a8716d11fd4b351205a5e77d2ee", "score": "0.5036496", "text": "func (pb *PictureBook) GatherPictures(ctx context.Context, paths []string) ([]*picture.PictureBookPicture, error) {\n\n\tpictures := make([]*picture.PictureBookPicture, 0)\n\n\tvar list func(context.Context, *blob.Bucket, string) error\n\n\tlist = func(ctx context.Context, bucket *blob.Bucket, prefix string) error {\n\n\t\titer := bucket.List(&blob.ListOptions{\n\t\t\tDelimiter: \"/\",\n\t\t\tPrefix: prefix,\n\t\t})\n\n\t\tfor {\n\t\t\tobj, err := iter.Next(ctx)\n\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to iterate next in bucket for %s, %w\", prefix, err)\n\t\t\t}\n\n\t\t\tpath := obj.Key\n\n\t\t\tif obj.IsDir {\n\n\t\t\t\terr := list(ctx, bucket, path)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Failed to list bucket for %s, %w\", path, err)\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpic, err := pb.ProcessFunc(ctx, path)\n\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to apply ProcessFunc for %s, %w\", path, err)\n\t\t\t}\n\n\t\t\tif pic == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif pic.TempFile != \"\" {\n\t\t\t\tpb.tmpfiles = append(pb.tmpfiles, pic.TempFile)\n\t\t\t}\n\n\t\t\tpb.Mutex.Lock()\n\n\t\t\tpictures = append(pictures, pic)\n\t\t\tcount_pictures := len(pictures)\n\n\t\t\tpb.Mutex.Unlock()\n\n\t\t\tif pb.Options.MaxPages > 0 && count_pictures >= pb.Options.MaxPages {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tfor _, path := range paths {\n\n\t\terr := list(ctx, pb.Options.Source, path)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Failed to list bucket for %s, %w\", path, err)\n\t\t}\n\t}\n\n\tif pb.Options.Verbose {\n\t\tlog.Printf(\"Gathered %d pictures\\n\", len(pictures))\n\t}\n\n\treturn pictures, nil\n}", "title": "" }, { "docid": "5166fdbe2e7bc1c13dee18538ec182f7", "score": "0.50139546", "text": "func (r *Reader) Read(tileIndexes ...int) ([]image.Image, error) {\n\tif r.Metadata.BitsPerSample != 8 {\n\t\treturn nil, fmt.Errorf(\"only support 8 bit format images, got %d\", r.Metadata.BitsPerSample)\n\t}\n\n\t// TODO: handle other image types\n\t// return image based on type e.g. gray\n\tswitch r.Metadata.PhotometricInterpretation {\n\tcase pBlackIsZero:\n\t\treturn r.decodeGrays(tileIndexes)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"photometric interpretation value %d not supported\", r.Metadata.PhotometricInterpretation)\n\t}\n}", "title": "" }, { "docid": "38858702fe579b773ec878c2d48732f9", "score": "0.50069493", "text": "func ListImages(dir string) ([]os.FileInfo, error) {\n\tvar result lecio.Files\n\tfiles, err := ioutil.ReadDir(dir)\n\n\t// Failed to read directory\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\tfor _, file := range files {\n\t\text := strings.ToLower(filepath.Ext(file.Name()))\n\t\tif isImage(ext) {\n\t\t\tresult = append(result, file)\n\t\t}\n\t}\n\n\tsort.Sort(result)\n\treturn result, nil\n}", "title": "" }, { "docid": "4a16e3fe14220c2511ef647381512196", "score": "0.49622607", "text": "func findScreenshots() []string {\n screenshots := make([]string, 0, 8)\n // get all files from current directory\n files, err := ioutil.ReadDir(\"./\")\n if err != nil {\n fmt.Printf(\"failed to read current directory - error: %v\", err)\n return screenshots\n }\n\n // filter Hearthstone*.png files\n for _, file := range files {\n if ! file.IsDir() &&\n len(file.Name()) > 15 &&\n file.Name()[:11] == \"Hearthstone\" &&\n file.Name()[len(file.Name()) - 4:] == \".png\" {\n screenshots = append(screenshots, file.Name())\n }\n }\n \n return screenshots\n}", "title": "" }, { "docid": "25bdd4bae39e485fdf62cccdbb9e01e8", "score": "0.4944012", "text": "func load(dir string, imgs []string) (Set, error) {\n\t// Load annotations.\n\timgset := make(map[string][]Object, len(imgs))\n\tfor _, img := range imgs {\n\t\tobjs, err := Objects(dir, img)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\timgset[img] = objs\n\t}\n\treturn imgset, nil\n}", "title": "" }, { "docid": "9426fbd53154f10c6e9a4f4417a7e945", "score": "0.49261943", "text": "func ioReadDir(root string) ([]string, error) {\n\tvar files []string\n\tfileInfo, err := ioutil.ReadDir(root)\n\tif err != nil {\n\t\treturn files, err\n\t}\n\n\tfor _, file := range fileInfo {\n\t\tfiles = append(files, fmt.Sprintf(\"%s/%s\", root, file.Name()))\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "96e57ddc790fe92f9191db066ef1aa2d", "score": "0.49246556", "text": "func (f *file) ReadDir(n int) ([]fs.DirEntry, error) {\n\tfiles, err := f.parent.client.ReadDir(f.name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := make([]fs.DirEntry, 0, len(files))\n\tfor _, info := range files {\n\t\tres = append(res, infoDelegate{info})\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "3391ab99a3141cb4cd082750af6859ff", "score": "0.49244627", "text": "func DoReadDirFils(src, tar Dot) Dot {\n\tdirname := src.String()\n\tReadDirFils(tar, dirname)\n\treturn src\n}", "title": "" }, { "docid": "aa2b34895957446c2b1c7aeb42791077", "score": "0.49234766", "text": "func readDir(dirPath string) (entries []string, err error) {\n\treturn readDirWithOpts(dirPath, readDirOpts{count: -1})\n}", "title": "" }, { "docid": "00bf2ebc76b8972383896932641e3a48", "score": "0.49085125", "text": "func (st *TLphotos_photos) ReadFrom(_is *codec.Reader) error {\n\tvar err error\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\tst.ResetDefault()\n\n\terr = st.Data.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = err\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "title": "" }, { "docid": "37735df159bfd4309b9a2a12a403f8c5", "score": "0.48989558", "text": "func (ops *FileOps) ReadDir(dir string) ([]os.FileInfo, error) {\n\treturn ioutil.ReadDir(dir)\n}", "title": "" }, { "docid": "7844a1ce947bdaf0dff7a03242875efa", "score": "0.48838016", "text": "func ReadDir(dirname string) ([]os.FileInfo, error) {\n\tf, err := os.Open(dirname) // 打开文件目录\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist, err := f.Readdir(-1)\n\tf.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Slice(list, func(i, j int) bool { return list[i].Name() < list[j].Name() }) // 根据文件名排序\n\treturn list, nil\n}", "title": "" }, { "docid": "b2b078204d74702660f2aa14a813613a", "score": "0.48762992", "text": "func setupTestReadDirGeneric(t *testing.T) (testResults []result) {\n\tdir := mustSetupDir(t)\n\tif err := os.MkdirAll(filepath.Join(dir, \"mydir\"), 0777); err != nil {\n\t\tt.Fatalf(\"Unable to create prefix directory \\\"mydir\\\", %s\", err)\n\t}\n\tentries := []string{\"mydir/\"}\n\tfor i := 0; i < 10; i++ {\n\t\tname := fmt.Sprintf(\"file-%d\", i)\n\t\tif err := ioutil.WriteFile(filepath.Join(dir, \"mydir\", name), []byte{}, os.ModePerm); err != nil {\n\t\t\t// For cleanup, its required to add these entries into test results.\n\t\t\ttestResults = append(testResults, result{dir, entries})\n\t\t\tt.Fatalf(\"Unable to write file, %s\", err)\n\t\t}\n\t}\n\t// Keep entries sorted for easier comparison.\n\tsort.Strings(entries)\n\n\t// Add entries slice for this test directory.\n\ttestResults = append(testResults, result{dir, entries})\n\treturn testResults\n}", "title": "" }, { "docid": "03352933bed1fdbc7e0ddff0a40510f0", "score": "0.48759207", "text": "func (s *Store) GetImage(id string) (io.Reader, error) {\n\t// We're only going to be reading from the disk - lock for reading.\n\ts.mutex.RLock()\n\n\t// Unlock once we're done.\n\tdefer s.mutex.RUnlock()\n\n\t// Open the file as read-only.\n\tf, err := os.OpenFile(path.Join(s.path, \"index.json\"), os.O_RDONLY, 0)\n\n\t// If the file doesn't exist then we can exit early (as we don't have any images).\n\tif os.IsNotExist(err) {\n\t\treturn nil, moodboard.ErrNoSuchItem\n\t} else if err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open store: %w\", err)\n\t}\n\n\tvar items []string\n\n\t// Read the current item list.\n\tif err = json.NewDecoder(f).Decode(&items); err != nil {\n\t\t_ = f.Close()\n\n\t\t// If it's an EOF error then we can ignore the error and exit early (as the file is empty).\n\t\tif err == io.EOF {\n\t\t\treturn nil, moodboard.ErrNoSuchItem\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"failed to read store: %w\", err)\n\t}\n\n\t// We can ignore close errors here as we haven't written to the file.\n\t_ = f.Close()\n\n\tvar exists bool\n\n\tfor _, item := range items {\n\t\tif item == id {\n\t\t\texists = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !exists {\n\t\treturn nil, moodboard.ErrNoSuchItem\n\t}\n\n\tf, err = os.OpenFile(path.Join(s.path, id), os.O_RDONLY, 0)\n\n\tif os.IsNotExist(err) {\n\t\treturn nil, moodboard.ErrNoSuchItem\n\t} else if err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open image: %w\", err)\n\t}\n\n\treturn f, nil\n}", "title": "" }, { "docid": "edfacdd002b26c5c02b37c1c4a90ad9f", "score": "0.48618078", "text": "func ReadDirByTime(path string) ([]os.FileInfo, error) {\n\tlist, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Sort(fileInfo(list))\n\treturn list, err\n}", "title": "" }, { "docid": "8e8c60765931cc616f42e7e6f4cb6934", "score": "0.48603544", "text": "func (ts *Templates) readDir(path string) (names []string, err error) {\n\tvar f fauxfile.File\n\tif f, err = ts.fs.Open(path); err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\tnames, err = f.Readdirnames(-1)\n\treturn\n}", "title": "" }, { "docid": "5ee60ac7041e71e37f3a96ab3c9a9581", "score": "0.4841292", "text": "func readDir(fd int) (records []Record, err error) {\n\tbuf := make([]byte, direntBlockSize)\n\tpos, size, offset := 0, 0, uint64(1)\n\n\tfor {\n\t\tif pos >= size {\n\t\t\tpos = 0\n\t\t\tif size, err = unix.ReadDirent(fd, buf); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif size <= 0 {\n\t\t\t\tbreak // EOF\n\t\t\t}\n\t\t}\n\n\t\trec, consumed, off := parse(buf[pos:size], offset)\n\t\toffset = off\n\t\tpos += consumed\n\t\trecords = append(records, rec...)\n\t}\n\n\treturn records, err\n}", "title": "" }, { "docid": "ffe03aa6fd128e958c5235bd02dbc934", "score": "0.48411053", "text": "func Find(dir string) []Container {\n\n var names []string\n var containers []Container\n\n names, _ = filepath.Glob(dir + \"/*\")\n for _, name := range names {\n fi, _ := os.Stat(name)\n\n if fi.IsDir() {\n containers = append(containers, Load(name))\n }\n }\n return containers\n}", "title": "" }, { "docid": "5f9d0788eaa8aa1b33d5ad7383170b6a", "score": "0.4841008", "text": "func ReadImageFile(name string) (rows, cols int, imgs []RawImage, err error) {\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn 0, 0, nil, err\n\t}\n\tdefer f.Close()\n\tz, err := gzip.NewReader(f)\n\tif err != nil {\n\t\treturn 0, 0, nil, err\n\t}\n\treturn readImageFile(z)\n}", "title": "" }, { "docid": "2f373ce263f8d100ef2a1c7ee0ec0ff4", "score": "0.48307815", "text": "func readDir(fs http.FileSystem, name string) ([]os.FileInfo, error) {\n\tf, err := fs.Open(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\treturn f.Readdir(0)\n}", "title": "" }, { "docid": "be8d15921336583fad0108b4b487b7df", "score": "0.4824975", "text": "func ReadDir(tar Dot, dirname string) Dot {\n\tmyName := \"ReadDir\"\n\n\tif dirs, ok := readDir(tar, myName, dirname); ok {\n\t\tfor _, info := range dirs {\n\t\t\tc := lookupDot(tar, info.Name())\n\t\t\tc.Tag(info)\n\t\t}\n\t}\n\treturn tar\n}", "title": "" }, { "docid": "8db977592c71e7a028ca9a2663008d35", "score": "0.4822984", "text": "func (p *Provider) ReadDir(path string) ([]os.FileInfo, error) {\n\tc, err := p.p.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlisting, err := c.sftpConn.ReadDir(path)\n\tif err != nil {\n\t\t// Test the underlying ssh connection to see if it's still okay.\n\t\t_, _, sshErr := c.sshConn.SendRequest(\"ping\", true, nil)\n\t\tif sshErr != nil {\n\t\t\tc.Close()\n\t\t} else {\n\t\t\tp.p.Put(c)\n\t\t}\n\t\treturn nil, err\n\t}\n\tp.p.Put(c)\n\treturn listing, nil\n}", "title": "" }, { "docid": "b4f59c9a84b34188931ba8bfb40d2afa", "score": "0.4815942", "text": "func readDir(path string, fn func(f fs.DirEntry)) error {\n\tfiles, err := os.ReadDir(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, file := range files {\n\t\tfn(file)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "52858283822c7e6307b33534d085afbc", "score": "0.4808035", "text": "func findAndLoadImageFromCurrentDirectory() {\r\n\r\n\tvar waitGroup sync.WaitGroup\r\n\t// Getting working directory\r\n\tthisDir, dirErr := os.Getwd()\r\n\tif dirErr != nil {\r\n\t\tfmt.Println(\"Failed to get current directory\")\r\n\t\treturn\r\n\t}\r\n\tfiles, readDirErr := ioutil.ReadDir(thisDir)\r\n\tif readDirErr != nil {\r\n\t\tfmt.Println(\"failed to read current directory\")\r\n\t\treturn\r\n\t}\r\n\r\n\tif len(files) > 0 {\r\n\t\timg := getImage(files[0], thisDir)\r\n\t\tif img != nil {\r\n\t\t\tcolor.Yellow(\"First image has been loaded\")\r\n\t\t\tImages = append(Images, img)\r\n\t\t\tFiles = append(Files, files[0])\r\n\t\t}\r\n\t}\r\n\r\n\t// Loading files excpet first via goroutine\r\n\t// so we don't have to wait for every image\r\n\t// to be loaded to show up first image\r\n\twaitGroup.Add(1)\r\n\tgo func() {\r\n\t\tfor i, file := range files {\r\n\t\t\tif i == 0 {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\timg := getImage(file, thisDir)\r\n\t\t\tif img != nil {\r\n\t\t\t\tImages = append(Images, img)\r\n\t\t\t\tFiles = append(Files, file)\r\n\t\t\t}\r\n\t\t}\r\n\t\twaitGroup.Done()\r\n\t}()\r\n\twaitGroup.Wait()\r\n}", "title": "" }, { "docid": "ec6a8e5f92d6d8008cd0e46fb80f1820", "score": "0.4804357", "text": "func readDirectory(mdmp *Minidump, buf *minidumpBuf) {\n\tbuf.off = int(mdmp.streamOff)\n\n\tmdmp.Streams = make([]Stream, mdmp.streamNum)\n\tfor i := range mdmp.Streams {\n\t\tbuf.ctx = fmt.Sprintf(\"reading stream directory entry %d\", i)\n\t\tstream := &mdmp.Streams[i]\n\t\tstream.Type = StreamType(buf.u32())\n\t\tstream.Offset, stream.RawData = readLocationDescriptor(buf)\n\t\tif buf.err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6f984c4aab12e1747b800bc9ea83ffde", "score": "0.4800091", "text": "func (i *Item) ReadDir(n int) (entries []fs.DirEntry, err error) {\n\tinfos := parser.ListDir(i.ntfsCtx, i.entry)\n\n\tfor _, info := range infos {\n\t\tif info.Name == \"\" || info.Name == \".\" || strings.Contains(info.Name, \":\") {\n\t\t\tcontinue\n\t\t}\n\t\tentries = append(entries, &DirEntry{info})\n\t}\n\n\t// directory already exhausted\n\tif n <= 0 && i.dirOffset >= len(entries) {\n\t\treturn nil, nil\n\t}\n\n\t// read till end\n\tif n > 0 && i.dirOffset+n > len(entries) {\n\t\terr = io.EOF\n\t}\n\n\tif n > 0 && i.dirOffset+n <= len(entries) {\n\t\tentries = entries[i.dirOffset : i.dirOffset+n]\n\t\ti.dirOffset += n\n\t} else {\n\t\tentries = entries[i.dirOffset:]\n\t\ti.dirOffset += len(entries)\n\t}\n\n\treturn entries, err\n}", "title": "" }, { "docid": "6720733b45385eec7df666aa29cb269e", "score": "0.47872922", "text": "func setupTestReadDirFiles(t *testing.T) (testResults []result) {\n\tdir := mustSetupDir(t)\n\tentries := []string{}\n\tfor i := 0; i < 10; i++ {\n\t\tname := fmt.Sprintf(\"file-%d\", i)\n\t\tif err := ioutil.WriteFile(filepath.Join(dir, name), []byte{}, os.ModePerm); err != nil {\n\t\t\t// For cleanup, its required to add these entries into test results.\n\t\t\ttestResults = append(testResults, result{dir, entries})\n\t\t\tt.Fatalf(\"Unable to create file, %s\", err)\n\t\t}\n\t\tentries = append(entries, name)\n\t}\n\n\t// Keep entries sorted for easier comparison.\n\tsort.Strings(entries)\n\n\t// Add entries slice for this test directory.\n\ttestResults = append(testResults, result{dir, entries})\n\treturn testResults\n}", "title": "" }, { "docid": "ed5965be298922251d8f4316c9ab8df4", "score": "0.4775594", "text": "func getFiles(path string, extensions []string) []File {\n\tvar returnFiles []File\n\n\tfiles, _ := ioutil.ReadDir(path)\n\tfor _, file := range files {\n\n\t\tfileExt := filepath.Ext(path + \"/\" + file.Name())\n\n\t\tfor _, extension := range extensions {\n\t\t\tif fileExt == extension {\n\t\t\t\t//TODO: change this to add to slice, add from slice to folder in a different func\n\t\t\t\t//TODO: add file to folder\n\t\t\t\t//data, err := ioutil.ReadFile(path + \"/\" + file.Name())\n\t\t\t\t//if err != nil {\n\t\t\t\t//\tfmt.Println(err)\n\t\t\t\t//\tbreak\n\t\t\t\t//}\n\t\t\t\t//\n\t\t\t\t//err = ioutil.WriteFile(folderPath + \"/\" + file.Name(), data, 0777)\n\t\t\t\t//\n\t\t\t\t//if err != nil {\n\t\t\t\t//\tfmt.Println(err)\n\t\t\t\t//\tbreak\n\t\t\t\t//}\n\t\t\t\t//break\n\n\t\t\t\tvar st syscall.Stat_t\n\t\t\t\tif err := syscall.Stat(path+\"/\"+file.Name(), &st); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\n\t\t\t\tfileObject := File{\n\t\t\t\t\tInfo: file,\n\t\t\t\t\tPath: path + \"/\" + file.Name(),\n\t\t\t\t\tcTime: st.Ctimespec.Sec,\n\t\t\t\t}\n\t\t\t\treturnFiles = append(returnFiles, fileObject)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t//if fileExt == \".jpg\" {\n\t\t//\tfmt.Printf(\"Name: %v, size: %v kb, Mode: %v, isDir: %v\\n\",\n\t\t//\t\tfile.Name(),\n\t\t//\t\tfile.Size()/1000,\n\t\t//\t\tfile.Mode(),\n\t\t//\t\tfile.IsDir())\n\t\t//}\n\n\t\tif file.IsDir() {\n\t\t\treturnFiles = append(returnFiles, getFiles(path+\"/\"+file.Name(), extensions)...)\n\t\t}\n\t}\n\n\treturn returnFiles\n}", "title": "" }, { "docid": "e5d88a55507812483227f57fdc826cfb", "score": "0.47721314", "text": "func filteredReadDir(path string) []dirDisplay {\n\t// Where a .md and an accompanying .md.html exist\n\t// suppress the .md.html output\n\tvar retList []dirDisplay\n\tdlist, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn nil\n\t}\n\t// remember you can't futz with a map whilst iterating it\n\tdmap := make(map[string]bool) // key on file name, value immaterial\n\tvar mds []string\n\tvar ads []string\n\tfor _, file := range dlist {\n\t\tfname := file.Name()\n\t\tdmap[fname] = true\n\t\tif strings.HasSuffix(fname, \".md\") {\n\t\t\tmds = append(mds, fname)\n\t\t}\n\t\tif strings.HasSuffix(fname, \".ad\") {\n\t\t\tads = append(mds, fname)\n\t\t}\n\t}\n\t// remove the entries for .md.html files where there is a .md source\n\tfor _, md := range mds {\n\t\tdelete(dmap, md+\".html\") // deleting non-existent key is OK\n\t}\n\tfor _, ad := range ads {\n\t\tdelete(dmap, ad+\".html\") // deleting non-existent key is OK\n\t}\n\tfor _, file := range dlist {\n\t\tif _, ok := dmap[file.Name()]; ok {\n\t\t\tvar display dirDisplay\n\t\t\tdisplay.DisplayName = file.Name()\n\t\t\tdisplay.Size = fmt.Sprintf(\"%d\", file.Size())\n\t\t\tdisplay.Modified = tfmt(file.ModTime())\n\t\t\tdisplay.Accessed = accessTime(file)\n\t\t\tif file.IsDir() {\n\t\t\t\tdisplay.Anchor = file.Name() + \"/\" // tell browser to prepend relative URL\n\t\t\t} else {\n\t\t\t\tdisplay.Anchor = file.Name()\n\t\t\t}\n\t\t\tretList = append(retList, display)\n\t\t}\n\t}\n\treturn retList\n}", "title": "" }, { "docid": "cc622c81f50ae1b945542b4e2cafce5b", "score": "0.4770052", "text": "func ReadImages(cfg config.AntidoteConfig) ([]*models.Image, error) {\n\n\t// Get image definitions\n\tfileList := []string{}\n\timageDir := fmt.Sprintf(\"%s/images\", cfg.CurriculumDir)\n\tlog.Debugf(\"Searching %s for image definitions\", imageDir)\n\terr := filepath.Walk(imageDir, func(path string, f os.FileInfo, err error) error {\n\t\timageLoc := fmt.Sprintf(\"%s/image.meta.yaml\", path)\n\t\tif _, err := os.Stat(imageLoc); err == nil {\n\t\t\tlog.Debugf(\"Found image definition at: %s\", imageLoc)\n\t\t\tfileList = append(fileList, imageLoc)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\timages := []*models.Image{}\n\n\tfor f := range fileList {\n\n\t\tfile := fileList[f]\n\n\t\tlog.Infof(\"Importing image definition at: %s\", file)\n\n\t\tyamlDef, err := ioutil.ReadFile(file)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Encountered problem %s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar image models.Image\n\t\terr = yaml.Unmarshal([]byte(yamlDef), &image)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to import %s: %s\", file, err)\n\t\t}\n\n\t\tif image.NetworkInterfaces == nil {\n\t\t\timage.NetworkInterfaces = []string{}\n\t\t}\n\n\t\terr = validateImage(&image)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Image '%s' failed to validate\", image.Slug)\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Infof(\"Successfully imported image '%s'\", image.Slug)\n\n\t\timages = append(images, &image)\n\t}\n\n\tif len(fileList) == len(images) {\n\t\tlog.Infof(\"Imported %d image definitions.\", len(images))\n\t\treturn images, nil\n\t}\n\n\tlog.Warnf(\"Imported %d image definitions with errors.\", len(images))\n\treturn images, errors.New(\"Not all image definitions were imported\")\n}", "title": "" }, { "docid": "dfadec55b470293c3e429b28c5384faa", "score": "0.476188", "text": "func getTiles(p *Parameters, i *image.RGBA64) []Tile {\r\n\ttiles := []Tile{}\r\n\tfor y := 0; y < p.ImageHeight; y += p.TileHeight {\r\n\t\tfor x := 0; x < p.ImageWidth; x += p.TileWidth {\r\n\t\t\twidth := math.Min(float64(p.TileWidth), float64(p.ImageWidth-x))\r\n\t\t\theight := math.Min(float64(p.TileHeight), float64(p.ImageHeight-y))\r\n\t\t\ttiles = append(tiles, Tile{\r\n\t\t\t\tOrigin: geometry.Point{\r\n\t\t\t\t\tX: float64(x),\r\n\t\t\t\t\tY: float64(y),\r\n\t\t\t\t},\r\n\t\t\t\tSpan: geometry.Vector{\r\n\t\t\t\t\tX: width,\r\n\t\t\t\t\tY: height,\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\treturn tiles\r\n}", "title": "" }, { "docid": "de48e9516f7ee95587ce57b2a62477cf", "score": "0.4759836", "text": "func recoverImages(fileData []byte) ([][]byte, error) {\n\tvar images [][]byte\n\tvar imageData []byte // slice for our eventual recovered image data\n\n\tstartOffset := 0\n\twriting := false\n\tnestedSOI := 0\n\n\tfor i := 0; i < len(fileData); i++ {\n\t\tif writing {\n\t\t\timageData = append(imageData, fileData[i])\n\t\t}\n\n\t\tif fileData[i] == byte(JFIF_STARTMARK) {\n\t\t\tswitch fileData[i+1] {\n\t\t\tcase byte(JFIF_SOI):\n\t\t\t\tif writing {\n\t\t\t\t\t// already writing, so we must be seeing the start of a nested jpg\n\t\t\t\t\tnestedSOI++\n\t\t\t\t} else {\n\t\t\t\t\twriting = true\n\t\t\t\t\timageData = append(imageData, fileData[i])\n\t\t\t\t\tlog.Printf(\"Found JPG starting at offset %d\", i)\n\t\t\t\t\tstartOffset = i\n\t\t\t\t}\n\t\t\tcase byte(JFIF_EOI):\n\t\t\t\tif nestedSOI == 0 {\n\t\t\t\t\t// End of a non nested image\n\t\t\t\t\timageData = append(imageData, fileData[i+1])\n\n\t\t\t\t\tlog.Printf(\"Found end of JPG at offset %d\", i)\n\t\t\t\t\tlog.Printf(\"Total size: %d bytes\", i-startOffset)\n\n\t\t\t\t\timages = append(images, imageData)\n\n\t\t\t\t\twriting = false\n\t\t\t\t\ti++\n\t\t\t\t\timageData = make([]byte, 0)\n\n\t\t\t\t} else {\n\t\t\t\t\tnestedSOI--\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\tlog.Printf(\"Found %d total images\", len(images))\n\treturn images, nil\n}", "title": "" }, { "docid": "b86a020256eb2ac1c5293670868d731d", "score": "0.47495368", "text": "func (pg *PictureFolder) ReadMetadata(metaOrigin io.Reader) error {\r\n\tdata, err := ioutil.ReadAll(metaOrigin)\r\n\tif err != nil {\r\n\t\treturn errors.Wrap(err, \"loading metadata from file\")\r\n\t}\r\n\tif len(data) == 0 {\r\n\t\treturn nil\r\n\t}\r\n\terr = json.Unmarshal(data, pg)\r\n\tif err != nil {\r\n\t\treturn errors.Wrap(err, \"deserializing picture group from file data\")\r\n\t}\r\n\t// reparent de-serialized images\r\n\tfor _, v := range pg.Pictures {\r\n\t\tv.Parent = pg\r\n\t}\r\n\tvar newOrder = []string{}\r\n\tfor i, v := range pg.SubGroupOrder {\r\n\t\tfullPath := filepath.Join(pg.TraverseFileSystemPath(), v)\r\n\t\t_, err := os.Stat(fullPath)\r\n\t\tif os.IsNotExist(err) {\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tnewOrder = append(newOrder, pg.SubGroupOrder[i])\r\n\t\t//pg.AddSubFolder(fullPath, v, false, false)\r\n\t}\r\n\tpg.SubGroupOrder = newOrder\r\n\treturn nil\r\n}", "title": "" }, { "docid": "0cb864dc6277b4e37bbbe6ace8d90e78", "score": "0.47495356", "text": "func GetFilesLayer(path string) []File {\r\n\tfiles, _ := ioutil.ReadDir(path)\r\n\tvar fileList []File\r\n\r\n\tfor _, file := range files {\r\n\t\tif !file.IsDir() && IsLegalPath(file.Name()) {\r\n\t\t\tf := ProcessFile(filepath.Join(path, file.Name()))\r\n\t\t\tfileList = append(fileList, f)\r\n\t\t}\r\n\t}\r\n\r\n\treturn fileList\r\n}", "title": "" }, { "docid": "f822e8feb95456eb0310aa4bf2b4a005", "score": "0.4742846", "text": "func (c *Client) ReadDir(dir string) ([]os.FileInfo, error) {\n\tvar files []*ftp.Entry\n\n\tif *c.cfg.EscapeRegexpMeta {\n\t\tdir = regexp.QuoteMeta(dir)\n\t}\n\tfiles, err := c.ftp.List(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar entries []os.FileInfo\n\tfor _, file := range files {\n\t\tif file.Name == \".\" || file.Name == \"..\" {\n\t\t\tcontinue\n\t\t}\n\t\tvar mode os.FileMode\n\t\tswitch file.Type {\n\t\tcase ftp.EntryTypeFolder:\n\t\t\tmode |= os.ModeDir\n\t\tcase ftp.EntryTypeLink:\n\t\t\tmode |= os.ModeSymlink\n\t\t}\n\t\tfileInfo := &fileInfo{\n\t\t\tname: file.Name,\n\t\t\tmode: mode,\n\t\t\tmtime: file.Time,\n\t\t\tsize: int64(file.Size),\n\t\t}\n\t\tentries = append(entries, fileInfo)\n\t}\n\n\treturn entries, nil\n}", "title": "" }, { "docid": "a2d1d18af06f9e8cf51c050aeb0a9566", "score": "0.47356766", "text": "func (gcs *gcsPhotos) read(filename string) (buf []byte, err error) {\n\tsrc, err := os.Open(filename)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer src.Close()\n\tsize, err := src.Stat()\n\tif err != nil {\n\t\treturn\n\t}\n\tbuf = make([]byte, size.Size())\n\t_, err = src.Read(buf)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "db99cfbced5a5e2c075d1d070aa02e64", "score": "0.4732879", "text": "func ReadDir(dirname string) ([]os.FileInfo, error) {\n\tlog.Printf(\"androidasset.ReadDir() %s\", dirname)\n\tvar assetFile string\n\tif dirname == \"\" || dirname == \".\" {\n\t\tassetFile = assetFileName\n\t} else {\n\t\tassetFile = filepath.Join(dirname, assetFileName)\n\t}\n\tvar yamlFile []byte\n\tvar err error\n\tlog.Printf(\"androidasset.ReadFile() %s\", assetFile)\n\tif yamlFile, err = ReadFile(assetFile); err != nil {\n\t\tlog.Printf(\"Error loading asset file %s %v\", assetFile, err)\n\t\treturn nil, err\n\t}\n\tif len(yamlFile) == 0 {\n\t\tlog.Printf(\"empty yaml file\")\n\t\treturn nil, fmt.Errorf(\"File not found\")\n\t}\n\tlog.Printf(\"dir: %s\", string(yamlFile[:]))\n\tret := make([]os.FileInfo, 0)\n\tmanifest := &directoryManifest{}\n\terr = yaml.Unmarshal(yamlFile, manifest)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, f := range manifest.Files {\n\t\tret = append(ret, &assetFileStat{\n\t\t\tname: f,\n\t\t\tsize: 1, // don't know the size, for now...\n\t\t\tmode: 0444,\n\t\t\tmodTime: time.Now(),\n\t\t\tsys: nil,\n\t\t})\n\n\t}\n\treturn ret, nil\n\n}", "title": "" }, { "docid": "d19602c04539e9fba1c81a9397712cc0", "score": "0.47252032", "text": "func GetImages(path string) ([]string, error) {\n\tresult := make([]string, 0)\n\terr := filepath.Walk(path, func(path string, info os.FileInfo, err error) error {\n\t\tif info.IsDir() {\n\t\t\t// ignore sub-directories\n\t\t\treturn nil\n\t\t}\n\n\t\tif isImageType(info.Name()) {\n\t\t\tresult = append(result, path)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"an error occurred when walking directory: \"+path)\n\t}\n\n\tsort.Strings(result)\n\treturn result, nil\n}", "title": "" }, { "docid": "5a30977f7d71f8ad4bf574adbaa6701c", "score": "0.47143576", "text": "func ReadDir(ctx context.Context, rootDir string) Struct {\n\tif ctx == nil {\n\t\tpanic(\"null ctx\")\n\t}\n\tvar s Struct = &dirContents{\n\t\tctx: ctx,\n\t\trootDir: rootDir,\n\t}\n\tInitStruct(s)\n\treturn s\n}", "title": "" }, { "docid": "623325be9063cbdcd347970112777c8c", "score": "0.47136256", "text": "func makeThumbnails(filenames []string) {\n for _, f := range filenames {\n if _, err := thumbnail.ImageFile(f); err != nil {\n log.Println(err)\n }\n }\n}", "title": "" }, { "docid": "cb53817ada5d0e1a847aa3aafff75726", "score": "0.47131556", "text": "func (mCatRepo *MockGalleryRepo) PicsInGallery(gallery *entity.Gallery) ([]entity.Pic, []error) {\n\tpics := []entity.Pic{entity.PicMock}\n\treturn pics, nil\n}", "title": "" }, { "docid": "701ccd37297b63d22bd7ad6c91bcb867", "score": "0.47130993", "text": "func (r *RemoteTransport) ReadDir(path string, re bool) (*ReadDirRes, error) {\n\treq := struct {\n\t\tPath string\n\t\tRecursive bool\n\t\tIgnoreFolders []string\n\t}{\n\t\tPath: r.fullPath(path),\n\t\tRecursive: re,\n\t\tIgnoreFolders: r.IgnoreDirs,\n\t}\n\tres := &ReadDirRes{}\n\tif err := r.trip(\"fs.readDirectory\", req, &res); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// remove remote path prefix from entries\n\tfor i, entry := range res.Files {\n\t\tentry.FullPath = r.relativePath(entry.FullPath)\n\t\tres.Files[i] = entry\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "9a133629d64fbfebef2646724eddc91d", "score": "0.47011948", "text": "func Unpack(file string) ([]*Layer, string, error) {\n\tvar err error\n\tfile, err = filepath.EvalSymlinks(file)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tdir, err := ioutil.TempDir(\"\", \"box-image-tmp\")\n\tif err != nil {\n\t\treturn nil, dir, err\n\t}\n\n\tdir, err = filepath.EvalSymlinks(dir)\n\tif err != nil {\n\t\treturn nil, dir, err\n\t}\n\n\timg, err := extractManifest(file)\n\tif err != nil {\n\t\treturn nil, dir, err\n\t}\n\n\tif err := extractLayers(img, dir, file); err != nil {\n\t\treturn nil, dir, err\n\t}\n\n\tlayers := []*Layer{}\n\n\tfor _, layerID := range img.layerOrder {\n\t\tif layer, ok := img.layerMap[layerID]; ok {\n\t\t\tlayers = append(layers, layer)\n\t\t} else {\n\t\t\treturn nil, dir, fmt.Errorf(\"Layer ID %v not found in mapping: %v\", layerID, img.layerMap)\n\t\t}\n\t}\n\n\treturn layers, dir, nil\n}", "title": "" }, { "docid": "1d38c7acdf18958c4828d05d0091b063", "score": "0.4700577", "text": "func DecodeDir(r ReadAtReader, order binary.ByteOrder) (d *Dir, offset int32, err error) {\n\td = new(Dir)\n\n\t// get num of tags in ifd\n\tvar nTags int16\n\terr = binary.Read(r, order, &nTags)\n\tif err != nil {\n\t\treturn nil, 0, errors.New(\"tiff: failed to read IFD tag count: \" + err.Error())\n\t}\n\n\t// load tags\n\tfor n := 0; n < int(nTags); n++ {\n\t\tt, err := DecodeTag(r, order)\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\t\td.Tags = append(d.Tags, t)\n\t}\n\n\t// get offset to next ifd\n\terr = binary.Read(r, order, &offset)\n\tif err != nil {\n\t\treturn nil, 0, errors.New(\"tiff: falied to read offset to next IFD: \" + err.Error())\n\t}\n\n\treturn d, offset, nil\n}", "title": "" }, { "docid": "37b3a4ffc688da945573b5c513e6b5f8", "score": "0.46980613", "text": "func (in *inode) ReadDir(p []byte, offset int) int {\n\tif !in.isDir() {\n\t\tpanic(\"ReadDir called on non-directory.\")\n\t}\n\n\tvar n int\n\tfor i := offset; i < len(in.entries); i++ {\n\t\te := in.entries[i]\n\n\t\t// Skip unused entries.\n\t\tif e.Type == fuseutil.DT_Unknown {\n\t\t\tcontinue\n\t\t}\n\n\t\ttmp := fuseutil.WriteDirent(p[n:], in.entries[i])\n\t\tif tmp == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tn += tmp\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "93b96a8a65ce41184836e4da69ee38ad", "score": "0.46980247", "text": "func Load(dir, set string) (Set, error) {\n\timgs, err := Images(dir, set)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn load(dir, imgs)\n}", "title": "" }, { "docid": "fa51d5fd8019957e1c1a5ca0a3d3f098", "score": "0.46795088", "text": "func (fs *FileSystem) ReadDir(p string) ([]os.FileInfo, error) {\n\tvar fi []os.FileInfo\n\t// non-workspace: read from iso9660\n\t// workspace: read from regular filesystem\n\tif fs.workspace != \"\" {\n\t\tfullPath := path.Join(fs.workspace, p)\n\t\t// read the entries\n\t\tdirEntries, err := os.ReadDir(fullPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not read directory %s: %v\", p, err)\n\t\t}\n\t\tfor _, e := range dirEntries {\n\t\t\tinfo, err := e.Info()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"could not read directory %s: %v\", p, err)\n\t\t\t}\n\t\t\tfi = append(fi, info)\n\t\t}\n\t} else {\n\t\tdirEntries, err := fs.readDirectory(p)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error reading directory %s: %v\", p, err)\n\t\t}\n\t\tfi = make([]os.FileInfo, 0, len(dirEntries))\n\t\tfor _, entry := range dirEntries {\n\t\t\t// ignore any entry that is current directory or parent\n\t\t\tif entry.isSelf || entry.isParent {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfi = append(fi, entry)\n\t\t}\n\t}\n\treturn fi, nil\n}", "title": "" }, { "docid": "a61c5775a77f437e2d4b3dd2f0e4875d", "score": "0.46773243", "text": "func GetFilepathsInDir(dirpath string, filePathIncludeRegexp, filePathExcludeRegexp *regexp.Regexp) ([](*FileData), error) {\n if filePathExcludeRegexp.MatchString(dirpath) {\n return nil, nil\n }\n\n fileInfoForFilesInDir, err := ioutil.ReadDir(dirpath)\n if err != nil {\n return nil, err\n }\n\n // fmt.Println(\"Scanning\", dirpath)\n\n // TODO: Is this copying strings? Need to understand how Go handles ptrs, strings, arrays behind\n // the scenes\n\n // Builds up an array of the results from each file (can be a single file or dir) in the path\n filesInSubdirs := make([][](*FileData), len(fileInfoForFilesInDir))\n for i, fileInfo := range fileInfoForFilesInDir {\n // For now, don't follow symlinks\n if fileInfo.Mode() & os.ModeSymlink != 0 {\n continue\n }\n\n filePath := path.Join(dirpath, fileInfo.Name())\n\n // fmt.Println(\"Examining\", filePath)\n\n if fileInfo.IsDir() {\n subfilesInDir, err := GetFilepathsInDir(filePath, filePathIncludeRegexp, filePathExcludeRegexp)\n if err != nil {\n return nil, err\n }\n filesInSubdirs[i] = subfilesInDir\n } else { // Is just a file\n if filePathIncludeRegexp != nil && !filePathIncludeRegexp.MatchString(filePath) {\n // Skip file if doesn't match file path whitelist\n continue\n }\n filesInSubdirs[i] = [](*FileData){&FileData{FilePath: filePath}}\n }\n }\n\n // Allocate flat file array (need to figure out how many exist)\n flatFileCount := 0\n for _, filesInSubdir := range filesInSubdirs {\n if filesInSubdirs == nil {\n continue\n }\n flatFileCount += len(filesInSubdir)\n }\n flatFilesInDir := make([](*FileData), 0, flatFileCount)\n\n // TODO: Need to make sense of arrays vs slices, length/capacity\n\n // Merges the result arrays into a single array\n for _, filesInSubdir := range filesInSubdirs {\n flatFilesInDir = append(flatFilesInDir, filesInSubdir...)\n }\n\n return flatFilesInDir, nil\n}", "title": "" }, { "docid": "7e364d685316d6db826b55e71d0ca982", "score": "0.46718976", "text": "func (m *MaskImage) ReadImagePaths(target string) []string {\n\tfiles, err := ioutil.ReadDir(target)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// create full path lists\n\tvar filesPaths []string\n\tfor _, fileInfo := range files {\n\t\t// skip directory\n\t\tif fileInfo.IsDir() {\n\t\t\tcontinue\n\t\t}\n\n\t\tfilesPaths = append(filesPaths, target+fileInfo.Name())\n\t}\n\n\treturn filesPaths\n}", "title": "" }, { "docid": "9c8d24c62cca124d735b5e5613a110db", "score": "0.46600342", "text": "func (ir *ImageRepository) Get(p string) ([]byte, error) {\n\n\tdata, err := ioutil.ReadFile(path.Join(\".\", ir.parentDir, p))\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, ErrorNonExist\n\t\t}\n\t\treturn nil, fmt.Errorf(\"couldn't read file. %v\", err)\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "2876ad58fedc1cbda0f73cb0b3294357", "score": "0.46546984", "text": "func readDir(dir string) ([]os.DirEntry, error) {\n\tif dir == \"\" {\n\t\tdir = \".\"\n\t}\n\treturn os.ReadDir(dir)\n}", "title": "" }, { "docid": "6d10da7fc121d0643f14635a714ef4e8", "score": "0.46485177", "text": "func (cli *Client) ReadDir(handle string) ([]os.FileInfo, error) {\n\tread := &sshfxp.ReadDir{\n\t\tHandle: handle,\n\t}\n\n\tresCh, err := cli.send(read)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := <-resCh\n\n\tif err := sshfxp.IsError(res); err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch msg := res.(type) {\n\tcase *sshfxp.Name:\n\t\tvar res []os.FileInfo\n\t\tfor _, name := range msg.Names {\n\t\t\tres = append(res, FileInfo{\n\t\t\t\tname: name.Filename,\n\t\t\t\tsize: int64(name.Attr.Size),\n\t\t\t\tmode: os.FileMode(name.Attr.Permissions),\n\t\t\t\tmodtime: time.Unix(int64(name.Attr.MTime), 0),\n\t\t\t\tpacket: name,\n\t\t\t})\n\t\t}\n\n\t\treturn res, nil\n\t}\n\n\treturn nil, errors.New(\"unexpected response\")\n}", "title": "" }, { "docid": "c13957cf211e837e294a1c9052de2240", "score": "0.4647513", "text": "func LoadFromDirectory(dir string) Feed {\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfeed := NewFeed()\n\tfor _, file := range files {\n\t\tf, err := os.Open(filepath.Join(dir, file.Name()))\n\t\tdefer f.Close()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tparse(file.Name(), f, &feed)\n\t}\n\treturn feed\n}", "title": "" }, { "docid": "2935d52a58463ec04ce7f320cce25509", "score": "0.46462834", "text": "func (m Mount) ReadDir(dirname string) ([]os.FileInfo, error) {\n\tf, err := m.open(dirname)\n\tif os.IsNotExist(err) {\n\t\treturn ioutil.ReadDir(m.toPhysicalPath(dirname))\n\t}\n\n\tif !f.IsDir() {\n\t\treturn nil, &os.PathError{Op: \"read\", Path: dirname, Err: errors.New(\"is a file\")}\n\t}\n\n\tlist := append([]os.FileInfo{}, f.node.childInfos...)\n\tsort.Sort(byName(list))\n\n\treturn list, nil\n}", "title": "" }, { "docid": "fc6f0b43d0113cdcaa3af57202862061", "score": "0.4642837", "text": "func readFilesFromDir(dir *os.File) ([]string, error) {\n\tfiles, err := dir.Readdirnames(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "227bcdb115c3ba863f2d1677f3528cf5", "score": "0.46383843", "text": "func (st *TLphotos_photo) ReadFrom(_is *codec.Reader) error {\n\tvar err error\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\tst.ResetDefault()\n\n\terr = st.Data.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = err\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "title": "" }, { "docid": "c235746cea378b5ca4615e9ba2cacd0b", "score": "0.46313483", "text": "func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {\n\n\tvar res []fuse.Dirent\n\n\ttags, err := db.GetCoincidentTags(d.database, d.path, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, tag := range tags {\n\t\tres = append(res, fuse.Dirent{Type: fuse.DT_Dir, Name: tag.Text})\n\t}\n\n\t// TODO: batch files in pseudo-directory if too many to list\n\t// for now, only list files if not in the root\n\tif d.path != nil && len(d.path) > 0 {\n\t\tfiles, fileError := db.GetFilesWithTags(d.database, d.path, \"\")\n\t\tif fileError != nil {\n\t\t\treturn nil, fileError\n\t\t}\n\t\tfor _, file := range files {\n\t\t\tres = append(res, fuse.Dirent{Name: file.Name, Type: fuse.DT_File})\n\t\t}\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "c91417a4c5fa4f2639b34990c5a6c116", "score": "0.46219745", "text": "func ReadImages(filename string) ([]string, error) {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\tfilebytes, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ReadLines(filebytes), nil\n}", "title": "" }, { "docid": "f504028964475d5728ab3448c1553864", "score": "0.46139893", "text": "func (st *TLphotos_getUserPhotos) ReadFrom(_is *codec.Reader) error {\n\tvar err error\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\tst.ResetDefault()\n\n\terr = st.User_id.ReadBlock(_is, 0, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _is.Read_int32(&st.Offset, 1, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _is.Read_int64(&st.Max_id, 2, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _is.Read_int32(&st.Limit, 3, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = err\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "title": "" }, { "docid": "8c5c5a9b331e4ec213cf294a00c60732", "score": "0.4612366", "text": "func (m *MockserviceRuntime) ReadDir(dirname string) ([]os.FileInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ReadDir\", dirname)\n\tret0, _ := ret[0].([]os.FileInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2c2cb902d7d2085ea3018fa48ce7ee4e", "score": "0.46031484", "text": "func ReadDir(path string) ([]fs.FileInfo, error) {\n\tentries, err := os.ReadDir(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read dir %q: %w\", path, err)\n\t}\n\tinfos := make([]fs.FileInfo, 0, len(entries))\n\tfor _, entry := range entries {\n\t\tinfo, err := entry.Info()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to fetch fileInfo of %q in %q: %w\", entry.Name(), path, err)\n\t\t}\n\t\tinfos = append(infos, info)\n\t}\n\treturn infos, nil\n}", "title": "" }, { "docid": "4bdf7daa2208ab9d720fa7fb0608ee7f", "score": "0.46000546", "text": "func ReadMbtiles(filename string) (Mbtiles, error) {\n\tdb, err := sql.Open(\"sqlite3\", filename)\n\tif err != nil {\n\t\treturn Mbtiles{}, err\n\t}\n\t// starting the transaction for adding tiles\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn Mbtiles{}, err\n\t}\n\n\tvar mutex sync.Mutex\n\tmb := Mbtiles{Tx: tx,\n\t\tMutex: mutex,\n\t\tNewBool: false,\n\t\tOld_Total: -1,\n\t\tFileName: filename}\n\tminzoom, maxzoom := mb.GetMinMaxZoom()\n\tmb.MinZoom = minzoom\n\tmb.MaxZoom = maxzoom\n\tmb.CheckGZip()\n\treturn mb, nil\n\n}", "title": "" }, { "docid": "9a1c66685969ca2137aa32c177ffbc53", "score": "0.4597604", "text": "func Files(c jpg2go.FilesComponents, root string, size jpg2go.Size) error {\n\tfilePaths := c.Get(root)\n\tfor _, filePath := range filePaths {\n\t\timg, err := c.Image(filePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\timg, err = c.Resize(img, size)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = c.Write(img, filePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10387ea8a6ad4e1262e64e883ba12f88", "score": "0.45933136", "text": "func (m *MockIOUtil) ReadDir(arg0 string) ([]os.FileInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ReadDir\", arg0)\n\tret0, _ := ret[0].([]os.FileInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e79fb4077b1c5d5926b7b2be9b85d4aa", "score": "0.45841268", "text": "func processMockFolder(mockFolder string) ([]MockResource, error) {\n\tlogger.Debug(\"Reading mocks folders : \", mockFolder)\n\tfiles, err := ioutil.ReadDir(mockFolder)\n\tif err != nil {\n\t\tlogger.Error(\"Error reading mocks folders\", err)\n\t\treturn nil, errors.New(\"Error reading mocks folders\")\n\t}\n\tlogger.Debug(\"Done Reading mocks folders : \", mockFolder)\n\tlogger.Debug(\"Processing files in mocks folders : \", mockFolder)\n\treturn processMockFiles(mockFolder, files)\n}", "title": "" }, { "docid": "aa2740dd59d3ec0b852bceb972845a4e", "score": "0.4577578", "text": "func readDirWithOpts(dirPath string, opts readDirOpts) (entries []string, err error) {\n\tf, err := Open(dirPath)\n\tif err != nil {\n\t\treturn nil, osErrToFileErr(err)\n\t}\n\tdefer f.Close()\n\n\tbufp := direntPool.Get().(*[]byte)\n\tdefer direntPool.Put(bufp)\n\tbuf := *bufp\n\n\tnameTmp := direntNamePool.Get().(*[]byte)\n\tdefer direntNamePool.Put(nameTmp)\n\ttmp := *nameTmp\n\n\tboff := 0 // starting read position in buf\n\tnbuf := 0 // end valid data in buf\n\n\tcount := opts.count\n\n\tfor count != 0 {\n\t\tif boff >= nbuf {\n\t\t\tboff = 0\n\t\t\tnbuf, err = syscall.ReadDirent(int(f.Fd()), buf)\n\t\t\tif err != nil {\n\t\t\t\tif isSysErrNotDir(err) {\n\t\t\t\t\treturn nil, errFileNotFound\n\t\t\t\t}\n\t\t\t\treturn nil, osErrToFileErr(err)\n\t\t\t}\n\t\t\tif nbuf <= 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tconsumed, name, typ, err := parseDirEnt(buf[boff:nbuf])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tboff += consumed\n\t\tif len(name) == 0 || bytes.Equal(name, []byte{'.'}) || bytes.Equal(name, []byte{'.', '.'}) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Fallback for filesystems (like old XFS) that don't\n\t\t// support Dirent.Type and have DT_UNKNOWN (0) there\n\t\t// instead.\n\t\tif typ == unexpectedFileMode || typ&os.ModeSymlink == os.ModeSymlink {\n\t\t\tfi, err := Stat(pathJoin(dirPath, string(name)))\n\t\t\tif err != nil {\n\t\t\t\t// It got deleted in the meantime, not found\n\t\t\t\t// or returns too many symlinks ignore this\n\t\t\t\t// file/directory.\n\t\t\t\tif osIsNotExist(err) || isSysErrPathNotFound(err) ||\n\t\t\t\t\tisSysErrTooManySymlinks(err) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// Ignore symlinked directories.\n\t\t\tif !opts.followDirSymlink && typ&os.ModeSymlink == os.ModeSymlink && fi.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttyp = fi.Mode() & os.ModeType\n\t\t}\n\n\t\tvar nameStr string\n\t\tif typ.IsRegular() {\n\t\t\tnameStr = string(name)\n\t\t} else if typ.IsDir() {\n\t\t\t// Use temp buffer to append a slash to avoid string concat.\n\t\t\ttmp = tmp[:len(name)+1]\n\t\t\tcopy(tmp, name)\n\t\t\ttmp[len(tmp)-1] = '/' // SlashSeparator\n\t\t\tnameStr = string(tmp)\n\t\t}\n\n\t\tcount--\n\t\tentries = append(entries, nameStr)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f5e17c7fc887710e5c3df3d831bccc2e", "score": "0.4573228", "text": "func readDirN(dirPath string, count int) (entries []string, err error) {\n\treturn readDirWithOpts(dirPath, readDirOpts{count: count})\n}", "title": "" }, { "docid": "1f5941f4f9be0bc268b5ca7484594a82", "score": "0.45718163", "text": "func (pl ProfileList) ReadDirAll(_ context.Context) (res []fuse.Dirent, err error) {\n\tprofiles := pprof.Profiles()\n\tres = make([]fuse.Dirent, 0, len(profiles))\n\tfor _, p := range profiles {\n\t\tname := p.Name()\n\t\tif !libfs.IsSupportedProfileName(name) {\n\t\t\tcontinue\n\t\t}\n\t\tres = append(res, fuse.Dirent{\n\t\t\tType: fuse.DT_Dir,\n\t\t\tName: name,\n\t\t})\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "1efb24bca962e8470f52884cd370abdf", "score": "0.45711902", "text": "func (fs *FileSystem) readDirectory(p string) ([]*directoryEntry, error) {\n\tvar (\n\t\tlocation, size uint32\n\t\terr error\n\t\tn int\n\t)\n\n\t// try from path table, then walk the directory tree, unless we were told explicitly not to\n\tusePathtable := true\n\tfor _, e := range fs.suspExtensions {\n\t\tusePathtable = e.UsePathtable()\n\t\tif !usePathtable {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif usePathtable {\n\t\tlocation = fs.pathTable.getLocation(p)\n\t}\n\n\t// if we found it, read the first directory entry to get the size\n\tif location != 0 {\n\t\t// we need 4 bytes to read the size of the directory; it is at offset 10 from beginning\n\t\tdirb := make([]byte, 4)\n\t\tn, err = fs.file.ReadAt(dirb, int64(location)*fs.blocksize+10)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not read directory %s: %v\", p, err)\n\t\t}\n\t\tif n != len(dirb) {\n\t\t\treturn nil, fmt.Errorf(\"read %d bytes instead of expected %d\", n, len(dirb))\n\t\t}\n\t\t// convert to uint32\n\t\tsize = binary.LittleEndian.Uint32(dirb)\n\t} else {\n\t\t// if we could not find the location in the path table, try reading directly from the disk\n\t\t// it is slow, but this is how Unix does it, since many iso creators *do* create illegitimate disks\n\t\tlocation, size, err = fs.rootDir.getLocation(p)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to read directory tree for %s: %v\", p, err)\n\t\t}\n\t}\n\n\t// did we still not find it?\n\tif location == 0 {\n\t\treturn nil, fmt.Errorf(\"could not find directory %s\", p)\n\t}\n\n\t// we have a location, let's read the directories from it\n\tb := make([]byte, size)\n\tn, err = fs.file.ReadAt(b, int64(location)*fs.blocksize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not read directory entries for %s: %v\", p, err)\n\t}\n\tif n != int(size) {\n\t\treturn nil, fmt.Errorf(\"reading directory %s returned %d bytes read instead of expected %d\", p, n, size)\n\t}\n\t// parse the entries\n\tentries, err := parseDirEntries(b, fs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not parse directory entries for %s: %v\", p, err)\n\t}\n\treturn entries, nil\n}", "title": "" }, { "docid": "c04e333e996245ae201851c86ef0cea0", "score": "0.45594674", "text": "func colorDirectoryPages(mask, dir string, keep bool) ([]int, error) {\n\tpattern := filepath.Join(dir, mask)\n\tfiles, err := filepath.Glob(pattern)\n\tif err != nil {\n\t\tcommon.Log.Error(\"isColorDirectory: Glob failed. pattern=%#q err=%v\", pattern, err)\n\t\treturn nil, err\n\t}\n\n\tcolorPages := []int{}\n\tfor _, path := range files {\n\t\tmatches := gsImageRegex.FindStringSubmatch(path)\n\t\tif len(matches) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tpageNum, err := strconv.Atoi(matches[1])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t\treturn colorPages, err\n\t\t}\n\t\tisColor, err := isColorImage(path, keep)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t\treturn colorPages, err\n\t\t}\n\t\tif isColor {\n\t\t\tcolorPages = append(colorPages, pageNum)\n\t\t}\n\t}\n\treturn colorPages, nil\n}", "title": "" }, { "docid": "43b16eb851cf7492ac7ee8b9f9350cf5", "score": "0.45561856", "text": "func (v *FilesystemManifestValidator) ReadDir(dirname string) ([]os.FileInfo, error) {\n\tf, err := v.fs.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist, err := f.Readdir(-1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := f.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Slice(list, func(i, j int) bool { return list[i].Name() < list[j].Name() })\n\treturn list, nil\n}", "title": "" }, { "docid": "56ed4745b187e101ddec390fa1fb8a62", "score": "0.45524183", "text": "func (c *Client) ReadDir(path string) ([]os.FileInfo, error) {\n\tpath = FixSlashes(path)\n\tfiles := make([]os.FileInfo, 0)\n\tskipSelf := true\n\tparse := func(resp interface{}) error {\n\t\tr := resp.(*response)\n\n\t\tif skipSelf {\n\t\t\tskipSelf = false\n\t\t\tif p := getProps(r, \"200\"); p != nil && p.Type.Local == \"collection\" {\n\t\t\t\tr.Props = nil\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn newPathError(\"ReadDir\", path, 405)\n\t\t}\n\n\t\tif p := getProps(r, \"200\"); p != nil {\n\t\t\tf := new(File)\n\t\t\tr.Href = strings.ReplaceAll(r.Href, \"+\", \"%2B\")\n\t\t\tif ps, err := url.QueryUnescape(r.Href); err == nil {\n\t\t\t\tf.name = pathpkg.Base(ps)\n\t\t\t} else {\n\t\t\t\tf.name = p.Name\n\t\t\t}\n\t\t\tf.path = path + f.name\n\t\t\tf.modified = parseModified(&p.Modified)\n\t\t\tf.etag = p.ETag\n\t\t\tf.contentType = p.ContentType\n\n\t\t\tif p.Type.Local == \"collection\" {\n\t\t\t\tf.path += \"/\"\n\t\t\t\tf.size = 0\n\t\t\t\tf.isdir = true\n\t\t\t} else {\n\t\t\t\tf.size = parseInt64(&p.Size)\n\t\t\t\tf.isdir = false\n\t\t\t}\n\n\t\t\tfiles = append(files, f)\n\t\t}\n\n\t\tr.Props = nil\n\t\treturn nil\n\t}\n\n\terr := c.propfind(path, false,\n\t\t`<d:propfind xmlns:d='DAV:'>\n\t\t\t<d:prop>\n\t\t\t\t<d:displayname/>\n\t\t\t\t<d:resourcetype/>\n\t\t\t\t<d:getcontentlength/>\n\t\t\t\t<d:getcontenttype/>\n\t\t\t\t<d:getetag/>\n\t\t\t\t<d:getlastmodified/>\n\t\t\t</d:prop>\n\t\t</d:propfind>`,\n\t\t&response{},\n\t\tparse)\n\n\tif err != nil {\n\t\tif _, ok := err.(*os.PathError); !ok {\n\t\t\terr = newPathErrorErr(\"ReadDir\", path, err)\n\t\t}\n\t}\n\treturn files, err\n}", "title": "" }, { "docid": "cdb74ddeb32aac5ed5545d1fedb66987", "score": "0.45373946", "text": "func readFilesInDirectory(fileMap map[string]*string, dir string) error {\n\tfor k, v := range fileMap {\n\t\tb, err := os.ReadFile(filepath.Join(dir, k))\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\treturn errors.Wrapf(err, \"%s: unable to read file %q\", dir, k)\n\t\t}\n\n\t\t*v = strings.TrimSpace(string(b))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "edd8bab2b7d02543bbc9cb45c2134098", "score": "0.45347646", "text": "func Decode(r io.Reader) (*Tiff, error) {\n\tdata, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, errors.New(\"tiff: could not read data\")\n\t}\n\tbuf := bytes.NewReader(data)\n\n\tt := new(Tiff)\n\n\t// read byte order\n\tbo := make([]byte, 2)\n\tif _, err = io.ReadFull(buf, bo); err != nil {\n\t\treturn nil, errors.New(\"tiff: could not read tiff byte order\")\n\t}\n\tif string(bo) == \"II\" {\n\t\tt.Order = binary.LittleEndian\n\t} else if string(bo) == \"MM\" {\n\t\tt.Order = binary.BigEndian\n\t} else {\n\t\treturn nil, errors.New(\"tiff: could not read tiff byte order\")\n\t}\n\n\t// check for special tiff marker\n\tvar sp int16\n\terr = binary.Read(buf, t.Order, &sp)\n\tif err != nil || 42 != sp {\n\t\treturn nil, errors.New(\"tiff: could not find special tiff marker\")\n\t}\n\n\t// load offset to first IFD\n\tvar offset int32\n\terr = binary.Read(buf, t.Order, &offset)\n\tif err != nil {\n\t\treturn nil, errors.New(\"tiff: could not read offset to first IFD\")\n\t}\n\n\t// load IFD's\n\tvar d *Dir\n\tprev := offset\n\tfor offset != 0 {\n\t\t// seek to offset\n\t\t_, err := buf.Seek(int64(offset), 0)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"tiff: seek to IFD failed\")\n\t\t}\n\n\t\tif buf.Len() == 0 {\n\t\t\treturn nil, errors.New(\"tiff: seek offset after EOF\")\n\t\t}\n\n\t\t// load the dir\n\t\td, offset, err = DecodeDir(buf, t.Order)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif offset == prev {\n\t\t\treturn nil, errors.New(\"tiff: recursive IFD\")\n\t\t}\n\t\tprev = offset\n\n\t\tt.Dirs = append(t.Dirs, d)\n\t}\n\n\treturn t, nil\n}", "title": "" }, { "docid": "c813c3f36af6c030be338c608c5b2116", "score": "0.45312354", "text": "func (s *xlStorage) ListDir(ctx context.Context, volume, dirPath string, count int) (entries []string, err error) {\n\t// Verify if volume is valid and it exists.\n\tvolumeDir, err := s.getVolDir(volume)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdirPathAbs := pathJoin(volumeDir, dirPath)\n\tif count > 0 {\n\t\tentries, err = readDirN(dirPathAbs, count)\n\t} else {\n\t\tentries, err = readDir(dirPathAbs)\n\t}\n\tif err != nil {\n\t\tif err == errFileNotFound {\n\t\t\tif ierr := Access(volumeDir); ierr != nil {\n\t\t\t\tif osIsNotExist(ierr) {\n\t\t\t\t\treturn nil, errVolumeNotFound\n\t\t\t\t} else if isSysErrIO(ierr) {\n\t\t\t\t\treturn nil, errFaultyDisk\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn entries, nil\n}", "title": "" }, { "docid": "22153fca953ffec944f138bb6bc9ea39", "score": "0.4531152", "text": "func (m *source) readFromArchive(tr *tar.Reader, dir string, madeDir map[string]bool) error {\n\tf, err := tr.Next()\n\tif err != nil {\n\t\t// This catches EOF, which means that we're done\n\t\treturn err\n\t}\n\n\tif f == nil {\n\t\t// if the header is nil, just skip it (not sure how this happens)\n\t\treturn nil\n\t}\n\n\trel := filepath.FromSlash(f.Name)\n\tabs := filepath.Join(dir, rel)\n\tfi := f.FileInfo()\n\tmode := fi.Mode()\n\n\tswitch f.Typeflag {\n\tcase tar.TypeDir:\n\t\tif err := os.MkdirAll(abs, 0755); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmadeDir[abs] = true\n\n\tcase tar.TypeReg:\n\t\tdir := filepath.Dir(abs)\n\t\tif !madeDir[dir] {\n\t\t\tif err := os.MkdirAll(filepath.Dir(abs), 0755); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmadeDir[dir] = true\n\t\t}\n\n\t\twf, err := os.OpenFile(abs, os.O_RDWR|os.O_CREATE|os.O_TRUNC, mode.Perm())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// copy over contents\n\t\tif _, err := io.Copy(wf, tr); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// manually close here after each file operation; defering would cause each file close\n\t\t// to wait until all operations have completed.\n\t\twf.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60494ff895355370b8008fd4c1803945", "score": "0.45293167", "text": "func DoReadDir(src, tar Dot) Dot {\n\tdirname := src.String()\n\tReadDir(tar, dirname)\n\treturn src\n}", "title": "" }, { "docid": "f98f5b691e23e6c9c15da9174e3e5676", "score": "0.45291978", "text": "func (ir *Runtime) LoadFromArchive(ctx context.Context, name, signaturePolicyPath string, writer io.Writer) ([]*Image, error) {\n\tvar newImages []*Image\n\tnewImage := Image{\n\t\tInputName: name,\n\t\tLocal: false,\n\t\timageruntime: ir,\n\t}\n\n\tif signaturePolicyPath == \"\" {\n\t\tsignaturePolicyPath = ir.SignaturePolicyPath\n\t}\n\timageNames, err := newImage.pullImage(ctx, writer, \"\", signaturePolicyPath, SigningOptions{}, &DockerRegistryOptions{}, false)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to pull %s\", name)\n\t}\n\n\tfor _, name := range imageNames {\n\t\tnewImage := Image{\n\t\t\tInputName: name,\n\t\t\tLocal: true,\n\t\t\timageruntime: ir,\n\t\t}\n\t\timg, err := newImage.getLocalImage()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"error retrieving local image after pulling %s\", name)\n\t\t}\n\t\tnewImage.image = img\n\t\tnewImages = append(newImages, &newImage)\n\t}\n\n\treturn newImages, nil\n}", "title": "" }, { "docid": "624157e88804011895f21113f35c70a1", "score": "0.45274866", "text": "func (m *MockIoUtil) ReadDir(dirname string) ([]os.FileInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ReadDir\", dirname)\n\tret0, _ := ret[0].([]os.FileInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "999768951ac378c53059bc5b14aac1d5", "score": "0.45240274", "text": "func readDirAll(readDirPath, entryPrefixMatch string) ([]fsDirent, error) {\n\tbuf := make([]byte, readDirentBufSize)\n\tf, err := os.Open(readDirPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tdirents := []fsDirent{}\n\tfor {\n\t\tnbuf, err := syscall.ReadDirent(int(f.Fd()), buf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif nbuf <= 0 {\n\t\t\tbreak\n\t\t}\n\t\tfor _, dirent := range parseDirents(buf[:nbuf]) {\n\t\t\tif dirent.isDir {\n\t\t\t\tdirent.name += string(os.PathSeparator)\n\t\t\t\tdirent.size = 0\n\t\t\t}\n\t\t\tif strings.HasPrefix(dirent.name, entryPrefixMatch) {\n\t\t\t\tdirents = append(dirents, dirent)\n\t\t\t}\n\t\t}\n\t}\n\tsort.Sort(byDirentNames(dirents))\n\treturn dirents, nil\n}", "title": "" }, { "docid": "d66023f47b1bcb1fc5fd147c4d33cdf9", "score": "0.4520188", "text": "func (wd *webDav) readDir(dirname string) ([]os.FileInfo, error) {\n\tfs, err := wd.ReadDir(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Slice(fs, func(i, j int) bool {\n\t\treturn sort.StringsAreSorted([]string{fs[i].Name(), fs[j].Name()})\n\t})\n\treturn fs, nil\n}", "title": "" }, { "docid": "c98407f0b004ebe48e88129e54a3abad", "score": "0.4506083", "text": "func (d *TagsDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {\n\tdebug.Log(\"ReadDirAll()\")\n\n\t// update snapshots\n\tupdateSnapshots(ctx, d.root)\n\n\t// update tag names\n\tupdateTagNames(d)\n\n\titems := []fuse.Dirent{\n\t\t{\n\t\t\tInode: d.inode,\n\t\t\tName: \".\",\n\t\t\tType: fuse.DT_Dir,\n\t\t},\n\t\t{\n\t\t\tInode: d.root.inode,\n\t\t\tName: \"..\",\n\t\t\tType: fuse.DT_Dir,\n\t\t},\n\t}\n\n\tfor tag := range d.tags {\n\t\titems = append(items, fuse.Dirent{\n\t\t\tInode: fs.GenerateDynamicInode(d.inode, tag),\n\t\t\tName: tag,\n\t\t\tType: fuse.DT_Dir,\n\t\t})\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "74b44e0f007e02cab8f6b6e9a715a3ac", "score": "0.45006904", "text": "func (p *AzureBlobPath) ReadDir() ([]Path, error) {\n\tctx := context.TODO()\n\n\tclient, err := p.getClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar paths []Path\n\tcURL, err := client.newContainerURL(p.container)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprefix := p.key\n\tif !strings.HasSuffix(prefix, \"/\") {\n\t\tprefix += \"/\"\n\t}\n\n\tfor m := (azblob.Marker{}); m.NotDone(); {\n\t\t// List all blobs that have the same prefix (without\n\t\t// recursion). By specifying \"/\", the request will\n\t\t// group blobs with their names up to the appearance of \"/\".\n\t\t//\n\t\t// Suppose that we have the following blobs:\n\t\t//\n\t\t// - cluster/cluster.spec\n\t\t// - cluster/config\n\t\t// - cluster/instancegroup/master-eastus-1\n\t\t//\n\t\t// When the prefix is set to \"cluster/\", the request\n\t\t// returns \"cluster/cluster.spec\" and \"cluster/config\" in BlobItems\n\t\t// and returns \"cluster/instancegroup/\" in BlobPrefixes.\n\t\tresp, err := cURL.ListBlobsHierarchySegment(\n\t\t\tctx,\n\t\t\tm,\n\t\t\t\"/\", /* delimiter */\n\t\t\tazblob.ListBlobsSegmentOptions{Prefix: prefix})\n\t\tif err != nil {\n\t\t\treturn nil, nil\n\t\t}\n\t\tfor _, item := range resp.Segment.BlobItems {\n\t\t\tpaths = append(paths, &AzureBlobPath{\n\t\t\t\tvfsContext: p.vfsContext,\n\t\t\t\tcontainer: p.container,\n\t\t\t\tkey: item.Name,\n\t\t\t\tmd5Hash: string(item.Properties.ContentMD5),\n\t\t\t})\n\t\t}\n\t\tfor _, prefix := range resp.Segment.BlobPrefixes {\n\t\t\tpaths = append(paths, &AzureBlobPath{\n\t\t\t\tvfsContext: p.vfsContext,\n\t\t\t\tcontainer: p.container,\n\t\t\t\tkey: prefix.Name,\n\t\t\t})\n\t\t}\n\n\t\tm = resp.NextMarker\n\n\t}\n\treturn paths, nil\n}", "title": "" }, { "docid": "e70494ac8572827df90860297b006bb9", "score": "0.44986635", "text": "func browseFiles(absoluteDirPath string) (*data.ReadDirResult, error) {\n if !dirExists(absoluteDirPath) {\n errMsg := \"Directory \" + absoluteDirPath + \" does not exisit.\"\n glog.Errorln(errMsg)\n return nil, fmt.Errorf(errMsg)\n }\n // Get the info of files/folders inside the directory.\n readDirResult := new(data.ReadDirResult)\n files, _ := ioutil.ReadDir(absoluteDirPath)\n for _, file := range files {\n dirEntry := new(data.DirEntry)\n dirEntry.Name = file.Name()\n dirEntry.FilePath = filepath.Join(absoluteDirPath, file.Name())\n dirEntry.Size = file.Size()\n if file.IsDir() {\n dirEntry.Type = \"kDirectory\"\n } else if !file.Mode().IsRegular() {\n dirEntry.Type = \"kSymlink\"\n } else {\n dirEntry.Type = \"kFile\"\n }\n glog.Infoln(\"Adding entry to read directory under: \"+absoluteDirPath+\n \" with properties: %+v\\n\", *dirEntry)\n readDirResult.Entries = append(readDirResult.Entries, dirEntry)\n }\n return readDirResult, nil\n}", "title": "" }, { "docid": "69ed7666df24721d6dae1c1847958d96", "score": "0.4491887", "text": "func (manager *FileManager) readFiles(dir string, recursive bool) ([]*File, error) {\n\tfpath, _ := filepath.Abs(dir)\n\tinfo, err := os.Stat(fpath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !info.IsDir() {\n\t\treturn []*File{{\n\t\t\tFile: info,\n\t\t\tFullPath: fpath,\n\t\t}}, nil\n\t}\n\tlist, err := ioutil.ReadDir(fpath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult := []*File{}\n\tfor _, f := range list {\n\t\tif !f.IsDir() {\n\t\t\tfname := strings.ToLower(f.Name())\n\t\t\tif string(fname[len(fname)-4:]) == \".hcl\" {\n\t\t\t\tresult = append(result, &File{\n\t\t\t\t\tFile: f,\n\t\t\t\t\tFullPath: fpath + string(filepath.Separator) + f.Name(),\n\t\t\t\t})\n\t\t\t}\n\t\t} else if recursive {\n\t\t\tsubdirList, serr := manager.readFiles(dir+\"/\"+f.Name(), recursive)\n\t\t\tif serr != nil {\n\t\t\t\treturn nil, serr\n\t\t\t}\n\t\t\tfor _, s := range subdirList {\n\t\t\t\tresult = append(result, s)\n\t\t\t}\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "7ab64f0cd0223fbb2150e3d46b064a30", "score": "0.44817847", "text": "func (f StdFS) ReadDir(name string) ([]iofs.DirEntry, error) {\n\tif err := checkStdFSName(name); err != nil {\n\t\treturn nil, err\n\t}\n\tvar entries []iofs.DirEntry\n\terr := f.File.Join(name).ListDir(func(file File) error {\n\t\tentries = append(entries, file.StdDirEntry())\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Slice(entries, func(i, j int) bool { return entries[i].Name() < entries[j].Name() })\n\treturn entries, nil\n}", "title": "" }, { "docid": "9439d49baeb7b91af259f36aea4d74f4", "score": "0.44797003", "text": "func getOpenFilesInDir(dirPath string, fFilter fileFilter) ([]*os.File, error) {\n\tdfi, err := os.Open(dirPath)\n\tif err != nil {\n\t\treturn nil, newCannotOpenFileError(\"Cannot open directory \" + dirPath)\n\t}\n\tdefer dfi.Close()\n\t// Size of read buffer (i.e. chunk of items read at a time).\n\trbs := 64\n\tresFiles := []*os.File{}\nL:\n\tfor {\n\t\t// Read directory entities by reasonable chuncks\n\t\t// to prevent overflows on big number of files.\n\t\tfis, e := dfi.Readdir(rbs)\n\t\tswitch e {\n\t\t// It's OK.\n\t\tcase nil:\n\t\t// Do nothing, just continue cycle.\n\t\tcase io.EOF:\n\t\t\tbreak L\n\t\t// Something went wrong.\n\t\tdefault:\n\t\t\treturn nil, e\n\t\t}\n\t\t// THINK: Maybe, use async running.\n\t\tfor _, fi := range fis {\n\t\t\t// NB: On Linux this could be a problem as\n\t\t\t// there are lots of file types available.\n\t\t\tif !fi.IsDir() {\n\t\t\t\tf, e := os.Open(filepath.Join(dirPath, fi.Name()))\n\t\t\t\tif e != nil {\n\t\t\t\t\tif f != nil {\n\t\t\t\t\t\tf.Close()\n\t\t\t\t\t}\n\t\t\t\t\t// THINK: Add nil as indicator that a problem occurred.\n\t\t\t\t\tresFiles = append(resFiles, nil)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// Check filter condition.\n\t\t\t\tif fFilter != nil && !fFilter(fi, f) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tresFiles = append(resFiles, f)\n\t\t\t}\n\t\t}\n\t}\n\treturn resFiles, nil\n}", "title": "" } ]
093e52e931e02b8b0ebfc9695371fc65
UpdateProbes updates details of Probe
[ { "docid": "2675f6752896b5180647a56b96532ce7", "score": "0.72664833", "text": "func UpdateProbes(ctx context.Context, query bson.D, updateQuery bson.D) (*mongo.UpdateResult, error) {\n\tresult, err := mongodb.Operator.UpdateMany(ctx, mongodb.ChaosProbeCollection, query, updateQuery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif result.MatchedCount == 0 {\n\t\treturn result, errors.New(\"no matching documents found\")\n\t}\n\treturn result, nil\n}", "title": "" } ]
[ { "docid": "5e202e84b38a425d4aa62f6493b67f16", "score": "0.55936474", "text": "func (t *FakeStatusTracker) UpdatePrometheus(hostnames, machines map[string]bool) error {\n\treturn t.Err\n}", "title": "" }, { "docid": "066cd061225cc746fbd4d0ad238cc950", "score": "0.55716795", "text": "func updateForAddrs(ctx context.Context, api API, chainIndex *ChainIndex, addrs []string) error {\n\tvar l sync.Mutex\n\trl := make(chan struct{}, maxParallelism)\n\tfor i, a := range addrs {\n\t\trl <- struct{}{}\n\t\tgo func(addr string) {\n\t\t\tdefer func() { <-rl }()\n\t\t\tpw, err := getPower(ctx, api, addr)\n\t\t\tif err != nil {\n\t\t\t\tlog.Debug(\"error getting power: %s\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tl.Lock()\n\t\t\tchainIndex.Power[addr] = pw\n\t\t\tl.Unlock()\n\t\t}(a)\n\t\tstats.Record(context.Background(), mOnChainRefreshProgress.M(float64(i)/float64(len(addrs))))\n\t}\n\tfor i := 0; i < maxParallelism; i++ {\n\t\trl <- struct{}{}\n\t}\n\tstats.Record(context.Background(), mOnChainRefreshProgress.M(1))\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn fmt.Errorf(\"cancelled by context\")\n\tdefault:\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd1057d7e392778148616594d90ef910", "score": "0.5413969", "text": "func UpdateProbe(ctx context.Context, query bson.D, updateQuery bson.D) (*mongo.UpdateResult, error) {\n\tresult, err := mongodb.Operator.Update(ctx, mongodb.ChaosProbeCollection, query, updateQuery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif result.MatchedCount == 0 {\n\t\treturn result, errors.New(\"no matching documents found\")\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "b5545b1dc123a1f04865e9389d8e40ee", "score": "0.5190225", "text": "func ParseProbes(_ context.Context, probeSpecs []corev1alpha1.Probe) Prober {\n\tvar probeList list\n\tfor _, probeSpec := range probeSpecs {\n\t\tvar probe Prober\n\n\t\tswitch {\n\t\tcase probeSpec.FieldsEqual != nil:\n\t\t\tprobe = &fieldsEqualProbe{\n\t\t\t\tFieldA: probeSpec.FieldsEqual.FieldA,\n\t\t\t\tFieldB: probeSpec.FieldsEqual.FieldB,\n\t\t\t}\n\n\t\tcase probeSpec.Condition != nil:\n\t\t\tprobe = NewConditionProbe(\n\t\t\t\tprobeSpec.Condition.Type,\n\t\t\t\tprobeSpec.Condition.Status,\n\t\t\t)\n\n\t\tdefault:\n\t\t\t// probe has no known config\n\t\t\tcontinue\n\t\t}\n\t\tprobeList = append(probeList, probe)\n\t}\n\n\t// Always check .status.observedCondition, if present.\n\treturn &statusObservedGenerationProbe{Prober: probeList}\n}", "title": "" }, { "docid": "36e91ed2948e3d7ca3aefcedee56168a", "score": "0.51412654", "text": "func (mgr *endpointManager) UpdatePolicyMaps(ctx context.Context, notifyWg *sync.WaitGroup) *sync.WaitGroup {\n\tvar epWG sync.WaitGroup\n\tvar wg sync.WaitGroup\n\n\tproxyWaitGroup := completion.NewWaitGroup(ctx)\n\n\teps := mgr.GetEndpoints()\n\tepWG.Add(len(eps))\n\twg.Add(1)\n\n\t// This is in a goroutine to allow the caller to proceed with other tasks before waiting for the ACKs to complete\n\tgo func() {\n\t\t// Wait for all the eps to have applied policy map\n\t\t// changes before waiting for the changes to be ACKed\n\t\tepWG.Wait()\n\t\tif err := waitForProxyCompletions(proxyWaitGroup); err != nil {\n\t\t\tlog.WithError(err).Warning(\"Failed to apply L7 proxy policy changes. These will be re-applied in future updates.\")\n\t\t}\n\t\twg.Done()\n\t}()\n\n\t// TODO: bound by number of CPUs?\n\tfor _, ep := range eps {\n\t\tgo func(ep *endpoint.Endpoint) {\n\t\t\t// Proceed only after all notifications have been delivered to endpoints\n\t\t\tnotifyWg.Wait()\n\t\t\tif err := ep.ApplyPolicyMapChanges(proxyWaitGroup); err != nil {\n\t\t\t\tep.Logger(\"endpointmanager\").WithError(err).Warning(\"Failed to apply policy map changes. These will be re-applied in future updates.\")\n\t\t\t}\n\t\t\tepWG.Done()\n\t\t}(ep)\n\t}\n\n\treturn &wg\n}", "title": "" }, { "docid": "671b09f02104480c0cacf948f2334531", "score": "0.5085107", "text": "func (w *WorldImpl) UpdatePheromones() {\n\tfor pair := range w.updatedPheroMap {\n\t\tw.pheroMap[pair] *= decayFactor\n\t\tif updatedVal, ok := w.updatedPheroMap[pair]; ok {\n\t\t\tw.pheroMap[pair] += updatedVal\n\t\t}\n\t\tif updatedVal, ok := w.updatedPheroMap[pair.invert()]; ok {\n\t\t\tw.pheroMap[pair] += updatedVal\n\t\t}\n\t}\n}", "title": "" }, { "docid": "33465e5835207bac12411e31ab91fa79", "score": "0.49756375", "text": "func (r *Probes) Add(probe *Probe) {\n\t*r = append(*r, probe)\n}", "title": "" }, { "docid": "6f1807c46da2b8f3f5c5e980d48124e1", "score": "0.49013364", "text": "func (r Probes) NumProbes() int {\n\treturn len(r)\n}", "title": "" }, { "docid": "c7008d9abf8d95027fb5874fe29b7a3d", "score": "0.48770115", "text": "func (l *ObserversList) Update(nodes []*apiv1.Node, now time.Time) {\n\tfor _, observer := range l.observers {\n\t\tobserver.UpdateScaleDownCandidates(nodes, now)\n\t}\n}", "title": "" }, { "docid": "911741b60589c04642d4f08ff7334a73", "score": "0.48600096", "text": "func SetHonoProbes(container *corev1.Container) {\n\n\tcontainer.ReadinessProbe = install.ApplyHttpProbe(container.ReadinessProbe, 10, \"/readiness\", 8088)\n\tcontainer.LivenessProbe = install.ApplyHttpProbe(container.LivenessProbe, 10, \"/liveness\", 8088)\n\n}", "title": "" }, { "docid": "999278a5ac9e3b3e9074b8560bba1379", "score": "0.48346242", "text": "func (epPolicyMaps *endpointPolicyStatusMap) Update(endpointID uint16, policyStatus models.EndpointPolicyEnabled) {\n\tepPolicyMaps.mutex.Lock()\n\tepPolicyMaps.m[endpointID] = policyStatus\n\tepPolicyMaps.mutex.Unlock()\n\tendpointPolicyStatus.UpdateMetrics()\n}", "title": "" }, { "docid": "b72d31104b2b855fe468f9758aaef818", "score": "0.4798884", "text": "func (tb *table) UpdateMetrics(m *TableMetrics) {\n\ttb.ptwsLock.Lock()\n\tfor _, ptw := range tb.ptws {\n\t\tptw.pt.UpdateMetrics(&m.partitionMetrics)\n\t\tm.PartitionsRefCount += atomic.LoadUint64(&ptw.refCount)\n\t}\n\ttb.ptwsLock.Unlock()\n}", "title": "" }, { "docid": "05d94a37bfccfeadb66073c48726c7ec", "score": "0.47922722", "text": "func (o *FeaturepropPub) 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\tfeaturepropPubUpdateCacheMut.RLock()\n\tcache, cached := featurepropPubUpdateCache[key]\n\tfeaturepropPubUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(featurepropPubColumns, featurepropPubPrimaryKeyColumns, whitelist)\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"chado: unable to update featureprop_pub, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"featureprop_pub\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, featurepropPubPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(featurepropPubType, featurepropPubMapping, append(wl, featurepropPubPrimaryKeyColumns...))\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, \"chado: unable to update featureprop_pub row\")\n\t}\n\n\tif !cached {\n\t\tfeaturepropPubUpdateCacheMut.Lock()\n\t\tfeaturepropPubUpdateCache[key] = cache\n\t\tfeaturepropPubUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "71dd4f8c2e8dd202467d1280f10a0615", "score": "0.47780007", "text": "func (o *PolicyLinks) Update() (*restapi.GenericMapResponse, error) {\n\toldplinks, rev, err := o.GetPlinks()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Only change plinks order, not insert or delete any from the list\n\tif len(o.Plinks) != len(oldplinks) {\n\t\treturn nil, fmt.Errorf(\"There are %d defined polices but there are %d existing policies in the tenant\", len(o.Plinks), len(oldplinks))\n\t}\n\n\tvar newplinks []map[string]interface{}\n\tfor _, v := range o.Plinks {\n\t\tfound := findItem(\"ID\", v.ID, oldplinks)\n\t\tif found == nil {\n\t\t\t// Can't find a matched ID in tenant plinks, return error\n\t\t\treturn nil, fmt.Errorf(\"Policy %s not found in policy list\", v.ID)\n\t\t}\n\t\tnewplinks = append(newplinks, found)\n\t}\n\n\tvar queryArg = make(map[string]interface{})\n\tqueryArg[\"Plinks\"] = newplinks\n\tqueryArg[\"RevStamp\"] = rev\n\n\tLogD.Printf(\"Generated Map for Update(): %+v\", queryArg)\n\tresp, err := o.client.CallGenericMapAPI(o.apiUpdate, queryArg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !resp.Success {\n\t\treturn nil, errors.New(resp.Message)\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "e0ce2d469f296d751ae4e88f2ae9a863", "score": "0.47450462", "text": "func updatePeerList(heartBeat *data.HeartBeatData) {\n\tPeers.Add(heartBeat.Addr, heartBeat.Id)\n\tPeers.InjectPeerMapJson(heartBeat.PeerMapJson, SELF_ADDR)\n\n\tPeers.AddPid(heartBeat.Addr, heartBeat.Pid) //p5\n\tPeers.InjectPeerMapPidJson(heartBeat.PeerMapPidJson, SELF_ADDR)\n}", "title": "" }, { "docid": "ed4cedb76890ffaa737bdab14ff7fe27", "score": "0.470423", "text": "func (p *Pool) Update() {\n p.Lock()\n\n resp, err := p.Client.DescribeInstances(&ec2.DescribeInstancesInput{\n MaxResults: aws.Int64(1000),\n Filters: []*ec2.Filter{&ec2.Filter{Name: aws.String(\"vpc-id\"), Values: []*string{aws.String(p.Vpc)}}},\n })\n if err != nil {\n log.Println(err)\n return\n }\n\n p.Running, p.Stopped = []*ec2.Instance{}, []*ec2.Instance{}\n instances := []*ec2.Instance{}\n // \"We need to go deeper\" -- Inception\n for _, reservation := range resp.Reservations {\n for _, instance := range reservation.Instances {\n for _, tag := range instance.Tags {\n if *tag.Key == \"Name\" {\n if p.Filter.Match([]byte(*tag.Value)) {\n instances = append(instances, instance)\n }\n }\n }\n }\n }\n\n for _, instance := range instances {\n switch *instance.State.Name {\n case \"running\":\n p.Running = append(p.Running, instance)\n case \"stopped\":\n p.Stopped = append(p.Stopped, instance)\n }\n }\n\n if len(p.Running) > 0 || len(p.Stopped) > 0 {\n p.Available = true\n }\n\n p.Unlock()\n\n log.Printf(\"[%s - %s] Pool updated - Running: %s - Stopped: %s\\n\",\n p.Vpc, p.FilterString, p.ListString(\"running\"), p.ListString(\"stopped\"))\n}", "title": "" }, { "docid": "abd3a204cb833ff1d8f11ece3b217c83", "score": "0.4690882", "text": "func (epPolicyMaps *endpointPolicyStatusMap) UpdateMetrics() {\n\tpolicyStatus := map[models.EndpointPolicyEnabled]float64{\n\t\tmodels.EndpointPolicyEnabledNone: 0,\n\t\tmodels.EndpointPolicyEnabledEgress: 0,\n\t\tmodels.EndpointPolicyEnabledIngress: 0,\n\t\tmodels.EndpointPolicyEnabledBoth: 0,\n\t\tmodels.EndpointPolicyEnabledAuditDashEgress: 0,\n\t\tmodels.EndpointPolicyEnabledAuditDashIngress: 0,\n\t\tmodels.EndpointPolicyEnabledAuditDashBoth: 0,\n\t}\n\n\tepPolicyMaps.mutex.Lock()\n\tfor _, value := range epPolicyMaps.m {\n\t\tpolicyStatus[value]++\n\t}\n\tepPolicyMaps.mutex.Unlock()\n\n\tfor k, v := range policyStatus {\n\t\tmetrics.PolicyEndpointStatus.WithLabelValues(string(k)).Set(v)\n\t}\n}", "title": "" }, { "docid": "63bbd30346e4f9775ff2d23ed1de3481", "score": "0.4688558", "text": "func (r Probes) GetProbes() []*Probe {\n\treturn []*Probe(r)\n}", "title": "" }, { "docid": "4b13c48aefd6a683a89ba62e2f651496", "score": "0.46628278", "text": "func (e *updateE2e) Update(ctx context.Context) func(*testing.T) {\n\tfp := driver.Fingerprint(uuid.New().String())\n\treturn func(t *testing.T) {\n\t\tctx := zlog.Test(ctx, t)\n\t\te.updateOps = make([]driver.UpdateOperation, 0, e.Updates)\n\t\tfor _, vs := range e.vulns() {\n\t\t\tref, err := e.s.UpdateVulnerabilities(ctx, e.updater, fp, vs)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"failed to perform update: %v\", err)\n\t\t\t}\n\n\t\t\t// attach generated UpdateOperations to test retrieval\n\t\t\t// date can be ignored. add in stack order to compare\n\t\t\te.updateOps = append(e.updateOps, driver.UpdateOperation{\n\t\t\t\tRef: ref,\n\t\t\t\tFingerprint: fp,\n\t\t\t\tUpdater: e.updater,\n\t\t\t})\n\n\t\t\tcheckInsertedVulns(ctx, t, e.pool, ref, vs)\n\t\t}\n\t\tt.Log(\"ok\")\n\t}\n}", "title": "" }, { "docid": "7bb01eca982e10fec713fc507f9238bd", "score": "0.4646186", "text": "func Update() {\n\tlog.Info(\"updating vulnerabilities\")\n\n\t// Fetch updates in parallel.\n\tvar status = true\n\tvar responseC = make(chan *FetcherResponse, 0)\n\tfor n, f := range fetchers {\n\t\tgo func(name string, fetcher Fetcher) {\n\t\t\tresponse, err := fetcher.FetchUpdate()\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"an error occured when fetching update '%s': %s.\", name, err)\n\t\t\t\tstatus = false\n\t\t\t\tresponseC <- nil\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tresponseC <- &response\n\t\t}(n, f)\n\t}\n\n\t// Collect results of updates.\n\tvar responses []*FetcherResponse\n\tvar notes []string\n\tfor i := 0; i < len(fetchers); {\n\t\tselect {\n\t\tcase resp := <-responseC:\n\t\t\tif resp != nil {\n\t\t\t\tresponses = append(responses, resp)\n\t\t\t\tnotes = append(notes, resp.Notes...)\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t}\n\n\tclose(responseC)\n\n\t// TODO(Quentin-M): Merge responses together\n\t// TODO(Quentin-M): Complete informations using NVD\n\n\t// Store flags out of the response struct.\n\tflags := make(map[string]string)\n\tfor _, response := range responses {\n\t\tif response.FlagName != \"\" && response.FlagValue != \"\" {\n\t\t\tflags[response.FlagName] = response.FlagValue\n\t\t}\n\t}\n\n\t// Update health notes.\n\thealthNotes = notes\n\n\t// Build list of packages.\n\tvar packages []*database.Package\n\tfor _, response := range responses {\n\t\tfor _, v := range response.Vulnerabilities {\n\t\t\tpackages = append(packages, v.FixedIn...)\n\t\t}\n\t}\n\n\t// Insert packages into the database.\n\tlog.Tracef(\"beginning insertion of %d packages for update\", len(packages))\n\tt := time.Now()\n\terr := database.InsertPackages(packages)\n\tlog.Tracef(\"inserting %d packages took %v\", len(packages), time.Since(t))\n\tif err != nil {\n\t\tlog.Errorf(\"an error occured when inserting packages for update: %s\", err)\n\t\tupdateHealth(false)\n\t\treturn\n\t}\n\tpackages = nil\n\n\t// Build a list of vulnerabilties.\n\tvar vulnerabilities []*database.Vulnerability\n\tfor _, response := range responses {\n\t\tfor _, v := range response.Vulnerabilities {\n\t\t\tvar packageNodes []string\n\t\t\tfor _, pkg := range v.FixedIn {\n\t\t\t\tpackageNodes = append(packageNodes, pkg.Node)\n\t\t\t}\n\t\t\tvulnerabilities = append(vulnerabilities, &database.Vulnerability{ID: v.ID, Link: v.Link, Priority: v.Priority, Description: v.Description, FixedInNodes: packageNodes})\n\t\t}\n\t}\n\tresponses = nil\n\n\t// Insert vulnerabilities into the database.\n\tlog.Tracef(\"beginning insertion of %d vulnerabilities for update\", len(vulnerabilities))\n\tt = time.Now()\n\tnotifications, err := database.InsertVulnerabilities(vulnerabilities)\n\tlog.Tracef(\"inserting %d vulnerabilities took %v\", len(vulnerabilities), time.Since(t))\n\tif err != nil {\n\t\tlog.Errorf(\"an error occured when inserting vulnerabilities for update: %s\", err)\n\t\tupdateHealth(false)\n\t\treturn\n\t}\n\tvulnerabilities = nil\n\n\t// Insert notifications into the database.\n\terr = database.InsertNotifications(notifications, database.GetDefaultNotificationWrapper())\n\tif err != nil {\n\t\tlog.Errorf(\"an error occured when inserting notifications for update: %s\", err)\n\t\tupdateHealth(false)\n\t\treturn\n\t}\n\tnotifications = nil\n\n\t// Update flags in the database.\n\tfor flagName, flagValue := range flags {\n\t\tdatabase.UpdateFlag(flagName, flagValue)\n\t}\n\n\t// Update health depending on the status of the fetchers.\n\tupdateHealth(status)\n\n\tlog.Info(\"update finished\")\n}", "title": "" }, { "docid": "eabb5ec72c661ef0e8542e6ec8f6f432", "score": "0.46347737", "text": "func (ab *dsAddrBook) UpdateAddrs(p peer.ID, oldTTL time.Duration, newTTL time.Duration) {\n\tpr, err := ab.loadRecord(p, true, false)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to update ttls for peer %s: %s\\n\", p.Pretty(), err)\n\t\treturn\n\t}\n\n\tpr.Lock()\n\tdefer pr.Unlock()\n\n\tnewExp := ab.clock.Now().Add(newTTL).Unix()\n\tfor _, entry := range pr.Addrs {\n\t\tif entry.Ttl != int64(oldTTL) {\n\t\t\tcontinue\n\t\t}\n\t\tentry.Ttl, entry.Expiry = int64(newTTL), newExp\n\t\tpr.dirty = true\n\t}\n\n\tif pr.clean(ab.clock.Now()) {\n\t\tpr.flush(ab.ds)\n\t}\n}", "title": "" }, { "docid": "f386b8349aef575566ace595dbba9ba6", "score": "0.46278247", "text": "func (j JobsOp) UpdateEncodeProbeByID(id int64, jsonString string) error {\n\tconst query = `UPDATE encode SET probe = $1 WHERE id = $2`\n\n\tdb, _ := ConnectDB()\n\ttx := db.MustBegin()\n\t_, err := tx.Exec(query, jsonString, id)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\ttx.Commit()\n\n\tdb.Close()\n\treturn nil\n}", "title": "" }, { "docid": "313f9cf36815e4bd8c6167f6486a656f", "score": "0.46088758", "text": "func (p *AviPlugin) UpdatePoolMembers(poolname string, new_members map[string]int) error {\n\tpool, err := p.EnsurePoolExists(poolname)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcurrent_members := getPoolMembers(pool)\n\n\tif reflect.DeepEqual(current_members, new_members) {\n\t\tglog.V(4).Infof(\"New members same as the existing members!\")\n\t\treturn nil\n\t}\n\n\t// new members not same as the old one; just do a new pool update with new members\n\tpool_uuid := pool[\"uuid\"].(string)\n\tnmembers := make([]interface{}, 0)\n\tfor memberip, memberport := range new_members {\n\t\tserver := make(map[string]interface{})\n\t\tip := make(map[string]interface{})\n\t\tip[\"type\"] = \"V4\"\n\t\tip[\"addr\"] = memberip\n\t\tserver[\"ip\"] = ip\n\t\tserver[\"port\"] = memberport\n\t\tnmembers = append(nmembers, server)\n\t\tglog.Errorf(\"nmbers in loop: %s\", nmembers)\n\t}\n\tpool[\"servers\"] = nmembers\n\tglog.Errorf(\"pool after assignment: %s\", pool)\n\tres, err := p.AviSess.Put(\"/api/pool/\"+pool_uuid, pool)\n\tif err != nil {\n\t\tglog.V(4).Infof(\"Avi update Pool failed: %v\", res)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ccf3dcb6cc10238e5fd730cddafdf2c", "score": "0.45911604", "text": "func (ps *PeerStore) Update(ih store.InfoHash, p store.Peer) error {\n\terr := ps.client.HSet(peerKey(ih, p.PeerID), map[string]interface{}{\n\t\t\"speed_up\": p.SpeedUP,\n\t\t\"speed_dn\": p.SpeedDN,\n\t\t\"speed_up_max\": p.SpeedUPMax,\n\t\t\"speed_dn_max\": p.SpeedDNMax,\n\t\t\"uploaded\": p.Uploaded,\n\t\t\"downloaded\": p.Downloaded,\n\t\t\"total_left\": p.Left,\n\t\t\"announces\": p.Announces,\n\t\t\"total_time\": p.TotalTime,\n\t\t\"last_announce\": util.TimeToString(p.AnnounceLast),\n\t\t\"first_announce\": util.TimeToString(p.AnnounceFirst),\n\t}).Err()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to Update\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3dad86d0b52404bf575ca56662c3b49b", "score": "0.45842528", "text": "func (p *Profile) Update(pc cpu.Word, s *cpu.Storage) {\n\tp.Data[pc].Count++\n}", "title": "" }, { "docid": "e11b55f352ccdb867a2e87e07ff9a2aa", "score": "0.4575144", "text": "func (c *HAProxyController) updateHAProxySrvs(oldEndpoints, newEndpoints *store.PortEndpoints) {\n\tif oldEndpoints.BackendName == \"\" {\n\t\treturn\n\t}\n\tnewEndpoints.HAProxySrvs = oldEndpoints.HAProxySrvs\n\tnewEndpoints.BackendName = oldEndpoints.BackendName\n\thaproxySrvs := newEndpoints.HAProxySrvs\n\tnewAddresses := newEndpoints.AddrNew\n\t// Disable stale entries from HAProxySrvs\n\t// and provide list of Disabled Srvs\n\tvar disabled []*store.HAProxySrv\n\tfor i, srv := range haproxySrvs {\n\t\tif _, ok := newAddresses[srv.Address]; ok {\n\t\t\tdelete(newAddresses, srv.Address)\n\t\t} else {\n\t\t\thaproxySrvs[i].Address = \"\"\n\t\t\thaproxySrvs[i].Modified = true\n\t\t\tdisabled = append(disabled, srv)\n\t\t}\n\t}\n\n\t// Configure new Addresses in available HAProxySrvs\n\tfor newAddr := range newAddresses {\n\t\tif len(disabled) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tdisabled[0].Address = newAddr\n\t\tdisabled[0].Modified = true\n\t\tdisabled = disabled[1:]\n\t\tdelete(newAddresses, newAddr)\n\t}\n\t// Dynamically updates HAProxy backend servers with HAProxySrvs content\n\tvar addrErr, stateErr error\n\tfor _, srv := range haproxySrvs {\n\t\tif !srv.Modified {\n\t\t\tcontinue\n\t\t}\n\t\tif srv.Address == \"\" {\n\t\t\tlogger.Debugf(\"server '%s/%s' changed status to %v\", newEndpoints.BackendName, srv.Name, \"maint\")\n\t\t\taddrErr = c.Client.SetServerAddr(newEndpoints.BackendName, srv.Name, \"127.0.0.1\", 0)\n\t\t\tstateErr = c.Client.SetServerState(newEndpoints.BackendName, srv.Name, \"maint\")\n\t\t} else {\n\t\t\tlogger.Debugf(\"server '%s/%s' changed status to %v\", newEndpoints.BackendName, srv.Name, \"ready\")\n\t\t\taddrErr = c.Client.SetServerAddr(newEndpoints.BackendName, srv.Name, srv.Address, 0)\n\t\t\tstateErr = c.Client.SetServerState(newEndpoints.BackendName, srv.Name, \"ready\")\n\t\t}\n\t\tif addrErr != nil || stateErr != nil {\n\t\t\tnewEndpoints.DynUpdateFailed = true\n\t\t\tlogger.Error(addrErr)\n\t\t\tlogger.Error(stateErr)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b570e0c0a213b627de337387e11036b2", "score": "0.45520124", "text": "func Update(ingresses controller.IngressEntries, lbs map[string]v1.LoadBalancerStatus, k8sClient k8s.Client) error {\n\tvar updateErrors []error\n\tfor _, ingress := range ingresses {\n\t\tif lb, ok := lbs[ingress.LbScheme]; ok {\n\t\t\tif statusUnchanged(ingress.Ingress.Status.LoadBalancer.Ingress, lb.Ingress) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tingress.Ingress.Status.LoadBalancer.Ingress = lb.Ingress\n\n\t\t\tif err := k8sClient.UpdateIngressStatus(ingress.Ingress); err != nil {\n\t\t\t\tupdateErrors = append(updateErrors, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif totalErrors := len(updateErrors); totalErrors > 0 {\n\t\treturn fmt.Errorf(\"failed to update %d ingresses: %v\", totalErrors, updateErrors)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24a8a550c3c9be1856a6822d30254910", "score": "0.45447093", "text": "func UpdatePBR(log *base.LogObject, status types.DeviceNetworkStatus) {\n\n\tlog.Functionf(\"UpdatePBR: %d ports\", len(status.Ports))\n\t// Track any ifnames which need to have PBR deleted\n\tifnameFound := make(map[string]bool)\n\n\tfor _, u := range status.Ports {\n\t\tifnameFound[u.IfName] = true\n\n\t\tvar addrs []net.IP\n\t\tfor _, ai := range u.AddrInfoList {\n\t\t\taddrs = append(addrs, ai.Addr)\n\t\t}\n\t\tif oldAddrs, ok := ifnameHasPBR[u.IfName]; ok {\n\t\t\tif reflect.DeepEqual(oldAddrs, addrs) {\n\t\t\t\tlog.Functionf(\"Ifname %s already has PBR\",\n\t\t\t\t\tu.IfName)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlog.Functionf(\"Ifname %s PBR changed from %v to %v\",\n\t\t\t\tu.IfName, oldAddrs, addrs)\n\t\t\tdelPBR(log, status, u.IfName)\n\t\t\taddPBR(log, status, u.IfName, addrs)\n\t\t\tifnameHasPBR[u.IfName] = addrs\n\t\t\tcontinue\n\t\t}\n\t\taddPBR(log, status, u.IfName, addrs)\n\t\tifnameHasPBR[u.IfName] = addrs\n\t}\n\tfor old := range ifnameHasPBR {\n\t\tif _, ok := ifnameFound[old]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tdelPBR(log, status, old)\n\t\tdelete(ifnameHasPBR, old)\n\t}\n}", "title": "" }, { "docid": "e9c2e7c7eace6f142e531c827f3d6762", "score": "0.45423457", "text": "func getProbeIndexes(n *int32) (probes []int32) {\n\tl := len(framework.Config.Hardware.Probes)\n\tif n == nil || *n < 0 {\n\t\tprobes = make([]int32, l)\n\t\tfor i := 0; i < l; i++ {\n\t\t\tprobes[i] = int32(i)\n\t\t}\n\t} else {\n\t\tprobes = make([]int32, 1)\n\t\tprobes[0] = *n\n\t}\n\treturn\n}", "title": "" }, { "docid": "14b77a802eda243a77c7f49a3e536104", "score": "0.45293224", "text": "func (in *WebSphereLibertyApplicationProbes) DeepCopy() *WebSphereLibertyApplicationProbes {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebSphereLibertyApplicationProbes)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d12d0bd989fee111a032b45fef4aaecb", "score": "0.4512141", "text": "func (e *Endpoints) Update(endpointsEvents chan *v1.Endpoints) {\n\tfor endpoints := range endpointsEvents {\n\t\te.SetEndpoints(endpoints)\n\t}\n}", "title": "" }, { "docid": "7c4475c243f12925faeb83498dff273b", "score": "0.45015106", "text": "func (s *ProfileStorage) Update(p model.Profile) error {\n\tvar prof model.Profile\n\terror := s.db.SelectOne(&prof, \"select * from profiles where profile_id = $1 limit 1\", p.Pid)\n\tprof.NumTrips = p.NumTrips\n\tif error != nil {\n\t\treturn error\n\t}\t\n\tprof.User = p.User\n\t_, err := s.db.Update(&prof)\n\treturn err\n}", "title": "" }, { "docid": "9ec08f70c2bffe1fd896d840697626d2", "score": "0.44631848", "text": "func (m *Monitoring) Update() {}", "title": "" }, { "docid": "40fa5e878745a5154618e905bd5c8e6e", "score": "0.44477713", "text": "func (h *profiles) Update(a *api.Profile) (*api.Profile, error) {\n\treturn a, h.c.update(*a, h)\n}", "title": "" }, { "docid": "4c9287dc1f2786270a78c67bbec78146", "score": "0.44457647", "text": "func (ei *EngineInstance) updateInUseBdevs(ctx context.Context, ctrlrs []storage.NvmeController, ms uint64, rs uint64) ([]storage.NvmeController, error) {\n\tctrlrMap := make(map[string]*storage.NvmeController)\n\tfor idx, ctrlr := range ctrlrs {\n\t\tif _, exists := ctrlrMap[ctrlr.PciAddr]; exists {\n\t\t\treturn nil, errors.Errorf(\"duplicate entries for controller %s\",\n\t\t\t\tctrlr.PciAddr)\n\t\t}\n\n\t\t// Clear SMD info for controllers to remove stale stats.\n\t\tctrlrs[idx].SmdDevices = []*storage.SmdDevice{}\n\t\t// Update controllers in input slice through map by reference.\n\t\tctrlrMap[ctrlr.PciAddr] = &ctrlrs[idx]\n\t}\n\n\tsmdDevs, err := ei.ListSmdDevices(ctx, new(ctlpb.SmdDevReq))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"list smd devices\")\n\t}\n\tei.log.Debugf(\"engine %d: smdDevs %+v\", ei.Index(), smdDevs)\n\n\thasUpdatedHealth := make(map[string]bool)\n\tfor _, smd := range smdDevs.Devices {\n\t\tmsg := fmt.Sprintf(\"instance %d: smd %s: ctrlr %s\", ei.Index(), smd.Uuid,\n\t\t\tsmd.TrAddr)\n\n\t\tctrlr, exists := ctrlrMap[smd.GetTrAddr()]\n\t\tif !exists {\n\t\t\tei.log.Errorf(\"%s: ctrlr not found\", msg)\n\t\t\tcontinue\n\t\t}\n\n\t\tsmdDev, err := ei.getSmdDetails(smd)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"%s: collect smd info\", msg)\n\t\t}\n\t\tsmdDev.MetaSize = ms\n\t\tsmdDev.RdbSize = rs\n\n\t\tpbStats, err := ei.GetBioHealth(ctx, &ctlpb.BioHealthReq{DevUuid: smdDev.UUID, MetaSize: ms, RdbSize: rs})\n\t\tif err != nil {\n\t\t\t// Log the error if it indicates non-existent health and the SMD entity has\n\t\t\t// an abnormal state. Otherwise it is expected that health may be missing.\n\t\t\tstatus, ok := errors.Cause(err).(daos.Status)\n\t\t\tif ok && status == daos.Nonexistent && smdDev.NvmeState != storage.NvmeStateNormal {\n\t\t\t\tei.log.Debugf(\"%s: stats not found (device state: %q), skip update\",\n\t\t\t\t\tmsg, smdDev.NvmeState.String())\n\t\t\t} else {\n\t\t\t\tei.log.Errorf(\"%s: fetch stats: %s\", msg, err.Error())\n\t\t\t}\n\t\t\tctrlr.UpdateSmd(smdDev)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Populate space usage for each SMD device from health stats.\n\t\tsmdDev.TotalBytes = pbStats.TotalBytes\n\t\tsmdDev.AvailBytes = pbStats.AvailBytes\n\t\tsmdDev.ClusterSize = pbStats.ClusterSize\n\t\tsmdDev.MetaWalSize = pbStats.MetaWalSize\n\t\tsmdDev.RdbWalSize = pbStats.RdbWalSize\n\t\tmsg = fmt.Sprintf(\"%s: smd usage = %s/%s\", msg, humanize.Bytes(smdDev.AvailBytes),\n\t\t\thumanize.Bytes(smdDev.TotalBytes))\n\t\tctrlr.UpdateSmd(smdDev)\n\n\t\t// Multiple SMD entries for the same address key may exist when there are multiple\n\t\t// NVMe namespaces (and resident blobstores) exist on a single controller. In this\n\t\t// case only update once as health stats will be the same for each.\n\t\tif hasUpdatedHealth[ctrlr.PciAddr] {\n\t\t\tcontinue\n\t\t}\n\t\tctrlr.HealthStats = new(storage.NvmeHealth)\n\t\tif err := convert.Types(pbStats, ctrlr.HealthStats); err != nil {\n\t\t\tei.log.Errorf(\"%s: update ctrlr health: %s\", msg, err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tei.log.Debugf(\"%s: ctrlr health updated\", msg)\n\t\thasUpdatedHealth[ctrlr.PciAddr] = true\n\t}\n\n\treturn ctrlrs, nil\n}", "title": "" }, { "docid": "2385d7a668c561b9e4331b235ed02712", "score": "0.4444473", "text": "func (s *ProbeStats) incrPerfEventsUpdateLost(count uint64) {\n\tatomic.AddUint64(&s.PerfEventsUpdateLost, count)\n}", "title": "" }, { "docid": "6b665c6485b708949b907cfa8aea30f7", "score": "0.44339454", "text": "func (p *Planner) setNDMProbeDefaultsIfNotSet() error {\n\t// Check if NDM probes field is set or not, if not\n\t// then initialize it in order to fill the defaults.\n\tif p.ObservedOpenEBS.Spec.NDMDaemon.Probes == nil {\n\t\tp.ObservedOpenEBS.Spec.NDMDaemon.Probes = &types.NDMProbes{}\n\t}\n\t// Initialize Udev probe if not set\n\tif p.ObservedOpenEBS.Spec.NDMDaemon.Probes.Udev == nil {\n\t\tp.ObservedOpenEBS.Spec.NDMDaemon.Probes.Udev = &types.ProbeState{}\n\t}\n\t// Enable Udev probe if the field is not set i.e. set the\n\t// value to true.\n\t// TODO: Validate the values that can be provided for this\n\t// field.\n\tif p.ObservedOpenEBS.Spec.NDMDaemon.Probes.Udev.Enabled == nil {\n\t\tp.ObservedOpenEBS.Spec.NDMDaemon.Probes.Udev.Enabled = new(bool)\n\t\t*p.ObservedOpenEBS.Spec.NDMDaemon.Probes.Udev.Enabled = true\n\t}\n\t// Initialize Smart probe if not set\n\tif p.ObservedOpenEBS.Spec.NDMDaemon.Probes.Smart == nil {\n\t\tp.ObservedOpenEBS.Spec.NDMDaemon.Probes.Smart = &types.ProbeState{}\n\t}\n\t// Enable Smart probe if the field is not set i.e. set the\n\t// value to true.\n\t// TODO: Validate the values that can be provided for this\n\t// field.\n\tif p.ObservedOpenEBS.Spec.NDMDaemon.Probes.Smart.Enabled == nil {\n\t\tp.ObservedOpenEBS.Spec.NDMDaemon.Probes.Smart.Enabled = new(bool)\n\t\t*p.ObservedOpenEBS.Spec.NDMDaemon.Probes.Smart.Enabled = true\n\t}\n\t// Initialize Seachest probe if not set\n\tif p.ObservedOpenEBS.Spec.NDMDaemon.Probes.Seachest == nil {\n\t\tp.ObservedOpenEBS.Spec.NDMDaemon.Probes.Seachest = &types.ProbeState{}\n\t}\n\t// Disable Seachest probe if the field is not set i.e. set the\n\t// value to false.\n\t// TODO: Validate the values that can be provided for this\n\t// field.\n\tif p.ObservedOpenEBS.Spec.NDMDaemon.Probes.Seachest.Enabled == nil {\n\t\tp.ObservedOpenEBS.Spec.NDMDaemon.Probes.Seachest.Enabled = new(bool)\n\t\t*p.ObservedOpenEBS.Spec.NDMDaemon.Probes.Seachest.Enabled = false\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "61ffb66d294acf2a41aad6b8a66575d8", "score": "0.44281262", "text": "func (o *Prospect) 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\tprospectUpdateCacheMut.RLock()\n\tcache, cached := prospectUpdateCache[key]\n\tprospectUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tprospectAllColumns,\n\t\t\tprospectPrimaryKeyColumns,\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 prospects, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"prospects\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, prospectPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(prospectType, prospectMapping, append(wl, prospectPrimaryKeyColumns...))\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 prospects 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 prospects\")\n\t}\n\n\tif !cached {\n\t\tprospectUpdateCacheMut.Lock()\n\t\tprospectUpdateCache[key] = cache\n\t\tprospectUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "63e372179831da4f58d0226c5b4108c6", "score": "0.44162643", "text": "func (c *bcacheCollector) Update(ch chan<- prometheus.Metric) error {\n\tvar stats []*bcache.Stats\n\tvar err error\n\tif *priorityStats {\n\t\tstats, err = c.fs.Stats()\n\t} else {\n\t\tstats, err = c.fs.StatsWithoutPriority()\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve bcache stats: %w\", err)\n\t}\n\n\tfor _, s := range stats {\n\t\tc.updateBcacheStats(ch, s)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "45d4bd40cffb7ba8046df94b8e7343e6", "score": "0.44151327", "text": "func getProbes() prober.Probes {\n\tcreateOnce.Do(func() {\n\t\tif !flag.Parsed() {\n\t\t\tflag.Parse()\n\t\t}\n\t\tif *proberDisabled {\n\t\t\tglog.Infof(\"Probes are disabled with -no_probes\\n\")\n\t\t} else {\n\t\t\tallProbes = []*prober.Probe{\n\t\t\t\tgetDnsProbe(),\n\t\t\t}\n\t\t\tallProbes = append(allProbes, getWebProbes()...)\n\t\t}\n\t})\n\tsort.Sort(allProbes)\n\treturn allProbes\n}", "title": "" }, { "docid": "25ff2fa1d8462f0f3dbc6b5d94a7b3c0", "score": "0.4413484", "text": "func (o *FeaturepropPub) UpdateP(exec boil.Executor, whitelist ...string) {\n\terr := o.Update(exec, whitelist...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "8f7b65e10aca1de30941281a67c3974d", "score": "0.43976337", "text": "func (st *Status) Update(service string, status HealthStatus) {\n\tst.mu.Lock()\n\tdefer st.mu.Unlock()\n\n\tst.UpdatedAt = time.Now()\n\tfor i, svc := range st.Report {\n\t\tif svc.Name == service {\n\t\t\tst.Report[i].HealthStatus = status\n\t\t\tst.eb.Publish(string(UPDATE), svc)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "372d6e1bcf7e9bbeb99ef61be3c998ad", "score": "0.43938816", "text": "func Probe(original, override *corev1.Probe) *corev1.Probe {\n\tif override == nil {\n\t\treturn original\n\t}\n\tif original == nil {\n\t\treturn override\n\t}\n\tmerged := *original\n\tif override.Exec != nil {\n\t\tmerged.Exec = override.Exec\n\t}\n\tif override.HTTPGet != nil {\n\t\tmerged.HTTPGet = override.HTTPGet\n\t}\n\tif override.TCPSocket != nil {\n\t\tmerged.TCPSocket = override.TCPSocket\n\t}\n\tif override.InitialDelaySeconds != 0 {\n\t\tmerged.InitialDelaySeconds = override.InitialDelaySeconds\n\t}\n\tif override.TimeoutSeconds != 0 {\n\t\tmerged.TimeoutSeconds = override.TimeoutSeconds\n\t}\n\tif override.PeriodSeconds != 0 {\n\t\tmerged.PeriodSeconds = override.PeriodSeconds\n\t}\n\n\tif override.SuccessThreshold != 0 {\n\t\tmerged.SuccessThreshold = override.SuccessThreshold\n\t}\n\n\tif override.FailureThreshold != 0 {\n\t\tmerged.FailureThreshold = override.FailureThreshold\n\t}\n\treturn &merged\n}", "title": "" }, { "docid": "dd385f25325b7bc27a1eb13a001503fe", "score": "0.4383264", "text": "func TestLearnRUpdate(t *testing.T) {\n\ttestNum := 0 //Used for incrementing\n\tfor _, test := range learnrCrudUpdateResults {\n\t\tsuccess, message := callUpdateLearnR(test.TheLearnr)\n\t\tif success != test.ExpectedTruth {\n\t\t\tt.Fatal(\"Failed at this step: \" + strconv.Itoa(testNum) + \" :\" + message)\n\t\t}\n\t\ttestNum = testNum + 1 //Increment this number for testing\n\t}\n}", "title": "" }, { "docid": "e4f8c34ce423d852b47c4cd9a34abe8e", "score": "0.4379526", "text": "func (s *Deployment) addNodeContainerProbes(nodeContainer *corev1.Container) {\n\tnodeContainer.LivenessProbe = &corev1.Probe{\n\t\tInitialDelaySeconds: int32(65),\n\t\tTimeoutSeconds: int32(10),\n\t\tFailureThreshold: int32(5),\n\t\tHandler: corev1.Handler{\n\t\t\tHTTPGet: &corev1.HTTPGetAction{\n\t\t\t\tPath: \"/v1/health\",\n\t\t\t\tPort: intstr.IntOrString{Type: intstr.String, StrVal: \"api\"},\n\t\t\t},\n\t\t},\n\t}\n\tnodeContainer.ReadinessProbe = &corev1.Probe{\n\t\tInitialDelaySeconds: int32(65),\n\t\tTimeoutSeconds: int32(10),\n\t\tFailureThreshold: int32(5),\n\t\tHandler: corev1.Handler{\n\t\t\tHTTPGet: &corev1.HTTPGetAction{\n\t\t\t\tPath: \"/v1/health\",\n\t\t\t\tPort: intstr.IntOrString{Type: intstr.String, StrVal: \"api\"},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "34cace5df6362fc27a7218b7a233259e", "score": "0.4374177", "text": "func (h *Gh) sendUpdates(fkey string, bucket string, update string) {\n\tfor _, peer := range h.args.Peers {\n\t\tif h.args.CheckMemberAlive(peer) == true {\n\t\t\tlog.Debugln(\"Send update to peer:\", peer)\n\t\t\tupd := &HashUpdate{Peer: h.args.LocalName, BucketName: bucket, Fkey: fkey, Update: update}\n\t\t\tdata, errM := json.Marshal(upd)\n\t\t\tif errM != nil {\n\t\t\t\tlog.Errorln(errM)\n\t\t\t}\n\t\t\tbuff := bytes.NewBuffer(data)\n\t\t\tlog.Debugln(peer)\n\t\t\treq, err := http.NewRequest(\"POST\", \"http://\"+peer, buff)\n\t\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t\t\tclient := &http.Client{}\n\t\t\tresp, err := client.Do(req)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorln(err)\n\t\t\t} else {\n\t\t\t\tresp.Body.Close()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c554f0ce4ccfae8e3d4cd9957d67c267", "score": "0.43716925", "text": "func (endpointsStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {\n}", "title": "" }, { "docid": "cd9e50ba47702fb7707094d922f166f1", "score": "0.43541476", "text": "func (ps PeerStore) Update(ih model.InfoHash, p *model.Peer) error {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "a4af5d26d5dd386c92981be5e9ec38ad", "score": "0.43477824", "text": "func hasProbeChanged(currentProbe *corev1.Probe, revisedProbe *corev1.Probe) bool {\n\tif currentProbe == nil {\n\t\treturn revisedProbe != nil\n\t}\n\tif currentProbe.InitialDelaySeconds != revisedProbe.InitialDelaySeconds {\n\t\treturn true\n\t}\n\tif currentProbe.TimeoutSeconds != revisedProbe.TimeoutSeconds {\n\t\treturn true\n\t}\n\tif currentProbe.PeriodSeconds != revisedProbe.PeriodSeconds {\n\t\treturn true\n\t}\n\tif currentProbe.FailureThreshold != revisedProbe.FailureThreshold {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f996ca28bd9f4f0444b097de0c7ca82d", "score": "0.43340784", "text": "func initProbSlice(p []prob) {\n\tfor i := range p {\n\t\tp[i] = probInit\n\t}\n}", "title": "" }, { "docid": "abf2d1da682a2a955155f252b194c912", "score": "0.4330716", "text": "func (in *Probes) DeepCopy() *Probes {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Probes)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "abf2d1da682a2a955155f252b194c912", "score": "0.4330716", "text": "func (in *Probes) DeepCopy() *Probes {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Probes)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "abf2d1da682a2a955155f252b194c912", "score": "0.4330716", "text": "func (in *Probes) DeepCopy() *Probes {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Probes)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7aa0c44e48ef556c35ce969c196b9494", "score": "0.4325252", "text": "func (s *ProbeStats) incrPerfEventsUpdate() {\n\tatomic.AddUint64(&s.PerfEventsUpdate, 1)\n\ts.incrPerfEventsTotal()\n}", "title": "" }, { "docid": "5a1b3c41c0d95dcaef246e7623ff258a", "score": "0.4324253", "text": "func (m *NvidiaDevicePlugin) Update(devs []*pluginapi.Device) {\n\tm.update <- devs\n}", "title": "" }, { "docid": "4c9d74b440a6bac3e577af82666532a4", "score": "0.4322159", "text": "func (b *Backend) Probe() {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tmatches, err := b.Find(ctx, \"*\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\ttlds := make(map[string]struct{})\n\tfor _, m := range matches.Matches {\n\t\ttlds[m.Path] = struct{}{}\n\t}\n\n\tb.mutex.Lock()\n\tb.tlds = tlds\n\tb.mutex.Unlock()\n}", "title": "" }, { "docid": "2c7e12192d77c022c6e94eb08628ded7", "score": "0.43163797", "text": "func UpdateInfo(a *network.Agent, params []interface{}) (p *proto.ProtocolBytes, isEmpty bool) {\n\treturn nil,true\n}", "title": "" }, { "docid": "9a8848e8cb2379f1e97dbe39aac3db7d", "score": "0.43147698", "text": "func updateAllToCheckRegistration(db gorp.SqlExecutor) error {\n\tquery := `UPDATE worker_model SET check_registration = $1`\n\tres, err := db.Exec(query, true)\n\tif err != nil {\n\t\treturn sdk.WithStack(err)\n\t}\n\trows, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn sdk.WithStack(err)\n\t}\n\tlog.Debug(context.Background(), \"updateAllToCheckRegistration> %d worker model(s) check registration\", rows)\n\treturn nil\n}", "title": "" }, { "docid": "f83d148533edb111ce74aad9d25e7d58", "score": "0.43055865", "text": "func (s *FSMSuite) TestProbingUnsuccessfull(c *C) {\n\tendpoints := newW(0.5, 0.5, 0, 0, 0)\n\tf := s.newF(endpoints)\n\n\tadjusted, err := f.AdjustWeights()\n\n\t// It will adjust weight and set timer\n\tc.Assert(err, IsNil)\n\tc.Assert(getWeights(adjusted), DeepEquals, []int{1, 1, FSMGrowFactor, FSMGrowFactor, FSMGrowFactor})\n\tfor _, a := range adjusted {\n\t\ta.GetEndpoint().setEffectiveWeight(a.GetWeight())\n\t}\n\t// Times has passed and good endpoint appears to behave worse now, oh no!\n\tfor _, e := range endpoints {\n\t\te.GetMeter().(*metrics.TestMeter).Rate = 0.5\n\t}\n\ts.advanceTime(endpoints[0].meter.GetWindowSize()/2 + time.Second)\n\n\t// As long as all endpoints are equally bad now, we will revert weights back\n\tadjusted, err = f.AdjustWeights()\n\tc.Assert(err, IsNil)\n\tc.Assert(getWeights(adjusted), DeepEquals, []int{1, 1, 1, 1, 1})\n}", "title": "" }, { "docid": "2ee443d34321dac2855717eab72605f9", "score": "0.43018723", "text": "func (self *CassClient) UpdateBeacons(beacons []*Beacon) *UpsertResult {\n\ttemplate := `UPDATE beacons SET deploy_name = ?, msg_url = ? WHERE user_id = ? AND name = ? IF EXISTS`\n\tdispatch := newDispatcher()\n\n\tfor _, bkn := range beacons {\n\t\tcmd := []interface{}{\n\t\t\tbkn.DeployName,\n\t\t\tbkn.MsgUrl,\n\t\t\tbkn.UserId,\n\t\t\tbkn.Name,\n\t\t}\n\n\t\tdispatch.Register(func() *UpsertResult {\n\t\t\treturn &UpsertResult{\n\t\t\t\tBatch: nil,\n\t\t\t\tErr: self.Sess.Query(template, cmd...).Exec(),\n\t\t\t}\n\t\t})\n\t}\n\n\tfor i := uint32(0); i < dispatch.Ct; i++ {\n\t\tres := <-dispatch.Ch\n\n\t\tif res.Err != nil {\n\t\t\treturn res\n\t\t}\n\t}\n\n\tres := UpsertResult{\n\t\tErr: nil,\n\t\t// return nil batch b/c theres no collective batch\n\t\tBatch: nil,\n\t}\n\n\treturn &res\n\n}", "title": "" }, { "docid": "0c3ae5822fde3342e3c849292f8c3b22", "score": "0.42932522", "text": "func (p PagerDuty) Notify(results []Result) error {\n\tfor _, result := range results {\n\t\tif !result.Healthy {\n\t\t\tp.Send(result)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f472ca7f0a63a12ae5fa4db87cff7cc0", "score": "0.42926955", "text": "func (priorityClassStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {}", "title": "" }, { "docid": "db02100bc8e2b4b70440c04af614b44c", "score": "0.4286389", "text": "func (db *PostgresRepo) UpdateSieve(test earthworks.GSADataRequest, testID int, sieveID int) (earthworks.GSADataResponse, error) {\n\tquery := `\n\t\tUPDATE gsa_data\n\t\tSET pan, size, mass_retained\n\t\tVALUES ($1, $2, $3)\n\t\tWHERE id = $4 AND test = $5\n\t\tRETURNING id, test, pan, size, mass_retained\n\t`\n\n\tcreated := earthworks.GSADataResponse{}\n\n\terr := db.conn.Get(&created, query, test.Pan, test.Size, test.Retained, sieveID, testID)\n\tif err != nil {\n\t\treturn earthworks.GSADataResponse{}, err\n\t}\n\n\treturn created, nil\n}", "title": "" }, { "docid": "e39b8e4298947edca4724a32136fe186", "score": "0.42766252", "text": "func geneveInterfaceMetricsUpdate() error {\n\tgeneveInterfaceName := \"genev_sys_6081\"\n\tlink, err := netlink.LinkByName(geneveInterfaceName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to lookup link %s: (%v)\", geneveInterfaceName, err)\n\t}\n\tovsInterfaceMetricsDataMap[\"interface_mtu\"].metric.WithLabelValues(\n\t\t\"none\", \"none\", geneveInterfaceName).Set(float64(link.Attrs().MTU))\n\tgeneveInterfaceLinkStateValue := getOvsInterfaceState(link.Attrs().OperState.String())\n\tovsInterfaceMetricsDataMap[\"interface_link_state\"].metric.WithLabelValues(\n\t\t\"none\", \"none\", geneveInterfaceName).Set(geneveInterfaceLinkStateValue)\n\tovsInterfaceMetricsDataMap[\"interface_ifindex\"].metric.WithLabelValues(\n\t\t\"none\", \"none\", geneveInterfaceName).Set(float64(link.Attrs().Index))\n\tsetGeneveInterfaceStatistics(geneveInterfaceName, link)\n\treturn nil\n}", "title": "" }, { "docid": "413d39e1d0f8f776f903b19d864efac6", "score": "0.42748323", "text": "func (e *EMAThroughput) updateMaps() {\n\te.lock.Lock()\n\tif e.testSignalMapsDone != nil {\n\t\tdefer func() {\n\t\t\te.testSignalMapsDone <- struct{}{}\n\t\t}()\n\t}\n\t// short circuit if no traffic\n\tif len(e.currentCounts) == 0 {\n\t\t// No traffic the last interval, don't update anything. This is deliberate to avoid\n\t\t// the average decaying when there's no traffic (comes in bursts, or there's some kind of outage).\n\t\te.lock.Unlock()\n\t\treturn\n\t}\n\t// If there is another updateMaps going, bail\n\tif e.updating {\n\t\te.lock.Unlock()\n\t\treturn\n\t}\n\te.updating = true\n\t// make a local copy of the sample counters for calculation\n\ttmpCounts := e.currentCounts\n\te.currentCounts = make(map[string]float64)\n\te.currentBurstSum = 0\n\te.lock.Unlock()\n\n\te.updateEMA(tmpCounts)\n\n\t// Goal events to send this interval is the total count of events in the EMA\n\t// divided by the desired average sample rate\n\tvar sumEvents float64\n\tfor _, count := range e.movingAverage {\n\t\tsumEvents += math.Max(1, count)\n\t}\n\n\t// Store this for burst detection. This is checked in GetSampleRate\n\t// so we need to grab the lock when we update it.\n\te.lock.Lock()\n\te.burstThreshold = sumEvents * e.BurstMultiple\n\te.lock.Unlock()\n\n\t// Calculate the desired average sample rate per second based on the volume we've received.\n\t// This is the number of events we'd like to let through per adjustment interval.\n\tgoalCount := float64(e.GoalThroughputPerSec) * e.AdjustmentInterval.Seconds()\n\n\t// goalRatio is the goalCount divided by the sum of all the log values - it\n\t// determines what percentage of the total event space belongs to each key\n\tvar logSum float64\n\tfor _, count := range e.movingAverage {\n\t\t// We take the max of (1, count) because count * weight is < 1 for\n\t\t// very small counts, which throws off the logSum and can cause\n\t\t// incorrect samples rates to be computed when throughput is low\n\t\tlogSum += math.Log10(math.Max(1, count))\n\t}\n\tgoalRatio := goalCount / logSum\n\n\tnewSavedSampleRates := calculateSampleRates(goalRatio, e.movingAverage)\n\te.lock.Lock()\n\tdefer e.lock.Unlock()\n\te.savedSampleRates = newSavedSampleRates\n\te.haveData = true\n\te.updating = false\n}", "title": "" }, { "docid": "caf819c9c75f9c967d59b1eeb4422999", "score": "0.42718676", "text": "func (s *ServiceDiscoveryInstance) UpdateParams(params discoveryInstanceParams) error {\n\ts.params = params\n\tfor _, se := range s.services {\n\t\terr := se.confService.UpdateScalingParams(configuration.ScalingParams{\n\t\t\tBaseSlots: s.params.ServerSlotsBase,\n\t\t\tSlotsGrowthType: s.params.SlotsGrowthType,\n\t\t\tSlotsIncrement: s.params.SlotsIncrement,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "caf819c9c75f9c967d59b1eeb4422999", "score": "0.42718676", "text": "func (s *ServiceDiscoveryInstance) UpdateParams(params discoveryInstanceParams) error {\n\ts.params = params\n\tfor _, se := range s.services {\n\t\terr := se.confService.UpdateScalingParams(configuration.ScalingParams{\n\t\t\tBaseSlots: s.params.ServerSlotsBase,\n\t\t\tSlotsGrowthType: s.params.SlotsGrowthType,\n\t\t\tSlotsIncrement: s.params.SlotsIncrement,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a83eaff414b17aa7e0ca6466927709c", "score": "0.426137", "text": "func (downloader *Downloader) updatePiecePriority(peer *Peer) {\n\tlog.Debugf(\"updating piece priority\")\n\tfor _, piece := range downloader.Pieces {\n\t\tpiece.updateAvailability(incrementAvailability, peer)\n\t\tif piece.QueueIndex > -1 {\n\t\t\tdownloader.queue.fixQueue(piece.QueueIndex)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "218695bf6f516f2bd50aece792c4621d", "score": "0.42509323", "text": "func update(p []byte) error {\n\tvar params fdehelper.UpdateParams\n\tif err := json.Unmarshal(p, &params); err != nil {\n\t\treturn err\n\t}\n\n\tpcrProfile, err := buildPCRProtectionProfile(params.ModelParams)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttpm, err := sb.ConnectToDefaultTPM()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot connect to TPM: %v\", err)\n\t}\n\tdefer tpm.Close()\n\n\t// obtain the update key\n\tk, err := sb.ReadSealedKeyObject(sealedKeyFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot read the sealed key: %v\", err)\n\t}\n\t_, authKey, err := k.UnsealFromTPM(tpm, \"\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot unseal: %v\", err)\n\t}\n\n\t// reseal the key\n\treturn sb.UpdateKeyPCRProtectionPolicy(tpm, sealedKeyFile, authKey, pcrProfile)\n}", "title": "" }, { "docid": "95e81745e2abf98f2089fb2dcfd139c5", "score": "0.4245156", "text": "func (o *FeaturepropPub) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range featurepropPubAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9ee564ee5e937e056cb837b1c4e7459f", "score": "0.42416507", "text": "func (m *Manager) UpdateListeners(ctx context.Context, listeners int) error {\n\tdefer m.updateStreamStatus()\n\tm.mu.Lock()\n\tm.status.Listeners = listeners\n\tm.mu.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "02ed3572d295048396a38d5d1073671a", "score": "0.42407787", "text": "func updateCounters(ctx context.Context, partner string, endpoint gocql.UUID, correctCount int) (err error) {\n\tcounts, err := models.TaskCounter.GetCounters(ctx, partner, endpoint)\n\tif err != nil {\n\t\tcounts = []models.TaskCount{{\n\t\t\tManagedEndpointID: endpoint,\n\t\t\tCount: 0,\n\t\t}}\n\t}\n\n\terr = models.TaskCounter.DecreaseCounter(partner, counts, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = models.TaskCounter.IncreaseCounter(partner, []models.TaskCount{{ManagedEndpointID: endpoint, Count: correctCount}}, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6d506179a23270794f46a905f341527c", "score": "0.4233739", "text": "func (o FeaturepropPubSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "895147278f48e0b0093e275eda13aee2", "score": "0.42331275", "text": "func (l *LoadBalancer) UpdateEndpoints(urls []url.URL) {\n\tl.strategy.SetEndpoints(urls)\n}", "title": "" }, { "docid": "656eba812f8df418c96e3b10049e6619", "score": "0.42316386", "text": "func update() {\n\tpmData := pd.PrintmapsData{}\n\tpmData.Data.Type = \"maps\"\n\tpmData.Data.ID = mapID\n\tpmData.Data.Attributes = mapConfig.Metadata\n\n\trequestURL := mapConfig.ServiceURL + \"metadata\"\n\n\tdata, err := json.MarshalIndent(pmData, pd.IndentPrefix, pd.IndexString)\n\tif err != nil {\n\t\tlog.Fatalf(\"error <%v> at json.MarshalIndent()\", err)\n\t}\n\n\treq, err := http.NewRequest(\"PATCH\", requestURL, bytes.NewReader(data))\n\tif err != nil {\n\t\tlog.Fatalf(\"error <%v> at http.NewRequest()\", err)\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/vnd.api+json; charset=utf-8\")\n\treq.Header.Add(\"Accept\", \"application/vnd.api+json; charset=utf-8\")\n\n\tprintRequest(req, true)\n\n\tresp, err := netClient.Do(req)\n\tif err != nil {\n\t\tlog.Fatalf(\"error <%v> at http.Do()\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tprintResponse(resp, true)\n\tprintSuccess(resp, http.StatusOK)\n}", "title": "" }, { "docid": "f5648f333745d60925e81a5e4f36772a", "score": "0.42314762", "text": "func (s *statusSync) updateStatus(newIngressPoint []v1.IngressLoadBalancerIngress) {\n\tings := s.IngressLister.ListIngresses()\n\n\tp := pool.NewLimited(10)\n\tdefer p.Close()\n\n\tbatch := p.Batch()\n\tsort.SliceStable(newIngressPoint, lessLoadBalancerIngress(newIngressPoint))\n\n\tfor _, ing := range ings {\n\t\tcurIPs := ing.Status.LoadBalancer.Ingress\n\t\tsort.SliceStable(curIPs, lessLoadBalancerIngress(curIPs))\n\t\tif ingressSliceEqual(curIPs, newIngressPoint) {\n\t\t\tklog.V(3).InfoS(\"skipping update of Ingress (no change)\", \"namespace\", ing.Namespace, \"ingress\", ing.Name)\n\t\t\tcontinue\n\t\t}\n\n\t\tbatch.Queue(runUpdate(ing, newIngressPoint, s.Client))\n\t}\n\n\tbatch.QueueComplete()\n\tbatch.WaitAll()\n}", "title": "" }, { "docid": "4d4bc5e37c4740dd743772dfcf9b94b3", "score": "0.423122", "text": "func (o *Prospect) doAfterUpdateHooks(exec boil.Executor) (err error) {\n\tfor _, hook := range prospectAfterUpdateHooks {\n\t\tif err := hook(exec, o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "15f4a3eae704a2c70d093ad05520aed3", "score": "0.4228664", "text": "func (o *Statistic) UpdateP(exec boil.Executor, whitelist ...string) {\n\terr := o.Update(exec, whitelist...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "ca8b3d83eaf60fc978756ebeb068c881", "score": "0.42281002", "text": "func (c *PgpolicylogController) onUpdate(oldObj, newObj interface{}) {\n}", "title": "" }, { "docid": "78fd473957c6a03460f45155cee25af8", "score": "0.42263234", "text": "func (db *ProposalDB) updateInProgressProposals() (int, error) {\n\t// statuses defines a list of vote statuses whose proposals may need an update.\n\tstatuses := []pitypes.VoteStatusType{\n\t\tpitypes.VoteStatusType(piapi.PropVoteStatusNotAuthorized),\n\t\tpitypes.VoteStatusType(piapi.PropVoteStatusAuthorized),\n\t\tpitypes.VoteStatusType(piapi.PropVoteStatusStarted),\n\t}\n\n\tvar inProgress []*pitypes.ProposalInfo\n\terr := db.dbP.Select(\n\t\tq.Or(\n\t\t\tq.Eq(\"VoteStatus\", statuses[0]),\n\t\t\tq.Eq(\"VoteStatus\", statuses[1]),\n\t\t\tq.Eq(\"VoteStatus\", statuses[2]),\n\t\t),\n\t).Find(&inProgress)\n\t// Return an error only if the said error is not 'not found' error.\n\tif err != nil && err != storm.ErrNotFound {\n\t\treturn 0, err\n\t}\n\n\t// count defines the number of total updated records.\n\tvar count int\n\n\tfor _, val := range inProgress {\n\t\tproposal, err := piclient.RetrieveProposalByToken(db.client, db.APIURLpath, val.TokenVal)\n\t\t// Do not update if:\n\t\t// 1. piclient.RetrieveProposalByToken returned an error\n\t\tif err != nil {\n\t\t\t// Since the proposal tokens being updated here are already in the\n\t\t\t// proposals.db. Do not return errors found since they will still be\n\t\t\t// updated when the data is available.\n\t\t\tlog.Errorf(\"RetrieveProposalByToken failed: %v \", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tproposal.Data.ID = val.ID\n\t\tproposal.Data.RefID = val.RefID\n\n\t\t// 2. The new proposal data has not changed.\n\t\tif val.IsEqual(proposal.Data) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// 4. Some or all data returned was empty or invalid.\n\t\tif proposal.Data.TokenVal == \"\" || proposal.Data.TotalVotes < val.TotalVotes {\n\t\t\t// Should help detect when API changes are effected on Politeia's end.\n\t\t\tlog.Warnf(\"invalid or empty data entries were returned for %v\", val.TokenVal)\n\t\t\tcontinue\n\t\t}\n\n\t\terr = db.dbP.Update(proposal.Data)\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"Update for %s failed with error: %v \", val.TokenVal, err)\n\t\t}\n\n\t\tcount++\n\t}\n\treturn count, nil\n}", "title": "" }, { "docid": "8476b3ed17dd2cbf1c1f38a18a76d5ad", "score": "0.42254412", "text": "func (s *Service) Update(newConfigs []interface{}) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tconfigs := make([]Config, len(newConfigs))\n\tfor i, c := range newConfigs {\n\t\tif config, ok := c.(Config); ok {\n\t\t\tconfigs[i] = config\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"unexpected config object type, got %T exp %T\", c, config)\n\t\t}\n\t}\n\n\ts.storeConfigs(configs)\n\tif s.open {\n\t\tpairs := s.pairs()\n\t\tconf := s.prom(pairs)\n\t\tselect {\n\t\tcase <-s.closing:\n\t\t\treturn fmt.Errorf(\"error writing configuration to closed scraper\")\n\t\tcase s.updating <- conf:\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "531520672be58cf52a820f05d672d57f", "score": "0.42252687", "text": "func (db *MemoryDB) Update(source string, fetched time.Time, blocked []string) error {\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\tdb.lists[source] = blocked\n\tdb.lastFetched[source] = fetched\n\treturn nil\n}", "title": "" }, { "docid": "0713e52487bb0389aa5714a9fe051b39", "score": "0.42241696", "text": "func (a *AppRoof) Update(completed_tasks []common.TaskData, time int) {\n\tif time == a.cfg.StartSec {\n\t\ta.populate_im()\n\t}\n\tfor _, t := range completed_tasks {\n\t\tdelete(a.interest_map, t.GetTask())\n\t}\n}", "title": "" }, { "docid": "38d184308b17138600a64bcf0b78b56b", "score": "0.42221785", "text": "func (p *Plugin) periodicUpdates() {\n\tdefer p.wg.Done()\n\n\t// Create GoVPP channel\n\tvppCh, err := p.GoVppmux.NewAPIChannel()\n\tif err != nil {\n\t\tp.Log.Errorf(\"creating channel failed: %v\", err)\n\t\treturn\n\t}\n\tdefer vppCh.Close()\n\n\tp.handler = vppcalls.CompatibleTelemetryHandler(vppCh)\n\n\tp.Log.Debugf(\"starting periodic updates (%v)\", p.updatePeriod)\n\n\tfor {\n\t\tselect {\n\t\t// Delay period between updates\n\t\tcase <-time.After(p.updatePeriod):\n\t\t\tp.updatePrometheus()\n\n\t\t// Plugin has stopped.\n\t\tcase <-p.quit:\n\t\t\tp.Log.Debugf(\"stopping periodic updates\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a8b9a1796dcedb8e53d38f13fc250d89", "score": "0.42210272", "text": "func UpdatePrometheus() {\n\terr := UpdatePrometheusConfig()\n\tif err != nil {\n\t\tlog.Warnf(\"Could not update prometheus configmap: %v\", err)\n\t}\n}", "title": "" }, { "docid": "c2479e32b59b5d3fed9fc7c70f4f61cd", "score": "0.42111522", "text": "func (o *FeaturePub) 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\tfeaturePubUpdateCacheMut.RLock()\n\tcache, cached := featurePubUpdateCache[key]\n\tfeaturePubUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(featurePubColumns, featurePubPrimaryKeyColumns, whitelist)\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"chado: unable to update feature_pub, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"feature_pub\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, featurePubPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(featurePubType, featurePubMapping, append(wl, featurePubPrimaryKeyColumns...))\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, \"chado: unable to update feature_pub row\")\n\t}\n\n\tif !cached {\n\t\tfeaturePubUpdateCacheMut.Lock()\n\t\tfeaturePubUpdateCache[key] = cache\n\t\tfeaturePubUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "1ac0efc98401c81086e898c5c57a447d", "score": "0.42105848", "text": "func (pb *prober) probe(probeType probeType, pod *v1.Pod, status v1.PodStatus, container v1.Container, containerID kubecontainer.ContainerID) (results.Result, error) {\n\tvar probeSpec *v1.Probe\n\tswitch probeType {\n\tcase readiness:\n\t\tprobeSpec = container.ReadinessProbe\n\tcase liveness:\n\t\tprobeSpec = container.LivenessProbe\n\tcase startup:\n\t\tprobeSpec = container.StartupProbe\n\tdefault:\n\t\treturn results.Failure, fmt.Errorf(\"unknown probe type: %q\", probeType)\n\t}\n\n\tif probeSpec == nil {\n\t\tklog.InfoS(\"Probe is nil\", \"probeType\", probeType, \"pod\", klog.KObj(pod), \"podUID\", pod.UID, \"containerName\", container.Name)\n\t\treturn results.Success, nil\n\t}\n\n\tresult, output, err := pb.runProbeWithRetries(probeType, probeSpec, pod, status, container, containerID, maxProbeRetries)\n\tif err != nil || (result != probe.Success && result != probe.Warning) {\n\t\t// Probe failed in one way or another.\n\t\tif err != nil {\n\t\t\tklog.V(1).ErrorS(err, \"Probe errored\", \"probeType\", probeType, \"pod\", klog.KObj(pod), \"podUID\", pod.UID, \"containerName\", container.Name)\n\t\t\tpb.recordContainerEvent(pod, &container, v1.EventTypeWarning, events.ContainerUnhealthy, \"%s probe errored: %v\", probeType, err)\n\t\t} else { // result != probe.Success\n\t\t\tklog.V(1).InfoS(\"Probe failed\", \"probeType\", probeType, \"pod\", klog.KObj(pod), \"podUID\", pod.UID, \"containerName\", container.Name, \"probeResult\", result, \"output\", output)\n\t\t\tpb.recordContainerEvent(pod, &container, v1.EventTypeWarning, events.ContainerUnhealthy, \"%s probe failed: %s\", probeType, output)\n\t\t}\n\t\treturn results.Failure, err\n\t}\n\tif result == probe.Warning {\n\t\tpb.recordContainerEvent(pod, &container, v1.EventTypeWarning, events.ContainerProbeWarning, \"%s probe warning: %s\", probeType, output)\n\t\tklog.V(3).InfoS(\"Probe succeeded with a warning\", \"probeType\", probeType, \"pod\", klog.KObj(pod), \"podUID\", pod.UID, \"containerName\", container.Name, \"output\", output)\n\t} else {\n\t\tklog.V(3).InfoS(\"Probe succeeded\", \"probeType\", probeType, \"pod\", klog.KObj(pod), \"podUID\", pod.UID, \"containerName\", container.Name)\n\t}\n\treturn results.Success, nil\n}", "title": "" }, { "docid": "0ec17d09e983ca9433462d8a506528e6", "score": "0.42083234", "text": "func (ps *procStat) updateFromSmaps() {\n\t// Verified with:\n\t// cd /proc; for PID in [0-9]*; do PSS=$(echo $(egrep \"^Pss:\" /proc/$PID/smaps 2>/dev/null | egrep -o \"[0-9]+\" | sed -r 's/$/+/' | tr -d '\\n')0 | bc); if [[ $PSS != 0 ]]; then echo \"$PSS kB : $PID : $(cat /proc/$PID/cmdline)\"; fi ; done | sort -n\n\tif ps.smapsTs == stamp || ps.status == DEAD {\n\t\treturn\n\t}\n\tps.smapsTs = stamp\n\tif ps.pfnSmaps == \"\" {\n\t\tps.pfnSmaps = procFileName(ps.pid, \"smaps\")\n\t}\n\terr := fastReadOpen(ps.pfnSmaps)\n\tif err != nil {\n\t\tps.dead(0)\n\t\treturn\n\t}\n\tvar totpss int\n\tvar kw uint32 // The bytes from 'Pss:' can be stored on a single 32b word.\n\tfor {\n\t\tc, err := fastReadByte()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tkw = (kw << 8) + uint32(c)\n\t\tif kw != 0x5073733a { // echo -n \"Pss:\" | od -t x4 --endian=big\n\t\t\tcontinue\n\t\t}\n\t\tkw = 0\n\t\t// We matched \"Pss:\", now search for the digits.\n\t\tvar pss int = 0\n\tWSpaces:\n\t\tc, err = fastReadByte()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tif c == ' ' {\n\t\t\tgoto WSpaces\n\t\t}\n\t\tvar unread = true\n\tDigits:\n\t\tif !unread {\n\t\t\tc, err = fastReadByte()\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else {\n\t\t\tunread = false\n\t\t}\n\t\tif (c >= '0') && (c <= '9') {\n\t\t\tpss = pss*10 + int(c-'0')\n\t\t\tgoto Digits\n\t\t}\n\t\ttotpss += pss\n\t\t// skip the \"kB: sctring.\n\t\t_, _ = fastReadByte()\n\t\t_, _ = fastReadByte()\n\t}\n\tps.pss = uint64(totpss) << 10 // kB to bytes <=> *1024 <=> left shift 10\n}", "title": "" }, { "docid": "9ccb9b7931be7be6a151455e29c593a0", "score": "0.42059347", "text": "func (adb *aerospikedb) Update(ctx context.Context, table string, key string, values map[string][]byte) error {\n\tasKey, err := as.NewKey(adb.ns, table, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\trecord, err := adb.client.Get(nil, asKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbins := as.BinMap{}\n\tvar policy *as.WritePolicy\n\tif record != nil {\n\t\tbins = record.Bins\n\t\tpolicy := as.NewWritePolicy(record.Generation, 0)\n\t\tpolicy.GenerationPolicy = as.EXPECT_GEN_EQUAL\n\t}\n\tfor k, v := range values {\n\t\tbins[k] = v\n\t}\n\treturn adb.client.Put(policy, asKey, bins)\n}", "title": "" }, { "docid": "0a01ec90ac5ab5e086eec5f206c28a37", "score": "0.42051625", "text": "func cmdUpdateProperty(c *cli.Context) error {\n\n\tvar pWeight float64\n\tvar pTargets *TargetFlags\n\tvar pServers []string\n\tvar pLivenessTests []string\n\tvar pEnabled bool = true\n\tvar pDatacenters *arrayFlags\n\tvar pComplete bool = false\n\tvar pTimeout int = defaultTimeout\n\tvar pDryrun bool = false\n\tconfig, err := akamai.GetEdgegridConfig(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconfiggtm.Init(config)\n\n\tif c.NArg() < 2 {\n\t\tcli.ShowCommandHelp(c, c.Command.Name)\n\t\treturn cli.NewExitError(color.RedString(\"domain and property are required\"), 1)\n\t}\n\n\tdomainName := c.Args().Get(0)\n\tpropertyName := c.Args().Get(1)\n\n\t// Changes may be to enabled, weight or servers\n\tpWeight = c.Float64(\"weight\")\n\tpServers = c.StringSlice(\"server\")\n\tpLivenessTests = c.StringSlice(\"liveness_test\")\n\tfmt.Println(\"pLivenessTests: \", pLivenessTests)\n\tif c.IsSet(\"enable\") && c.IsSet(\"disable\") {\n\t\treturn cli.NewExitError(color.RedString(\"must specified either enable or disable.\"), 1)\n\t} else if c.IsSet(\"enable\") {\n\t\tpEnabled = true\n\t} else if c.IsSet(\"disable\") {\n\t\tpEnabled = false\n\t}\n\tpDatacenters = (c.Generic(\"datacenter\")).(*arrayFlags)\n\tpTargets = (c.Generic(\"target\")).(*TargetFlags)\n\tif c.IsSet(\"verbose\") {\n\t\tverboseStatus = true\n\t}\n\tif c.IsSet(\"complete\") {\n\t\tpComplete = true\n\t}\n\tif c.IsSet(\"dryrun\") {\n\t\tpDryrun = true\n\t}\n\tif c.IsSet(\"timeout\") {\n\t\tpTimeout = c.Int(\"timeout\")\n\t}\n\tif c.IsSet(\"datacenter\") && c.IsSet(\"liveness_test\") && (c.IsSet(\"enable\") || c.IsSet(\"disable\")) {\n\t\treturn cli.NewExitError(color.RedString(\"enable/disable can only be applied to either datacenter(s) OR liveness_test(s)\"), 1)\n\t}\n\tif !c.IsSet(\"target\") && !c.IsSet(\"datacenter\") && !c.IsSet(\"liveness_test\") {\n\t\treturn cli.NewExitError(color.RedString(\"datacenter(s), target(s) and/or liveness_test(s)s must be specified\"), 1)\n\t}\n\t// if nicknames specified, add to dcFlags\n\terr = ParseNicknames(pDatacenters.nicknamesList, domainName)\n\tif err != nil {\n\t\tif verboseStatus {\n\t\t\treturn cli.NewExitError(color.RedString(\"Unable to retrieve datacenter list. \"+err.Error()), 1)\n\t\t} else {\n\t\t\treturn cli.NewExitError(color.RedString(\"Unable to retrieve datacenter.\"), 1)\n\t\t}\n\t}\n\tif !c.IsSet(\"datacenter\") && !c.IsSet(\"liveness_test\") && (c.IsSet(\"enable\") || c.IsSet(\"disable\")) {\n\t\treturn cli.NewExitError(color.RedString(\"datacenter(s) or liveness_test(s) must be specified when enable or disable are specified\"), 1)\n\t}\n\tif !c.IsSet(\"datacenter\") && (c.IsSet(\"server\") || c.IsSet(\"weight\")) {\n\t\treturn cli.NewExitError(color.RedString(\"datacenter(s) must be specified when server or weight field changes are specified\"), 1)\n\t}\n\tif c.IsSet(\"liveness_test\") && !(c.IsSet(\"enable\") || c.IsSet(\"disable\")) {\n\t\treturn cli.NewExitError(color.RedString(\"liveness_test(s) specified without enable or disable directive\"), 1)\n\t}\n\tif c.IsSet(\"datacenter\") && !(c.IsSet(\"server\") || c.IsSet(\"weight\") || c.IsSet(\"enable\") || c.IsSet(\"disable\")) {\n\t\treturn cli.NewExitError(color.RedString(\"datacenter(s) specified with no field changes\"), 1)\n\t}\n\tfor _, dcID := range pDatacenters.flagList {\n\t\tif _, ok := pTargets.targetList[dcID]; ok {\n\t\t\treturn cli.NewExitError(color.RedString(\"datacenters and targets cannot be the same\"), 1)\n\t\t}\n\t}\n\tif c.IsSet(\"server\") && len(pDatacenters.flagList) > 1 {\n\t\treturn cli.NewExitError(color.RedString(\"server update may only apply to one datacenter\"), 1)\n\t}\n\tif c.IsSet(\"weight\") && len(pDatacenters.flagList) > 1 {\n\t\treturn cli.NewExitError(color.RedString(\"weight update may only apply to one datacenter\"), 1)\n\t}\n\tif c.IsSet(\"json\") {\n\t\tfmt.Println(fmt.Sprintf(\"Updating property %s\", propertyName))\n\t}\n\n\tproperty, err := configgtm.GetProperty(propertyName, domainName)\n\tif err != nil {\n\t\treturn cli.NewExitError(color.RedString(\"Property not found\"), 1)\n\t}\n\n\tchanges_made := false\n\ttrafficTargets := property.TrafficTargets\n\ttargetsmsg := fmt.Sprintf(\"%s contains %s targets\", property.Name, strconv.Itoa(len(trafficTargets)))\n\tif !c.IsSet(\"json\") {\n\t\tfmt.Println(targetsmsg)\n\t}\n\tfmt.Sprintf(targetsmsg)\n\takamai.StartSpinner(\"Updating Traffic Targets \", \"\")\n\tvar propTargets = map[int]string{}\n\tfor _, traffTarg := range trafficTargets {\n\t\t// Al traffic target fields can be updated via target.\n\t\tif c.IsSet(\"target\") {\n\t\t\tfor _, targ := range pTargets.targets {\n\t\t\t\tpropTargets[traffTarg.DatacenterId] = \"\"\n\t\t\t\tif traffTarg.DatacenterId == targ.DatacenterId {\n\t\t\t\t\t// required\n\t\t\t\t\tif traffTarg.Weight != targ.Weight {\n\t\t\t\t\t\ttraffTarg.Weight = targ.Weight\n\t\t\t\t\t\tchanges_made = true\n\t\t\t\t\t}\n\t\t\t\t\t// required\n\t\t\t\t\tif traffTarg.Enabled != targ.Enabled {\n\t\t\t\t\t\ttraffTarg.Enabled = targ.Enabled\n\t\t\t\t\t\tchanges_made = true\n\t\t\t\t\t}\n\t\t\t\t\t// optional\n\t\t\t\t\tif len(targ.Servers) > 0 {\n\t\t\t\t\t\tif len(targ.Servers) != len(traffTarg.Servers) {\n\t\t\t\t\t\t\ttraffTarg.Servers = targ.Servers\n\t\t\t\t\t\t\tchanges_made = true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsort.Strings(targ.Servers)\n\t\t\t\t\t\t\tsort.Strings(traffTarg.Servers)\n\t\t\t\t\t\t\tfor i, v := range traffTarg.Servers {\n\t\t\t\t\t\t\t\tif v != targ.Servers[i] {\n\t\t\t\t\t\t\t\t\ttraffTarg.Servers = targ.Servers\n\t\t\t\t\t\t\t\t\tchanges_made = true\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// optional\n\t\t\t\t\tif traffTarg.HandoutCName != targ.HandoutCName && targ.HandoutCName != \"\" {\n\t\t\t\t\t\ttraffTarg.HandoutCName = targ.HandoutCName\n\t\t\t\t\t\tchanges_made = true\n\t\t\t\t\t}\n\t\t\t\t\t// optional\n\t\t\t\t\tif traffTarg.Name != targ.Name && targ.Name != \"\" {\n\t\t\t\t\t\ttraffTarg.Name = targ.Name\n\t\t\t\t\t\tchanges_made = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, dcID := range pDatacenters.flagList {\n\t\t\tif traffTarg.DatacenterId == dcID {\n\t\t\t\tfmt.Sprintf(\"%s contains dc %s\", traffTarg.Name, strconv.Itoa(dcID))\n\t\t\t\tif (c.IsSet(\"enable\") || c.IsSet(\"disable\")) && traffTarg.Enabled != pEnabled {\n\t\t\t\t\ttraffTarg.Enabled = pEnabled\n\t\t\t\t\tchanges_made = true\n\t\t\t\t}\n\t\t\t\tif c.IsSet(\"weight\") && traffTarg.Weight != pWeight {\n\t\t\t\t\t// Note: weight will be ignored for a number of property types\n\t\t\t\t\ttraffTarg.Weight = pWeight\n\t\t\t\t\tchanges_made = true\n\t\t\t\t}\n\t\t\t\tif c.IsSet(\"server\") {\n\t\t\t\t\ttraffTarg.Servers = pServers\n\t\t\t\t\tchanges_made = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif c.IsSet(\"target\") {\n\t\t// Any new target?\n\t\tfor cmdTarget, _ := range pTargets.targetList {\n\t\t\tif _, ok := propTargets[cmdTarget]; !ok {\n\t\t\t\t// New target. Find it\n\t\t\t\tfor _, t := range pTargets.targets {\n\t\t\t\t\tif t.DatacenterId == cmdTarget {\n\t\t\t\t\t\tproperty.TrafficTargets = append(property.TrafficTargets, &t)\n\t\t\t\t\t\tchanges_made = 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}\n\n\t// enable/disable property liveness tests?\n\tif len(pLivenessTests) > 0 {\n\t\ttestList := strings.Join(pLivenessTests, \" \")\n\t\tfmt.Println(\"livesness tests: \", testList)\n\t\tfor _, test := range property.LivenessTests {\n\t\t\tfmt.Println(\"Processing livesness test: \", test.Name)\n\t\t\tif strings.Contains(testList, test.Name) {\n\t\t\t\tfmt.Println(\"Livesness test match!\")\n\t\t\t\tfmt.Println(\"pEnabled: \", pEnabled)\n\t\t\t\tfmt.Println(\"test.Disabled: \", test.Disabled)\n\t\t\t\tif (c.IsSet(\"enable\") || c.IsSet(\"disable\")) && test.Disabled != !pEnabled {\n\t\t\t\t\t// logic is reversed.\n\t\t\t\t\ttest.Disabled = !pEnabled\n\t\t\t\t\tchanges_made = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif changes_made {\n\n\t\tif pDryrun {\n\t\t\tjson, err := json.MarshalIndent(property, \"\", \" \")\n\t\t\tif err != nil {\n\t\t\t\treturn cli.NewExitError(color.RedString(\"Unable to display proposed property update\"), 1)\n\t\t\t}\n\t\t\tfmt.Fprintln(c.App.Writer, \"Proposed Property Update\")\n\t\t\tfmt.Fprintln(c.App.Writer, string(json))\n\n\t\t\tif !c.IsSet(\"json\") {\n\t\t\t\takamai.StopSpinnerOk()\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\n\t\tpropStat, err := property.Update(domainName)\n\t\tif err != nil {\n\t\t\takamai.StopSpinnerFail()\n\t\t\treturn cli.NewExitError(color.RedString(fmt.Sprintf(\"Error updating property %s. %s\", propertyName, err.Error())), 1)\n\t\t}\n\t\tif !c.IsSet(\"json\") {\n\t\t\takamai.StopSpinnerOk()\n\t\t}\n\t\t// wait to complete?\n\t\tif pComplete && propStat.PropagationStatus == \"PENDING\" {\n\t\t\tvar sleepInterval time.Duration = 1 // seconds. TODO:Should be configurable by user ...\n\t\t\tvar sleepTimeout time.Duration = 1 // seconds. TODO: Should be configurable by user ...\n\t\t\tsleepInterval *= time.Duration(defaultInterval)\n\t\t\tsleepTimeout *= time.Duration(pTimeout)\n\t\t\tif !c.IsSet(\"json\") {\n\t\t\t\tfmt.Println(\" \")\n\t\t\t\takamai.StartSpinner(\"Waiting for completion \", \"\")\n\t\t\t}\n\t\t\tfor {\n\t\t\t\ttime.Sleep(sleepInterval * time.Second)\n\t\t\t\tsleepTimeout -= sleepInterval\n\t\t\t\tif propStat.PropagationStatus == \"COMPLETE\" {\n\t\t\t\t\tif !c.IsSet(\"json\") {\n\t\t\t\t\t\takamai.StopSpinner(\"[Change deployed]\", true)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t} else if propStat.PropagationStatus == \"DENIED\" {\n\t\t\t\t\tif !c.IsSet(\"json\") {\n\t\t\t\t\t\takamai.StopSpinner(\"[Change denied]\", true)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif sleepTimeout <= 0 {\n\t\t\t\t\tif !c.IsSet(\"json\") {\n\t\t\t\t\t\takamai.StopSpinner(\"[Maximum wait time elapsed. Use query-status confirm successful deployment]\", true)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tpropStat, err = configgtm.GetDomainStatus(domainName)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif !c.IsSet(\"json\") {\n\t\t\t\t\t\takamai.StopSpinner(\"[Unable to retrieve domain status]\", true)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif c.IsSet(\"json\") {\n\t\t\tfmt.Fprintln(c.App.Writer, fmt.Sprintf(\"Property %s updated\", propertyName))\n\t\t}\n\t\tvar status interface{}\n\n\t\tif c.IsSet(\"verbose\") && verboseStatus {\n\t\t\tstatus = propStat\n\t\t} else {\n\t\t\tstatus = fmt.Sprintf(\"ChangeId: %s\", propStat.ChangeId)\n\t\t}\n\n\t\tif c.IsSet(\"json\") && c.Bool(\"json\") {\n\t\t\tjson, err := json.MarshalIndent(status, \"\", \" \")\n\t\t\tif err != nil {\n\t\t\t\treturn cli.NewExitError(color.RedString(\"Unable to display status results\"), 1)\n\t\t\t}\n\t\t\tfmt.Fprintln(c.App.Writer, string(json))\n\t\t} else {\n\t\t\tfmt.Fprintln(c.App.Writer, \"\")\n\t\t\tif c.IsSet(\"verbose\") && verboseStatus {\n\t\t\t\tfmt.Fprintln(c.App.Writer, renderStatus(status.(*configgtm.ResponseStatus), c))\n\t\t\t} else {\n\t\t\t\tfmt.Fprintln(c.App.Writer, \"Response Status\")\n\t\t\t\tfmt.Fprintln(c.App.Writer, \" \")\n\t\t\t\tfmt.Fprintln(c.App.Writer, status)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif !c.IsSet(\"json\") {\n\t\t\takamai.StopSpinnerOk()\n\t\t\tfmt.Fprintln(c.App.Writer, fmt.Sprintf(\"No update required for Property %s\", propertyName))\n\t\t}\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "048663320cc8b37640801eaf5eb36431", "score": "0.42022994", "text": "func (n *Node) UpdateHeartbeatTable(request *message.Request, reply *message.Reply) error {\n\tn.HeartBeatTable = request.Payload.(map[int]bool)\n\tlog.Printf(\"Node %d's Heartbeat Table is updated: %v\", n.Pid, n.HeartBeatTable)\n\treturn nil\n}", "title": "" }, { "docid": "633a289f319844d9b6a4d4262b339588", "score": "0.41961354", "text": "func (client *LoadBalancerProbesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string, options *LoadBalancerProbesGetOptions) (ProbeResponse, error) {\n\treq, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, probeName, options)\n\tif err != nil {\n\t\treturn ProbeResponse{}, err\n\t}\n\tresp, err := client.con.Pipeline().Do(req)\n\tif err != nil {\n\t\treturn ProbeResponse{}, err\n\t}\n\tif !resp.HasStatusCode(http.StatusOK) {\n\t\treturn ProbeResponse{}, client.getHandleError(resp)\n\t}\n\treturn client.getHandleResponse(resp)\n}", "title": "" }, { "docid": "18193e28e46f3ff5646c6af9406d9da8", "score": "0.4194261", "text": "func UpdateMetricsOnReqEnd(params map[string]interface{}) {\n\tfor _, v := range Engine.Metrics {\n\t\tv.Update(params)\n\t}\n}", "title": "" }, { "docid": "2b5a80cb21b20ebcfff1ef9c4c4ee68d", "score": "0.4193971", "text": "func ovsBridgeMetricsUpdate() {\n\tfor {\n\t\ttime.Sleep(30 * time.Second)\n\t\t// set geneve interface metrics\n\t\terr := geneveInterfaceMetricsUpdate()\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"%s\", err.Error())\n\t\t}\n\t\t// update ovs bridge metrics\n\t\tbridgePortCountMapping, portBridgeMapping, err := getOvsBridgeInfo()\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"%s\", err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tfor brName, nPorts := range bridgePortCountMapping {\n\t\t\tmetricOvsBridge.WithLabelValues(brName).Set(1)\n\t\t\tmetricOvsBridgePortsTotal.WithLabelValues(brName).Set(nPorts)\n\t\t\tflowsCount := getOvsBridgeOpenFlowsCount(brName)\n\t\t\tmetricOvsBridgeFlowsTotal.WithLabelValues(brName).Set(flowsCount)\n\t\t}\n\t\tmetricOvsBridgeTotal.Set(float64(len(bridgePortCountMapping)))\n\n\t\tinterfaceToPortToBridgeMap, err := getInterfaceToPortToBridgeMapping(portBridgeMapping)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"%s\", err.Error())\n\t\t\tcontinue\n\t\t}\n\t\t// set ovs interface metrics.\n\t\terr = ovsInterfaceMetricsUpdate(interfaceToPortToBridgeMap)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"%s\", err.Error())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5508637594cdd23ed65bde07b28132c2", "score": "0.41921443", "text": "func (p *GoPacketProbesHandler) RegisterProbe(n *graph.Node, capture *api.Capture, ft *flow.Table) error {\n\tname, _ := n.GetFieldString(\"Name\")\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"No name for node %v\", n)\n\t}\n\n\tif state, _ := n.GetFieldString(\"State\"); capture.Type == \"pcap\" && state != \"UP\" {\n\t\treturn fmt.Errorf(\"Can't start pcap capture on node down %s\", name)\n\t}\n\n\tencapType, _ := n.GetFieldString(\"EncapType\")\n\tif encapType == \"\" {\n\t\treturn fmt.Errorf(\"No EncapType for node %v\", n)\n\t}\n\n\ttid, _ := n.GetFieldString(\"TID\")\n\tif tid == \"\" {\n\t\treturn fmt.Errorf(\"No TID for node %v\", n)\n\t}\n\n\tid := string(n.ID)\n\n\tif _, ok := p.probes[id]; ok {\n\t\treturn fmt.Errorf(\"Already registered %s\", name)\n\t}\n\n\tif port, err := n.GetFieldInt64(\"MPLSUDPPort\"); err == nil {\n\t\t// All gopacket instance of this agent will classify UDP packets coming\n\t\t// from UDP port MPLSUDPPort as MPLS whatever the source interface\n\t\tlayers.RegisterUDPPortLayerType(layers.UDPPort(port), layers.LayerTypeMPLS)\n\t\tlogging.GetLogger().Infof(\"MPLSoUDP port: %v\", port)\n\t}\n\n\tprobe := &GoPacketProbe{\n\t\tNodeTID: tid,\n\t\tstate: common.StoppedState,\n\t\tflowTable: ft,\n\t}\n\n\tp.probesLock.Lock()\n\tp.probes[id] = probe\n\tp.probesLock.Unlock()\n\tp.wg.Add(1)\n\n\tgo func() {\n\t\tdefer p.wg.Done()\n\n\t\tprobe.run(p.graph, n, capture)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "450a126c514e89231b7d5351b2c8200f", "score": "0.41877192", "text": "func (job *TrainJob) updateTrainMetrics(loss float64, elapsed time.Duration) error {\n\n\t// add the new metrics to the history\n\tjob.history.Parallelism = append(job.history.Parallelism, float64(job.parallelism))\n\tjob.history.EpochDuration = append(job.history.EpochDuration, elapsed.Seconds())\n\tjob.history.TrainLoss = append(job.history.TrainLoss, loss)\n\n\t// send the update to the PS\n\terr := job.ps.UpdateMetrics(job.jobId, getLatestMetrics(&job.history))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error sending train update to parameter server\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ca40a98093a41e06adef9064f00a22ce", "score": "0.4185589", "text": "func (m *manager) processVMProbe(w worker.Worker, ctx *context.ProbeContext) error {\n\tvm := ctx.VM\n\tif vm.Status.PowerState != vmoperatorv1alpha1.VirtualMachinePoweredOn {\n\t\t// If a vm is not powered on, we don't run probes against it and translate probe result to failure.\n\t\t// Populate the Condition and update the VM status.\n\t\tctx.Logger.V(4).Info(\"the VirtualMachine is not powered on\")\n\t\treturn w.ProcessProbeResult(ctx, probe.Failure, fmt.Errorf(\"virtual machine is not powered on\"))\n\t}\n\treturn w.DoProbe(ctx)\n}", "title": "" }, { "docid": "17af517cd5720bed8a3ab6349a7194a9", "score": "0.4178098", "text": "func (c *WorkerTenantCounts) Update(key string, count int) {\n c.mux.Lock()\n // Lock so only one goroutine at a time can access the map c.v.\n c.v[key] = count\n c.mux.Unlock()\n}", "title": "" }, { "docid": "86d3b72f1fb579d50759b746f51b176f", "score": "0.41775063", "text": "func (s *CBOW) UpdateParams(ps []params.Param) {\n\tfor j, l := range s.Layers {\n\t\tp := l.GetParam()\n\t\t// ignore if weight is nil.\n\t\tif p.Weight == nil {\n\t\t\tcontinue\n\t\t}\n\t\tl.SetParam(ps[0])\n\t\ts.Layers[j] = l\n\t}\n\n\ts.LossLayer.UpdateParams([]params.Param{ps[1]})\n}", "title": "" }, { "docid": "b12f791eecbe288c3aa4ab6834bbea6e", "score": "0.41734555", "text": "func (p *BlockPuller) probeEndpoints(minRequestedSequence uint64) *endpointInfoBucket {\n\tendpointsInfo := make(chan *endpointInfo, len(p.Endpoints))\n\n\tvar wg sync.WaitGroup\n\twg.Add(len(p.Endpoints))\n\n\tvar forbiddenErr uint32\n\tvar unavailableErr uint32\n\n\tfor _, endpoint := range p.Endpoints {\n\t\tgo func(endpoint EndpointCriteria) {\n\t\t\tdefer wg.Done()\n\t\t\tei, err := p.probeEndpoint(endpoint, minRequestedSequence)\n\t\t\tif err != nil {\n\t\t\t\tp.Logger.Warningf(\"Received error of type '%v' from %s\", err, endpoint.Endpoint)\n\t\t\t\tp.Logger.Debugf(\"%s's TLSRootCAs are %s\", endpoint.Endpoint, endpoint.TLSRootCAs)\n\t\t\t\tif err == ErrForbidden {\n\t\t\t\t\tatomic.StoreUint32(&forbiddenErr, 1)\n\t\t\t\t}\n\t\t\t\tif err == ErrServiceUnavailable {\n\t\t\t\t\tatomic.StoreUint32(&unavailableErr, 1)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tendpointsInfo <- ei\n\t\t}(endpoint)\n\t}\n\twg.Wait()\n\n\tclose(endpointsInfo)\n\teib := &endpointInfoBucket{\n\t\tbucket: endpointsInfo,\n\t\tlogger: p.Logger,\n\t}\n\n\tif unavailableErr == 1 && len(endpointsInfo) == 0 {\n\t\teib.err = ErrServiceUnavailable\n\t}\n\tif forbiddenErr == 1 && len(endpointsInfo) == 0 {\n\t\teib.err = ErrForbidden\n\t}\n\treturn eib\n}", "title": "" } ]
413ae0c60d72f809810becb004cb9689
SaveOutsideCollaborators saves an outside collaborator list to a JSON file
[ { "docid": "de0910414479872618ad8ba081d4424d", "score": "0.8574973", "text": "func SaveOutsideCollaborators(ls []*User) error {\n\tcollaboratorList := path.Join(DataDir, \"outside_collaborators.json\")\n\tos.Remove(collaboratorList)\n\tlog.SetOutput(os.Stdout)\n\tlog.Printf(\"Saving outside collaborator list to: %s\\n\", collaboratorList)\n\tjd, jerr := json.Marshal(ls)\n\tif jerr != nil {\n\t\treturn jerr\n\t}\n\treturn ioutil.WriteFile(collaboratorList, jd, 0755)\n}", "title": "" } ]
[ { "docid": "bd15622fcafd8e9bc638a720e9b37006", "score": "0.5989664", "text": "func ListOutsideCollaborators(page int) ([]*User, ListPages, error) {\n\tvar ul []*User\n\tvar lp ListPages\n\treqURL := \"https://api.github.com/orgs/\" + Org + \"/outside_collaborators\"\n\tif page > 0 {\n\t\treqURL += \"?page=\" + strconv.Itoa(page)\n\t}\n\treq, err := http.NewRequest(\"GET\", reqURL, nil)\n\tif err != nil {\n\t\treturn ul, lp, err\n\t}\n\treq.Header.Set(\"Authorization\", \"token \"+Token)\n\tc := &http.Client{}\n\tres, rerr := c.Do(req)\n\tif rerr != nil {\n\t\treturn ul, lp, rerr\n\t}\n\tlinks := res.Header.Get(\"Link\")\n\tlp, err = parseLinks(links)\n\tif err != nil {\n\t\treturn ul, lp, err\n\t}\n\t_, rlerr := ParseRateLimit(res)\n\tif rlerr != nil {\n\t\treturn ul, lp, rlerr\n\t}\n\tdefer res.Body.Close()\n\tbd, berr := ioutil.ReadAll(res.Body)\n\tif berr != nil {\n\t\treturn ul, lp, berr\n\t}\n\tjerr := json.Unmarshal(bd, &ul)\n\tif jerr != nil {\n\t\treturn ul, lp, jerr\n\t}\n\treturn ul, lp, nil\n}", "title": "" }, { "docid": "de696bb4f2aa96ba17d1dff820638553", "score": "0.58789", "text": "func SaveInvitations(ls []*Invitation) error {\n\tinvitationListFile := path.Join(DataDir, \"invitations.json\")\n\tos.Remove(invitationListFile)\n\tlog.SetOutput(os.Stdout)\n\tlog.Printf(\"Saving invitations list to: %s\\n\", invitationListFile)\n\tjd, jerr := json.Marshal(ls)\n\tif jerr != nil {\n\t\treturn jerr\n\t}\n\treturn ioutil.WriteFile(invitationListFile, jd, 0755)\n}", "title": "" }, { "docid": "a64b6ea1358f05a3f53222cefe762f3e", "score": "0.5512436", "text": "func saveFormsToDisk() {\n\tscoutFormJSON, _ := json.Marshal(scoutFormList)\n\tatomic.WriteFile(\"./data/forms.json\", bytes.NewReader(scoutFormJSON))\n}", "title": "" }, { "docid": "ce1fe10bc0159b463b82626f6d61f770", "score": "0.5441108", "text": "func GetAllOutsideCollaborators() ([]*User, error) {\n\tvar lp ListPages\n\tvar us []*User\n\tfor lp.Next <= lp.Last {\n\t\tif lp.Next == 0 {\n\t\t\tlp.Next = 1\n\t\t}\n\t\tlog.SetOutput(os.Stdout)\n\t\tlog.Printf(\"Listing Org Outside Collaborators, %+v\\n\", lp)\n\t\tusl, llp, err := ListOutsideCollaborators(lp.Next)\n\t\tfor _, u := range usl {\n\t\t\tgerr := u.GetDetails()\n\t\t\tif gerr != nil {\n\t\t\t\treturn us, gerr\n\t\t\t}\n\t\t}\n\t\tus = append(us, usl...)\n\t\tif err != nil {\n\t\t\treturn us, err\n\t\t}\n\t\tif lp.Next == lp.Last && lp.Last > 0 {\n\t\t\tbreak\n\t\t}\n\t\tlp = llp\n\t\tif lp.Last == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn us, nil\n}", "title": "" }, { "docid": "94c2ec0c5ced4b2b612b590fb489b265", "score": "0.5416012", "text": "func getAllCollaborators(userName string, password string) map[string][]string {\n\tconst getAPIPath string = apiPath + \"/user/repos?visibility=private&affiliation=owner\"\n\tclient := &http.Client{}\n\treq, _ := http.NewRequest(\"GET\", getAPIPath, nil)\n\treq.SetBasicAuth(userName, password)\n\treq.Header.Add(\"Accept\", \"application/vnd.github.v3+json\")\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer resp.Body.Close()\n\n\tdecoder := json.NewDecoder(resp.Body)\n\tvar data []map[string]interface{}\n\tdecodeErr := decoder.Decode(&data)\n\tif decodeErr != nil {\n\t\tfmt.Println(decodeErr)\n\t}\n\n\t// For all the repos, find the collaborators and store it in a map\n\tcollabs := make(map[string][]string)\n\tfor i := 0; i < len(data); i++ {\n\t\tname := data[i][\"full_name\"]\n\t\tcollabURL := data[i][\"collaborators_url\"]\n\t\tcollabURLStr := strings.Split(collabURL.(string), \"{\")[0]\n\n\t\t// Call the collaborator's url\n\t\treq, _ = http.NewRequest(\"GET\", collabURLStr, nil)\n\t\treq.SetBasicAuth(userName, password)\n\t\treq.Header.Add(\"Accept\", \"application/vnd.github.v3+json\")\n\t\tresp, _ = client.Do(req)\n\n\t\t// bodyText, _ := ioutil.ReadAll(resp.Body)\n\t\t// s := string(bodyText)\n\t\t// fmt.Println(s)\n\t\tcollabDecoder := json.NewDecoder(resp.Body)\n\t\tvar collabData []map[string]interface{}\n\t\tdecodeErr = collabDecoder.Decode(&collabData)\n\t\tif decodeErr != nil {\n\t\t\tfmt.Println(decodeErr)\n\t\t}\n\t\t// Loop over all collaborators for this repo\n\t\tfor c := 0; c < len(collabData); c++ {\n\t\t\tcollab := collabData[c][\"login\"].(string)\n\t\t\t// Get this collaborator from the map, and append this repos name to it\n\t\t\tcollabs[collab] = append(collabs[collab], name.(string))\n\t\t}\n\t}\n\treturn collabs\n}", "title": "" }, { "docid": "9bb57ff997cfd8d2063f6e19ec3dacca", "score": "0.52002615", "text": "func saveUserJSON(jsonFile string, m *map[string]user) error {\n\tr, _ := json.MarshalIndent(m, \"\", \" \")\n\terr := ioutil.WriteFile(jsonFile, []byte(r), 0644)\n\treturn err\n}", "title": "" }, { "docid": "2bb045d26278948ac97e7b674b09264e", "score": "0.5174094", "text": "func removeCollaboratorFromAllRepos(userName string, password string) {\n\tfmt.Println(\"\\nFetching all the private repositories:\")\n\tcollabs := getAllCollaborators(userName, password)\n\tb, err := json.MarshalIndent(collabs, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t}\n\tfmt.Print(string(b))\n\n\tfmt.Println(\"\\nEnter username to delete:\")\n\tvar userNameToDelete string\n\tfmt.Scanln(&userNameToDelete)\n\n\treposToCheck := collabs[userNameToDelete]\n\tfmt.Println(\"\\nRemoving \" + userNameToDelete + \" from repos \" + strings.Join(reposToCheck, \",\"))\n\n\tfor i := 0; i < len(reposToCheck); i++ {\n\t\tgetAPIPath := fmt.Sprintf(\"%s/repos/%s/collaborators/%s\",\n\t\t\tapiPath, reposToCheck[i], userNameToDelete)\n\t\tfmt.Println(\"Calling delete on \" + getAPIPath)\n\t\tclient := &http.Client{}\n\t\treq, _ := http.NewRequest(\"DELETE\", getAPIPath, nil)\n\t\treq.SetBasicAuth(userName, password)\n\t\treq.Header.Add(\"Accept\", \"application/vnd.github.v3+json\")\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t}\n}", "title": "" }, { "docid": "87c8bf945b24fe3baf685a7349777aca", "score": "0.51130223", "text": "func (s *ProjectService) SaveCollaborator(projectId string, collaboratorId string) error {\n\tproject, err := s.ProjectRepository.FindByID(projectId)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not find project by id\")\n\t}\n\tif project.ID == \"\" {\n\t\treturn nil\n\t}\n\t//TODO contributor user exists, with signed JWT ?\n\terr = s.ProjectRepository.SaveCollaborator(projectId, collaboratorId)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not save save collaborator\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3500759291f05a05a78a74198a147e4", "score": "0.5111523", "text": "func (c *Config) SaveOIDCTokens() {\n\ttokenParentPath := c.ConfigPath(\"oidctokens\")\n\n\tif !shared.PathExists(tokenParentPath) {\n\t\t_ = os.MkdirAll(tokenParentPath, 0755)\n\t}\n\n\tfor remote, tokens := range c.oidcTokens {\n\t\ttokenPath := c.OIDCTokenPath(remote)\n\t\tdata, _ := json.Marshal(tokens)\n\t\t_ = os.WriteFile(tokenPath, data, 0600)\n\t}\n}", "title": "" }, { "docid": "2649dce771bf7e51a1f978fab3e30dae", "score": "0.5060926", "text": "func writeJsonFile(dstPath string, ps []orb.CartesianPoint) error {\n\tf, err := os.Create(dstPath)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tdefer f.Close()\n\tenc := json.NewEncoder(f)\n\tfor _, p := range ps {\n\t\tif err := enc.Encode(p); err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "097b88f9c186dcac8f70ea221e86a377", "score": "0.5049214", "text": "func writeList(path string, list []todo.List) {\n\n\t// encode List slice\n\ttd, err := json.Marshal(list)\n\tif err != nil {\n\t\tfmt.Println(\"json marshal error \", err)\n\t}\n\n\t// write todo.List to file\n\tfile, err := os.Create(path)\n\tif err != nil {\n\t\tfmt.Println(\"file crate error: \", err)\n\t}\n\tdefer file.Close()\n\n\tfile.Write(td)\n}", "title": "" }, { "docid": "6a507446247c091eef24ae3d1bdd9023", "score": "0.501418", "text": "func saveTeamJSON(jsonFile string, m *map[string]teamStats) error {\n\tr, _ := json.MarshalIndent(m, \"\", \" \")\n\terr := ioutil.WriteFile(jsonFile, []byte(r), 0644)\n\treturn err\n}", "title": "" }, { "docid": "49663181c657c5e2619cff79a14cc04f", "score": "0.49577114", "text": "func export(fname, lname string) {\n\tpotato := &Potato {\n\t\tFirstName: fname,\n\t\tLastName: lname }\n\tpotatoByte, _ := json.Marshal(potato)\n\n\terr := ioutil.WriteFile(\"output.json\", potatoByte, 0644)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n}", "title": "" }, { "docid": "dc18565e745cad6f589d203c2000364a", "score": "0.49270874", "text": "func (s *WhiteList) save() {\n\tjson, err := json.MarshalIndent(s.Whitelisted, \"\", \" \")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = os.WriteFile(\"./debcvescan.whitelist\", json, 0600)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "2e90a98204131258c09b574c3fac6d59", "score": "0.49118763", "text": "func (companies *Companies) ExportJSON(language string) ([]byte, error) {\n\tquery := fmt.Sprintf(`{\n\t\t\t\tcompanies(func: has(companyName)) {\n\t\t\t\t\tuid\n\t\t\t\t}\n\t\t\t}`)\n\n\ttransaction := companies.storage.Client.NewTxn()\n\tresponseWithCompaniesIDs, err := transaction.Query(context.Background(), query)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\ttype allCompaniesWithIDOnly struct {\n\t\tCompaniesWithIDOnly []Company `json:\"companies\"`\n\t}\n\n\tvar allCompaniesIDs allCompaniesWithIDOnly\n\n\terr = json.Unmarshal(responseWithCompaniesIDs.GetJson(), &allCompaniesIDs)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\ttype allExportedCompanies struct {\n\t\tLanguage string `json:\"language\"`\n\t\tCompanies []Company `json:\"companies\"`\n\t}\n\n\tfoundedCompanies := allExportedCompanies{Language: language}\n\n\tfor _, companyID := range allCompaniesIDs.CompaniesWithIDOnly {\n\t\tcompany, err := companies.ReadCompanyByID(companyID.ID, language)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfoundedCompanies.Companies = append(foundedCompanies.Companies, company)\n\t}\n\n\tjsonForExport, err := json.Marshal(foundedCompanies)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn jsonForExport, nil\n}", "title": "" }, { "docid": "9fa568e0c7634e714d23283998d7868e", "score": "0.48583463", "text": "func (pl *peerlist) save(fn string) error {\n\t// filter the peers that has retrytime > MaxPeerRetryTimes\n\tpeers := make(map[string]PeerJSON)\n\tfor k, p := range pl.peers {\n\t\tif p.RetryTimes <= MaxPeerRetryTimes {\n\t\t\tpeers[k] = newPeerJSON(*p)\n\t\t}\n\t}\n\n\tif err := file.SaveJSON(fn, peers, 0600); err != nil {\n\t\treturn fmt.Errorf(\"save peer list failed: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3698e3689236f85044a8eb051dd1b630", "score": "0.48412198", "text": "func ListCollaborators(ctx *context.APIContext) {\n\tif !ctx.Repo.IsWriter() {\n\t\tctx.Error(403, \"\", \"User does not have push access\")\n\t\treturn\n\t}\n\tcollaborators, err := ctx.Repo.Repository.GetCollaborators()\n\tif err != nil {\n\t\tctx.Error(500, \"ListCollaborators\", err)\n\t\treturn\n\t}\n\tusers := make([]*api.User, len(collaborators))\n\tfor i, collaborator := range collaborators {\n\t\tusers[i] = collaborator.APIFormat()\n\t}\n\tctx.JSON(200, users)\n}", "title": "" }, { "docid": "961bb51bb5a84310e1d3ee68bed3483e", "score": "0.48352462", "text": "func Save(fname string) (err error) {\n var data []byte\n data, err = json.Marshal(MailServer)\n if err == nil {\n var buff bytes.Buffer\n err = json.Indent(&buff, data, \" \", \" \")\n if err == nil {\n err = ioutil.WriteFile(fname, buff.Bytes(), 0600)\n }\n }\n return\n}", "title": "" }, { "docid": "ba5b1d0a198a43ad5cef26c3ee72d978", "score": "0.4815482", "text": "func UserWriteFile(userArr []User) {\n\t//fmt.Println(\"fucksadsads\", userArr)\n\tfile, err := os.OpenFile(\"entity/data/User.txt\", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)\n\tos.Truncate(\"entity/data/User.txt\", 0)\n\tif err != nil {\n\t\tfmt.Println(\"error open file\")\n\t\tos.Exit(1)\n\t}\n\tdefer file.Close()\n\n\tfor i := 0; i < len(userArr); i++ {\n\t\t//fmt.Println(userArr[i])\n\t\tfile.WriteString(string(UserJsonEncode(userArr[i])))\n\t\tif i != len(userArr)-1 {\n\t\t\tfile.WriteString(\"\\n\")\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "750462ba5ef4be911942049ee123ea4f", "score": "0.48089707", "text": "func saveSites() {\n\tfile, err := os.Create(\"config/probe/sites.json\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\tencoder := json.NewEncoder(file)\n\tencoder.Encode(sites)\n}", "title": "" }, { "docid": "9d01f91a18d2dd51713d81e04d1f3f13", "score": "0.47983024", "text": "func saveJSONToDisk(createDir bool, col, id, valor string) {\n\n\tif createDir {\n\t\tos.Mkdir(config[\"data_dir\"].(string)+\"/\"+col, 0777)\n\t}\n\n\terr := ioutil.WriteFile(config[\"data_dir\"].(string)+\"/\"+col+\"/\"+id+\".json\", []byte(valor), 0644)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "title": "" }, { "docid": "3db4fa0a37cf16ed7e09f66ec2c0fd55", "score": "0.4792229", "text": "func NotionListToFile(notionItems []*NotionExport, outputFile string) error {\n\n\tcsvFile, err := os.OpenFile(outputFile, os.O_RDWR|os.O_CREATE, os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = gocsv.MarshalFile(notionItems, csvFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "d8df339621a4b79af72075352e3d2384", "score": "0.47922134", "text": "func writeLossesToFile(badMoves []interface{}) {\n\tlosses := []interface{}{[]byte{}}\n\tfor i := range badMoves {\n\t\tlosses = append(losses, badMoves[i])\n\t}\n\tjsonData, _ := json.Marshal(losses)\n\terr := ioutil.WriteFile(\"computerlosses.txt\", jsonData, 0644)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "b3c434859ea1ba43876a7f8afdbe4461", "score": "0.4790245", "text": "func Save(filePath string, issues []*tenet.Issue) error {\n\n\t// // TODO(waigani) provide a flag to control filepath formatting\n\t// make paths relative to lingo\n\tpwd, err := os.Getwd()\n\tif err == nil {\n\t\tfor _, i := range issues {\n\t\t\tabsStart := i.Position.Start.Filename\n\t\t\tabsEnd := i.Position.End.Filename\n\t\t\tprefix := pwd + \"/\"\n\t\t\ti.Position.Start.Filename = strings.TrimPrefix(absStart, prefix)\n\t\t\ti.Position.End.Filename = strings.TrimPrefix(absEnd, prefix)\n\n\t\t\ti.Name = i.Position.Start.Filename\n\t\t}\n\t} else {\n\t\tlog.Printf(\"could not make filepaths relative to pwd: %v\", err)\n\t}\n\n\tjsonIssues, err := json.Marshal(issues)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\t// CLI will expand tilde for -output ~/file but not -output=~/file. In the\n\t// latter case, if we can find the user, expand tilde to their home dir.\n\tif filePath[:2] == \"~/\" {\n\t\tusr, err := user.Current()\n\t\tif err == nil {\n\t\t\tdir := usr.HomeDir + \"/\"\n\t\t\tfilePath = strings.Replace(filePath, \"~/\", dir, 1)\n\t\t}\n\t}\n\n\terr = ioutil.WriteFile(filePath, jsonIssues, os.FileMode(0644))\n\tif err != nil {\n\t\treturn errors.Errorf(\"could not write to file %s: %s\", filePath, err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ddac431c709d137c7d90fec058b7e48", "score": "0.47363362", "text": "func (r *Renter) save() (err error) {\n\t// create slice of savedFiles\n\tsavedPieces := make([]savedFiles, 0, len(r.files))\n\tfor nickname, file := range r.files {\n\t\tsavedPieces = append(savedPieces, savedFiles{file.pieces, nickname, file.startHeight})\n\t}\n\n\terr = ioutil.WriteFile(filepath.Join(r.saveDir, \"files.dat\"), encoding.Marshal(savedPieces), 0666)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "48c9ed8d5618edea2d51024f691911ff", "score": "0.47300825", "text": "func writeComics(comics Comics) error {\n\t// Open the output file\n\tfile, err := os.OpenFile(comicsFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create the file writer\n\twriter := bufio.NewWriter(file)\n\n\t// Encode the file using the JSON encoder\n\tif err := json.NewEncoder(writer).Encode(comics); err != nil {\n\t\tfile.Close()\n\t\treturn err\n\t}\n\n\t// Don't forget to flush\n\twriter.Flush()\n\n\tfile.Close()\n\treturn nil\n\n}", "title": "" }, { "docid": "e72744d02bf896ac357fd39f57bf6c7c", "score": "0.47128034", "text": "func writeToFile(issues []GitHubIssue, path string) error {\n\tbytes, err := json.MarshalIndent(issues, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(path, bytes, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "24220c3e935a7422937735c0e79657ec", "score": "0.47103515", "text": "func writeReminders(rd remindersData, ioLogger *log.Entry) error {\n\trdJSON, err := json.Marshal(rd)\n\tif err != nil {\n\t\tioLogger.Error(\"Could not encode reminders\")\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(remindersFileName, rdJSON, 0644)\n\tif err != nil {\n\t\tioLogger.Error(\"Could not write file\")\n\t\treturn err\n\t}\n\treturn err\n}", "title": "" }, { "docid": "288c07b4605335060b51fc3f19162c8b", "score": "0.46816805", "text": "func SaveParcels(tile Tile, parcels *Parcels, opts Options) (string, error) {\n\tb, err := json.MarshalIndent(parcels.FeatureCollection, \"\", \" \")\n\tif err != nil {\n\t\treturn StatusGeoJSONError, err\n\t}\n\tfilePath := tile.GetParcelPath(opts.ParcelsPath)\n\terr = SaveGeoJSON(filePath, b)\n\tif err != nil {\n\t\treturn StatusSaveError, err\n\t}\n\treturn StatusSaveSucceeded, nil\n}", "title": "" }, { "docid": "5add488e4cb62a0508c4f9eff6c5a285", "score": "0.46745864", "text": "func (p *AggConfigManager) Save() error {\n\tclics := []*CLIConfig{}\n\tcredcs := []*CredentialConfig{}\n\tfor _, aggConfig := range p.configs {\n\t\tcliConfig := &CLIConfig{}\n\t\taggConfig.copyToCLIConfig(cliConfig)\n\t\tclics = append(clics, cliConfig)\n\n\t\tcredConfig := &CredentialConfig{}\n\t\taggConfig.copyToCredentialConfig(credConfig)\n\t\tcredcs = append(credcs, credConfig)\n\t}\n\taerr := WriteJSONFile(clics, p.configFile.Name())\n\tberr := WriteJSONFile(credcs, p.credFile.Name())\n\n\tif aerr != nil && berr != nil {\n\t\treturn fmt.Errorf(\"save cli config failed: %v | save credentail failed: %v\", aerr, berr)\n\t}\n\tif aerr != nil {\n\t\treturn fmt.Errorf(\"save cli config failed: %v\", aerr)\n\t}\n\tif berr != nil {\n\t\treturn fmt.Errorf(\"save cerdentail failed: %v\", berr)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ad404ecee4ab55fc155cacd1c63e0a69", "score": "0.4653588", "text": "func TokenSave(fileName string) {\n\tjsonTokens, err := json.Marshal(tokens)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = ioutil.WriteFile(fileName, jsonTokens, os.ModePerm)\n}", "title": "" }, { "docid": "cf1bf1c030ef7f30c380b7df00cda01a", "score": "0.46462864", "text": "func addAuthorizedUser( user_name string) error{\n auth_info := AuthorizedInfo{}\n err_json := getAuthorizedUsersJson( &auth_info)\n if err_json != nil{\n // Couldn't open a json with list. Consider it empty\n log.Printf(\"%v\\n\", err_json)\n }\n const kAuthUserFile = \"authorized.json\"\n file, err := os.OpenFile( kAuthUserFile, os.O_WRONLY | os.O_TRUNC | os.O_CREATE, 0777)\n if err != nil{\n return err\n }\n defer file.Close()\n\n auth_info.Users = append( auth_info.Users, user_name)\n\n encoder := json.NewEncoder( file)\n err = encoder.Encode( &auth_info)\n if err != nil{\n return err\n }\n return nil\n}", "title": "" }, { "docid": "19e7653a95a50719db70a1c0286dae36", "score": "0.46211532", "text": "func writeRecordListToDisk(path string, list map[string]schema.Record) {\n\t//flags we pass here are important, need to replace the entire file\n\tjsonFile, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0755)\n\tif err != nil {\n\t\tfmt.Println(\"Error trying to write the new inverted index to disk\")\n\t}\n\tdefer jsonFile.Close()\n\tjsoniter.NewEncoder(jsonFile).Encode(list)\n}", "title": "" }, { "docid": "326e16fd8ee2f628910e2db5ccee9831", "score": "0.45871517", "text": "func (c *authConnectorCollection) WriteJSON(w io.Writer) error {\n\treturn utils.WriteJSON(c, w)\n}", "title": "" }, { "docid": "924503272912c127482722a8fe330478", "score": "0.45747408", "text": "func writeFileListaCancion(listaCancion []ListaCancion, path string) {\n\tfile, err := os.Create(path)\n\tif(err != nil){\n\t\tfmt.Printf(\"No se ha podido guardar el archivo de Lista de Candiones.\")\n\t\tos.Exit(1)\n\t}\n\tdefer file.Close()\n\tfor _, lista := range listaCancion {\n\t\tidCancion := strconv.Itoa(lista.IdCancion)\n\t\tidLista := strconv.Itoa(lista.IdLista)\n\t\tline := idLista + \"|\" + idCancion + \"\\r\\n\"\n\t\tfmt.Fprintf(file, line)\n\t}\n}", "title": "" }, { "docid": "e48eea1d102a1018d0fcda4b07e5cce6", "score": "0.45303178", "text": "func SaveClipsToFile(orderedClips *ClipJSON) error {\n\tfile, err := os.OpenFile(\"clips_order.json\", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0777)\n\n\tif err != nil {\n\t\treturn errors.New(\"Failed to open clips_order.json\")\n\t}\n\n\tjsonParser := json.NewEncoder(file)\n\n\terr = jsonParser.Encode(*orderedClips)\n\n\tif err != nil {\n\t\treturn errors.New(\"Error with sending to json\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bb047310e3279745f64a9f500ab33f7c", "score": "0.452586", "text": "func (o *PutReposOwnerRepoCollaboratorsUserForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(403)\n}", "title": "" }, { "docid": "c12538ffe3b0cdab2e07035d77a88548", "score": "0.4519392", "text": "func (r *roleSystem) saveAutoRanks(file string) error {\n\tjson, err := json.MarshalIndent(r.tiers, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write to data to a file\n\terr = ioutil.WriteFile(file, json, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9438c45fbf573a3d0a988daa8a7bf364", "score": "0.4519041", "text": "func (m *UserORM) AfterToPB(ctx context.Context, a *User) error {\n\t\n\tfor _, ct := range m.GroupList {\n\t\tcontainerTagId, err := resource.Encode(&Group{}, ct.Id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ta.GroupList = append(a.GroupList, containerTagId)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "493565f383deaf8aa87445723a49b67d", "score": "0.45117438", "text": "func (f *fakeRepoService) ListCollaborators(ctx context.Context, owner, repo string, opt *github.ListCollaboratorsOptions) ([]*github.User, *github.Response, error) {\n\tresp := &github.Response{\n\t\tRate: github.Rate{Limit: 5000, Remaining: 1000, Reset: github.Timestamp{Time: time.Now()}},\n\t\tLastPage: (len(f.collaborators) + 1) / 2,\n\t}\n\tif owner != f.org {\n\t\treturn nil, resp, fmt.Errorf(\"org '%s' not recognized, only '%s' is valid\", owner, f.org)\n\t}\n\tif repo != f.repo {\n\t\treturn nil, resp, fmt.Errorf(\"repo '%s' not recognized, only '%s' is valid\", repo, f.repo)\n\t}\n\tif len(f.collaborators) == 0 {\n\t\treturn nil, resp, nil\n\t}\n\treturn []*github.User{f.collaborators[(opt.Page*2)-2], f.collaborators[(opt.Page*2)-1]}, resp, nil\n}", "title": "" }, { "docid": "968b521ebebede7a42c435e6d52dcf5a", "score": "0.4500634", "text": "func saveNamespaces(nss []Namespace) error {\n\tfn := *targetDir + \"/\" + NamespaceFile\n\tf, err := os.Create(fn)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tenc := json.NewEncoder(f)\n\tenc.SetIndent(\"\", \" \")\n\tenc.Encode(nss)\n\treturn nil\n}", "title": "" }, { "docid": "f3a8faf38d1a8410e876cde6a63462b1", "score": "0.44880667", "text": "func (fl FileList) Save(w io.Writer) error {\n\tdata := make([]interface{}, 4)\n\tenc := json.NewEncoder(w)\n\tenc.SetEscapeHTML(false)\n\tfor _, fr := range fl {\n\t\tdata[0] = fr.Path\n\t\tdata[1] = fr.Sha1\n\t\tdata[2] = fr.Size\n\t\tdata[3] = fr.Mtime\n\t\terr := enc.Encode(&data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a375fb917ed547bf72d6f30500fd1245", "score": "0.44846907", "text": "func (m *MockGitHubClientInterface) ListCollaborator(owner, repo string) ([]*github.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListCollaborator\", owner, repo)\n\tret0, _ := ret[0].([]*github.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7a621ab21e3b073274a7ca9208dfee99", "score": "0.44601014", "text": "func (c *Client) AfterResponseWritePrettyJSONBodyToFile(filename string) {\n\tc.restyClient.OnAfterResponse(func(rc *resty.Client, resp *resty.Response) error {\n\t\treturn WritePrettyJSONBytesToFile(resp.Body(), filename)\n\t})\n}", "title": "" }, { "docid": "80d9efc66c2870e369e2bfe031c1af93", "score": "0.44546783", "text": "func customersToSave(s schema.Schema, path string) CustomersToSave {\n\tvar wg sync.WaitGroup\n\tcnt := &SaveContainer{}\n\n\tfor i := range s.Parties.Customers {\n\t\twg.Add(1)\n\t\tcstFolder := filepath.Join(path, folderName(s.Parties.Customers[i].Name))\n\t\tgo customerToSave(s, s.Parties.Customers[i], cnt, cstFolder, &wg)\n\t}\n\twg.Wait()\n\tcnt.Wait()\n\n\treturn cnt.cst\n}", "title": "" }, { "docid": "0276e5aa642674788ccbf196b574857d", "score": "0.4454649", "text": "func StoreUsers(users map[string]User) {\n\tfile, err := os.Create(\"data\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer file.Close()\n\n\tjson.NewEncoder(file).Encode(users)\n}", "title": "" }, { "docid": "6ddd8543f0bf1adcfcffd856487b4e5d", "score": "0.44469273", "text": "func restoreList() {\n\toriginalContents := make(map[string][]string, 2)\n\toriginalContents[\"foo\"] = []string{\"milk\"}\n\toriginalContents[\"bar\"] = []string{\"eggs\", \"bread\"}\n\n\tjsonAsBytes, err := json.Marshal(originalContents)\n\tif err != nil {\n\t\t// TODO: Fix this error handling\n\t\tpanic(err)\n\t}\n\terr = ioutil.WriteFile(listPath, jsonAsBytes, 0644)\n\tif err != nil {\n\t\t// TODO: Fix this error handling\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "d727ef28cde06506a39504ce847fe4df", "score": "0.4436268", "text": "func create_and_save() {\n ul := make(UserList)\n ul[\"alice\"] = User{\"ALICE\", 42}\n ul[\"bob\"] = User{\"ROBERT\", 21}\n ul.Save(\"users.json\")\n}", "title": "" }, { "docid": "11794cfbb7a3885eef51d3ebd3fb3173", "score": "0.44330102", "text": "func WriteJSONToFile(l interface{}, file string) {\n\tWriteToFile(RenderJSON(l), file)\n}", "title": "" }, { "docid": "5e9a775dc53f3b368f57a98c7f971105", "score": "0.44317967", "text": "func WriteSliceToFile(filepath string, values []string) error {\n\tdata := strings.Join(values, \"\\n\")\n\treturn ioutil.WriteFile(filepath, []byte(data), ownerRWPermissions)\n}", "title": "" }, { "docid": "5d2e4ac196af5594290b6230b59765e6", "score": "0.44309422", "text": "func (tracker *Tracker) WorkerJson() []byte {\n\ttracker.workerlock.RLock()\n\tdefer tracker.workerlock.RUnlock()\n\tworkers := make([]*Worker, 0)\n\tfoundids := make([]string, 0)\n\tfor _, w := range tracker.workers {\n\t\tw.ConnectedFor = time.Since(w.connectedat).String()\n\t\tworkers = append(workers, w)\n\t\tfoundids = append(foundids, w.Serial.String())\n\t}\n\t//Append offline workers...\n\tc := session.DB(\"dnsdist\").C(\"agents\")\n\tvar newids []string\n\tc.Find(bson.M{\"_id\": bson.M{\"$nin\": foundids}}).Distinct(\"_id\", &newids)\n\t//log.Println(err)\n\t//log.Println(foundids)\n\t//log.Println(newids)\n\tfor _, newid := range newids {\n\t\twrk := new(Worker)\n\t\twrk.Serial = new(big.Int)\n\t\twrk.Serial.SetString(newid, 10)\n\t\tpopulatedata(wrk, false)\n\t\tworkers = append(workers, wrk)\n\t}\n\tdata, _ := json.MarshalIndent(workers, \"\", \" \")\n\treturn data\n}", "title": "" }, { "docid": "bfb610958ac0cde58c75464ad9fa8bfe", "score": "0.44221607", "text": "func (r *Refs) saveToFile() (err error) {\n\tcodesByte, err := json.Marshal(r)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = ioutil.WriteFile(r.RefSavePath, codesByte, 0644)\n\treturn\n}", "title": "" }, { "docid": "844d63150c3a6429981118601aa0df44", "score": "0.44103122", "text": "func customerToSave(s schema.Schema, cst schema.Party, cnt *SaveContainer, path string, wg *sync.WaitGroup) {\n\tvar prjWg sync.WaitGroup\n\tprjCnt := &SaveContainer{}\n\n\tfor i := range s.Projects {\n\t\tif !s.Projects[i].Customer.Match(cst) {\n\t\t\tcontinue\n\t\t}\n\t\tprjWg.Add(1)\n\t\tprjFolder := filepath.Join(path, folderName(s.Projects[i].Name))\n\t\tgo projectFile(s, s.Projects[i], prjCnt, prjFolder, &prjWg)\n\t}\n\tprjWg.Wait()\n\tprjCnt.Wait()\n\n\tcnt.AddCst(CustomerToSave{\n\t\tCustomer: cst,\n\t\tProjectFiles: prjCnt.prj,\n\t})\n\twg.Done()\n}", "title": "" }, { "docid": "fbf69e923ffbd04a6aabf9a1a93ec126", "score": "0.44025722", "text": "func (v GetFwLeaderboardsCorporationsYesterdayYesterdayList) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson8ff736dbEncodeGithubComAntihaxGoesiEsi(w, v)\n}", "title": "" }, { "docid": "185375703cd17e536a0888a6eebc7c09", "score": "0.4389806", "text": "func ExportJson(u week3.SocialMedia, filename string) error {\n\tfeed := make(map[int]string)\n\tfor index, val := range u.Feed() {\n\t\tfeed[index+1] = val\n\t}\n\tbu, err := json.Marshal(feed)\n\tif err != nil{\n\t\tfmt.Println(\"An error occurred opening this file :\", err.Error())\n\t}\n\tioutil.WriteFile(filename, bu, 0644)\n\treturn nil\n}", "title": "" }, { "docid": "c25cc3d5836dedd128e81059638301b6", "score": "0.43887988", "text": "func (j *JSONWriter) WriteEmojis(emojis []*turtle.Emoji) error {\n\treturn j.e.Encode(emojis)\n}", "title": "" }, { "docid": "91642ba3888c42e454c72a71281b0df9", "score": "0.4386275", "text": "func (coll *Collections) Write(filename string) {\n\tfile, _ := json.MarshalIndent(coll, \"\", \" \")\n\t_ = ioutil.WriteFile(filename, file, 0644)\n}", "title": "" }, { "docid": "bf00f76689beb938c52927aaabc7f6b2", "score": "0.43830192", "text": "func (c *DockerClient) Save() {\n\tclients, _ := LoadDockerClients()\n\tfound := false\n\tfor _, client := range clients {\n\t\tif client.Endpoint == c.Endpoint {\n\t\t\tclient.CertPath = c.CertPath\n\t\t\tclient.IsActive = c.IsActive\n\t\t\tfound = true\n\t\t}\n\t}\n\tif !found {\n\t\tclients = append(clients, c)\n\t}\n\tmisc.SaveAsFile(DockerClientSavePath, clients)\n}", "title": "" }, { "docid": "7fdfa52b1f89d7218e3afdc908841392", "score": "0.4382725", "text": "func (v GetCorporationsCorporationIdOutpostsOutpostIdCoordinatesList) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson248fda80EncodeGithubComAntihaxGoesiEsi(w, v)\n}", "title": "" }, { "docid": "e726cb36de39e1d93618f939340ea3fd", "score": "0.4381568", "text": "func (lf *LidarFrame) ToJSON(isSave bool) []byte {\n\tpointsLen := len(lf.Points)\n\tpoints := make([]CartesianPoint, pointsLen)\n\n\t// Waitgroup for storing points\n\tvar wg sync.WaitGroup\n\twg.Add(pointsLen)\n\n\t// Convert points to Cartesian points\n\tfor index, p := range lf.Points {\n\t\tgo appendToPoints(&points, index, &p, &wg)\n\t}\n\twg.Wait()\n\n\tallPoints, _ := json.Marshal(points)\n\n\tif isSave {\n\t\t// Save to JSON\n\t\toutputFileName := fmt.Sprintf(\"frame%d.json\", lf.Index)\n\t\toutputFileName = filepath.Join(cli.UserInput.OutputPath, outputFileName)\n\n\t\tos.Remove(outputFileName)\n\t\tf, err := os.OpenFile(outputFileName, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)\n\t\tdefer f.Close()\n\t\tcheck(err)\n\n\t\t_, err = f.WriteString(string(allPoints))\n\t\tcheck(err)\n\t}\n\n\treturn allPoints\n}", "title": "" }, { "docid": "8eecc93e6fb4ff4fe2697ceeffca6ff0", "score": "0.43805486", "text": "func output2(name string, r *geojson.FeatureCollection, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tdata, err := json.MarshalIndent(r, \"\", \" \")\n\tif err != nil {\n\t\tlog.Fatalf(\"error marshalling json: %v\", err)\n\t}\n\n\terr = ioutil.WriteFile(name+\".geojson\", data, 0644)\n\tif err != nil {\n\t\tlog.Fatalf(\"write file failure: %v\", err)\n\t}\n}", "title": "" }, { "docid": "423baf3ff23de4f01844a89c370e61fc", "score": "0.43799472", "text": "func Save(values map[string]string) error {\n\tfileLocation := getFileLocation()\n\tloginDetails, err := json.Marshal(values)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(fileLocation, loginDetails, 0644)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bc69a1492ce32d19559e2c50916b4e1e", "score": "0.43644696", "text": "func (v GetCorporationsCorporationIdDivisionsWalletWalletList) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonFa8e3062EncodeGithubComAntihaxGoesiEsi(w, v)\n}", "title": "" }, { "docid": "cdd3fc678bcd045418eee04ac6c71eaa", "score": "0.43596092", "text": "func (h *Handler) OwnerList() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tcc, err := h.store.Computers()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tjson.NewEncoder(w).Encode(cc)\n\t}\n}", "title": "" }, { "docid": "558b7660354519d5f91827d9361a5c5d", "score": "0.43556142", "text": "func (c *Collection) Save() error {\n\n\t// Get a representation of each file and group as json\n\tdata, err := json.MarshalIndent(c, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error marshalling assets file %s %v\", c.path, err)\n\t}\n\n\t// Write our assets json file to the path\n\terr = ioutil.WriteFile(c.path, data, 0644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error writing assets file %s %v\", c.path, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2d726aac7ce0f2b3ea9bac6d08b1dac1", "score": "0.43429178", "text": "func (keyS *keyService) saveCommittee(curKeyBlock *types.KeyBlock) {\n\tmb := bftview.LoadMember(curKeyBlock.NumberU64(), curKeyBlock.Hash(), false)\n\tif mb != nil {\n\t\treturn\n\t}\n\n\tvar newNode *common.Cnode\n\tif curKeyBlock.BlockType() == types.PowReconfig || curKeyBlock.BlockType() == types.PacePowReconfig {\n\t\tnewNode = &common.Cnode{\n\t\t\tCoinBase: curKeyBlock.InAddress(),\n\t\t\tPublic: curKeyBlock.InPubKey(),\n\t\t}\n\t}\n\n\tmb, _ = bftview.GetCommittee(newNode, curKeyBlock, false)\n\tmb.Store0(curKeyBlock)\n}", "title": "" }, { "docid": "75434a4acdb31d26d3f92c677f81b717", "score": "0.43396625", "text": "func getSavePath(team string, board string) string {\n\tdir := \"./data/\" + team\n\t// TODO: Handle the potential error here.\n\tos.MkdirAll(dir, 0777)\n\treturn dir + \"/\" + board + \".json\"\n}", "title": "" }, { "docid": "4b5e400c00b9500d40652944a688d6fd", "score": "0.43327063", "text": "func TestListRepositoryCollaborators(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\towner string\n\t\trepo string\n\t\taffiliation CollaboratorAffiliation\n\t\twantUsers []*Collaborator\n\t}{\n\t\t{\n\t\t\tname: \"public repo\",\n\t\t\towner: \"sourcegraph-vcr-repos\",\n\t\t\trepo: \"public-org-repo-1\",\n\t\t\twantUsers: []*Collaborator{\n\t\t\t\t{\n\t\t\t\t\tID: \"MDQ6VXNlcjYzMjkwODUx\", // sourcegraph-vcr as owner\n\t\t\t\t\tDatabaseID: 63290851,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"private repo\",\n\t\t\towner: \"sourcegraph-vcr-repos\",\n\t\t\trepo: \"private-org-repo-1\",\n\t\t\twantUsers: []*Collaborator{\n\t\t\t\t{\n\t\t\t\t\tID: \"MDQ6VXNlcjYzMjkwODUx\", // sourcegraph-vcr as owner\n\t\t\t\t\tDatabaseID: 63290851,\n\t\t\t\t}, {\n\t\t\t\t\tID: \"MDQ6VXNlcjY2NDY0Nzcz\", // sourcegraph-vcr-amy as team member\n\t\t\t\t\tDatabaseID: 66464773,\n\t\t\t\t}, {\n\t\t\t\t\tID: \"MDQ6VXNlcjY2NDY0OTI2\", // sourcegraph-vcr-bob as outside collaborator\n\t\t\t\t\tDatabaseID: 66464926,\n\t\t\t\t}, {\n\t\t\t\t\tID: \"MDQ6VXNlcjg5NDk0ODg0\", // sourcegraph-vcr-dave as team member\n\t\t\t\t\tDatabaseID: 89494884,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"direct collaborator outside collaborator\",\n\t\t\towner: \"sourcegraph-vcr-repos\",\n\t\t\trepo: \"private-org-repo-1\",\n\t\t\taffiliation: AffiliationDirect,\n\t\t\twantUsers: []*Collaborator{\n\t\t\t\t{\n\t\t\t\t\tID: \"MDQ6VXNlcjY2NDY0OTI2\", // sourcegraph-vcr-bob as outside collaborator\n\t\t\t\t\tDatabaseID: 66464926,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"direct collaborator repo owner\",\n\t\t\towner: \"sourcegraph-vcr\",\n\t\t\trepo: \"public-user-repo-1\",\n\t\t\taffiliation: AffiliationDirect,\n\t\t\twantUsers: []*Collaborator{\n\t\t\t\t{\n\t\t\t\t\tID: \"MDQ6VXNlcjYzMjkwODUx\", // sourcegraph-vcr as owner\n\t\t\t\t\tDatabaseID: 63290851,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tclient, save := newV3TestClient(t, \"ListRepositoryCollaborators_\"+test.name)\n\t\t\tdefer save()\n\n\t\t\tusers, _, err := client.ListRepositoryCollaborators(context.Background(), test.owner, test.repo, 1, test.affiliation)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\tif diff := cmp.Diff(test.wantUsers, users); diff != \"\" {\n\t\t\t\tt.Fatalf(\"Users mismatch (-want +got):\\n%s\", diff)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "295c1f854830cb946f646ed033352bc7", "score": "0.4328666", "text": "func WritePersonFile(ps []Person, fName string) int {\n\n\tnameMap := make(map[string]string)\n\n\tfor _, p := range ps {\n\t\tnameMap[(sanitizeName(p.FirstName + p.LastName))] = p.NameSlug\n\t}\n\n\tjson, jerr := json.MarshalIndent(nameMap, \"\", \" \")\n\thandleError(jerr)\n\n\tf, createErr := os.Create(fName)\n\thandleError(createErr)\n\n\tdefer f.Close()\n\n\tbytes, writeErr := f.Write(json)\n\thandleError(writeErr)\n\n\tf.Sync()\n\treturn bytes\n}", "title": "" }, { "docid": "0052ce77b7bbb80f056b96f74644e945", "score": "0.43241802", "text": "func (c *roleCollection) WriteJSON(w io.Writer) error {\n\treturn utils.WriteJSON(c, w)\n}", "title": "" }, { "docid": "868f599a1431ae823a2620125c053bb0", "score": "0.43116763", "text": "func SaveLicences(licences []Licence) {\n\tdb, err := sql.Open(\"mysql\", \"crawler:popopop@tcp(db:3306)/funkoscrap\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tstmt, err := db.Prepare(\"REPLACE INTO licences(LicenceID, Name, Logo, URL, CrawledAt) VALUES (?, ?, ?, ?, ?)\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor i, licence := range licences {\n\t\tfmt.Printf(\"%d = Licence: %s (%d) \\n\", i, licence.Name, licence.LicenceID)\n\t\t_, err := stmt.Exec(licence.LicenceID, licence.Name, licence.Logo, licence.URL, licence.CrawledAt.Format(time.RFC3339))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b71b42cb2d7853adfb3d9d2f543318f2", "score": "0.43114686", "text": "func writeFile(nrDashboardDefnPretty []byte, dashboardID string) {\n\tioutil.WriteFile(dashboardID+\".json\", nrDashboardDefnPretty, 0644)\n}", "title": "" }, { "docid": "73ee01df3c5c48cb9a4522942a167278", "score": "0.43031663", "text": "func WriteToJSON(filePath string, cotentToAppend string) {\n\n\t_, err := os.Stat(filePath)\n\tif err != nil {\n\t\t_, err := os.Create(filePath)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Error creating file:\", err)\n\t\t}\n\t}\n\n\tf, err := os.OpenFile(filePath, os.O_APPEND|os.O_WRONLY, 0600)\n\tif err != nil {\n\t\tlog.Fatal(\"Error opening file:\", err)\n\t}\n\n\tdefer f.Close()\n\n\tif _, err = f.WriteString(cotentToAppend + \"\\n\"); err != nil {\n\t\tlog.Fatal(\"Error writing json string:\", err)\n\t}\n\n}", "title": "" }, { "docid": "ba575bb5acf3089184f916f6a09d01b0", "score": "0.4301135", "text": "func (r *replicator) Save(filename string, keysPath string) error {\n\tdefer func(FromNodeClient *clientv3.Client) {\n\t\terr := FromNodeClient.Close()\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t}(r.FromNodeClient)\n\n\tctx := context.Background()\n\n\tresp, err := r.FromNodeClient.Get(ctx, keysPath, clientv3.WithPrefix(), clientv3.WithSort(clientv3.SortByKey, clientv3.SortAscend))\n\tif err != nil {\n\t\treturn err\n\t}\n\tf, err := os.Create(filename + \".csv\")\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\tdefer f.Close()\n\n\tw := csv.NewWriter(f)\n\tdefer w.Flush()\n\n\tfor i := range resp.Kvs {\n\t\tr := make([]string, 0, 2)\n\t\tr = append(r, string(resp.Kvs[i].Key))\n\t\tr = append(r, string(resp.Kvs[i].Value))\n\t\terr := w.Write(r)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "f9a700becdaf4722be52b3f7774b9d74", "score": "0.42909467", "text": "func writeJsonToFile(output interface{}) {\n\tvar err error\n\t_, err = os.Stat(\"churn-metrics\")\n\tif os.IsNotExist(err) {\n\t\terrDir := os.MkdirAll(\"churn-metrics\", 0755)\n\t\tif errDir != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tf, err := os.Create(filepath.Join(\"churn-metrics\", \"churn-metrics-op-\"+time.Now().Format(time.RFC3339)+\".json\"))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tf.Close()\n\t}\n\tdefer f.Close()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tout, err := json.Marshal(output)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_, err = fmt.Fprintln(f, string(out))\n\tCheckIfError(err)\n}", "title": "" }, { "docid": "4ff04be64e191acc17627472e3b6e667", "score": "0.42906293", "text": "func (sfd *StatusFileData) saveToFile(file io.Writer) error {\n\tjsonBytes, err := json.Marshal(sfd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonBytes = append(jsonBytes, '\\n')\n\t_, err = file.Write(jsonBytes)\n\n\treturn err\n}", "title": "" }, { "docid": "d23c478d55548e367156deadb9c6cfb9", "score": "0.42898884", "text": "func (pm *PicMap) SaveJSON(fname string) error {\n\tf, err := os.Create(fname)\n\tdefer f.Close()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\tfb := bufio.NewWriter(f) // this makes a HUGE difference in write performance!\n\tdefer fb.Flush()\n\n\te := json.NewEncoder(fb)\n\te.SetIndent(\"\", \"\\t\")\n\terr = e.Encode(*pm)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2ed47bf4344fead5d7fb98eec3fad793", "score": "0.42897534", "text": "func (c *company) SaveFolder(w io.Writer) error {\n\t_, err := w.Write([]byte(c.String()))\n\tif err != nil {\n\t\tlog.Println(\"Failed to save data\")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37f8ee9ad86a38276ced71b18a2c2293", "score": "0.42832366", "text": "func Save(c *cli.Context) {\n\traw, err := ioutil.ReadFile(\"./package.json\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tvar dependencies map[string]interface{}\n\tvar devDependencies map[string]interface{}\n\n\tscan.ScanJSON(strings.NewReader(string(raw)), \"/devDependencies\", &devDependencies)\n\tscan.ScanJSON(strings.NewReader(string(raw)), \"/dependencies\", &dependencies)\n\n\tvar dependenciesKeys []string\n\tvar devDependenciesKeys []string\n\tfor key := range dependencies {\n\t\tdependenciesKeys = append(dependenciesKeys, key)\n\t}\n\tfor key := range devDependencies {\n\t\tdevDependenciesKeys = append(devDependenciesKeys, key)\n\t}\n\n\toutput, err := json.Marshal(&model.Json{\n\t\tDependencies: dependenciesKeys,\n\t\tDevDependencies: devDependenciesKeys,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"Save modules: %v\", string(output))\n\n\tcontext := []byte(output)\n\tioutil.WriteFile(\".nick.json\", context, os.ModePerm)\n}", "title": "" }, { "docid": "8f3211b2f62eb49754f7bc103ae168c7", "score": "0.42756426", "text": "func saveJSON(configuration interface{}, configFile string) (err error) {\n\tvar bytes []byte\n\tbytes, err = json.MarshalIndent(configuration, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(configFile, bytes, 0644)\n\treturn err\n}", "title": "" }, { "docid": "08a45ffcdfe4b0674e1b79c8563056df", "score": "0.42705703", "text": "func saveAdminEditCo(d *personDetail, atr *TestResults) bool {\n\tURL := fmt.Sprintf(\"http://%s:%d/saveAdminEditCo/%d\", App.Host, App.Port, d.UID)\n\tvar c company\n\thc := http.Client{}\n\tgetCompanyInfo(d.UID, &c)\n\n\t// fmt.Printf(\"Company %d\\n\", d.UID)\n\t// fmt.Printf(\"Initial: %#v\\n\", c)\n\n\tform := url.Values{}\n\n\t// user d.UID must only change the company names to something that none\n\t// of the other users will use.\n\tn := int64(len(App.Companies)) / App.TestUsers // this is the range that ea\n\tnstart := n * (d.UID - 1) // starting index for this user\n\n\t// set new values\n\tc.LegalName = App.Companies[nstart+rand.Int63n(n)]\n\tc.CommonName = c.LegalName\n\tc.Designation = genDesignation(c.LegalName, \"cocode\", \"companies\")\n\tc.Email = randomCompanyEmail(c.LegalName)\n\tc.Phone = randomPhoneNumber()\n\tc.Fax = randomPhoneNumber()\n\tc.Active = rand.Int63n(2)\n\tc.EmploysPersonnel = rand.Int63n(2)\n\tc.Address = randomAddress()\n\tif rand.Intn(10) > 7 {\n\t\tc.Address2 = fmt.Sprintf(\"Suite %d\", 1+rand.Intn(10000))\n\t}\n\tc.City = App.Cities[rand.Intn(len(App.Cities))]\n\tc.State = App.States[rand.Intn(len(App.States))]\n\tc.PostalCode = fmt.Sprintf(\"%05d\", rand.Intn(99999))\n\tc.Country = \"USA\"\n\n\t// fmt.Printf(\"Random Updates: %#v\\n\", c)\n\n\t//===================================================\n\t// Simulate filling in the fields...\n\t//===================================================\n\tform.Add(\"LegalName\", c.LegalName)\n\tform.Add(\"CommonName\", c.CommonName)\n\tform.Add(\"Designation\", c.Designation)\n\tform.Add(\"Email\", c.Email)\n\tform.Add(\"Phone\", c.Phone)\n\tform.Add(\"Fax\", c.Fax)\n\tform.Add(\"Active\", activeToString(c.Active))\n\tform.Add(\"EmploysPersonnel\", yesnoToString(c.EmploysPersonnel))\n\tform.Add(\"Address\", c.Address)\n\tform.Add(\"Address2\", c.Address2)\n\tform.Add(\"City\", c.City)\n\tform.Add(\"State\", c.State)\n\tform.Add(\"PostalCode\", c.PostalCode)\n\tform.Add(\"Country\", c.Country)\n\n\t//===================================================\n\t// Simulate the button press...\n\t//===================================================\n\tform.Add(\"action\", \"save\")\n\n\treq, err := http.NewRequest(\"POST\", URL, bytes.NewBufferString(form.Encode()))\n\terrcheck(err)\n\n\thdrs := []KeyVal{\n\t\t// {\"Host:\", fmt.Sprintf(\"%s:%d\", App.Host, App.Port)},\n\t\t{\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\"},\n\t\t{\"Accept-Encoding\", \"gzip, deflate\"},\n\t\t{\"Accept-Language\", \"en-US,en;q=0.8\"},\n\t\t{\"Cache-Control\", \"max-age=0\"},\n\t\t{\"Connection\", \"keep-alive\"},\n\t\t{\"Content-Type\", \"application/x-www-form-urlencoded\"},\n\t\t{\"User-Agent\", \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36\"},\n\t}\n\tfor i := 0; i < len(hdrs); i++ {\n\t\treq.Header.Add(hdrs[i].key, hdrs[i].value)\n\t}\n\t// fmt.Printf(\"adminEditSave: Adding session cookie: %#v\\n\", d.SessionCookie)\n\treq.AddCookie(d.SessionCookie)\n\n\t// fmt.Printf(\"d before save = %#v\\n\", d)\n\n\t//===================================================\n\t// SUBMIT THE FORM...\n\t//===================================================\n\tresp, err := hc.Do(req)\n\tif nil != err {\n\t\tfmt.Printf(\"saveAdminEdit: hc.Do(req) returned error: %#v\\n\", err)\n\t\tfmt.Printf(\"err: %s\\n\", err.Error())\n\t\treturn false\n\t}\n\tdefer resp.Body.Close()\n\n\t// if 1 > 0 {\n\t// \tfmt.Printf(\"DumpResponse:\\n\")\n\t// \tdump, err := httputil.DumpResponse(resp, true)\n\t// \terrcheck(err)\n\t// \tfmt.Printf(\"\\n\\ndumpResponse = %s\\n\", string(dump))\n\t// }\n\n\t// Verify if the response was ok\n\tif resp.StatusCode != http.StatusOK {\n\t\tfmt.Printf(\"saveAdminEditCo: Server return non-200 status: %v\\n\", resp.Status)\n\t}\n\n\t//==============================================================\n\t// now read in the updated version\n\t//==============================================================\n\tvar cnew company\n\tgetCompanyInfo(d.UID, &cnew)\n\n\t// fmt.Printf(\"After db update and readback: %#v\\n\", cnew)\n\tres := c.matches(&cnew, atr)\n\n\treturn res\n}", "title": "" }, { "docid": "51ea6e3d4a884ce07e037ed85d560678", "score": "0.42659816", "text": "func (fs *FSHelper) SaveAsJSON(data interface{}, filename string) error {\n\n\tvar buf bytes.Buffer\n\te := json.NewEncoder(&buf)\n\te.SetEscapeHTML(false)\n\te.SetIndent(\"\", \" \")\n\te.Encode(data)\n\n\terr := os.WriteFile(filename, buf.Bytes(), 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a47f72e73c59b306f6d1f6f870550c08", "score": "0.42656842", "text": "func (c *PolicyChecker) saveInlinePolicies(list []*AwsPolicy) error {\n\tc.loggingInfo(\"invoking `saveInlinePolicies` size:[%d] ...\", len(list))\n\n\tf, err := NewFileHandler(c.config.GetOutputFile())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// CSV headers\n\theaders := []string{\n\t\t\"entity_type\",\n\t\t\"entity_name\",\n\t\t\"policy_name\",\n\t\t\"policy_action\",\n\t\t\"policy_resource_action\",\n\t}\n\n\t// CSV row\n\tfnCols := func(p *AwsPolicy) []string {\n\t\ttyp, entities := p.GetEntityAndType()\n\t\treturn []string{\n\t\t\ttyp,\n\t\t\tstrings.Join(entities, \"\\n\"),\n\t\t\tp.PolicyName,\n\t\t\tstrings.Join(p.PolicyActions, \"\\n\"),\n\t\t\tstrings.Join(GetResourceAndAction(p.PolicyResourceActions), \"\\n\"),\n\t\t}\n\t}\n\n\treturn f.WriteAll(headers, toSliceForOutpout(list, fnCols))\n}", "title": "" }, { "docid": "d726be88bf51e2599ea4cd8892c5da35", "score": "0.42641926", "text": "func (t *GenerateRewardMerkleTreeTask) SaveRewardMerkleTreeLeavesToFile() error {\n\tlog.Printf(\"saving merkle tree leaves to ./%s\", t.rewardMerkleTreeLeavesFilepath)\n\n\tdata, err := json.MarshalIndent(t.rewardMerkleTree.MerkleTreeLeaves, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := ioutil.WriteFile(t.rewardMerkleTreeLeavesFilepath, append(data, '\\n'), 0644); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b5d1ec516005d1d075472aeda0e69de3", "score": "0.42621964", "text": "func (l Lists) save() error {\n\tdata, err := yaml.Marshal(l)\n\tif err == nil {\n\t\terr = ioutil.WriteFile(l.listsFile, data, 0644)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "ccda7cff40b066c1e4b6fdd74ce212b6", "score": "0.42578852", "text": "func (v GetFwLeaderboardsCorporationsYesterdayYesterday1List) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonCa0a4d4bEncodeGithubComAntihaxGoesiEsi(w, v)\n}", "title": "" }, { "docid": "708f4dec14938e597d3c3a988e892785", "score": "0.4248541", "text": "func (m *Manifest)Save(filepath string) {\n manifestString, _ := json.MarshalIndent(m, \"\", \" \")\n err := ioutil.WriteFile(filepath, manifestString, 0644)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "72fcf8983a7dfd24b2685d7eea883243", "score": "0.4248036", "text": "func saveComments(username string, comments *[]Comment) {\n\tcommentJson, err := json.MarshalIndent(comments, \"\", \"\\t\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = ioutil.WriteFile(packageTools.GetWD()+\"/static/data/comments_\"+username+\".json\", commentJson, 0644)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "4ee78e2909cffc64e3fe78923230ff37", "score": "0.42391488", "text": "func (c *ClusterEncoder) Save(path string) error {\n\tdata, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"save encoder\")\n\t}\n\tif err := ioutil.WriteFile(path, data, 0755); err != nil {\n\t\treturn errors.Wrap(err, \"save encoder\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ca6d131da4777204b7acc30320bc728", "score": "0.42364594", "text": "func (c *trustedClusterCollection) WriteJSON(w io.Writer) error {\n\treturn utils.WriteJSON(c, w)\n}", "title": "" }, { "docid": "202420364dbf8b00c5a5d5ffb3605615", "score": "0.42328426", "text": "func (c Client)saveSliceToRetry(results_list []string) {\n\t/*\n\tIf size of file is bigger, than max size we will remove lines from this file,\n\tand will call this function again to check result and write to the file.\n\tRecursion:)\n\t */\n\tf, err := os.OpenFile(c.conf.RetryFile, os.O_RDWR | os.O_CREATE | os.O_APPEND, 0600)\n\tdefer f.Close()\n\tif err != nil {\n\t\tc.lg.Println(\"CLIENT:\", err.Error())\n\t}\n\t/*\n\t We are saving only amount of lines which less than c.lc.fileMetricSize\n\t Of course we drop old metrics if it is\n\t */\n\n\tfor _, metric := range results_list {\n\t\tf.WriteString(metric+\"\\n\")\n\t\tc.mon.saved++\n\t}\n\tc.removeOldDataFromRetryFile()\n}", "title": "" }, { "docid": "ac882cfd3df0f3843caa9d4c1b5ad1c8", "score": "0.4230526", "text": "func storePrivKeys(w io.Writer, list openpgp.EntityList) error {\n\tfor _, e := range list {\n\t\tif err := e.SerializePrivate(w, nil); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a5be674b8b06521973ad14f80358e67", "score": "0.42163548", "text": "func (v PostUniverseIdsCorporationList) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson5808f57cEncodeGithubComAntihaxGoesiEsi(w, v)\n}", "title": "" }, { "docid": "af885bc3f4e62927f87ddd9d8ffc1559", "score": "0.42144692", "text": "func(f *FileOutput) WriteBackendsState() error {\n\tdata, err := json.Marshal(f.Backends)\n\tif err != nil {\n\t\tlog.WithError(err).Warn(\"Unable to Marchal in JSON Backends State\")\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(f.FilePath,data,0644)\n\tif err != nil {\n\t\tlog.WithField(\"Filename\",f.FilePath).WithError(err).Warn(\"Unable to Write Backends State into File\")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e37e42edec8c681ae3c325f5126cfa38", "score": "0.4213692", "text": "func WriteChains (filepath string, \n\trandom_seed, \n\tppe int,\n\tchain_avg_len, executor_count int,\n\tchain_merge_p, chain_sync_p, chain_variance float64,\n\tchains, periods, priorities []int, \n\tpaths [][]int, \n\tus []float64) error {\n\tvar cs Chains = []Chain{}\n\n\t// Create the data structures\n\tfor id, _ := range chains {\n\t\tcs = append(cs, Chain{\n\t\t\tID: id,\n\t\t\tPrio: priorities[id],\n\t\t\tPath: paths[id],\n\t\t\tPeriod_us: int64(periods[id]),\n\t\t\tUtilisation: us[id],\n\t\t\tRandom_seed: random_seed,\n\t\t\tPPE: ppe,\n\t\t\tAvg_len: chain_avg_len,\n\t\t\tMerge_p: chain_merge_p,\n\t\t\tSync_p: chain_sync_p,\n\t\t\tVariance: chain_variance,\n\t\t\tExecutors: executor_count,\n\t\t})\n\t}\n\n\t// Attempt to marshall the data\n\tdata, err := json.Marshal(cs)\n\tif nil != err {\n\t\treturn err\n\t}\n\t\n\t// Attempt to write the serialized data to file\n\treturn ioutil.WriteFile(filepath, data, 0777)\n}", "title": "" }, { "docid": "591b659fc858d65337f9e1c24f9e8613", "score": "0.4210789", "text": "func writeContacts(lines []string, path string) error {\n\n\tfile, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tw := bufio.NewWriter(file)\n\tfor _, line := range lines {\n\t\tfmt.Fprintln(w, line)\n\t}\n\treturn w.Flush()\n}", "title": "" }, { "docid": "b62100ac217cfda6bad665f694ee0782", "score": "0.4208925", "text": "func (c *Coffees) ToJSON() ([]byte, error) {\n\treturn json.Marshal(c)\n}", "title": "" }, { "docid": "3d1ac5150e22006853ab95f4bf9d075e", "score": "0.420278", "text": "func (db *JsonDB) saveToFile() error {\n\n\tj, err := json.MarshalIndent(db.tasks, \" \", \" \")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, err := os.Create(db.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\t_, err = f.Write(j)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "576b381cdea71fdf909b5bc07b0a5c3d", "score": "0.42004886", "text": "func (e *Enforcer) SaveAllowlist(path string) error {\n\treturn e.allowlist.Save(path)\n}", "title": "" }, { "docid": "50cd37b6661f8ea082b2a06fd1ba2b8b", "score": "0.41979426", "text": "func SaveFullCommitJSON(fc lite.FullCommit, path string) error {\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tdefer f.Close()\n\tstream := json.NewEncoder(f)\n\terr = stream.Encode(fc)\n\treturn errors.WithStack(err)\n}", "title": "" } ]
ffb8b776a45971d2ea881ddaf17dd05e
Run starts the server.
[ { "docid": "724b7797135e05479c80e2d00cabf6c5", "score": "0.0", "text": "func (server *Server) Run() {\n\t// defer closing db/store\n\tdefer server.store.Close()\n\n\tdone := false\n\tfor !done {\n\t\tselect {\n\t\tcase <-server.signals:\n\t\t\tserver.Shutdown()\n\t\t\tdone = true\n\n\t\tcase <-server.rehashSignal:\n\t\t\t// eventually we expect to use HUP to reload config\n\t\t\terr := server.rehash()\n\t\t\tif err != nil {\n\t\t\t\tLog.error.Println(\"Failed to rehash:\", err.Error())\n\t\t\t}\n\n\t\tcase conn := <-server.newConns:\n\t\t\t// check connection limits\n\t\t\tipaddr := net.ParseIP(IPString(conn.Conn.RemoteAddr()))\n\t\t\tif ipaddr != nil {\n\t\t\t\t// check DLINEs\n\t\t\t\tisBanned, info := server.dlines.CheckIP(ipaddr)\n\t\t\t\tif isBanned {\n\t\t\t\t\tbanMessage := fmt.Sprintf(bannedFromServerBytes, info.Reason)\n\t\t\t\t\tif info.Time != nil {\n\t\t\t\t\t\tbanMessage += fmt.Sprintf(\" [%s]\", info.Time.Duration.String())\n\t\t\t\t\t}\n\t\t\t\t\tconn.Conn.Write([]byte(banMessage))\n\t\t\t\t\tconn.Conn.Close()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// check connection limits\n\t\t\t\tserver.connectionLimitsMutex.Lock()\n\t\t\t\terr := server.connectionLimits.AddClient(ipaddr, false)\n\t\t\t\tserver.connectionLimitsMutex.Unlock()\n\t\t\t\tif err != nil {\n\t\t\t\t\t// too many connections from one client, tell the client and close the connection\n\t\t\t\t\t// this might not show up properly on some clients, but our objective here is just to close it out before it has a load impact on us\n\t\t\t\t\tconn.Conn.Write([]byte(tooManyClientsBytes))\n\t\t\t\t\tconn.Conn.Close()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// check connection throttle\n\t\t\t\tserver.connectionThrottleMutex.Lock()\n\t\t\t\terr = server.connectionThrottle.AddClient(ipaddr)\n\t\t\t\tserver.connectionThrottleMutex.Unlock()\n\t\t\t\tif err != nil {\n\t\t\t\t\t// too many connections too quickly from client, tell them and close the connection\n\t\t\t\t\tlength := &IPRestrictTime{\n\t\t\t\t\t\tDuration: server.connectionThrottle.BanDuration,\n\t\t\t\t\t\tExpires: time.Now().Add(server.connectionThrottle.BanDuration),\n\t\t\t\t\t}\n\t\t\t\t\tserver.dlines.AddIP(ipaddr, length, server.connectionThrottle.BanMessage, \"Exceeded automated connection throttle\")\n\n\t\t\t\t\t// reset ban on connectionThrottle\n\t\t\t\t\tserver.connectionThrottle.ResetFor(ipaddr)\n\n\t\t\t\t\t// this might not show up properly on some clients, but our objective here is just to close it out before it has a load impact on us\n\t\t\t\t\tconn.Conn.Write([]byte(server.connectionThrottle.BanMessageBytes))\n\t\t\t\t\tconn.Conn.Close()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tgo NewClient(server, conn.Conn, conn.IsTLS)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\tcase client := <-server.idle:\n\t\t\tclient.Idle()\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "5e17b48b7774618c1cee826804e1a171", "score": "0.83272505", "text": "func (h *Server) Run() {\n\n\th.g.StartServer()\n}", "title": "" }, { "docid": "1a77dd6c427814de342bd5e60e99bb8c", "score": "0.81180596", "text": "func Run() error {\n\tgo server.ListenAndServe()\n\t// TODO: Improve error handling\n\treturn nil\n}", "title": "" }, { "docid": "1b239e6384a917d09c2385c3f01506b7", "score": "0.80933595", "text": "func (s *Server) Run() {\n\tgo func() {\n\t\t// start serving\n\t\tif err := s.httpServer.ListenAndServe(); err != nil {\n\t\t\tlog.Errora(err)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "b304f477a5b0ee094a595647ba7cac30", "score": "0.8040263", "text": "func (s *Server) Run() error {\n\tbg := s.logger.Bg()\n\tlis, err := net.Listen(\"tcp\", s.hostPort)\n\n\tif err != nil {\n\t\tbg.Fatal(\"Unable to start server\", zap.Error(err))\n\t\treturn err\n\t}\n\n\tbg.Info(\"Starting\", zap.String(\"address\", \"tcp://\"+s.hostPort))\n\treturn s.Gs.Serve(lis)\n}", "title": "" }, { "docid": "66c0748d498bd77474a97e080e53857d", "score": "0.80165803", "text": "func Run() error {\n\tvar err error\n\n\ts := NewServer()\n\tport := \":1729\"\n\tfmt.Printf(\"Listening on %s...\\n\", port)\n\thttp.ListenAndServe(port, s)\n\n\treturn err\n}", "title": "" }, { "docid": "e1ef3fac113bad7f9b4bfc3d6a27e6a2", "score": "0.8016188", "text": "func (s *Server) Run() error {\n\treturn s.server.ListenAndServe()\n}", "title": "" }, { "docid": "cc6349cb15671afa3b23446f2f3b9778", "score": "0.7968423", "text": "func (s *Server) Run() error {\n\tmux := s.createServeMux()\n\tlog.WithField(\"address\", \"http://\"+s.hostPort).Info(\"Starting\")\n\treturn http.ListenAndServe(s.hostPort, mux)\n}", "title": "" }, { "docid": "cc6349cb15671afa3b23446f2f3b9778", "score": "0.7968423", "text": "func (s *Server) Run() error {\n\tmux := s.createServeMux()\n\tlog.WithField(\"address\", \"http://\"+s.hostPort).Info(\"Starting\")\n\treturn http.ListenAndServe(s.hostPort, mux)\n}", "title": "" }, { "docid": "7a8a42b0821225dacfc6ff7a56cdfc64", "score": "0.79275984", "text": "func (s *Server) Run(addr string) error {\n\tsvr := s.prepare(addr)\n\ts.logger.Info(\"start server\")\n\treturn svr.ListenAndServe()\n}", "title": "" }, { "docid": "6e0a98b520eceb2bdfd7b06f5b8b1dbf", "score": "0.7924831", "text": "func (s *Server) Run(ctx context.Context, wg *sync.WaitGroup) {\n\tif err := s.Config.Validate(); err != nil {\n\t\tlog.Panicf(\"invalid server config: %s\\n\", err)\n\t}\n\n\thandler := &http.Server{\n\t\tHandler: s.Router,\n\t\tAddr: \":\" + strconv.Itoa(s.Config.Port),\n\t}\n\n\tstartServer(ctx, handler, wg)\n}", "title": "" }, { "docid": "b8ac229429bb788479c38a42fb8a517d", "score": "0.7888267", "text": "func (srv *Server) Run() {\n\tsrv.StartListen()\n}", "title": "" }, { "docid": "15416fb1d0c0a0f137ced0d4f14a5124", "score": "0.78599983", "text": "func (s *Server) Run() error {\n\n\tgo func() {\n\t\tizap.Logger.Info(\"Starting http server\", zap.String(\"address\", s.srv.Addr))\n\t\terr := s.srv.ListenAndServe()\n\t\tif err != nil && err != http.ErrServerClosed {\n\t\t\ts.Stop()\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "2459fdb4f492e7dcf809131ae255b3f5", "score": "0.7854221", "text": "func (s *Server) Run() error {\n\t// configure service routes\n\ts.configureRoutes()\n\n\tlog.Infof(\"Serving '%s - %s' on address %s\", s.Title, s.Version, s.server.Addr)\n\t// server is set to healthy when started.\n\ts.healthy = true\n\tif s.config.InsecureHTTP {\n\t\treturn s.server.ListenAndServe()\n\t}\n\treturn s.server.ListenAndServeTLS(s.config.TLSCertFile, s.config.TLSKeyFile)\n}", "title": "" }, { "docid": "d8b5e370ddb4f6c7b52da119248de0c7", "score": "0.780602", "text": "func (s *server) Run() error {\n\ts.logger.Info(\"starting http server\", logger.String(\"addr\", s.server.Addr))\n\ts.server.Handler = s.gin\n\t// Open listener.\n\ttrackedListener, err := conntrack.NewTrackedListener(\"tcp\", s.addr, s.r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn s.server.Serve(trackedListener)\n}", "title": "" }, { "docid": "2092d0e9865e8e3401ca30d3f63f627e", "score": "0.77638775", "text": "func (s *Server) Run() error {\n\t// start fetcher, reporter and doc generator in goroutines\n\tgo s.fetcher.Run()\n\tgo s.reporter.Run()\n\tgo s.docGenerator.Run()\n\n\t// start webserver\n\tlistenAddress := s.listenAddress\n\tif listenAddress == \"\" {\n\t\tlistenAddress = DefaultAddress\n\t}\n\n\tr := mux.NewRouter()\n\n\t// register ping api\n\tr.HandleFunc(\"/_ping\", pingHandler).Methods(\"GET\")\n\n\t// github webhook API\n\tr.HandleFunc(\"/events\", s.gitHubEventHandler).Methods(\"POST\")\n\n\t// travisCI webhook API\n\tr.HandleFunc(\"/ci_notifications\", s.ciNotificationHandler).Methods(\"POST\")\n\n\tlogrus.Infof(\"start http server on address %s\", listenAddress)\n\treturn http.ListenAndServe(listenAddress, r)\n}", "title": "" }, { "docid": "b595e3ffeba92d4d1e987dd16619ff12", "score": "0.7754328", "text": "func (s *server) Run(ctx context.Context) {\n\tif s.banner {\n\t\tfmt.Printf(\"%s\\n\\n\", config.Banner)\n\t}\n\n\tet, err := NewEchoTCP(s.address, s.verbose)\n\tif err != nil {\n\t\tlog.Fatal(err) // exit if creating EchoTCP is failed.\n\t}\n\tdefer et.listener.Close()\n\n\tfmt.Printf(\"server is started at %s\\n\", s.address)\n\tet.Run(ctx)\n}", "title": "" }, { "docid": "6faabd2c938887e68ed26da6153d4222", "score": "0.77490586", "text": "func (s *Server) Run() {\n\trouter := routes.ConfigRoutes(s.server)\n\n\tlog.Print(\"server is running at port: \", s.port)\n\tlog.Fatal(router.Run(\":\" + s.port))\n}", "title": "" }, { "docid": "8df602596ee516ea6496b549a0944731", "score": "0.7736878", "text": "func (s *Server) Run() {\n\trouter := routes.LoadRoutes(s.server)\n\tlog.Println(\"server is running at port\", s.port)\n\tlog.Fatal(router.Run(\":\" + s.port))\n}", "title": "" }, { "docid": "960859f8c7294ec43a8227e2fb3419f3", "score": "0.7730335", "text": "func (s *Server) Run(addr string) {\n\tfmt.Println(\"Listening to port 8080\")\n\tlog.Fatal(http.ListenAndServe(addr, s.Router))\n}", "title": "" }, { "docid": "e0d3748b807617e95fd9aea49347fa80", "score": "0.77013695", "text": "func (h *Handler) Run() {\n\tlog.Printf(\"Listening on %s\", h.Cfg.Server.Address)\n\tserver := &http.Server{\n\t\tHandler: getRouter(),\n\t\tAddr: h.Cfg.Server.Address,\n\t}\n\th.listenErrCh <- server.ListenAndServe()\n}", "title": "" }, { "docid": "c691488cfa4521056c5dbcae1a2460a9", "score": "0.76656437", "text": "func (server *Server) Run(addr string) {\n\tlog.Println(\"Yinyo is ready and waiting.\")\n\tlog.Fatal(http.ListenAndServe(addr, server.router))\n}", "title": "" }, { "docid": "86256665ca5717ba6ee06955dc900c79", "score": "0.76489633", "text": "func (s *Server) Run(log *logrus.Entry) error {\n\ts.log = log.WithField(\"app\", AppName)\n\n\t// Init the app\n\ts.InitStart(log)\n\n\ts.gracefulServer = s.httpServer(s.log)\n\terr := s.gracefulServer.ListenAndServe()\n\tif err != nil && err != http.ErrServerClosed {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8823437a09fedd073ba9896237aa7ad", "score": "0.76275504", "text": "func (server Server) Run() error {\n\terr := server.supervisor.SpawnClient()\n\tif err != nil {\n\t\tserver.logger.Fatalf(\"Error in starting client: %s\", err)\n\t}\n\n\tgo listenForSMS(server.upstreamChannel, server.logger)\n\tserver.logger.Info(\"Listening for SMS\")\n\tserver.logger.Info(\"Starting Webserver\")\n\n\treturn server.webserver.Server.ListenAndServe()\n}", "title": "" }, { "docid": "f447e34f7bc48f0b7aa00272cc622adb", "score": "0.76164347", "text": "func (w *web) Run() {\n\tw.ready()\n\n\taddr := fmt.Sprintf(\"%s:%s\", w.Host, w.Port)\n\tLogger.Info(\"Starting web server at: %s\", addr)\n\tw.instance.Run(standard.New(addr))\n}", "title": "" }, { "docid": "81e8014e4d637aac71dbc9dd20f17f88", "score": "0.7594898", "text": "func (s httpServer) Run(h http.Handler) {\n\ts.srv.Handler = h\n\tgo s.srv.ListenAndServe()\n}", "title": "" }, { "docid": "d68f37a43672db5117b1725d8b0db4a0", "score": "0.757539", "text": "func (s *Server) Run() error {\n\ts.setRoutes()\n\n\thttpUrl := \":\" + strconv.Itoa(s.Config.HttpPort)\n\thttpsUrl := \":\" + strconv.Itoa(s.Config.HttpsPort)\n\ts.newServer(httpsUrl, httpUrl)\n\n\tgo s.httpServer.ListenAndServe()\n\treturn s.httpsServer.ListenAndServeTLS(s.Config.CertFile, s.Config.KeyFile)\n}", "title": "" }, { "docid": "73d105f9841fd80a864fa57204e92f1b", "score": "0.75607365", "text": "func Run(addr string) {\n\tmainServer.Run(addr)\n}", "title": "" }, { "docid": "bbc0aaf5f98d094b7d15a054b5acaa33", "score": "0.75552356", "text": "func (s *HttpServer) Run() {\n\n\tgo s.httpServer()\n\t<-s.quitChan\n}", "title": "" }, { "docid": "b9e496eb2e7d38d13cc380fe2ac0d3f8", "score": "0.7553506", "text": "func (s *Server) Run() {\n\trouter := gin.Default()\n\n\tv1 := router.Group(\"/v1\")\n\t{\n\t\tv1.POST(\"/login\", s.authMiddleware.LoginHandler)\n\t\tv1.POST(\"/users\", s.createUser)\n\n\t\tv1.Use(s.authMiddleware.MiddlewareFunc())\n\t\t{\n\n\t\t\tv1.GET(\"/tasks\", s.allTasks)\n\t\t\tv1.GET(\"/tasks/:id\", s.getTask)\n\t\t\tv1.POST(\"/tasks\", s.createTask)\n\t\t\tv1.PUT(\"/tasks/:id\", s.updateTask)\n\t\t}\n\t}\n\n\trouter.Run(\":\" + s.config.Port)\n}", "title": "" }, { "docid": "ce9c8655ab50fe26740128201a574111", "score": "0.75385225", "text": "func (s *Server) Run() {\n\tlog.Printf(\"[INFO] activate rest server on port %v\", s.Port)\n\tlog.Fatal(http.ListenAndServe(fmt.Sprintf(\"%v:%v\", s.address, s.Port), s.routes()))\n}", "title": "" }, { "docid": "a81280e1296847c802db51ce79a786f7", "score": "0.7531756", "text": "func Run() {\n\trouter := getRouter()\n\ts := &http.Server{\n\t\tAddr: \"0.0.0.0:8080\",\n\t\tHandler: router,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\ts.ListenAndServe()\n}", "title": "" }, { "docid": "de711f3899206c53207876efe596d702", "score": "0.7527195", "text": "func (t *Loki) Run() error {\n\treturn t.server.Run()\n}", "title": "" }, { "docid": "cf372f3fb2cfcc8721dab2d67f922f1d", "score": "0.75234246", "text": "func Run(h http.Handler) {\n\tsrv := createServer(h)\n\tgo gracefullyShutDownOnSignal(srv, context.Background())\n\tif err := srv.ListenAndServe(); err != http.ErrServerClosed {\n\t\tlog.Fatalf(\"Unable to to start server: %v\", err)\n\t}\n}", "title": "" }, { "docid": "affb3c6861582d68096e6da36ab54393", "score": "0.75159824", "text": "func (s *Server) Run() {\n\tvar l net.Listener\n\tvar err error\n\thost := s.ip+\":\"+s.port\n\tl, err = net.Listen(\"tcp\", host)\n\tif err != nil {\n\t\tlog.Fatal(\"Listen: %v\", err)\n\t}\n\tif s.connLimit > 0 {\n\t\tl = netutil.LimitListener(l, s.connLimit)\n\t}\n\n\terr = http.Serve(l, s)\n\tif err != nil {\n\t\tlog.Fatal(\"http.listenAndServe failed: %s\", err.Error())\n\t}\n\ts.l = l\n\treturn\n}", "title": "" }, { "docid": "41ecf923e98657813ac2bb20b8f6e8cb", "score": "0.75074124", "text": "func (a *API) Run() error {\n\tlog.Infof(\"Serving '%s - %s' on address %s\", a.Title, a.Version, a.server.Addr)\n\tif a.config.InsecureHTTP {\n\t\treturn a.server.ListenAndServe()\n\t}\n\treturn a.server.ListenAndServeTLS(a.config.TLSCertFile, a.config.TLSKeyFile)\n}", "title": "" }, { "docid": "65207d0664ba432d95d9e35145e060a8", "score": "0.75043017", "text": "func (s *Server) Run(ctx context.Context) error {\n\th := HealthHandler{\n\t\tservices: map[string]Healthier{\n\t\t\t\"ec2\": s.collectors.EC2,\n\t\t\t\"asg\": s.collectors.ASG,\n\t\t\t\"spot\": s.collectors.Spot,\n\t\t\t\"nodes\": s.collectors.Node,\n\t\t\t\"pods\": s.collectors.Pod,\n\n\t\t\t\"mainloop\": s.mainloop,\n\t\t},\n\t}\n\n\trouter := httprouter.New()\n\trouter.GET(\"/\", s.handleStatus)\n\trouter.GET(\"/-/ready\", webutil.HandleHealth)\n\trouter.Handler(\"GET\", \"/-/healthy\", h)\n\trouter.Handler(\"GET\", \"/metrics\", promhttp.Handler())\n\n\treturn webutil.ListenAndServerWithContext(\n\t\tctx, \":8080\", router)\n}", "title": "" }, { "docid": "f89ad196488719a651b35dc853fbd4cb", "score": "0.7500539", "text": "func (s *Server) Run() error {\n\n\tif err := s.init(); err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"QueryNode init done ...\")\n\n\tif err := s.start(); err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"QueryNode start done ...\")\n\treturn nil\n}", "title": "" }, { "docid": "ae64c136c1c2809aed3ce3d552e8295d", "score": "0.7498702", "text": "func (api *API) Run() error {\n\treturn api.startServe()\n}", "title": "" }, { "docid": "dcd62273fefde84ee00073a74531b4fd", "score": "0.74946964", "text": "func (s *SamFSServer) Run() error {\n\tlis, err := net.Listen(\"tcp\", s.port)\n\tif err != nil {\n\t\tglog.Fatalf(\"falied to listen on port :: %s(err=%s)\", s.port, err.Error())\n\t\treturn err\n\t}\n\n\trand.Seed(time.Now().UnixNano())\n\ts.sessionID = rand.Int63()\n\tglog.Infof(\"starting new server with sessionID %d\", s.sessionID)\n\n\tgs := grpc.NewServer()\n\tpb.RegisterNFSServer(gs, s)\n\ts.grpcServer = gs\n\treturn gs.Serve(lis)\n}", "title": "" }, { "docid": "257749bb97e51654735fecfe196592f6", "score": "0.74805635", "text": "func (s *Server) Run() error {\n\ttcpAddr, err := net.ResolveTCPAddr(\"tcp\", s.conf.Addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar listener net.Listener\n\tlistener, err = net.ListenTCP(\"tcp\", tcpAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif s.conf.TLSConfig != nil {\n\t\tlistener = tls.NewListener(listener, s.conf.TLSConfig)\n\t}\n\terr = s.Serve(listener)\n\treturn err\n}", "title": "" }, { "docid": "64395420d821d96659329b41bc8889af", "score": "0.7466316", "text": "func (server *Server) Run(ctx context.Context) {\n\tstopChan := make(chan struct{})\n\n\tserver.logger.Info(\"started\")\n\n\tgo func() {\n\t\tif err := server.server.ListenAndServe(); err != nil {\n\t\t\tif err == http.ErrServerClosed {\n\t\t\t\tserver.logger.Info(\"stopped\")\n\t\t\t} else {\n\t\t\t\tserver.logger.Error(err.Error())\n\t\t\t}\n\t\t}\n\n\t\tclose(stopChan)\n\t}()\n\n\tselect {\n\tcase <-stopChan:\n\tcase <-ctx.Done():\n\t}\n\n\terr := server.server.Shutdown(context.Background())\n\tif err != nil {\n\t\tserver.logger.Error(err.Error())\n\t}\n\n\t<-stopChan\n\n\tserver.logger.Sync()\n}", "title": "" }, { "docid": "d685b40d58b183d5fd2d7465740008d4", "score": "0.7465811", "text": "func Run() {\n\n\tgo func() {\n\t\terrors := setupTemplates(\"server/templates\")\n\t\tif errors != nil {\n\t\t\tfmt.Println(errors)\n\t\t}\n\t}()\n\n\tfmt.Println(\"Starting server...\")\n\thttp.HandleFunc(\"/\", index)\n\thttp.HandleFunc(\"/view\", view)\n\thttp.Handle(\"/static/\", http.StripPrefix(\"/static/\", http.FileServer(http.Dir(\"server/static/\"))))\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "b185b3265ea96a4cc57b2718040fa250", "score": "0.74632424", "text": "func Run() error {\n\tgo StartServer()\n\n\tlis, err := net.Listen(\"tcp\", \":50051\")\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to listen: %v\", err)\n\t}\n\n\ts := grpc.NewServer()\n\n\tklessapi.RegisterKlessAPIServer(s, &apiserver.APIServer{})\n\tif err := s.Serve(lis); err != nil {\n\t\tlog.Fatalf(\"failed to serve: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dee8d628f1509b9f548e2ccd83ef3100", "score": "0.7441511", "text": "func (serv *Server) Run(addr string) (err error) {\n\tdefer func() { debugPrintError(err) }()\n\n\tdebugPrint(\"Listening and serving HTTP on %s\\n\", addr)\n\terr = http.ListenAndServe(addr, serv)\n\treturn\n}", "title": "" }, { "docid": "2e9930076bdb15d05dabb7256ca28a27", "score": "0.74405", "text": "func (s *server) Run(addr string) error {\n\treturn http.ListenAndServe(addr, s.handler)\n}", "title": "" }, { "docid": "bfaab2c83b345ebd1367b59dc5a895cd", "score": "0.7439578", "text": "func (router *Router) Run() error {\n\tserver := router.server()\n\tlog.Printf(\"Router listening on port %s\\n\", server.Addr)\n\treturn server.ListenAndServe()\n}", "title": "" }, { "docid": "7c4aa6d4859b256abce3eecae57373f8", "score": "0.7431407", "text": "func Run(httpHandlers http.Handler) (s servers) {\n\ts.Host = config.Config.Server.Host\n\ts.Port = config.Config.Server.Port\n\tlog.Info(\"Starting Server On :\", \"address\", s.Host, \"port\", s.Port)\n\tstartServer(s, httpHandlers)\n\treturn\n}", "title": "" }, { "docid": "23860627e8c7cddc5bf4db4a35bf8f7c", "score": "0.7392064", "text": "func (app *Application) Run() {\n\terr := app.Server.ListenAndServe()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "title": "" }, { "docid": "9f5c95b867f7647f58534164ef1e668c", "score": "0.7327704", "text": "func (server *Server) Run() error {\n\t// run http server\n\tserver.runServer()\n\n\tif server.config.Server.EnableHTTPS {\n\t\tif server.config.TLS.CertFile == \"\" || server.config.TLS.KeyFile == \"\" {\n\t\t\treturn errors.New(\"use https should config the cert and key files\")\n\t\t}\n\t\tserver.runServerTLS()\n\t}\n\tif err := server.G.Wait(); err != nil {\n\t\tserver.API.log.Fatalln(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a12d6e6a1ba9b096559d1c0cde321a5d", "score": "0.7327077", "text": "func (ds *DiscoveryService) Run() {\n\tglog.Infof(\"Starting discovery service at %v\", ds.server.Addr)\n\tif err := ds.server.ListenAndServe(); err != nil {\n\t\tglog.Warning(err)\n\t}\n}", "title": "" }, { "docid": "a05d86f722b79f34b5717753d614c20d", "score": "0.7313524", "text": "func (s *Server) Run(address string) error {\n\treturn s.routes.Listen(address)\n}", "title": "" }, { "docid": "035ae5c003d8f5a76ebcf85294493a33", "score": "0.7302164", "text": "func (server *Server) Run() {\n\tc := cors.New(cors.Options{\n\t\tAllowedMethods: []string{\"GET\", \"POST\", \"OPTIONS\"},\n\t\tAllowedOrigins: []string{\"http://localhost:3000\"},\n\t\tAllowCredentials: true,\n\t\tAllowedHeaders: []string{\"Content-Type\", \"Bearer\", \"Bearer \", \"content-type\", \"Origin\", \"Accept\"},\n\t\tOptionsPassthrough: true,\n\t})\n\thandler := c.Handler(server.Router)\n\tlog.Fatal(http.ListenAndServe(\":8000\", handler))\n\tfmt.Println(\"Listening on port 8000\")\n}", "title": "" }, { "docid": "0012f4eeefc86a62b70115833ce47ff8", "score": "0.7299341", "text": "func Run() {\n\tApp.Init()\n\n\tif Config.String(\"address\") != \"\" {\n\t\tLog.Info(fmt.Sprintf(\"listening on %s\", Config.String(\"address\")))\n\t\tLog.Error(http.ListenAndServe(Config.String(\"address\"), App.Router))\n\t} else {\n\t\tLog.Info(fmt.Sprintf(\"listening on port :%d\", Config.Int(\"port\")))\n\t\tLog.Error(http.ListenAndServe(fmt.Sprintf(\":%d\", Config.Int(\"port\")), App.Router))\n\t}\n}", "title": "" }, { "docid": "b60b20b83ae8c818ce87d0abbbbc0ee0", "score": "0.72946924", "text": "func (a *ApiServer) Run(host string) {\n\tlog.Fatal(http.ListenAndServe(host, a.Router))\n}", "title": "" }, { "docid": "d6e4a0f252d58a26d6e5419e97208769", "score": "0.7294222", "text": "func (a *App) Run() {\n\taddr := fmt.Sprintf(\":%d\", a.getPort())\n\n\ta.Logger.Info(\"starting application\", logging.DataFields{\"port\": addr})\n\terr := http.ListenAndServe(addr,a.router)\n\tif err != nil {\n\t\ta.Logger.Error(\"An error occurred starting the server. Going to call exit\", logging.DataFields{\"Error\": err.Error()})\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "74fcf4d337236e365ba6f0aaf25b6224", "score": "0.72876", "text": "func Run(cfg RunnerConfig) {\n\tif cfg.LogOutput == nil {\n\t\tcfg.LogOutput = os.Stdout\n\t}\n\tlog.NewLogger(cfg.LogLevel, cfg.LogOutput)\n\tserver.Run()\n}", "title": "" }, { "docid": "cc63a6b76126a87e3d6acfb7ec857b3a", "score": "0.7283254", "text": "func (app *Application) Run() {\n\tapp.Setup()\n\n\tapp.App.Listen(fmt.Sprintf(\"%s:%d\", app.Config.App.Host, app.Config.App.Port))\n}", "title": "" }, { "docid": "1edc39b7b1b39d686842c9a76b27bcc9", "score": "0.7279343", "text": "func (server *Server) Run() {\n\tserver.goroutineWG.Add(1)\n\tgo server.run()\n}", "title": "" }, { "docid": "4d146489627fd321ba77ffde196bb395", "score": "0.7272571", "text": "func (a *App) Run() error {\n\tserver := &http.Server{\n\t\tAddr: a.addr,\n\t\tHandler: a.handle,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\tLogs.Info(\"Run Server %s\", a.addr)\n\treturn server.ListenAndServe()\n}", "title": "" }, { "docid": "fae4eed18de0ae39407f75dad53c4660", "score": "0.7254202", "text": "func (s *Service) Run(port string) {\n\ts.log.Println(\"Starting...\")\n\tr := s.prepareRouter()\n\n\tif err := http.ListenAndServe(port, r); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "41c4786ae08b6e02acfe7f67fd22b374", "score": "0.724812", "text": "func (a *App) Run() {\n\tlog.Fatal(http.ListenAndServe(\":8000\", a.router))\n}", "title": "" }, { "docid": "f5f8d82611b3e8103d5bcf704e1a9e3c", "score": "0.72471577", "text": "func (s *Server) Run(\n\t// Common\n\tctx context.Context,\n\tlog logger.Logger,\n\ttracer *trace.TracerProvider,\n) (*Server, error) {\n\t// API port\n\tviper.SetDefault(\"API_PORT\", 7070) // nolint:gomnd\n\t// Request Timeout (seconds)\n\tviper.SetDefault(\"API_TIMEOUT\", \"60s\")\n\n\tconfig := http_server.Config{\n\t\tPort: viper.GetInt(\"API_PORT\"),\n\t\tTimeout: viper.GetDuration(\"API_TIMEOUT\"),\n\t}\n\n\tg := errgroup.Group{}\n\n\tg.Go(func() error {\n\t\treturn s.run(\n\t\t\tctx,\n\t\t\tconfig,\n\t\t\tlog,\n\t\t\ttracer,\n\t\t)\n\t})\n\n\treturn s, nil\n}", "title": "" }, { "docid": "6399e4096de7e30ec783ce576201ac8e", "score": "0.7245837", "text": "func (s *Server) Run(ctx context.Context) error {\n\tfs := customFileSystem{http.Dir(s.Dir)}\n\n\thandler := http.NewServeMux()\n\thandler.Handle(\"/\", http.FileServer(fs))\n\n\tfileServer := &http.Server{\n\t\tAddr: s.ListenAddress,\n\t\tHandler: handler,\n\t\tReadTimeout: time.Second * 15,\n\t\tReadHeaderTimeout: time.Second * 15,\n\t\tWriteTimeout: time.Second * 15,\n\t\tIdleTimeout: time.Second * 30,\n\t\tMaxHeaderBytes: 4096,\n\t}\n\n\terrs := make(chan error)\n\tgo func() {\n\t\terrs <- fileServer.ListenAndServe()\n\t}()\n\n\tselect {\n\tcase err := <-errs:\n\t\treturn err\n\tcase <-ctx.Done():\n\t\treturn fileServer.Shutdown(ctx)\n\t}\n}", "title": "" }, { "docid": "17930b74ecd7b334f14164d62e179137", "score": "0.7244858", "text": "func (s *Server) Run() error {\n\tdefer s.logger.Sync()\n\tdefer s.redis.Close()\n\n\t// Create TCP listener\n\tl, err := net.Listen(\"tcp\", s.address)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed creating listener on %s\", s.address)\n\t}\n\n\t// Create HTTP Server\n\ts.server = &http.Server{\n\t\tHandler: s.router,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\n\t// Creating tracer\n\tvar tracer ot.Tracer\n\tvar closer io.Closer\n\ttracer, closer, err = util.InitTracer(\"order\", s.logger)\n\tif err != nil {\n\t\ts.logger.Warnw(\"unable to initialize tracer\",\n\t\t\t\"error\", err,\n\t\t)\n\t} else {\n\t\tdefer closer.Close()\n\t\tot.SetGlobalTracer(tracer)\n\t}\n\n\t// Listening\n\tgo func() {\n\t\ts.logger.Infow(\"Server listening\",\n\t\t\t\"address\", s.address,\n\t\t\t\"endpoint\", s.endpoint,\n\t\t)\n\t\ts.logger.Fatal(s.server.Serve(l))\n\t}()\n\n\t// Buffered channel to receive a single os.Signal\n\tstop := make(chan os.Signal, 1)\n\tsignal.Notify(stop, syscall.SIGINT, syscall.SIGTERM)\n\n\t// Blocking channel until interrupt occurs\n\t<-stop\n\ts.Stop()\n\n\treturn nil\n}", "title": "" }, { "docid": "b56cf726efd1c5481aab5ea5f6eaa9d4", "score": "0.7244423", "text": "func (s *Server) Run(addr string) (err error) {\n\ts.listener, err = net.Listen(network, addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn s.serve()\n}", "title": "" }, { "docid": "f9ca6115cafc6bce5111429e6f0b74b3", "score": "0.723898", "text": "func (a *App) Run() {\n\tfmt.Println(\"Run\")\n\tdefer a.session.Close()\n\ta.server.Start()\n}", "title": "" }, { "docid": "69d93986a5e978ee1c17c570fe9d31b5", "score": "0.7235119", "text": "func (s *Server) Run() (chan *Message, error) {\n\ts.logger.Notice(\"Starting %v server...\", s.name)\n\ts.commsChan = make(chan *Message)\n\ts.killChan = make(chan bool)\n\tgo s.listenAndServe()\n\treturn s.commsChan, nil\n}", "title": "" }, { "docid": "aafd2b21ee60c1a8dbcf12835e895ecb", "score": "0.72319627", "text": "func (app *App) Run() {\n\tMust(app.Engine.Start(\":\" + app.Conf.UString(\"port\")))\n}", "title": "" }, { "docid": "a0aff14473fc8a906be17fc66adab809", "score": "0.7222838", "text": "func (api *API) Run() {\n\tr := gin.Default()\n\n\tapi.configRoutes(r)\n\n\tr.Run() // listen and serve on 0.0.0.0:8080 (for windows \"localhost:8080\")\n}", "title": "" }, { "docid": "daab4b0de2310682b1a2a773e567f9aa", "score": "0.72172433", "text": "func (server *Server) Run() {\n\n\t// Create controllers\n\ttaskAssignmentsController := &taskAssignmentsController{server.TaskMaster}\n\ttaskController := &taskController{server.TaskMaster}\n\n\t// Register handlers\n\thttp.HandleFunc(\"/task/assignments\", taskAssignmentsController.buildHandlers())\n\thttp.HandleFunc(\"/task\", taskController.buildHandlers())\n\n\t// Start HTTP server\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}", "title": "" }, { "docid": "110cdc74e8d2591012d22da99540fcaf", "score": "0.72153133", "text": "func (srv *Server) Run() error {\n\tlog.Printf(\"Server listening on port %v\", srv.cfg.Port)\n\treturn http.ListenAndServeTLS(fmt.Sprintf(\":%v\", srv.cfg.Port), srv.cfg.CertFilePath, srv.cfg.KeyFilePath, srv.router)\n}", "title": "" }, { "docid": "c1ce238cd0b225ab895e5091f8e50afd", "score": "0.7213647", "text": "func Run() error {\n\ts := grapiserver.New(\n\t\tgrapiserver.WithDefaultLogger(),\n\t\tgrapiserver.WithServers(\n\t\t// TODO\n\t\t),\n\t)\n\treturn s.Serve()\n}", "title": "" }, { "docid": "89cf8bd73a125e537c57b1826bd762ff", "score": "0.7211302", "text": "func (a *App) Run(addr string) {\n\ta.Logger.WithFields(logrus.Fields{\"addr\": addr}).Info(\"starting http server\")\n\ta.Logger.Fatal(http.ListenAndServe(addr, a.Router))\n}", "title": "" }, { "docid": "c824024a63b43f74101d1b1d118fa6b4", "score": "0.72104204", "text": "func Run() {\n\tgetRoutes()\n\trouter.Run(\":5000\")\n}", "title": "" }, { "docid": "2765ab5a6ed0d82c6198e66535606e6c", "score": "0.72074455", "text": "func (s *JS8Server) Run() {\n\tgo s.run()\n}", "title": "" }, { "docid": "00f43c3d128546f2dbb8cdfb3c40322d", "score": "0.7206942", "text": "func Run(cfg *config.Config) {\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(2)\n\tr := newRouter(cfg.StaticPath)\n\tport := os.Getenv(\"PORT\")\n\tif port != \"\" {\n\t\t// production\n\t\tlog.WithField(\"port\", port).Info(\"Server started\")\n\t\tlog.Fatal(http.ListenAndServe(\":\"+port, r))\n\t} else {\n\t\t// dev\n\t\tserve(wg, cfg, r)\n\t}\n\n\twg.Wait()\n}", "title": "" }, { "docid": "8bf9fae8d8ed6b07b86ab7848c937670", "score": "0.71822816", "text": "func (serv *ExchangeServer) Run() {\n\tlogger.Info(\"server started %s:%d\", serv.cfg.Server, serv.cfg.Port)\n\n\t// register the order handlers\n\tfor cp, c := range serv.orderHandlers {\n\t\tserv.orderManager.RegisterOrderChan(cp, c)\n\t}\n\n\t// start the utxo manager\n\tc := make(chan bool)\n\tgo serv.btcum.Start(c)\n\tgo serv.skyum.Start(c)\n\n\tgo serv.orderManager.Start(1*time.Second, c)\n\tserv.handleOrders(c)\n\n\t// start the api server.\n\tr := router.New(serv, c)\n\tr.Run(serv.cfg.Server, serv.cfg.Port)\n}", "title": "" }, { "docid": "4d7d2279c4980937d7c1035c020d556c", "score": "0.71720845", "text": "func Run() error {\r\n\tif err := Start(); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tif err := DefaultServer.Register(); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tch := make(chan os.Signal, 1)\r\n\tsignal.Notify(ch, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)\r\n\tlog.Logf(\"Received signal %s\", <-ch)\r\n\r\n\tif err := DefaultServer.Deregister(); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn Stop()\r\n}", "title": "" }, { "docid": "d10b8dfdce755906ef4ede4e90d5ba09", "score": "0.7163742", "text": "func (s *Service) Run() {\n\tlog.Printf(\"[Info] todolist service listen on %s...\\n\", s.httpServer.Addr)\n\tlog.Fatal(\"[Fatal]\", s.httpServer.ListenAndServe())\n}", "title": "" }, { "docid": "cf21c56516d9d78ef777eab52800bb8e", "score": "0.7159565", "text": "func (a *App) Run() {\n\tif a.cmd != nil {\n\t\ta.cmd.Run(a.container)\n\t}\n\n\twg := sync.WaitGroup{}\n\n\t// Start HTTP Server\n\tif a.httpServer != nil {\n\t\twg.Add(1)\n\n\t\tgo func(s *httpServer) {\n\t\t\tdefer wg.Done()\n\t\t\ts.Run(a.container)\n\t\t}(a.httpServer)\n\t}\n\n\twg.Wait()\n}", "title": "" }, { "docid": "320acaf286eb43283c1382b3af441955", "score": "0.715156", "text": "func (s *AppServer) Run() {\n\tvar (\n\t\tconfig = s.config.Section()\n\t\tnetwork = \"tcp\"\n\t\taddr = config.Server.Addr\n\t\tport = config.Server.Port\n\t\trtimeout = DefaultHttpRequestTimeout\n\t\twtimeout = DefaultHttpResponseTimeout\n\t\tmaxheaderbytes = 0\n\n\t\tlocalAddr string\n\t)\n\n\t// throttle of rate limit\n\tif config.Server.Throttle > 0 {\n\t\ts.throttle = time.NewTicker(time.Second / time.Duration(config.Server.Throttle))\n\t}\n\n\t// adjust app server slowdown ms\n\ts.slowdown = time.Duration(config.Server.SlowdownMs) * time.Millisecond\n\n\t// adjust app server request id\n\tif config.Server.RequestId != \"\" {\n\t\ts.requestId = config.Server.RequestId\n\t}\n\n\t// adjust app logger filter parameters\n\ts.filterParams = config.Logger.FilterParams\n\n\t// If the port is zero, treat the address as a fully qualified local address.\n\t// This address must be prefixed with the network type followed by a colon,\n\t// e.g. unix:/tmp/app.socket or tcp6:::1 (equivalent to tcp6:0:0:0:0:0:0:0:1)\n\tif port == 0 {\n\t\tpieces := strings.SplitN(addr, \":\", 2)\n\n\t\tnetwork = pieces[0]\n\t\tlocalAddr = pieces[1]\n\t} else {\n\t\tlocalAddr = addr + \":\" + strconv.Itoa(port)\n\t}\n\n\tif config.Server.RTimeout > 0 {\n\t\trtimeout = config.Server.RTimeout\n\t}\n\tif config.Server.WTimeout > 0 {\n\t\twtimeout = config.Server.WTimeout\n\t}\n\tif config.Server.MaxHeaderBytes > 0 {\n\t\tmaxheaderbytes = config.Server.MaxHeaderBytes\n\t}\n\n\tserver := &http.Server{\n\t\tAddr: localAddr,\n\t\tHandler: s,\n\t\tReadTimeout: time.Duration(rtimeout) * time.Second,\n\t\tWriteTimeout: time.Duration(wtimeout) * time.Second,\n\t\tMaxHeaderBytes: maxheaderbytes,\n\t}\n\n\ts.logger.Infof(\"Listening on %s\", localAddr)\n\tif config.Server.Ssl {\n\t\tif network != \"tcp\" {\n\t\t\t// This limitation is just to reduce complexity, since it is standard\n\t\t\t// to terminate SSL upstream when using unix domain sockets.\n\t\t\ts.logger.Fatal(\"[GOGO]=> SSL is only supported for TCP sockets.\")\n\t\t}\n\n\t\ts.logger.Fatal(\"[GOGO]=> Failed to listen:\", server.ListenAndServeTLS(config.Server.SslCert, config.Server.SslKey))\n\t} else {\n\t\tlistener, err := net.Listen(network, localAddr)\n\t\tif err != nil {\n\t\t\ts.logger.Fatal(\"[GOGO]=> Failed to listen:\", err)\n\t\t}\n\n\t\ts.logger.Fatal(\"[GOGO]=> Failed to serve:\", server.Serve(listener))\n\t}\n}", "title": "" }, { "docid": "2b8131943f6b070b80b35bbae079169c", "score": "0.7130772", "text": "func (a *App) Run(addr string) {\n\tfmt.Printf(\"Server listening on port %s\\n\", strings.Trim(addr, \":\"))\n\tlog.Fatal(http.ListenAndServe(addr, a.Router))\n}", "title": "" }, { "docid": "89bbfa52e13de431328cc7898b1a100e", "score": "0.71287256", "text": "func (f *Floki) Run() {\n\tlogger := f.logger\n\n\tif Env == Prod {\n\t\truntime.GOMAXPROCS(runtime.NumCPU())\n\t}\n\n\ttplDir := f.GetParameter(\"views dir\").(string)\n\tf.SetParameter(\"templates\", compileTemplates(tplDir, logger))\n\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = \"3000\"\n\t}\n\n\thost := os.Getenv(\"HOST\")\n\t_ = host\n\n\taddr := host + \":\" + port\n\tlogger.Printf(\"listening on %s (%s)\\n\", addr, Env)\n\n\tif err := http.ListenAndServe(addr, f); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "7953a93ec53e53bee0242713c23d3aad", "score": "0.71286243", "text": "func (e *Engine) Run(port int64) {\n\thttp.HandleFunc(\"/\", handleRequest)\n\tstartHTTPServer(port)\n}", "title": "" }, { "docid": "283fb07207de29ee4ea545dbed4feb2f", "score": "0.71245253", "text": "func (server *Server) Run() *Server {\n\terr := server.router.Run()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn server\n}", "title": "" }, { "docid": "450e8a905bbd999da62a1d9e30672501", "score": "0.71218306", "text": "func (s *Server) Run(ctx context.Context) error {\n\t// Start the backend storage\n\tgo func() {\n\t\tif err := s.store.Run(ctx); err != nil {\n\t\t\tlog.Errorln(err)\n\t\t}\n\t}()\n\n\tgo func() {\n\t\t<-ctx.Done()\n\t\ts.server.Shutdown(ctx)\n\t}()\n\n\ts.server.Addr = s.GetBindAddress()\n\tif err := s.server.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b5a3cfeb0f01852305a33533db568c2d", "score": "0.7119417", "text": "func (s *Server) Run() error {\n\tpath := fmt.Sprintf(\"%s:%d\", s.host, s.port)\n\tlog.Printf(\"Starting %s server on: %s\", s.protocol, path)\n\n\tlistener, err := net.Listen(s.protocol, path)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// I usually use helper function, but don't want to call it only once.\n\tdefer func() {\n\t\tif err := listener.Close(); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}() // dont want to loose possible error\n\n\t// Pass context for the graceful shutdown.\n\t// It's not relevant in this lab (and it could be done far better),\n\t// but it's the best practice in go to use ctx\n\ts.handleConnections(s.handleCancel(), listener)\n\n\treturn nil\n}", "title": "" }, { "docid": "5ab6939f56b19c9c6ee545d5b7e71d7c", "score": "0.711115", "text": "func (a *Application) Run() {\n\tlog.Infof(\"Start to listening the incoming requests on http address: %s\", viper.GetString(\"app.addr\"))\n\tsrv := &http.Server{\n\t\tAddr: viper.GetString(\"app.addr\"),\n\t\tHandler: a.Router,\n\t}\n\tgo func() {\n\t\t// service connections\n\t\tif err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\t\tlog.Fatalf(\"listen: %s\", err.Error())\n\t\t}\n\t}()\n\n\tgracefulStop(srv)\n}", "title": "" }, { "docid": "a347f98651bfa7eb95251d37fc06d992", "score": "0.7108278", "text": "func (s *WebServer) Run(addr string) error {\n\tinitHandlers(s)\n\texpvar.Publish(\"Goroutines\", expvar.Func(func() interface{} {\n\t\treturn runtime.NumGoroutine()\n\t}))\n\n\thttp.Handle(\"/prom\", s.hub.Metrics.getHandler())\n\n\tsock, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tgo func() {\n\t\tfmt.Println(\"HTTP now available at\", addr)\n\t\tlog.Fatal(http.Serve(sock, nil))\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "20b2c4e92500d888c8771ec35fff835f", "score": "0.71035767", "text": "func (r *Router) Run(addr string) error {\n\treturn http.ListenAndServe(addr, r)\n}", "title": "" }, { "docid": "5f9611c456801b8ebaedfceac19ee8c7", "score": "0.70819044", "text": "func (s *Server) Run(ctx context.Context) {\n\tlog.Trace(\"Starting Eco server\")\n\n\tgo func() {\n\t\t<-ctx.Done()\n\t\ts.listener.Close()\n\t}()\n\n\ts.ctx = ctx\n\t// Start serving.\n\tlog.Infof(\"Eco server running\")\n\tfor {\n\t\tconn, err := s.listener.Accept()\n\t\tif err != nil {\n\t\t\tvar opErr *net.OpError\n\t\t\tif errors.As(err, &opErr) && strings.Contains(opErr.Error(), \"use of closed network connection\") {\n\t\t\t\t// Probably a normal shutdown\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Errorf(\"Accept error: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tif ctx.Err() != nil {\n\t\t\treturn\n\t\t}\n\t\tgo s.handleRequest(conn)\n\t}\n}", "title": "" }, { "docid": "e7a710bf4a2efc2f49d1c8641801bc52", "score": "0.70757985", "text": "func (s *Server) Run(address string) error {\n\tlog.Printf(\"connect to http://localhost%s/ for GraphQL playground\", address)\n\ts.router.Handle(\"/\", playground.Handler(\"GraphQL playground\", \"/graphql\"))\n\ts.router.Handle(\"/graphql\", s.server)\n\treturn http.ListenAndServe(address, s.router)\n}", "title": "" }, { "docid": "af4a8427ebcc4b95baa0e4174fcf57b8", "score": "0.7074595", "text": "func (r *Router) Run(addr ...string) {\n\tvar a string\n\n\tif len(addr) == 0 {\n\t\tif p := os.Getenv(\"PORT\"); p != \"\" {\n\t\t\ta = \":\" + p\n\t\t} else {\n\t\t\ta = \":3000\"\n\t\t}\n\t} else {\n\t\ta = addr[0]\n\t}\n\n\tr.server.Addr = a\n\tr.server.Handler = r\n\tr.logger.Printf(\"listening on %s\", a)\n\tr.logger.Fatal(r.server.ListenAndServe())\n}", "title": "" }, { "docid": "4a18c7b6ce074576fbe0ad015f1b67ac", "score": "0.7071186", "text": "func (bs *BusinessServer) Run() {\n\t// initialize config.\n\tbs.initConfig()\n\n\t// initialize logger.\n\tbs.initLogger()\n\tdefer bs.Stop()\n\n\t// initialize server modules.\n\tbs.initMods()\n\n\t// register businessserver service.\n\tgo func() {\n\t\tif err := bs.service.Register(bs.etcdCfg); err != nil {\n\t\t\tlogger.Fatal(\"register service for discovery, %+v\", err)\n\t\t}\n\t}()\n\tlogger.Info(\"register service for discovery success.\")\n\n\t// run service.\n\ts := grpc.NewServer(grpc.MaxRecvMsgSize(math.MaxInt32))\n\tpb.RegisterBusinessServer(s, bs)\n\tlogger.Info(\"Business Server running now.\")\n\n\tif err := s.Serve(bs.lis); err != nil {\n\t\tlogger.Fatal(\"start businessserver gRPC service. %+v\", err)\n\t}\n}", "title": "" }, { "docid": "a8a87ae966042649b1d21dbf8161e3f0", "score": "0.70688003", "text": "func Run(ctx context.Context, network string, cfg *Config) error {\n\tlog.Infof(\"starting server on %s %s\", network, cfg.Address)\n\n\tlis, err := net.Listen(network, cfg.Address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err := lis.Close(); err != nil {\n\t\t\tlog.Errorf(\"Failed to close %s %s: %v\", network, cfg.Address, err)\n\t\t}\n\t}()\n\n\ts := grpc.NewServer()\n\tserver, err := newOpenSavesServer(ctx, cfg.Cloud, cfg.Project, cfg.Bucket, cfg.Cache)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpb.RegisterOpenSavesServer(s, server)\n\treflection.Register(s)\n\n\treturn s.Serve(lis)\n}", "title": "" }, { "docid": "b51a047cc16b44541bf27e3e16c7f1b9", "score": "0.70638585", "text": "func (web Web) Run() {\n\tlog.Println(\"Starting webserver\")\n\n\t//Serve static files\n\tfs := http.FileServer(http.Dir(\"static/voipathon\"))\n\thttp.Handle(\"/\", fs)\n\n\tfsTestClient := http.FileServer(http.Dir(\"static/testclient\"))\n\thttp.Handle(\"/testclient/\", http.StripPrefix(\"/testclient/\", fsTestClient))\n\n\thttp.HandleFunc(\"/ws\", web.registerClient)\n\tlog.Println(\"Waiting for connections\")\n\tlog.Fatal(http.ListenAndServe(\":4242\", nil))\n}", "title": "" }, { "docid": "a0b20117709f0bf9ad230b9ef9339620", "score": "0.7058159", "text": "func (a *App) Run() {\n\tport := os.Getenv(\"PORT\")\n\tif len(port) == 0 {\n\t\tport = \"3000\"\n\t}\n\n\ta.logger.Println(\"listening on port \" + port)\n\ta.logger.Fatalln(http.ListenAndServe(\":\"+port, a))\n}", "title": "" }, { "docid": "7208e89cfd1dd1a712d05d550abbc480", "score": "0.7047443", "text": "func (s Server) Run() {\n\tlog.Printf(\"[INFO] activate rest server\")\n\n\tgin.SetMode(gin.ReleaseMode)\n\trouter := gin.New()\n\trouter.Use(gin.Recovery())\n\trouter.Use(s.limiterMiddleware())\n\trouter.Use(s.loggerMiddleware())\n\n\tv1 := router.Group(\"/v1\")\n\t{\n\t\tv1.POST(\"/message\", s.saveMessageCtrl)\n\t\tv1.GET(\"/message/:key/:pin\", s.getMessageCtrl)\n\t\tv1.GET(\"/params\", s.getParamsCtrl)\n\t\tv1.GET(\"/ping\", func(c *gin.Context) { c.String(200, \"pong\") })\n\t}\n\n\tlog.Fatal(router.Run(\":8080\"))\n}", "title": "" }, { "docid": "a254641bbca829a070dbaabb733e36bf", "score": "0.704588", "text": "func (app *App) Run(addr string) {\n\n\tlog.Fatal(http.ListenAndServe(addr, app.Router))\n}", "title": "" }, { "docid": "b61f0fcf32f16cd1a3d03b1fbecedec8", "score": "0.70454246", "text": "func Run(conf *config.Config) {\n\n\tvar eventHandler = ParseEventHandler(conf)\n\tcontroller.Start(conf, eventHandler)\n}", "title": "" }, { "docid": "947ac776586205c153c9e8489f071338", "score": "0.7035826", "text": "func (s *Server) Run() {\n\tfor _, hostRouter := range s.hostRouters {\n\t\ts.log.router.Info(\"Initializing router for address: %v\", hostRouter.addr)\n\t\thttp.ListenAndServe(hostRouter.addr, hostRouter)\n\t}\n}", "title": "" } ]
686eb8ce52997a8cdc0f32e3d9675224
//////////////////////////////////////////////////////////// Rich enum functions
[ { "docid": "71f2e17561e4e82ea87863744266ad1e", "score": "0.0", "text": "func (c *Card) Suit() string {\n\treturn c.Name()\n}", "title": "" } ]
[ { "docid": "976b04d0bf7a3cb291cbb379a988d840", "score": "0.7371044", "text": "func e(name string) repcore.Enum {\n\treturn repcore.Enum{Name: name}\n}", "title": "" }, { "docid": "976b04d0bf7a3cb291cbb379a988d840", "score": "0.7371044", "text": "func e(name string) repcore.Enum {\n\treturn repcore.Enum{Name: name}\n}", "title": "" }, { "docid": "ed4e769b985b94094474cface1c406ff", "score": "0.70177805", "text": "func (p *parser) parseEnumLabel() {\n}", "title": "" }, { "docid": "510cf827b5ec859b6b247cacf531eafd", "score": "0.68500763", "text": "func ValueEnumFromValue(value string) ValueEnum {\r\n switch value {\r\n case \"Running\":\r\n return Value_RUNNING\r\n case \"Off\":\r\n return Value_OFF\r\n case \"Idle\":\r\n return Value_IDLE\r\n default:\r\n return Value_RUNNING\r\n }\r\n}", "title": "" }, { "docid": "cceebe120042de4271bc7e0c61569ba0", "score": "0.68264854", "text": "func AlertStateEnumFromValue(value string) AlertStateEnum {\r\n switch value {\r\n case \"kOpen\":\r\n return AlertState_KOPEN\r\n case \"kResolved\":\r\n return AlertState_KRESOLVED\r\n case \"kSuppressed\":\r\n return AlertState_KSUPPRESSED\r\n default:\r\n return AlertState_KOPEN\r\n }\r\n}", "title": "" }, { "docid": "1fd798e72e612dfc1e374d96a3fe8c33", "score": "0.68080103", "text": "func ObjectStatusEnumFromValue(value string) ObjectStatusEnum {\r\n switch value {\r\n case \"kFilesCloned\":\r\n return ObjectStatus_KFILESCLONED\r\n case \"kFetchedEntityInfo\":\r\n return ObjectStatus_KFETCHEDENTITYINFO\r\n case \"kVMCreated\":\r\n return ObjectStatus_KVMCREATED\r\n case \"kRelocationStarted\":\r\n return ObjectStatus_KRELOCATIONSTARTED\r\n case \"kFinished\":\r\n return ObjectStatus_KFINISHED\r\n case \"kAborted\":\r\n return ObjectStatus_KABORTED\r\n case \"kDataCopyStarted\":\r\n return ObjectStatus_KDATACOPYSTARTED\r\n case \"kInProgress\":\r\n return ObjectStatus_KINPROGRESS\r\n default:\r\n return ObjectStatus_KFILESCLONED\r\n }\r\n}", "title": "" }, { "docid": "1059f4d7d4e2f393570b3216fb26ec0d", "score": "0.6781473", "text": "func Type12EnumFromValue(value string) Type12Enum {\r\n switch value {\r\n case \"kReadWrite\":\r\n return Type12_KREADWRITE\r\n case \"kLoadSharing\":\r\n return Type12_KLOADSHARING\r\n case \"kDataProtection\":\r\n return Type12_KDATAPROTECTION\r\n case \"kDataCache\":\r\n return Type12_KDATACACHE\r\n case \"kTmp\":\r\n return Type12_KTMP\r\n case \"kUnknownType\":\r\n return Type12_KUNKNOWNTYPE\r\n default:\r\n return Type12_KREADWRITE\r\n }\r\n}", "title": "" }, { "docid": "a201782ccf165a77afccd9b5855d2185", "score": "0.6772294", "text": "func writeEnum(w *writer, ed *desc.EnumDescriptorProto, prefixNames []string) {\n\tname := strings.Join(append(prefixNames, *ed.Name), \"_\")\n\ttypename := name + \"_enum_t\"\n\tw.p(\"newtype %s as int = int;\", typename)\n\tw.p(\"abstract class %s {\", name)\n\tfor _, v := range ed.Value {\n\t\tw.p(\"const %s %s = %d;\", typename, *v.Name, *v.Number)\n\t}\n\n\tw.p(\"private static dict<int, string> $itos = dict[\")\n\tw.i++\n\tfor _, v := range ed.Value {\n\t\tw.p(\"%d => '%s',\", v.GetNumber(), v.GetName())\n\t}\n\tw.i--\n\tw.p(\"];\")\n\n\tw.p(\"public static function ToStringDict(): dict<int, string> {\")\n\tw.p(\"return self::$itos;\")\n\tw.p(\"}\")\n\n\tw.p(\"private static dict<string, int> $stoi = dict[\")\n\tw.i++\n\tfor _, v := range ed.Value {\n\t\tw.p(\"'%s' => %d,\", v.GetName(), v.GetNumber())\n\t}\n\tw.i--\n\tw.p(\"];\")\n\n\tw.p(\"public static function FromMixed(mixed $m): %s {\", typename)\n\tw.p(\"if ($m is string) return idx(self::$stoi, $m, \\\\is_numeric($m) ? ((int) $m) : 0);\")\n\tw.p(\"if ($m is int) return $m;\")\n\tw.p(\"return 0;\")\n\tw.p(\"}\")\n\n\tw.p(\"public static function FromInt(int $i): %s {\", typename)\n\tw.p(\"return $i;\")\n\tw.p(\"}\")\n\tw.p(\"}\")\n\tw.ln()\n}", "title": "" }, { "docid": "67dcfab9390b4d85b2d8258a9b21c0c3", "score": "0.6706402", "text": "func Status4EnumFromValue(value string) Status4Enum {\r\n switch value {\r\n case \"kAccepted\":\r\n return Status4_KACCEPTED\r\n case \"kRunning\":\r\n return Status4_KRUNNING\r\n case \"kCanceling\":\r\n return Status4_KCANCELING\r\n case \"kCanceled\":\r\n return Status4_KCANCELED\r\n case \"kSuccess\":\r\n return Status4_KSUCCESS\r\n case \"kFailure\":\r\n return Status4_KFAILURE\r\n default:\r\n return Status4_KACCEPTED\r\n }\r\n}", "title": "" }, { "docid": "fbc25f188f1a7674ae0f92f6f8ba745d", "score": "0.668715", "text": "func (State) EnumDescriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_enums_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "0a2be405f7cbdfa5963d691c69aeb4a6", "score": "0.6590206", "text": "func (ValueType_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_feast_types_Value_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "128d803909703534c65ecd4e9f59411b", "score": "0.65404004", "text": "func (ECTest) IsYANGGoEnum() {}", "title": "" }, { "docid": "337820d518827d138eca0f3db6279dd5", "score": "0.65346915", "text": "func (E_OpenconfigIsis_LevelType) IsYANGGoEnum() {}", "title": "" }, { "docid": "337820d518827d138eca0f3db6279dd5", "score": "0.65346915", "text": "func (E_OpenconfigIsis_LevelType) IsYANGGoEnum() {}", "title": "" }, { "docid": "2c18b232ca85d104461da2ba67d92885", "score": "0.65260875", "text": "func (E_OpenconfigAaaTypes_AAA_METHOD_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "2c18b232ca85d104461da2ba67d92885", "score": "0.6525019", "text": "func (E_OpenconfigAaaTypes_AAA_METHOD_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "2c18b232ca85d104461da2ba67d92885", "score": "0.6525019", "text": "func (E_OpenconfigAaaTypes_AAA_METHOD_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "2c18b232ca85d104461da2ba67d92885", "score": "0.6525019", "text": "func (E_OpenconfigAaaTypes_AAA_METHOD_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "2c18b232ca85d104461da2ba67d92885", "score": "0.6525019", "text": "func (E_OpenconfigAaaTypes_AAA_METHOD_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "2c18b232ca85d104461da2ba67d92885", "score": "0.6525019", "text": "func (E_OpenconfigAaaTypes_AAA_METHOD_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "ce0859b96bb9aa4400ce8560543a2673", "score": "0.65154624", "text": "func Status2EnumFromValue(value string) Status2Enum {\n switch value {\n case \"failure\":\n return Status2_FAILURE\n case \"success\":\n return Status2_SUCCESS\n default:\n return Status2_FAILURE\n }\n}", "title": "" }, { "docid": "99d815824e97365f906402ac34c8e001", "score": "0.64634395", "text": "func generateEnum(ctx *context, w io.Writer, enum *Enum) {\n\tname := camelCaseName(enum.Name)\n\ttyp := binapiTypes[enum.Type]\n\n\tlogf(\" writing enum %q (%s) with %d entries\", enum.Name, name, len(enum.Entries))\n\n\t// generate enum comment\n\tgenerateComment(ctx, w, name, enum.Name, \"enum\")\n\n\t// generate enum definition\n\tfmt.Fprintf(w, \"type %s %s\\n\", name, typ)\n\tfmt.Fprintln(w)\n\n\t// generate enum entries\n\tfmt.Fprintln(w, \"const (\")\n\tfor _, entry := range enum.Entries {\n\t\tfmt.Fprintf(w, \"\\t%s %s = %v\\n\", entry.Name, name, entry.Value)\n\t}\n\tfmt.Fprintln(w, \")\")\n\tfmt.Fprintln(w)\n\n\t// generate enum conversion maps\n\tfmt.Fprintf(w, \"var %s_name = map[%s]string{\\n\", name, typ)\n\tfor _, entry := range enum.Entries {\n\t\tfmt.Fprintf(w, \"\\t%v: \\\"%s\\\",\\n\", entry.Value, entry.Name)\n\t}\n\tfmt.Fprintln(w, \"}\")\n\tfmt.Fprintln(w)\n\n\tfmt.Fprintf(w, \"var %s_value = map[string]%s{\\n\", name, typ)\n\tfor _, entry := range enum.Entries {\n\t\tfmt.Fprintf(w, \"\\t\\\"%s\\\": %v,\\n\", entry.Name, entry.Value)\n\t}\n\tfmt.Fprintln(w, \"}\")\n\tfmt.Fprintln(w)\n\n\tfmt.Fprintf(w, \"func (x %s) String() string {\\n\", name)\n\tfmt.Fprintf(w, \"\\ts, ok := %s_name[%s(x)]\\n\", name, typ)\n\tfmt.Fprintf(w, \"\\tif ok { return s }\\n\")\n\tfmt.Fprintf(w, \"\\treturn strconv.Itoa(int(x))\\n\")\n\tfmt.Fprintln(w, \"}\")\n\tfmt.Fprintln(w)\n}", "title": "" }, { "docid": "4ff189f0d6605b6609ca25f749f0f0e2", "score": "0.64601505", "text": "func TypeName2Enum(typename string) (Enum, bool) {\n\tswitch typename {\n\tcase \"bool\", \"_Bool\", \"Bool_t\":\n\t\treturn Bool, true\n\tcase \"byte\", \"uint8\", \"uint8_t\", \"unsigned char\", \"UChar_t\", \"Byte_t\":\n\t\treturn Uint8, true\n\tcase \"uint16\", \"uint16_t\", \"unsigned short\", \"UShort_t\":\n\t\treturn Uint16, true\n\tcase \"uint32\", \"uint32_t\", \"unsigned\", \"unsigned int\", \"UInt_t\":\n\t\treturn Uint32, true\n\tcase \"uint64\", \"uint64_t\", \"unsigned long\", \"unsigned long int\", \"ULong_t\", \"ULong64_t\":\n\t\treturn Uint64, true\n\n\tcase \"char*\":\n\t\treturn CharStar, true\n\tcase \"Bits_t\":\n\t\treturn Bits, true\n\n\tcase \"int8\", \"int8_t\", \"char\", \"Char_t\":\n\t\treturn Int8, true\n\tcase \"int16\", \"int16_t\", \"short\", \"Short_t\", \"Version_t\",\n\t\t\"Font_t\", \"Style_t\", \"Marker_t\", \"Width_t\",\n\t\t\"Color_t\",\n\t\t\"SCoord_t\":\n\t\treturn Int16, true\n\tcase \"int32\", \"int32_t\", \"int\", \"Int_t\":\n\t\treturn Int32, true\n\tcase \"int64\", \"int64_t\", \"long\", \"long int\", \"Long_t\", \"Long64_t\",\n\t\t\"Seek_t\":\n\t\treturn Int64, true\n\n\tcase \"float32\", \"float\", \"Float_t\", \"float32_t\",\n\t\t\"Angle_t\", \"Size_t\":\n\t\treturn Float32, true\n\tcase \"float64\", \"double\", \"Double_t\", \"float64_t\",\n\t\t\"Coord_t\":\n\t\treturn Float64, true\n\tcase \"Float16_t\", \"Float16\":\n\t\treturn Float16, true\n\tcase \"Double32_t\", \"Double32\":\n\t\treturn Double32, true\n\n\tcase \"TString\", \"Option_t\":\n\t\treturn TString, true\n\tcase \"string\", \"std::string\":\n\t\treturn STLstring, true\n\tcase \"TObject\":\n\t\treturn TObject, true\n\tcase \"TNamed\":\n\t\treturn TNamed, true\n\t}\n\n\treturn -1, false\n}", "title": "" }, { "docid": "ad61df855a4329cd5d3116593f60327c", "score": "0.6458418", "text": "func (E_OpenconfigAlarmTypes_OPENCONFIG_ALARM_TYPE_ID) IsYANGGoEnum() {}", "title": "" }, { "docid": "ad61df855a4329cd5d3116593f60327c", "score": "0.6458418", "text": "func (E_OpenconfigAlarmTypes_OPENCONFIG_ALARM_TYPE_ID) IsYANGGoEnum() {}", "title": "" }, { "docid": "ad61df855a4329cd5d3116593f60327c", "score": "0.6458418", "text": "func (E_OpenconfigAlarmTypes_OPENCONFIG_ALARM_TYPE_ID) IsYANGGoEnum() {}", "title": "" }, { "docid": "cbbc25a4fdd580d3854ea28937d2b487", "score": "0.6432836", "text": "func (AssertionOperatorTypeCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{23, 0}\n}", "title": "" }, { "docid": "d27f93ad474eb0ab22581971506891d3", "score": "0.64293003", "text": "func BondingModeEnumFromValue(value string) BondingModeEnum {\r\n switch value {\r\n case \"ActiveBackup\":\r\n return BondingMode_ACTIVEBACKUP\r\n case \"Enum_802_3ad\":\r\n return BondingMode_ENUM_802_3AD\r\n case \"BalanceAlb\":\r\n return BondingMode_BALANCEALB\r\n default:\r\n return BondingMode_ACTIVEBACKUP\r\n }\r\n}", "title": "" }, { "docid": "ec9defbda2a9df7388a0d0209f5daf9c", "score": "0.6419166", "text": "func statusToEnum(g string) code_review.CLStatus {\n\tswitch g {\n\tcase gerrit.CHANGE_STATUS_NEW:\n\t\treturn code_review.Open\n\tcase gerrit.CHANGE_STATUS_ABANDONED:\n\t\treturn code_review.Abandoned\n\tcase gerrit.CHANGE_STATUS_MERGED:\n\t\treturn code_review.Landed\n\t}\n\treturn code_review.Open\n}", "title": "" }, { "docid": "ec9defbda2a9df7388a0d0209f5daf9c", "score": "0.6419166", "text": "func statusToEnum(g string) code_review.CLStatus {\n\tswitch g {\n\tcase gerrit.CHANGE_STATUS_NEW:\n\t\treturn code_review.Open\n\tcase gerrit.CHANGE_STATUS_ABANDONED:\n\t\treturn code_review.Abandoned\n\tcase gerrit.CHANGE_STATUS_MERGED:\n\t\treturn code_review.Landed\n\t}\n\treturn code_review.Open\n}", "title": "" }, { "docid": "d30d2998a814c58eb27957f4b745f048", "score": "0.6418614", "text": "func RemovalStateEnumFromValue(value string) RemovalStateEnum {\r\n switch value {\r\n case \"kDontRemove\":\r\n return RemovalState_KDONTREMOVE\r\n case \"kMarkedForRemoval\":\r\n return RemovalState_KMARKEDFORREMOVAL\r\n case \"kOkToRemove\":\r\n return RemovalState_KOKTOREMOVE\r\n default:\r\n return RemovalState_KDONTREMOVE\r\n }\r\n}", "title": "" }, { "docid": "221d6119a9f9350f9900269f8b65463c", "score": "0.6417393", "text": "func DayEnumFromValue(value string) DayEnum {\r\n switch value {\r\n case \"kSunday\":\r\n return Day_KSUNDAY\r\n case \"kMonday\":\r\n return Day_KMONDAY\r\n case \"kTuesday\":\r\n return Day_KTUESDAY\r\n case \"kWednesday\":\r\n return Day_KWEDNESDAY\r\n case \"kThursday\":\r\n return Day_KTHURSDAY\r\n case \"kFriday\":\r\n return Day_KFRIDAY\r\n case \"kSaturday\":\r\n return Day_KSATURDAY\r\n default:\r\n return Day_KSUNDAY\r\n }\r\n}", "title": "" }, { "docid": "f56595367d2d1ce366aeeef68f9ea78e", "score": "0.6399914", "text": "func (AssertionDirectionTypeCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{22, 0}\n}", "title": "" }, { "docid": "cc4e38acb9e26072d76d4964a68534e4", "score": "0.6388839", "text": "func (E_OpenconfigLacp_LacpActivityType) IsYANGGoEnum() {}", "title": "" }, { "docid": "cc4e38acb9e26072d76d4964a68534e4", "score": "0.6388235", "text": "func (E_OpenconfigLacp_LacpActivityType) IsYANGGoEnum() {}", "title": "" }, { "docid": "e2fbd555bda1cc640968f353d53ebdc4", "score": "0.6387351", "text": "func Type34EnumFromValue(value string) Type34Enum {\r\n switch value {\r\n case \"kNearline\":\r\n return Type34_KNEARLINE\r\n case \"kColdline\":\r\n return Type34_KCOLDLINE\r\n case \"kGlacier\":\r\n return Type34_KGLACIER\r\n case \"kS3\":\r\n return Type34_KS3\r\n case \"kAzureStandard\":\r\n return Type34_KAZURESTANDARD\r\n case \"kS3Compatible\":\r\n return Type34_KS3COMPATIBLE\r\n case \"kQStarTape\":\r\n return Type34_KQSTARTAPE\r\n case \"kGoogleStandard\":\r\n return Type34_KGOOGLESTANDARD\r\n case \"kGoogleDRA\":\r\n return Type34_KGOOGLEDRA\r\n case \"kAWSGovCloud\":\r\n return Type34_KAWSGOVCLOUD\r\n case \"kNAS\":\r\n return Type34_KNAS\r\n case \"kAzureGovCloud\":\r\n return Type34_KAZUREGOVCLOUD\r\n default:\r\n return Type34_KNEARLINE\r\n }\r\n}", "title": "" }, { "docid": "059a3a9aa81358059e9caf8e5b8e3ebb", "score": "0.63822484", "text": "func (Validation_State) EnumDescriptor() ([]byte, []int) {\n\treturn file_gobgp_proto_rawDescGZIP(), []int{74, 0}\n}", "title": "" }, { "docid": "8c8b2067598f248fa8bd649ac2f4d985", "score": "0.63606274", "text": "func (StateTransition_StateTransitionState) EnumDescriptor() ([]byte, []int) {\n\treturn file_bol_api_proto_go_bol_api_proto_rawDescGZIP(), []int{102, 0}\n}", "title": "" }, { "docid": "fdf4259cda21806efaae4fa22c9b315e", "score": "0.6359041", "text": "func (E_OpenconfigIsisTypes_AFI_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "fdf4259cda21806efaae4fa22c9b315e", "score": "0.6358445", "text": "func (E_OpenconfigIsisTypes_AFI_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "935f75b11cd9bce20e73df6811016134", "score": "0.63531166", "text": "func (StatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{198, 0}\n}", "title": "" }, { "docid": "0aeff327186ececa0123f9b709df4c87", "score": "0.635098", "text": "func (OperationKindCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{153, 0}\n}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6337957", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6337957", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6337957", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6337957", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6337957", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6337957", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6337957", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "4caefe95afb958414e20d2ac19c1810d", "score": "0.63261354", "text": "func SqlOptionsEnumFromValue(value string) SqlOptionsEnum {\r\n switch value {\r\n case \"kCreate\":\r\n return SqlOptions_KCREATE\r\n case \"kUpdate\":\r\n return SqlOptions_KUPDATE\r\n case \"kFinalize\":\r\n return SqlOptions_KFINALIZE\r\n default:\r\n return SqlOptions_KCREATE\r\n }\r\n}", "title": "" }, { "docid": "498dd376061f14cc5f24dda9babefb70", "score": "0.63220274", "text": "func (StrandTypeCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{199, 0}\n}", "title": "" }, { "docid": "16adb1e49d70d6c1655249e19cf6481d", "score": "0.6321269", "text": "func OAuthProviderErrorEnumFromValue(value string) OAuthProviderErrorEnum {\r\n switch value {\r\n case \"invalid_request\":\r\n return OAuthProviderError_INVALID_REQUEST\r\n case \"invalid_client\":\r\n return OAuthProviderError_INVALID_CLIENT\r\n case \"invalid_grant\":\r\n return OAuthProviderError_INVALID_GRANT\r\n case \"unauthorized_client\":\r\n return OAuthProviderError_UNAUTHORIZED_CLIENT\r\n case \"unsupported_grant_type\":\r\n return OAuthProviderError_UNSUPPORTED_GRANT_TYPE\r\n case \"invalid_scope\":\r\n return OAuthProviderError_INVALID_SCOPE\r\n default:\r\n return OAuthProviderError_INVALID_REQUEST\r\n }\r\n}", "title": "" }, { "docid": "9cada795c0c0cdbbbf96f402dbfc1121", "score": "0.6318891", "text": "func Enum(name rune, values []string, helpvalue ...string) *string {\n\treturn CommandLine.Enum(name, values, helpvalue...)\n}", "title": "" }, { "docid": "d142922a65bec5c0e8b069f08177cce5", "score": "0.6318781", "text": "func (E_OpenconfigAlarmTypes_OPENCONFIG_ALARM_SEVERITY) IsYANGGoEnum() {}", "title": "" }, { "docid": "edac7e898d07518982fbbec4b870c1db", "score": "0.63186145", "text": "func (RejoinTimeExponent) EnumDescriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_lorawan_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "d142922a65bec5c0e8b069f08177cce5", "score": "0.63160497", "text": "func (E_OpenconfigAlarmTypes_OPENCONFIG_ALARM_SEVERITY) IsYANGGoEnum() {}", "title": "" }, { "docid": "d142922a65bec5c0e8b069f08177cce5", "score": "0.63160497", "text": "func (E_OpenconfigAlarmTypes_OPENCONFIG_ALARM_SEVERITY) IsYANGGoEnum() {}", "title": "" }, { "docid": "7370979f8d08a1a67514221a942c7bb1", "score": "0.6315908", "text": "func (StructureMapTransformCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{207, 0}\n}", "title": "" }, { "docid": "cd47be177ca02f33f722446bd4107804", "score": "0.631576", "text": "func (E_OpenconfigPlatformTypes_FEC_STATUS_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "473e07a4ab98d89da594591da44d3daa", "score": "0.6310328", "text": "func (E_OpenconfigIsisTypes_SAFI_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "473e07a4ab98d89da594591da44d3daa", "score": "0.6310328", "text": "func (E_OpenconfigIsisTypes_SAFI_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "bc411d26f4af3ec42dc7141d544a17b1", "score": "0.6303336", "text": "func (GoalLifecycleStatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{108, 0}\n}", "title": "" }, { "docid": "94ed9084f940ff736e29a9e4fbea1160", "score": "0.6296037", "text": "func (SubscriptionStatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{211, 0}\n}", "title": "" }, { "docid": "a25f06f261992722bfe80c5ac40f5ef3", "score": "0.62946343", "text": "func (SubscriptionStatusAtEventCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{210, 0}\n}", "title": "" }, { "docid": "b66759f26fe15b7f7dafcbe701c5b5fb", "score": "0.62924904", "text": "func (CompositionStatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{49, 0}\n}", "title": "" }, { "docid": "7f88e13a5085f03d4dc6374030ec0165", "score": "0.6287788", "text": "func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __EnumValueImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__EnumValue\")\n\t\tcase \"name\":\n\t\t\tout.Values[i] = ec.___EnumValue_name(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"description\":\n\t\t\tout.Values[i] = ec.___EnumValue_description(ctx, field, obj)\n\t\tcase \"isDeprecated\":\n\t\t\tout.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"deprecationReason\":\n\t\t\tout.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "title": "" }, { "docid": "7f88e13a5085f03d4dc6374030ec0165", "score": "0.6287788", "text": "func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __EnumValueImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__EnumValue\")\n\t\tcase \"name\":\n\t\t\tout.Values[i] = ec.___EnumValue_name(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"description\":\n\t\t\tout.Values[i] = ec.___EnumValue_description(ctx, field, obj)\n\t\tcase \"isDeprecated\":\n\t\t\tout.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"deprecationReason\":\n\t\t\tout.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "title": "" }, { "docid": "7f88e13a5085f03d4dc6374030ec0165", "score": "0.6287788", "text": "func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __EnumValueImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__EnumValue\")\n\t\tcase \"name\":\n\t\t\tout.Values[i] = ec.___EnumValue_name(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"description\":\n\t\t\tout.Values[i] = ec.___EnumValue_description(ctx, field, obj)\n\t\tcase \"isDeprecated\":\n\t\t\tout.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"deprecationReason\":\n\t\t\tout.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "title": "" }, { "docid": "7f88e13a5085f03d4dc6374030ec0165", "score": "0.6287788", "text": "func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __EnumValueImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__EnumValue\")\n\t\tcase \"name\":\n\t\t\tout.Values[i] = ec.___EnumValue_name(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"description\":\n\t\t\tout.Values[i] = ec.___EnumValue_description(ctx, field, obj)\n\t\tcase \"isDeprecated\":\n\t\t\tout.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"deprecationReason\":\n\t\t\tout.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "title": "" }, { "docid": "7f88e13a5085f03d4dc6374030ec0165", "score": "0.6287788", "text": "func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __EnumValueImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__EnumValue\")\n\t\tcase \"name\":\n\t\t\tout.Values[i] = ec.___EnumValue_name(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"description\":\n\t\t\tout.Values[i] = ec.___EnumValue_description(ctx, field, obj)\n\t\tcase \"isDeprecated\":\n\t\t\tout.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"deprecationReason\":\n\t\t\tout.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "title": "" }, { "docid": "96b6b0296fe06f32c58510bc901d8806", "score": "0.6274889", "text": "func (UspsTwoLetterAlphabeticCodesValueSet_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r4_uscore_codes_proto_rawDescGZIP(), []int{24, 0}\n}", "title": "" }, { "docid": "c7a71432a7c80d0eee946cbd34b97298", "score": "0.6273491", "text": "func Type13EnumFromValue(value string) Type13Enum {\r\n switch value {\r\n case \"kData\":\r\n return Type13_KDATA\r\n case \"kAdmin\":\r\n return Type13_KADMIN\r\n case \"kSystem\":\r\n return Type13_KSYSTEM\r\n case \"kNode\":\r\n return Type13_KNODE\r\n case \"kUnknown\":\r\n return Type13_KUNKNOWN\r\n default:\r\n return Type13_KDATA\r\n }\r\n}", "title": "" }, { "docid": "70d174aa95d337fa19caf5b1abf961b6", "score": "0.6273166", "text": "func (E_OpenconfigAft_LabelEntry_Label) IsYANGGoEnum() {}", "title": "" }, { "docid": "70d174aa95d337fa19caf5b1abf961b6", "score": "0.6273166", "text": "func (E_OpenconfigAft_LabelEntry_Label) IsYANGGoEnum() {}", "title": "" }, { "docid": "294c828051513456d901005e3771689a", "score": "0.6273139", "text": "func (AppointmentStatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{21, 0}\n}", "title": "" }, { "docid": "35bd7792c8897219945e330bd0323a38", "score": "0.6271949", "text": "func (HERO_STATUS) EnumDescriptor() ([]byte, []int) {\n\treturn file_msgenum_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "78c0a8c337021fa65ea31ea0b5099d5a", "score": "0.62663054", "text": "func (RejoinCountExponent) EnumDescriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_lorawan_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "d14fb1631f9cdb953b7f40fe18b6cb55", "score": "0.6265455", "text": "func (PublicationStatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{162, 0}\n}", "title": "" }, { "docid": "0fbb4459cd1599ee948d54574041af59", "score": "0.6262496", "text": "func (HTTPVerbCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{116, 0}\n}", "title": "" }, { "docid": "1e9f5c305257a2057c1dfe7658d924c5", "score": "0.6256363", "text": "func (AssertionResponseTypesCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{24, 0}\n}", "title": "" }, { "docid": "3e9f5cfa3277ba36eeaa1e11b581d510", "score": "0.6254245", "text": "func (p *Parser) Enum(i int, enum ...string) string {\n\tf := p.getField(i)\n\tfor _, s := range enum {\n\t\tif f == s {\n\t\t\treturn s\n\t\t}\n\t}\n\tp.setError(errUndefinedEnum, \"error parsing enum\")\n\treturn \"\"\n}", "title": "" }, { "docid": "8e13f87dfc7901f2c94ff7fafe169902", "score": "0.6253841", "text": "func (NutritionIntakeStatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{149, 0}\n}", "title": "" }, { "docid": "7023a9d33d49f9c178f8f4ff1c58f118", "score": "0.6250081", "text": "func (CodeSearchSupportCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{44, 0}\n}", "title": "" }, { "docid": "b170e3ed01b7d4315ac1e6bf0b90a4ad", "score": "0.62479806", "text": "func (E_OpenconfigNetworkInstance_Entry_EntryType) IsYANGGoEnum() {}", "title": "" }, { "docid": "b170e3ed01b7d4315ac1e6bf0b90a4ad", "score": "0.62479806", "text": "func (E_OpenconfigNetworkInstance_Entry_EntryType) IsYANGGoEnum() {}", "title": "" }, { "docid": "37033665789fad67e27aeb0b43c4044d", "score": "0.62472695", "text": "func (ExpansionParameterSourceCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{96, 0}\n}", "title": "" }, { "docid": "e2a48a441f827c3863b7434f426d248e", "score": "0.6244651", "text": "func (StandardsStatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{197, 0}\n}", "title": "" }, { "docid": "4852b625a0c7e665c91e33acbc838e3c", "score": "0.62419116", "text": "func (RejoinPeriodExponent) EnumDescriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_lorawan_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "3d85aede80b051e818c4b47a3d300d1b", "score": "0.623814", "text": "func Environments2EnumFromValue(value string) Environments2Enum {\r\n switch value {\r\n case \"kVMware\":\r\n return Environments2_KVMWARE\r\n case \"kSQL\":\r\n return Environments2_KSQL\r\n case \"kView\":\r\n return Environments2_KVIEW\r\n case \"kPuppeteer\":\r\n return Environments2_KPUPPETEER\r\n case \"kPhysical\":\r\n return Environments2_KPHYSICAL\r\n case \"kPure\":\r\n return Environments2_KPURE\r\n case \"kNetapp\":\r\n return Environments2_KNETAPP\r\n case \"kGenericNas\":\r\n return Environments2_KGENERICNAS\r\n case \"kHyperV\":\r\n return Environments2_KHYPERV\r\n case \"kAcropolis\":\r\n return Environments2_KACROPOLIS\r\n case \"kAzure\":\r\n return Environments2_KAZURE\r\n case \"kIsilon\":\r\n return Environments2_KISILON\r\n case \"kElastifile\":\r\n return Environments2_KELASTIFILE\r\n case \"kGPFS\":\r\n return Environments2_KGPFS\r\n case \"kFlashBlade\":\r\n return Environments2_KFLASHBLADE\r\n default:\r\n return Environments2_KVMWARE\r\n }\r\n}", "title": "" }, { "docid": "882d9fdbc4dc80016dac9616114b37b7", "score": "0.62356734", "text": "func (XPathUsageTypeCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{230, 0}\n}", "title": "" }, { "docid": "e9d9cd96b9e1fff88fe94dca17d0d678", "score": "0.62354326", "text": "func (IdentityAssuranceLevelCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{118, 0}\n}", "title": "" }, { "docid": "9295f2c98bffeb452b87b4ee25a81a71", "score": "0.622866", "text": "func (CareTeamStatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{37, 0}\n}", "title": "" }, { "docid": "6a09fc670dd915cc0a267104a892fdd2", "score": "0.6228516", "text": "func (E_OpenconfigBgpTypes_BGP_ERROR_CODE) IsYANGGoEnum() {}", "title": "" }, { "docid": "895d4e58a4e8ec5db58ffd73d5a7d702", "score": "0.62273675", "text": "func (EventStatusCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{93, 0}\n}", "title": "" }, { "docid": "6a09fc670dd915cc0a267104a892fdd2", "score": "0.62244046", "text": "func (E_OpenconfigBgpTypes_BGP_ERROR_CODE) IsYANGGoEnum() {}", "title": "" }, { "docid": "12acbc86eb4e7ed2db1108faf09940f3", "score": "0.622165", "text": "func (IssueType) EnumDescriptor() ([]byte, []int) {\n\treturn file_app_verifycode_pb_enum_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "7a1bed75292d19656a9406a6679e6100", "score": "0.62213594", "text": "func (SlicingRulesCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{191, 0}\n}", "title": "" }, { "docid": "e1f5006c910a468d96c5599a92e9fd6d", "score": "0.62184", "text": "func (USCoreSmokingStatusValueSet_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r4_uscore_codes_proto_rawDescGZIP(), []int{21, 0}\n}", "title": "" }, { "docid": "0fed79cb9a43e627e81167759b595bba", "score": "0.62178516", "text": "func (TriggerTypeCode_Value) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_codes_proto_rawDescGZIP(), []int{222, 0}\n}", "title": "" }, { "docid": "35177958f9d58da76c56f65a09aa7720", "score": "0.62174547", "text": "func (e EnumInt32) String() string {\n if e == EnumInt32_ENUM_VALUE_0 {\n return \"ENUM_VALUE_0\"\n }\n if e == EnumInt32_ENUM_VALUE_1 {\n return \"ENUM_VALUE_1\"\n }\n if e == EnumInt32_ENUM_VALUE_2 {\n return \"ENUM_VALUE_2\"\n }\n if e == EnumInt32_ENUM_VALUE_3 {\n return \"ENUM_VALUE_3\"\n }\n if e == EnumInt32_ENUM_VALUE_4 {\n return \"ENUM_VALUE_4\"\n }\n if e == EnumInt32_ENUM_VALUE_5 {\n return \"ENUM_VALUE_5\"\n }\n return \"<unknown>\"\n}", "title": "" }, { "docid": "67f64f34de9613380b142a6e8738b96f", "score": "0.6216596", "text": "func (E_OpenconfigAaa_Event_Record) IsYANGGoEnum() {}", "title": "" } ]
637613784fccded2c20277d2c522de4c
Airplanes will return all Airplanes currently stored.
[ { "docid": "69923924bf4af027052075d46971dc2b", "score": "0.841644", "text": "func (m *memoryStore) Airplanes(ctx context.Context) ([]Airplane, error) {\n\treturn m.airplanes, nil\n}", "title": "" } ]
[ { "docid": "4348124a8aca374fb6bc2b6a1863948a", "score": "0.64839375", "text": "func GetAllAirports() []string {\n\treturn database.GetAllAirports()\n}", "title": "" }, { "docid": "8543a005c45135f4d9bec1cc1368ad95", "score": "0.640165", "text": "func (s *airportService) Airports(ctx context.Context) ([]aviation.Airport, error) {\n\tairports, err := s.repo.Airports(ctx)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\treturn airports, nil\n}", "title": "" }, { "docid": "9ed847adf8ff09449f7b38fe1f217c8a", "score": "0.60875094", "text": "func (a *AirlineService) GetAirlines() (airlines []*models.Airline, err error) {\r\n\tlines, err := a.FileReader.ReadFromFile(config.CSV_PATH + \"/airlines.csv\")\r\n\tif err != nil {\r\n\t\treturn airlines, err\r\n\t}\r\n\r\n\tfor i, line := range lines {\r\n\t\tif i != 0 {\r\n\t\t\tairlines = append(airlines, &models.Airline{\r\n\t\t\t\tName: line[0],\r\n\t\t\t\tTwoDigitCode: line[1],\r\n\t\t\t\tThreeDigitCode: line[2],\r\n\t\t\t\tCountry: line[3],\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\treturn airlines, err\r\n}", "title": "" }, { "docid": "93ba17451b121179beabcdda68af2fb7", "score": "0.5551546", "text": "func GetAirportByInitials(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tsgAirport := params[\"sg_airport\"]\n\ts := GetMongoSession()\n\tdefer s.Close()\n\n\tvar airport Airport\n\tc := s.DB(\"airports\").C(\"airposts_list\")\n\terr := c.Find(bson.M{\"sg_airport\": sgAirport}).One(&airport)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tif err = json.NewEncoder(w).Encode(airport); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "4bdb7fc5ce4ffedc0d62616ee20c5f74", "score": "0.55369043", "text": "func GetAllPlanes(ds *mgo.Session, db string) (planes []model.Plane, err error) {\n\tsession := ds\n\tclone := session.Clone()\n\tdefer clone.Close()\n\tdatab := clone.DB(db)\n\tdal := NewMongoDBDAL(datab)\n\terr = dal.C(\"planes\").Find(bson.M{}).All(&planes)\n\treturn\n}", "title": "" }, { "docid": "089bdc9ef2950b601bd860c615a7567c", "score": "0.54489845", "text": "func AllAMVs() []*AMV {\n\tall := make([]*AMV, 0, DB.Collection(\"AMV\").Count())\n\n\tstream := StreamAMVs()\n\n\tfor obj := range stream {\n\t\tall = append(all, obj)\n\t}\n\n\treturn all\n}", "title": "" }, { "docid": "199d7dd384870db7134a764d10f76216", "score": "0.5212232", "text": "func (ap *ActivePipelines) GetAll() []gaia.Pipeline {\n\tc := make([]gaia.Pipeline, 0)\n\tap.RLock()\n\tdefer ap.RUnlock()\n\tc = append(c, ap.Pipelines...)\n\treturn c\n}", "title": "" }, { "docid": "4eeeb284f14dc4192e12d20eb6e90aaf", "score": "0.5146521", "text": "func (e Entities) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "709fcdff50c205de4d18e669087cea76", "score": "0.51344347", "text": "func (m *memoryStore) AirplaneCreate(ctx context.Context, req Airplane) (*Airplane, error) {\n\treq.ID = len(m.airplanes) + 1\n\tm.airplanes = append(m.airplanes, req)\n\treturn &req, nil\n}", "title": "" }, { "docid": "2e4c8769a70891fce3e0c0616a6f07f0", "score": "0.49945852", "text": "func (s *airportService) Airport(ctx context.Context, icao string) (*aviation.Airport, error) {\n\tif err := s.validateICAO(icao); err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tairplane, err := s.repo.Airport(ctx, icao)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\treturn airplane, nil\n}", "title": "" }, { "docid": "f33f74291d7c14c498c19475f93b50f8", "score": "0.49726608", "text": "func (ioVar ImageObject) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "70ed24a99c5af73648ed89b05c36f20e", "score": "0.4968093", "text": "func (s *Services) AiringReleases(ctx context.Context, request *empty.Empty) (*proto.ReleasesListResponse, error) {\n\tquery := s.DB\n\n\tvar result []models.Release\n\n\tquery = query.Where(\"started_airing IS NOT NULL AND stopped_airing IS NULL\").Where(\"release_type_id = ?\", 1).Or(\"release_type_id = ?\", 4)\n\tif err := query.Find(&result).Error; err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\tfinalRes := []*proto.Release{}\n\n\tfor i := range result {\n\t\tfinalRes = append(finalRes, result[i].ToProto())\n\t}\n\n\treturn &proto.ReleasesListResponse{Releases: finalRes}, nil\n}", "title": "" }, { "docid": "dfbc3a9ed1ec341e190a965d274e6f75", "score": "0.49607098", "text": "func (s *API) GetAllAvailabilities(\n\tparams map[string]zoho.Parameter,\n) (data GetAvailabilitiesResponse, err error) {\n\tendpoint := zoho.Endpoint{\n\t\tName: \"GetAllAvailabilities\",\n\t\tURL: fmt.Sprintf(\n\t\t\t\"https://shifts.zoho.%s/api/v1/%s/%s\",\n\t\t\ts.ZohoTLD,\n\t\t\ts.OrganizationID,\n\t\t\tavailabilityModule,\n\t\t),\n\t\tMethod: zoho.HTTPGet,\n\t\tResponseData: &GetAvailabilitiesResponse{},\n\t\tURLParameters: map[string]zoho.Parameter{\n\t\t\t\"start_date\": \"\", // yyyy-mm-dd\n\t\t\t\"end_date\": \"\", // yyyy-mm-dd\n\t\t\t\"employees\": \"\",\n\t\t},\n\t}\n\n\tif len(params) > 0 {\n\t\tfor k, v := range params {\n\t\t\tendpoint.URLParameters[k] = v\n\t\t}\n\t}\n\n\tif endpoint.URLParameters[\"start_date\"] == \"\" || endpoint.URLParameters[\"end_date\"] == \"\" {\n\t\treturn GetAvailabilitiesResponse{}, fmt.Errorf(\n\t\t\t\"failed to retreive availabilities: start_date and end_date are required fields\",\n\t\t)\n\t}\n\n\terr = s.Zoho.HTTPRequest(&endpoint)\n\tif err != nil {\n\t\treturn GetAvailabilitiesResponse{}, fmt.Errorf(\"failed to retrieve availabilities: %s\", err)\n\t}\n\tif v, ok := endpoint.ResponseData.(*GetAvailabilitiesResponse); ok {\n\t\treturn *v, nil\n\t}\n\treturn GetAvailabilitiesResponse{}, fmt.Errorf(\n\t\t\"data retrieved was not 'GetAvailabilitiesResponse'\",\n\t)\n}", "title": "" }, { "docid": "d2f5c7975142c729810a52baa175bebe", "score": "0.49381414", "text": "func (mo MediaObject) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b8399878e891c740691d23689118f59c", "score": "0.4926328", "text": "func (p Places) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4c675c7f2fa582114f7b92710d04c99e", "score": "0.49213263", "text": "func (cs CivicStructure) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8262ece9e00867e7d5be5334df7fd9de", "score": "0.48869312", "text": "func (atlan atlanticTimeZones) Azores() string {return \"Atlantic/Azores\" }", "title": "" }, { "docid": "37120413bdaefbbce5af0948d6be84ab", "score": "0.483749", "text": "func (a *AptDB) GetAirport(ident string) (*Airport, error) {\n\tvar apt Airport\n\terr := a.boltDB.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(\"Airports\"))\n\t\tv := b.Get([]byte(ident))\n\t\terr := msgpack.Unmarshal(v, &apt)\n\t\treturn err\n\t})\n\n\tif err != nil {\n\t\treturn &apt, errors.Wrap(err, \"get airport\")\n\t}\n\n\treturn &apt, nil\n}", "title": "" }, { "docid": "f664ea7857c41d3fd563421d1d58cd5a", "score": "0.47817138", "text": "func loadAirportsDB() (map[string]interface{}, error) {\n\tvar airports map[string]interface{}\n\n\tbyteValue, err := content.ReadFile(\"db/airports.json\")\n\n\tif err != nil {\n\t\treturn airports, err\n\t}\n\n\terr = json.Unmarshal([]byte(byteValue), &airports)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn airports, nil\n}", "title": "" }, { "docid": "a535c4afdeed47ae023a1a3baa97eeca", "score": "0.47662604", "text": "func (cw CreativeWork) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "874e030dc4484d6393fd836cbd8dc719", "score": "0.47631735", "text": "func (i Intangible) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "09df11c9700ef5f8dcd456747de38326", "score": "0.47615653", "text": "func loadAirports(db *bolt.DB, dataDir string) error {\n\tapts, err := os.Open(fmt.Sprintf(\"%s/%s\", dataDir, \"airports.csv\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer apts.Close()\n\n\tr := csv.NewReader(apts)\n\t_, err = r.Read() // skip header\n\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t_, err = tx.CreateBucketIfNotExists([]byte(\"Airports\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb := tx.Bucket([]byte(\"Airports\"))\n\n\t\tfor {\n\t\t\trecord, err := r.Read()\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"airport read\")\n\t\t\t}\n\n\t\t\tlatitude, _ := strconv.ParseFloat(record[4], 64)\n\t\t\tlongitude, _ := strconv.ParseFloat(record[5], 64)\n\t\t\televation, _ := strconv.ParseInt(record[6], 10, 64)\n\t\t\tapt := Airport{record[1],\n\t\t\t\trecord[3],\n\t\t\t\tlatitude,\n\t\t\t\tlongitude,\n\t\t\t\televation,\n\t\t\t\trecord[10],\n\t\t\t\trecord[9],\n\t\t\t\trecord[8],\n\t\t\t\trecord[7],\n\t\t\t\trecord[13]}\n\n\t\t\tm, err := msgpack.Marshal(&apt)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"airport marshal\")\n\t\t\t}\n\n\t\t\terr = b.Put([]byte(record[1]), m)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"database put\")\n\t\t\t}\n\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "f0579092f241c57771d249d5d48b3d4b", "score": "0.4731447", "text": "func (store *KapacitorStore) All(ctx context.Context) ([]chronograf.Server, error) {\n\tif store.Kapacitor != nil {\n\t\treturn []chronograf.Server{*store.Kapacitor}, nil\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "199a78ce51585f9cf9c15ba8890d6f3c", "score": "0.47282967", "text": "func (lb LocalBusiness) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c000937e4e9171e75ddc4f38b47605a8", "score": "0.47261634", "text": "func (model *GrogModel) AllAssets() ([]*Asset, error) {\n\tvar foundAssets []*Asset\n\n\trows, rowsErr := model.db.DB.Query(`select name, mimeType, content, serve_external, rendered,\n\t\tadded, modified from Assets`)\n\tif rowsErr != nil {\n\t\treturn nil, fmt.Errorf(\"error loading all assets: %v\", rowsErr)\n\t}\n\n\tdefer rows.Close()\n\n\tvar (\n\t\tname string\n\t\tmimeType string\n\t\tcontent = make([]byte, 0)\n\t\tserveExternal int64\n\t\trendered int64\n\t\tadded int64\n\t\tmodified int64\n\t)\n\n\tfor rows.Next() {\n\t\tif rows.Scan(&name, &mimeType, &content, &serveExternal, &rendered, &added, &modified) != sql.ErrNoRows {\n\t\t\tfoundAsset := model.NewAsset(name, mimeType)\n\t\t\tfoundAsset.Content = content\n\t\t\tif serveExternal == 1 {\n\t\t\t\tfoundAsset.ServeExternal = true\n\t\t\t} else {\n\t\t\t\tfoundAsset.ServeExternal = false\n\t\t\t}\n\n\t\t\tif rendered == 1 {\n\t\t\t\tfoundAsset.Rendered = true\n\t\t\t} else {\n\t\t\t\tfoundAsset.Rendered = false\n\t\t\t}\n\n\t\t\tfoundAsset.Added.Set(time.Unix(added, 0))\n\t\t\tfoundAsset.Modified.Set(time.Unix(modified, 0))\n\n\t\t\tif foundAssets == nil {\n\t\t\t\tfoundAssets = make([]*Asset, 0)\n\t\t\t}\n\t\t\tfoundAssets = append(foundAssets, foundAsset)\n\t\t}\n\t}\n\n\treturn foundAssets, nil\n}", "title": "" }, { "docid": "133f5e257cd7e0e2936ff77aa0ec2e3e", "score": "0.4720561", "text": "func (eb EntertainmentBusiness) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b46e635bfeb5c33881d1c7a5e34a5044", "score": "0.4716781", "text": "func (a *Amazon) AvailabilityZones() (availabiltyZones []string) {\n\tif a.availabilityZones != nil {\n\t\treturn *a.availabilityZones\n\t}\n\n\tsubnets := a.tarmak.Cluster().Subnets()\n\tzones := make(map[string]bool)\n\n\tfor _, subnet := range subnets {\n\t\tzones[subnet.Zone] = true\n\t}\n\n\ta.availabilityZones = &availabiltyZones\n\n\tfor zone, _ := range zones {\n\t\tavailabiltyZones = append(availabiltyZones, zone)\n\t}\n\n\tsort.Strings(availabiltyZones)\n\n\treturn availabiltyZones\n}", "title": "" }, { "docid": "b6f41c8e44cb256cf174fc8d53e75734", "score": "0.46758315", "text": "func NewGetAirports(ctx *middleware.Context, handler GetAirportsHandler) *GetAirports {\n\treturn &GetAirports{Context: ctx, Handler: handler}\n}", "title": "" }, { "docid": "2188a7111ac1fcc64fdee11b37e92d8f", "score": "0.4674024", "text": "func (h Hotel) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c3cb7dc6a45f328aaf97e69a5f6aa7b3", "score": "0.46661273", "text": "func (rr ACLRulesPipe) All() (rs ACLRules) {\n\tfor r := range rr {\n\t\trs = append(rs, r)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6bd64f30bed5fa6b6be70a960052ccd6", "score": "0.4652346", "text": "func (p Place) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "34036eca65dd14540361e5aa988a1a1d", "score": "0.46516633", "text": "func (i Identifiable) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1cdd0cfdbd2316b73c7d8347ba4aecbc", "score": "0.46501186", "text": "func (e *Enclosure) Association() []interface{} {\n\tret := []interface{}{}\n\tfor _, v := range e.PowerSlots {\n\t\tret = append(ret, v)\n\t}\n\tfor _, v := range e.FanSlots {\n\t\tret = append(ret, v)\n\t}\n\tfor _, v := range e.ApplianceSlots {\n\t\tret = append(ret, v)\n\t}\n\tfor _, v := range e.ManagerSlots {\n\t\tret = append(ret, v)\n\t}\n\tfor _, v := range e.SwitchSlots {\n\t\tret = append(ret, v)\n\t}\n\tfor _, v := range e.ServerSlots {\n\t\tret = append(ret, v)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "93243cdd2061507a6f18fb02bfb047ac", "score": "0.46440312", "text": "func (a *AmbientIndex) All() []*model.WorkloadInfo {\n\ta.mu.RLock()\n\tdefer a.mu.RUnlock()\n\tres := make([]*model.WorkloadInfo, 0, len(a.byPod))\n\t// byPod will not have any duplicates, so we can just iterate over that.\n\tfor _, wl := range a.byPod {\n\t\tres = append(res, wl)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "daa8dee3afb78cdff1ae2431307cdf59", "score": "0.46258095", "text": "func (mt MovieTheater) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "01f4b92a563fa8bfbb7f8aaa3373bb6e", "score": "0.4622681", "text": "func (o Organization) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "258fa919e59817418c48c41108015559", "score": "0.46140215", "text": "func (a Airport) AsAirport() (*Airport, bool) {\n\treturn &a, true\n}", "title": "" }, { "docid": "0cff134dc34ffd4e02c5e0d4c1e94484", "score": "0.4576481", "text": "func (l License) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f63324baf46f6e6fd0718673cce9baf5", "score": "0.45677236", "text": "func GetZones(full bool, tenant string) []Zone {\n\ttenantStr := func() string {\n\t\tif len(tenant) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn \"-tenant=\" + tenant\n\t}()\n\tfullStr := func() string {\n\t\tif full {\n\t\t\treturn \"-full\"\n\t\t}\n\t\treturn \"\"\n\t}()\n\n\toutput := RunCmd(fmt.Sprintf(\"%s api -fetch-zone-apps %s %s\", ActlPath, fullStr, tenantStr))\n\tlistOfZones := []Zone{}\n\tyaml.Unmarshal([]byte(output), &listOfZones)\n\treturn listOfZones\n}", "title": "" }, { "docid": "6bdcfba11137bcce56bc3187f1711d3c", "score": "0.45450443", "text": "func (fe FoodEstablishment) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "580a30de27a450ed47f029e8a340b38b", "score": "0.45401454", "text": "func (lb LodgingBusiness) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ee820534303e76d925c7dec3bd73399b", "score": "0.45289356", "text": "func FilterAMVs(filter func(*AMV) bool) []*AMV {\n\tvar filtered []*AMV\n\n\tfor obj := range DB.All(\"AMV\") {\n\t\trealObject := obj.(*AMV)\n\n\t\tif filter(realObject) {\n\t\t\tfiltered = append(filtered, realObject)\n\t\t}\n\t}\n\n\treturn filtered\n}", "title": "" }, { "docid": "f9acbe17963aff4c2615176a8ff7f37e", "score": "0.45270994", "text": "func GetAZs() (*AZs, []error) {\n\tvar wg sync.WaitGroup\n\tvar errs []error\n\n\tazList := new(AZs)\n\tregions := GetRegionList()\n\n\tfor _, region := range regions {\n\t\twg.Add(1)\n\n\t\tgo func(region *ec2.Region) {\n\t\t\tdefer wg.Done()\n\t\t\terr := GetRegionAZs(*region.RegionName, azList)\n\t\t\tif err != nil {\n\t\t\t\terrs = append(errs, err)\n\t\t\t}\n\t\t}(region)\n\t}\n\n\twg.Wait()\n\n\treturn azList, errs\n}", "title": "" }, { "docid": "102cbf6be4fea1880bbe965beaeae8de", "score": "0.4514552", "text": "func (f Film) GetPlanets(planetChannel chan []Planet) {\n\tvar planetArray []Planet\n\tfor _, url := range f.Planets {\n\t\tvar p Planet\n\t\tlib.GetJSON(url, &p)\n\t\tplanetArray = append(planetArray, p)\n\t\tplanetChannel <- planetArray\n\t}\n}", "title": "" }, { "docid": "493e2ca4862ba1b8e73132c170369df0", "score": "0.4511101", "text": "func (c *PlanClient) All() (*PlanListResponse, error) {\n\treturn c.AllWithFilters(Filters{})\n}", "title": "" }, { "docid": "03923c5094f862a90f0b87a1315c226d", "score": "0.4506429", "text": "func (svc *ServiceContext) GetArchivesList(c *gin.Context) {\n\ttype Archives struct {\n\t\tDisplay string `json:\"displayDate\"`\n\t\tInternal string `json:\"internalDate\"`\n\t}\n\tvar data []Archives\n\tq := svc.DB.NewQuery(`select distinct DATE_FORMAT(submitted_at,'%M %Y') display, DATE_FORMAT(submitted_at,'%Y-%m') as internal\n\t\t from submissions where public=1 order by submitted_at desc`)\n\terr := q.All(&data)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: Unable to get archives list: %s\", err.Error())\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, data)\n}", "title": "" }, { "docid": "292779e7a41b255e4cf143e80b46e4bb", "score": "0.4505872", "text": "func (d Data) GetAirport(code string) Airport {\n\tfor _, a := range d.Airports {\n\t\tif a.Code == code {\n\t\t\treturn a\n\t\t}\n\t}\n\treturn Airport{}\n}", "title": "" }, { "docid": "fbf183ab440c85461357221ee77ca8c4", "score": "0.45042944", "text": "func (s *AssignmentServer) ListBigqueryreservationAlphaAssignment(ctx context.Context, request *alphapb.ListBigqueryreservationAlphaAssignmentRequest) (*alphapb.ListBigqueryreservationAlphaAssignmentResponse, error) {\n\tcl, err := createConfigAssignment(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources, err := cl.ListAssignment(ctx, request.GetProject(), request.GetLocation(), request.GetReservation())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar protos []*alphapb.BigqueryreservationAlphaAssignment\n\tfor _, r := range resources.Items {\n\t\trp := AssignmentToProto(r)\n\t\tprotos = append(protos, rp)\n\t}\n\tp := &alphapb.ListBigqueryreservationAlphaAssignmentResponse{}\n\tp.SetItems(protos)\n\treturn p, nil\n}", "title": "" }, { "docid": "e62abab5cfc86dcd6ab0dd9da5fde090", "score": "0.4497598", "text": "func (d *Dao) Archives(c context.Context, aids []int64, ip string) (a map[int64]*api.Arc, err error) {\n\tvar arg = &archive.ArgAids2{Aids: aids, RealIP: ip}\n\tif a, err = d.arc.Archives3(c, arg); err != nil {\n\t\tlog.Error(\"rpc archive (%v) error(%v)\", aids, err)\n\t\terr = ecode.CreativeArcServiceErr\n\t}\n\treturn\n}", "title": "" }, { "docid": "587e4115e893bfde1ee099e04c4efb08", "score": "0.44954497", "text": "func (c *Catalog) GetCameras() (NamedObjectList, error) {\n\tif c.Cameras != nil {\n\t\treturn c.Cameras, nil\n\t}\n\tcameras, err := c.db.queryNamedObjects(\"select id_local, value from AgInternedExifCameraModel\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.Cameras = cameras\n\treturn c.Cameras, nil\n}", "title": "" }, { "docid": "b113af71272f11eccc9974a4a2f7e035", "score": "0.44902602", "text": "func (b *OGame) GetPlanets() []Planet {\n\treturn b.WithPriority(taskRunner.Normal).GetPlanets()\n}", "title": "" }, { "docid": "a9871dcad2b8820ae488259dc3b0a23b", "score": "0.44808787", "text": "func (a *AuthorizationsService) All() (auths []Authorization, result *Result) {\n\tresult = a.client.get(a.URL, &auths)\n\treturn\n}", "title": "" }, { "docid": "5686fb19fb3f32daa7ea93e5a9d2933b", "score": "0.44613987", "text": "func (h *ProxyArpVppHandler) DumpProxyArpInterfaces() (pArpIfs []*vppcalls.ProxyArpInterfaceDetails, err error) {\n\treqCtx := h.callsChannel.SendMultiRequest(&vpp_arp.ProxyArpIntfcDump{})\n\n\tfor {\n\t\tproxyArpDetails := &vpp_arp.ProxyArpIntfcDetails{}\n\t\tstop, err := reqCtx.ReceiveReply(proxyArpDetails)\n\t\tif stop {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\th.log.Error(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Interface\n\t\tifName, _, exists := h.ifIndexes.LookupBySwIfIndex(proxyArpDetails.SwIfIndex)\n\t\tif !exists {\n\t\t\th.log.Warnf(\"Proxy ARP interface dump: missing name for interface index %d\", proxyArpDetails.SwIfIndex)\n\t\t}\n\n\t\t// Create entry\n\t\tpArpIfs = append(pArpIfs, &vppcalls.ProxyArpInterfaceDetails{\n\t\t\tInterface: &l3.ProxyARP_Interface{\n\t\t\t\tName: ifName,\n\t\t\t},\n\t\t\tMeta: &vppcalls.ProxyArpInterfaceMeta{\n\t\t\t\tSwIfIndex: proxyArpDetails.SwIfIndex,\n\t\t\t},\n\t\t})\n\n\t}\n\n\treturn pArpIfs, nil\n}", "title": "" }, { "docid": "8e0302d5a872380c3ae046fc31696f1b", "score": "0.44459748", "text": "func (agr *apiGatewayResource) GetAll(request *http.Request) (map[string]restful.Attributes, error) {\n\tctx := request.Context()\n\n\t// get namespace\n\tnamespace := agr.getNamespaceFromRequest(request)\n\tif namespace == \"\" {\n\t\treturn nil, nuclio.NewErrBadRequest(\"Namespace must exist\")\n\t}\n\n\texportFunction := agr.GetURLParamBoolOrDefault(request, restful.ParamExport, false)\n\tprojectName := request.Header.Get(headers.ProjectName)\n\n\t// filter by project name (when it's specified)\n\tgetAPIGatewaysOptions := platform.GetAPIGatewaysOptions{\n\t\tAuthSession: agr.getCtxSession(ctx),\n\t\tNamespace: namespace,\n\t}\n\tif projectName != \"\" {\n\t\tgetAPIGatewaysOptions.Labels = fmt.Sprintf(\"%s=%s\",\n\t\t\tcommon.NuclioResourceLabelKeyProjectName,\n\t\t\tprojectName)\n\t}\n\n\treturn agr.GetAllByNamespace(ctx, &getAPIGatewaysOptions, exportFunction)\n}", "title": "" }, { "docid": "8007225797f3e8cf43c0391888423c29", "score": "0.4441986", "text": "func (a Airport) MarshalJSON() ([]byte, error) {\n\ta.Type = TypeAirport\n\tobjectMap := make(map[string]interface{})\n\tif a.IataCode != nil {\n\t\tobjectMap[\"iataCode\"] = a.IataCode\n\t}\n\tif a.IcaoCode != nil {\n\t\tobjectMap[\"icaoCode\"] = a.IcaoCode\n\t}\n\tif a.Address != nil {\n\t\tobjectMap[\"address\"] = a.Address\n\t}\n\tif a.Telephone != nil {\n\t\tobjectMap[\"telephone\"] = a.Telephone\n\t}\n\tif a.Name != nil {\n\t\tobjectMap[\"name\"] = a.Name\n\t}\n\tif a.URL != nil {\n\t\tobjectMap[\"url\"] = a.URL\n\t}\n\tif a.Image != nil {\n\t\tobjectMap[\"image\"] = a.Image\n\t}\n\tif a.Description != nil {\n\t\tobjectMap[\"description\"] = a.Description\n\t}\n\tif a.EntityPresentationInfo != nil {\n\t\tobjectMap[\"entityPresentationInfo\"] = a.EntityPresentationInfo\n\t}\n\tif a.BingID != nil {\n\t\tobjectMap[\"bingId\"] = a.BingID\n\t}\n\tif a.ContractualRules != nil {\n\t\tobjectMap[\"contractualRules\"] = a.ContractualRules\n\t}\n\tif a.WebSearchURL != nil {\n\t\tobjectMap[\"webSearchUrl\"] = a.WebSearchURL\n\t}\n\tif a.ID != nil {\n\t\tobjectMap[\"id\"] = a.ID\n\t}\n\tif a.Type != \"\" {\n\t\tobjectMap[\"_type\"] = a.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cd788ee5e9baea98b4e15ab26bfcdf9e", "score": "0.44344622", "text": "func (repository Accounts) GetAll() ([]models.Account, error) {\n\trows, err := repository.db.Query(\n\t\t\"select id, name, cpf, balance, created_at from accounts\",\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar accounts []models.Account\n\n\tfor rows.Next() {\n\t\tvar account models.Account\n\n\t\tif err = rows.Scan(\n\t\t\t&account.ID,\n\t\t\t&account.Name,\n\t\t\t&account.Cpf,\n\t\t\t&account.Balance,\n\t\t\t&account.CreatedAt,\n\t\t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\taccounts = append(accounts, account)\n\t}\n\n\treturn accounts, nil\n}", "title": "" }, { "docid": "d76929e4f67165cc6e1c24ebac58a963", "score": "0.44334146", "text": "func (o *Port) Alarms(info *bambou.FetchingInfo) (AlarmsList, *bambou.Error) {\n\n\tvar list AlarmsList\n\terr := bambou.CurrentSession().FetchChildren(o, AlarmIdentity, &list, info)\n\treturn list, err\n}", "title": "" }, { "docid": "35834c61ac7f05bd74a49f34b0f346be", "score": "0.4430554", "text": "func (x *Job) GetAcls() []*Acl {\n\tif x != nil {\n\t\treturn x.Acls\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b3a4bd7f893c71a71b5506d2671da64", "score": "0.4420467", "text": "func AddAirport(w http.ResponseWriter, r *http.Request) {\n\tvar air Airport\n\tif err := json.NewDecoder(r.Body).Decode(air); err != nil {\n\t\tpanic(err)\n\t}\n\ti := bson.NewObjectId()\n\tair.ID = i\n\n\ts := GetMongoSession()\n\tdefer s.Close()\n\n\tc := s.DB(\"airports\").C(\"airposts_list\")\n\terr := c.Insert(air)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tif err = json.NewEncoder(w).Encode(air); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "e33cf4fc0dc607a3731613458156fc8c", "score": "0.44201723", "text": "func LoadAirport(ctx context.Context, key int) (*sql.Airport, error) {\n\tvar a sql.Airport\n\n\tdata, err := Load(ctx, airportIDKey, strconv.Itoa(key))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ta, ok := data.(sql.Airport)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"wrong type: the expected type is %T but got %T\", a, data)\n\t}\n\n\treturn &a, nil\n}", "title": "" }, { "docid": "fd24841bd30c7248a6e190020a97cfc6", "score": "0.4416255", "text": "func (s *AdoptersService) ListAll(ctx context.Context) ([]*Adopter, *Response, error) {\n\tu := \"adopters\"\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tvar adopters []*Adopter\n\tresp, err := s.client.Do(ctx, req, &adopters)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn adopters, resp, nil\n}", "title": "" }, { "docid": "a99e822c8d4e3d6a99a6e5e2f249b2fc", "score": "0.44060338", "text": "func (d *Dao) Archives(c context.Context, aids []int64) (as map[int64]*arcwar.Arc, err error) {\n\tif len(aids) == 0 {\n\t\treturn\n\t}\n\tvar (\n\t\tmissed []int64\n\t\ttmp map[int64]*arcwar.Arc\n\t\treply *arcwar.ArcsReply\n\t)\n\tif as, missed, err = d.arcsCache(c, aids); err != nil {\n\t\tas = make(map[int64]*arcwar.Arc, len(aids))\n\t\tmissed = aids\n\t\tlog.Error(\"%+v\", err)\n\t\terr = nil\n\t}\n\tif len(missed) == 0 {\n\t\treturn\n\t}\n\targ := &arcwar.ArcsRequest{Aids: missed}\n\tif reply, err = d.arcClient.Arcs(c, arg); err != nil {\n\t\tlog.Error(\"d.arcRPC.Archives3(%v) error(%v)\", arg, err)\n\t\tif reply, err = d.arcClient.Arcs(c, arg); err != nil {\n\t\t\terr = errors.Wrapf(err, \"%v\", arg)\n\t\t\treturn\n\t\t}\n\t}\n\ttmp = reply.Arcs\n\tfor aid, a := range tmp {\n\t\tas[aid] = a\n\t\td.AddArcCache(aid, a) // re-fill the cache\n\t}\n\treturn\n}", "title": "" }, { "docid": "8563695fd763e1998419c7a3da8e51ca", "score": "0.44052604", "text": "func (a Airport) AsPlaces() (*Places, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5659a0bff3cf88bd8dc04d02d04a336b", "score": "0.4396849", "text": "func (pg *PostgresDb)Show(ctx context.Context) ([]*entities.Calendar, error) {\n\trows, err := pg.Db.QueryxContext(ctx,\"SELECT * FROM calendar\")\n\tif err != nil {\n\t\treturn nil, errs.TableNotExist\n\t}\n\tdefer rows.Close()\n\tcalendars := make([]*entities.Calendar, 0)\n\tfor rows.Next() {\n\t\tcalendar := new(entities.Calendar)\n\t\terr := rows.Scan(&calendar.ID, &calendar.Owner, &calendar.Title, &calendar.StartTime, &calendar.EndTime)\n\t\tif err != nil {\n\t\t\treturn nil, errs.SqlRequestNotCorrect\n\t\t}\n\t\tcalendars = append(calendars, calendar)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn calendars, nil\n}", "title": "" }, { "docid": "846c78a0ea258ececf0d33fac943b08a", "score": "0.43930367", "text": "func (a SecretAclsAPI) List(scope string) ([]ACLItem, error) {\n\tvar aclItem struct {\n\t\tItems []ACLItem `json:\"items,omitempty\"`\n\t}\n\terr := a.client.Get(\"/secrets/acls/list\", map[string]string{\n\t\t\"scope\": scope,\n\t}, &aclItem)\n\treturn aclItem.Items, err\n}", "title": "" }, { "docid": "19049724aba5ee9238653bc95e41dee5", "score": "0.43815422", "text": "func (ta TouristAttraction) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2649f13f837e406c02b0a223c165ea91", "score": "0.43811774", "text": "func (m *VirtualEndpoint) GetFrontLineServicePlans()([]CloudPcFrontLineServicePlanable) {\n val, err := m.GetBackingStore().Get(\"frontLineServicePlans\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]CloudPcFrontLineServicePlanable)\n }\n return nil\n}", "title": "" }, { "docid": "9283db2c21397c4b973da3f264ccb58c", "score": "0.43675342", "text": "func (this *DBHandler) GetAllWpa() []Wpa {\n\tlistwpa := []Wpa{}\n\trows, err := this.db.Query(\"select * from wpa\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar wpa Wpa\n\t\terr = rows.Scan(&wpa.id, &wpa.name, &wpa.bssid)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\tfmt.Printf(\"ID: %d\\n\", wpa.id)\n\t\tlistwpa = append(listwpa, wpa)\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treturn listwpa\n}", "title": "" }, { "docid": "84527d08cb846eb62747e93b9242795a", "score": "0.4358049", "text": "func (t Thing) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0b6cbd8a68ffbe3bd928256aece2efdc", "score": "0.4325369", "text": "func (a *IAMApiService) GetACLs(ctx context.Context) (IamAcls, *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 IamAcls\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/acs/api/v1/acls\"\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, 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 IamAcls\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": "b1c53906bbc67a4968dcf9c018a5e2f8", "score": "0.43234086", "text": "func (a *API) Assets(ctx context.Context, params AssetsParams) (*AssetsResult, error) {\n\tres := &AssetsResult{}\n\t_, err := a.get(ctx, api.BuildPath(assets, params.AssetType, params.DeliveryType), params, res)\n\n\treturn res, err\n}", "title": "" }, { "docid": "fe1ab941d67debf769af488c3b625990", "score": "0.4318827", "text": "func (r Response) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e2d60fe3dc5b8fdcffff57442ebf1d2c", "score": "0.4315464", "text": "func (r Restaurant) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9617c7c3a393d03130f6e792fa5c0ccc", "score": "0.43079334", "text": "func (x *AclSet) GetAcls() []*Acl {\n\tif x != nil {\n\t\treturn x.Acls\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3df1f127d6d7258b9fe809cb56815bcf", "score": "0.42942268", "text": "func (q assetQuery) All() (AssetSlice, error) {\n\tvar o AssetSlice\n\n\terr := q.Bind(&o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to Asset slice\")\n\t}\n\n\tif len(assetAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(queries.GetExecutor(q.Query)); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "19e472102f57f81f2bf76fd744f8201b", "score": "0.42902282", "text": "func (x *Trigger) GetAcls() []*Acl {\n\tif x != nil {\n\t\treturn x.Acls\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19ef25d326357468466c55ebc83a22c9", "score": "0.42897776", "text": "func (b *OGame) GetCachedPlanets() []Planet {\n\tb.planetsMu.RLock()\n\tdefer b.planetsMu.RUnlock()\n\treturn b.planets\n}", "title": "" }, { "docid": "df2952616c5328b7e6f60d75d19c512a", "score": "0.42779136", "text": "func All() []Room {\n\treturn rooms\n}", "title": "" }, { "docid": "baf2f188b0c361074c8a0afe7799a2fe", "score": "0.42646784", "text": "func (a *AptDB) GetCodes() ([]string, error) {\n\t// TODO: Errors?\n\tvar apts []string\n\terr := a.boltDB.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(\"Airports\"))\n\t\terr := b.ForEach(func(k, v []byte) error {\n\t\t\tapts = append(apts, string(k))\n\t\t\treturn nil\n\t\t})\n\t\treturn err\n\t})\n\n\tif err != nil {\n\t\treturn apts, errors.Wrap(err, \"get codes\")\n\t}\n\n\treturn apts, nil\n}", "title": "" }, { "docid": "958be7363a5891577a6c01bc8f90f787", "score": "0.42611966", "text": "func (this *AppCollection) All() []collection.Item {\n var apps []collection.Item\n\n for _, a := range this.apps {\n apps = append(apps, a)\n }\n\n return apps\n}", "title": "" }, { "docid": "14941ba3e94ec4bfda87a11f11f9ed7e", "score": "0.42558646", "text": "func (db *Database) GetAllArchiveBackports() ([]*models.ArchiveBackport, error) {\n\tvar archiveBackports []*models.ArchiveBackport\n\n\tif err := db.gormDB.Model(&models.ArchiveBackport{}).Find(&archiveBackports).Error; err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn archiveBackports, nil\n}", "title": "" }, { "docid": "32e630c4ed8d24e7dd59cff7ede15f6f", "score": "0.42461643", "text": "func (pa PostalAddress) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9f0ac2216adb1a5ac871070346003cba", "score": "0.4245844", "text": "func (a Answer) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5503379b69b0543358239a7c6d1286d2", "score": "0.42424542", "text": "func (m *Planner) GetPlans()([]PlannerPlanable) {\n return m.plans\n}", "title": "" }, { "docid": "2bb756e7f634d1537a1da6bf6c5c009a", "score": "0.42394704", "text": "func GetAccounts(db gorm.DB) ([]AccountView, error) {\n\n\tvar rows []AccountView\n\tdb.Table(ACCOUNT_VIEW).Select(ACCOUNT_VIEW_COLS).Scan(&rows)\n\treturn rows, nil\n\n}", "title": "" }, { "docid": "592caee1963f2955a8ba1eae3d7e2b13", "score": "0.42384508", "text": "func GetAllDashboards() []datadog.Board {\n\tjd := getJSONDataFromAPI(\"dashboard\")\n\n\tvar boards map[string][]datadog.Board\n\terr := json.Unmarshal([]byte(jd), &boards)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn boards[\"dashboards\"]\n}", "title": "" }, { "docid": "a0e91be14a6663dc2bd63f0c3aea9f01", "score": "0.42381212", "text": "func (router *Router) getAllDashboards(w http.ResponseWriter, r *http.Request) {\n\tlog.Tracef(\"getAllDashboards\")\n\n\tvar dashboards []dashboard.DashboardSpec\n\n\tfor _, cluster := range router.clusters.Clusters {\n\t\tdashboard, err := cluster.GetDashboards(r.Context(), \"\")\n\t\tif err != nil {\n\t\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not get dashboards\")\n\t\t\treturn\n\t\t}\n\n\t\tdashboards = append(dashboards, dashboard...)\n\t}\n\n\tlog.WithFields(logrus.Fields{\"count\": len(dashboards)}).Tracef(\"getAllDashboards\")\n\trender.JSON(w, r, dashboards)\n}", "title": "" }, { "docid": "f9a82290515a197965dbbf6092968c58", "score": "0.4237815", "text": "func List() ([]models.Plan, error) {\n\tds := newDatastore()\n\tresults := make([]models.Plan, 0)\n\terr := ds.C().Find(bson.M{}).All(&results)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "11626b6e0b892b7705e88e92fc8780bf", "score": "0.42323458", "text": "func (s *AdmAccountStore) List(f *AccountFilter) ([]pwdless.Account, int, error) {\n\ta := []pwdless.Account{}\n\tcount, err := s.db.Model(&a).\n\t\tApply(f.Apply).\n\t\tSelectAndCount()\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\treturn a, count, nil\n}", "title": "" }, { "docid": "d9391c16a533b5c02857a754664fb7cf", "score": "0.42307112", "text": "func (app *TravelSampleApp) AirportSearch(w http.ResponseWriter, req *http.Request) {\n\tsearchKey := req.FormValue(\"search\")\n\tqueryParams := make([]interface{}, 1)\n\n\tqueryStr := \"SELECT airportname FROM `travel-sample`.`inventory`.`airport`\"\n\tif len(searchKey) == 3 {\n\t\t// FAA code\n\t\tqueryParams[0] = strings.ToUpper(searchKey)\n\t\tqueryStr = fmt.Sprintf(\"%s WHERE faa=$1\", queryStr)\n\t} else if len(searchKey) == 4 && (strings.ToUpper(searchKey) == searchKey || strings.ToLower(searchKey) == searchKey) {\n\t\t// ICAO code\n\t\tqueryParams[0] = strings.ToUpper(searchKey)\n\t\tqueryStr = fmt.Sprintf(\"%s WHERE icao=$1\", queryStr)\n\t} else {\n\t\t// Airport name\n\t\tqueryParams[0] = \"%\" + strings.ToLower(searchKey) + \"%\"\n\t\tqueryStr = fmt.Sprintf(\"%s WHERE LOWER(airportname) LIKE $1\", queryStr)\n\t}\n\n\tvar respData jsonAirportSearchResp\n\trespData.Context.Add(fmt.Sprintf(\"N1QL query - scoped to inventory: %s\", queryStr))\n\trows, err := app.cluster.Query(queryStr, &gocb.QueryOptions{PositionalParameters: queryParams})\n\tif err != nil {\n\t\tapp.logger.Printf(\"Failed to execute airport search query: %s\", err)\n\t\twriteJsonFailure(w, 500, err)\n\t\treturn\n\t}\n\n\trespData.Data = []jsonAirport{}\n\tfor rows.Next() {\n\t\tvar airport jsonAirport\n\t\tif err = rows.Row(&airport); err != nil {\n\t\t\tapp.logger.Printf(\"Error occurred during airport search result parsing: %s\", err)\n\t\t\twriteJsonFailure(w, 500, err)\n\t\t\treturn\n\t\t}\n\n\t\trespData.Data = append(respData.Data, airport)\n\t}\n\n\t// We should always check for any errors that may have occurred on the stream.\n\tif err = rows.Err(); err != nil {\n\t\tapp.logger.Printf(\"Error occurred during airport search result streaming: %s\", err)\n\t\twriteJsonFailure(w, 500, err)\n\t\treturn\n\t}\n\n\tencodeRespOrFail(w, respData)\n}", "title": "" }, { "docid": "dbc2b2f62c14cfdc16bc47c976ed5576", "score": "0.4226125", "text": "func (sv StructuredValue) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e29cdb9ce1c404b7af312d7b37b457b1", "score": "0.42208657", "text": "func (am *AccountManager) AllAccounts() []*Account {\n\trespChan := make(chan []*Account)\n\tam.cmdChan <- &accessAllRequest{\n\t\tresp: respChan,\n\t}\n\treturn <-respChan\n}", "title": "" }, { "docid": "d47106cda5a353d6822f5332573aec48", "score": "0.42164323", "text": "func (a *Atlante) Sheets() (sheets []*Sheet) {\n\tif a == nil || len(a.sheets) == 0 {\n\t\treturn sheets\n\t}\n\tsheetnames := a.SheetNames()\n\tsheets = make([]*Sheet, len(sheetnames))\n\ta.sLock.RLock()\n\tfor i, k := range sheetnames {\n\t\tsheets[i] = a.sheets[k]\n\t}\n\ta.sLock.RUnlock()\n\treturn sheets\n}", "title": "" }, { "docid": "14ae0809c5c7cc238b80da3bb3334220", "score": "0.4216383", "text": "func (oSlice *ParkingSpaces) GetAll() error {\n\tvar o ParkingSpace\n\tif err := dynahelpers.DynamoGetAll(o, oSlice); err != nil {\n\t\tlog.Printf(\"Error getting object of type %s\\n\", utils.GetType(o))\n\t\treturn err\n\t}\n\tif len(*oSlice) == 0 {\n\t\t*oSlice = make([]ParkingSpace, 0)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8f98f2a816d0b12bcc30d2c4e5dad6c8", "score": "0.42087018", "text": "func (s *Store) GetApcByID(ctx context.Context, id int) (*[]APC, error) {\n\tapc := []APC{}\n\n\tif err := s.db.Select(&apc, getApcByID, id); err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn &apc, nil\n}", "title": "" }, { "docid": "b1a2efa3b873083a40d21becd156abd0", "score": "0.4201229", "text": "func (rb ResponseBase) AsAirport() (*Airport, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "049523d0a6ac888a40ef77a5f2a4d153", "score": "0.41981125", "text": "func (m *Manager) GetGeneraArchetypes() []*Archetype {\n\treturn m.generaArchetypes\n}", "title": "" }, { "docid": "acc449d72359304170d3211e165f00a1", "score": "0.41956258", "text": "func (area Area) GetResources() []resource.Resource {\n\tvar resources []resource.Resource\n\n\tfor _, a := range area.Animals {\n\t\tresources = append(resources, a.Resources...)\n\t}\n\n\tfor _, p := range area.Plants {\n\t\tresources = append(resources, p.Resources...)\n\t}\n\n\tfor _, m := range area.Minerals {\n\t\tresources = append(resources, m.Resources...)\n\t}\n\n\tfor _, s := range area.Soils {\n\t\tresources = append(resources, s.Resources...)\n\t}\n\n\treturn resources\n}", "title": "" }, { "docid": "5ea4eccbb3fef4167534538092c8d5b2", "score": "0.4192774", "text": "func (s *Repository) GetAll(ctx context.Context) ([]Account, error) {\n\tconst limit = 10\n\n\trows, err := s.pool.Query(\n\t\tctx,\n\t\t`select * from \"account\"\n\t\t\t order by \"createdAt\" desc\n\t\t\t limit $1`, limit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\n\treturn scanAccounts(limit, rows)\n}", "title": "" }, { "docid": "23d9017cac56f4aaffda8f94252c8c2e", "score": "0.4191279", "text": "func (s *Stream) AlphaPlaneSize() int {\n\tif s.Chroma == \"444alpha\" {\n\t\treturn s.Width * s.Height\n\t}\n\treturn 0\n}", "title": "" } ]
881edf6e45f08f2164334105dcbde21c
/ Converts a string which is in the encoding used by GLib for filenames into a UTF8 string. Note that on Windows GLib uses UTF8 for filenames; on other platforms, this function indirectly depends on the [current locale][setlocale].
[ { "docid": "0c28912e224114dc130420f8e5f16cf0", "score": "0.7648179", "text": "func FilenameToUtf8(opsysstring string, len_ int64, bytes_read *C.gsize, bytes_written *C.gsize) (return__ string, __err__ error) {\n\t__cgo__opsysstring := (*C.gchar)(unsafe.Pointer(C.CString(opsysstring)))\n\tvar __cgo_error__ *C.GError\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_filename_to_utf8(__cgo__opsysstring, C.gssize(len_), bytes_read, bytes_written, &__cgo_error__)\n\tC.free(unsafe.Pointer(__cgo__opsysstring))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\tif __cgo_error__ != nil {\n\t\t__err__ = errors.New(C.GoString((*C.char)(unsafe.Pointer(__cgo_error__.message))))\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "be4415e58ae8604a24edf6ebd86dbdb5", "score": "0.6925418", "text": "func LocaleToUtf8(opsysstring string, len_ int64, bytes_read *C.gsize, bytes_written *C.gsize) (return__ string, __err__ error) {\n\t__cgo__opsysstring := (*C.gchar)(unsafe.Pointer(C.CString(opsysstring)))\n\tvar __cgo_error__ *C.GError\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_locale_to_utf8(__cgo__opsysstring, C.gssize(len_), bytes_read, bytes_written, &__cgo_error__)\n\tC.free(unsafe.Pointer(__cgo__opsysstring))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\tif __cgo_error__ != nil {\n\t\t__err__ = errors.New(C.GoString((*C.char)(unsafe.Pointer(__cgo_error__.message))))\n\t}\n\treturn\n}", "title": "" }, { "docid": "e5cb4c4f80e235456080e402c4d9cf52", "score": "0.6530708", "text": "func FilenameFromUtf8(utf8string string, len_ int64) (bytes_read int64, bytes_written int64, return__ []byte, __err__ error) {\n\t__cgo__utf8string := (*C.gchar)(unsafe.Pointer(C.CString(utf8string)))\n\tvar __cgo__bytes_read C.gsize\n\tvar __cgo__bytes_written C.gsize\n\tvar __cgo_error__ *C.GError\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_filename_from_utf8(__cgo__utf8string, C.gssize(len_), &__cgo__bytes_read, &__cgo__bytes_written, &__cgo_error__)\n\tC.free(unsafe.Pointer(__cgo__utf8string))\n\tbytes_read = int64(__cgo__bytes_read)\n\tbytes_written = int64(__cgo__bytes_written)\n\tdefer func() { return__ = C.GoBytes(unsafe.Pointer(__cgo__return__), C.int(bytes_written)) }()\n\tif __cgo_error__ != nil {\n\t\t__err__ = errors.New(C.GoString((*C.char)(unsafe.Pointer(__cgo_error__.message))))\n\t}\n\treturn\n}", "title": "" }, { "docid": "a9c70b854719756be1288133a7aefb68", "score": "0.6378416", "text": "func CharsetToUtf8(str string) string {\n\tcharSET := DetectCharsetStr(str)\n\tif charSET != \"utf-8\" {\n\t\tr, _ := charset.NewReader(strings.NewReader(str), charSET) // convert to UTF-8\n\t\tstrByte, _ := ioutil.ReadAll(r)\n\t\treturn string(strByte)\n\t}\n\treturn str\n}", "title": "" }, { "docid": "837f309fef4f589487a732ee052d252e", "score": "0.62381476", "text": "func ToUTF8(srcCharset string, src string) (dst string, err error) {\n\treturn Convert(\"UTF-8\", srcCharset, src)\n}", "title": "" }, { "docid": "820674823864170201c7bf3faf8492e5", "score": "0.61903054", "text": "func WinToUtf8(s string) (string, error) {\n\td, err := iconv.Open(\"utf8\", \"cp1251\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer d.Close()\n\treturn d.ConvString(s), nil\n}", "title": "" }, { "docid": "e2257997fbf25de08d777415fa7808c9", "score": "0.6158587", "text": "func Utf8Strup(str string, len_ int64) (return__ string) {\n\t__cgo__str := (*C.gchar)(unsafe.Pointer(C.CString(str)))\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf8_strup(__cgo__str, C.gssize(len_))\n\tC.free(unsafe.Pointer(__cgo__str))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "4468d8458bdd703e35d891bbc7e7bbcb", "score": "0.61573017", "text": "func unicode2utf8(source string) string {\n\tvar res = []string{\"\"}\n\tsUnicode := strings.Split(source, \"\\\\u\")\n\tvar context = \"\"\n\tfor _, v := range sUnicode {\n\t\tvar additional = \"\"\n\t\tif len(v) < 1 {\n\t\t\tcontinue\n\t\t}\n\t\tif len(v) > 4 {\n\t\t\trs := []rune(v)\n\t\t\tv = string(rs[:4])\n\t\t\tadditional = string(rs[4:])\n\t\t}\n\t\ttemp, err := strconv.ParseInt(v, 16, 32)\n\t\tif err != nil {\n\t\t\tcontext += v\n\t\t}\n\t\tcontext += fmt.Sprintf(\"%c\", temp)\n\t\tcontext += additional\n\t}\n\tres = append(res, context)\n\treturn strings.Join(res, \"\")\n}", "title": "" }, { "docid": "4468d8458bdd703e35d891bbc7e7bbcb", "score": "0.61573017", "text": "func unicode2utf8(source string) string {\n\tvar res = []string{\"\"}\n\tsUnicode := strings.Split(source, \"\\\\u\")\n\tvar context = \"\"\n\tfor _, v := range sUnicode {\n\t\tvar additional = \"\"\n\t\tif len(v) < 1 {\n\t\t\tcontinue\n\t\t}\n\t\tif len(v) > 4 {\n\t\t\trs := []rune(v)\n\t\t\tv = string(rs[:4])\n\t\t\tadditional = string(rs[4:])\n\t\t}\n\t\ttemp, err := strconv.ParseInt(v, 16, 32)\n\t\tif err != nil {\n\t\t\tcontext += v\n\t\t}\n\t\tcontext += fmt.Sprintf(\"%c\", temp)\n\t\tcontext += additional\n\t}\n\tres = append(res, context)\n\treturn strings.Join(res, \"\")\n}", "title": "" }, { "docid": "9a4fc4466c52c66b72303074ea26d3eb", "score": "0.6155448", "text": "func LocaleFromUtf8(utf8string string, len_ int64, bytes_read *C.gsize, bytes_written *C.gsize) (return__ string, __err__ error) {\n\t__cgo__utf8string := (*C.gchar)(unsafe.Pointer(C.CString(utf8string)))\n\tvar __cgo_error__ *C.GError\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_locale_from_utf8(__cgo__utf8string, C.gssize(len_), bytes_read, bytes_written, &__cgo_error__)\n\tC.free(unsafe.Pointer(__cgo__utf8string))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\tif __cgo_error__ != nil {\n\t\t__err__ = errors.New(C.GoString((*C.char)(unsafe.Pointer(__cgo_error__.message))))\n\t}\n\treturn\n}", "title": "" }, { "docid": "49408de66eded3a06d8a40ff4f1ee4dc", "score": "0.6152832", "text": "func Utf8Strdown(str string, len_ int64) (return__ string) {\n\t__cgo__str := (*C.gchar)(unsafe.Pointer(C.CString(str)))\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf8_strdown(__cgo__str, C.gssize(len_))\n\tC.free(unsafe.Pointer(__cgo__str))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "f548f76ff4ebb0374f00647f56d92532", "score": "0.60091776", "text": "func Utf8CollateKeyForFilename(str string, len_ int64) (return__ string) {\n\t__cgo__str := (*C.gchar)(unsafe.Pointer(C.CString(str)))\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf8_collate_key_for_filename(__cgo__str, C.gssize(len_))\n\tC.free(unsafe.Pointer(__cgo__str))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "2dd893633020125dd4f1dfd3439f5177", "score": "0.5858734", "text": "func CP1252ToUTF8(s string) string {\n\tutf8Buf := make([]byte, utf8.UTFMax)\n\tbb := []byte{}\n\tfor i := 0; i < len(s); i++ {\n\t\tn := utf8.EncodeRune(utf8Buf, rune(s[i]))\n\t\tbb = append(bb, utf8Buf[:n]...)\n\t}\n\treturn string(bb)\n}", "title": "" }, { "docid": "6afd2abde5e203afc258e17475ca168f", "score": "0.57991874", "text": "func StrToUtf8(str *string) error {\n\tb, err := GbkToUtf8([]byte(*str))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*str = string(b)\n\treturn nil\n}", "title": "" }, { "docid": "77708009387776b83df387548bd67fb9", "score": "0.5799129", "text": "func UTF8To(dstCharset string, src string) (dst string, err error) {\n\treturn Convert(dstCharset, \"UTF-8\", src)\n}", "title": "" }, { "docid": "1db37dae11be9bacf4c4deb361ecd8a3", "score": "0.5693322", "text": "func Utf8Normalize(str string, len_ int64, mode C.GNormalizeMode) (return__ string) {\n\t__cgo__str := (*C.gchar)(unsafe.Pointer(C.CString(str)))\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf8_normalize(__cgo__str, C.gssize(len_), mode)\n\tC.free(unsafe.Pointer(__cgo__str))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "618b0064ee8e9c56aff2add6e03ea015", "score": "0.56634647", "text": "func encodeStringUTF8(s string, w io.Writer) error {\n\tl := len(s)\n\tvar b [bufCap]byte\n\ti := 0\n\tfor l-i > bufCap {\n\t\tn := i + bufCap\n\t\tcopy(b[:], s[i:n])\n\t\tif _, err := ioutilx.WriteUnsafe(w, b[:]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti = n\n\t}\n\tn := l - i\n\tcopy(b[:n], s[i:])\n\tioutilx.WriteUnsafe(w, b[:n])\n\treturn nil\n}", "title": "" }, { "docid": "cadaf7f8fd77c979710cc7bf6def83ed", "score": "0.5654653", "text": "func _escFSString(useLocal bool, name string) (string, error) {\n\tb, err := _escFSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "cadaf7f8fd77c979710cc7bf6def83ed", "score": "0.5654653", "text": "func _escFSString(useLocal bool, name string) (string, error) {\n\tb, err := _escFSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "cadaf7f8fd77c979710cc7bf6def83ed", "score": "0.5654653", "text": "func _escFSString(useLocal bool, name string) (string, error) {\n\tb, err := _escFSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "82dbecf44bb771841bcecb07623a0645", "score": "0.5620066", "text": "func Utf8Strchr(p string, len_ int64, c rune) (return__ string) {\n\t__cgo__p := (*C.gchar)(unsafe.Pointer(C.CString(p)))\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf8_strchr(__cgo__p, C.gssize(len_), C.gunichar(c))\n\tC.free(unsafe.Pointer(__cgo__p))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "335664f3dedcd45a99c7c36cf0fd10c2", "score": "0.5585602", "text": "func fixUTF8(s string) string {\n\tif utf8.ValidString(s) {\n\t\treturn s\n\t}\n\tvar buf strings.Builder\n\tbuf.Grow(len(s))\n\tfor _, r := range s {\n\t\tif utf8.ValidRune(r) {\n\t\t\tbuf.WriteRune(r)\n\t\t} else {\n\t\t\tbuf.WriteRune('\\uFFFD')\n\t\t}\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "b1774d33f0f6b84756afbd7fd8ddf180", "score": "0.55365086", "text": "func Utf8ToWin(s string) (string, error) {\n\td, err := iconv.Open(\"cp1251//IGNORE\", \"utf8\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer d.Close()\n\treturn d.ConvString(s), nil\n}", "title": "" }, { "docid": "c023a6364abaf9a5f940d46210e32240", "score": "0.5534203", "text": "func EncodeStringUTF8(s string, w io.Writer) error {\n\tif err := EncodeVarInt(int64(len(s)), w); err != nil {\n\t\treturn err\n\t}\n\treturn encodeStringUTF8(s, w)\n}", "title": "" }, { "docid": "c8c366da52170847058b7d6d0d80e52c", "score": "0.5522122", "text": "func (s Slice) GetStringUTF8() ([]byte, error) {\n\th := s.head()\n\tif h >= 0x40 && h <= 0xbe {\n\t\t// short UTF-8 String\n\t\tlength := h - 0x40\n\t\tresult := s[1 : 1+length]\n\t\treturn result, nil\n\t}\n\n\tif h == 0xbf {\n\t\t// long UTF-8 String\n\t\tlength := readIntegerFixed(s[1:], 8)\n\t\tif err := checkOverflow(ValueLength(length)); err != nil {\n\t\t\treturn nil, WithStack(err)\n\t\t}\n\t\tresult := s[1+8 : 1+8+length]\n\t\treturn result, nil\n\t}\n\n\treturn nil, InvalidTypeError{\"Expecting type String\"}\n}", "title": "" }, { "docid": "f256a1802f260d0bcdfcfb7323c4ef92", "score": "0.5517285", "text": "func GSM0338ToUTF8(text string) string {\n\ts := \"\"\n\n\tfor _, ch := range text {\n\t\tnewCh, found := gsmUtf8Chars[string(ch)]\n\t\tif found {\n\t\t\ts += newCh\n\t\t} else {\n\t\t\ts += string(ch)\n\t\t}\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "7419f8ed5608fce3097297e393f865c1", "score": "0.5510643", "text": "func DecodeStringUTF8(r io.Reader) (string, error) {\n\tl, err := DecodeVarInt(r)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn decodeStringUTF8(l, r)\n}", "title": "" }, { "docid": "4f20103cb6f62b538a83ec6d256fed67", "score": "0.55027974", "text": "func unUnicode(in string) string {\n\tb := []byte(in)\n\tout := \"\"\n\tfor len(b) > 0 {\n\t\t_, size := utf8.DecodeRune(b)\n\t\tif size > 1 {\n\t\t\tfor i := 0; i < size; i++ {\n\t\t\t\tout += fmt.Sprintf(\"%%%X\", b[i])\n\t\t\t}\n\t\t} else {\n\t\t\tout += string(b[0])\n\t\t}\n\t\tb = b[size:]\n\t}\n\treturn out\n}", "title": "" }, { "docid": "5bc9a1ac5142808b344e54d2f8245e06", "score": "0.55015975", "text": "func GetUTFString(data []byte) (string, int) {\n\tlengthData := data[:2]\n\tlength := int(lengthData[0])*256 + int(lengthData[1])\n\tlog.Printf(\"From %08b %08b, we get %d (%s)\", lengthData[0], lengthData[1], length, data[2:length+2])\n\treturn string(data[2 : length+2]), length + 2\n}", "title": "" }, { "docid": "472a512138bed4a1588a1f643ac17f31", "score": "0.5494653", "text": "func GbkToUtf8(str []byte) (b []byte, err error) {\n\tr := transform.NewReader(bytes.NewReader(str), simplifiedchinese.GBK.NewDecoder())\n\tb, err = ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "472a512138bed4a1588a1f643ac17f31", "score": "0.5494653", "text": "func GbkToUtf8(str []byte) (b []byte, err error) {\n\tr := transform.NewReader(bytes.NewReader(str), simplifiedchinese.GBK.NewDecoder())\n\tb, err = ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "88e1425f4b07029df0fb82a110923c59", "score": "0.54824376", "text": "func fixUTF8(s string) string {\n\tif utf8.ValidString(s) {\n\t\treturn s\n\t}\n\n\t// Otherwise time to build the sequence.\n\tbuf := new(bytes.Buffer)\n\tbuf.Grow(len(s))\n\tfor _, r := range s {\n\t\tif utf8.ValidRune(r) {\n\t\t\tbuf.WriteRune(r)\n\t\t} else {\n\t\t\tbuf.WriteRune('\\uFFFD')\n\t\t}\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "796dee6b551356551d79228ec4f9c194", "score": "0.54798186", "text": "func EncodeUTF8String(data string) ([]byte, error) {\n\tif valid := utf8.ValidString(data); !valid {\n\t\treturn []byte{}, fmt.Errorf(\"Data to encode is not a valid UTF-8 string\")\n\t}\n\trs := []rune(data)\n\n\tbyteSize := 0\n\tfor _, r := range rs {\n\t\tbyteSize += utf8.RuneLen(r)\n\t}\n\toutput := make([]byte, byteSize)\n\n\tbyteSize = 0\n\tfor i := 0; i < len(rs); i++ {\n\t\tbyteSize += utf8.EncodeRune(output[byteSize:], rs[i])\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "16891e848a5716174e4c5de9cede6dc3", "score": "0.5442805", "text": "func utf8Scrub(in string) string {\n\n\t// First check validity using the stdlib, returning if the string is already\n\t// valid\n\tif utf8.ValidString(in) {\n\t\treturn in\n\t}\n\n\tleft := []byte(in)\n\tvar result bytes.Buffer\n\n\tfor len(left) > 0 {\n\t\tr, n := utf8.DecodeRune(left)\n\n\t\t_, err := result.WriteRune(r)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tleft = left[n:]\n\t}\n\n\treturn result.String()\n}", "title": "" }, { "docid": "0c8b8d60816542f0feedb1f32e61b720", "score": "0.54294544", "text": "func UTF8(v interface{}) error {\n\tvalue := reflect.ValueOf(v)\n\tif value.Kind() == reflect.Ptr && !value.IsNil() {\n\t\tvalue = value.Elem()\n\t}\n\n\tif value.Kind() != reflect.Struct {\n\t\treturn fmt.Errorf(\"%w: %s\", ErrUnexpectedKind, value.Kind())\n\t}\n\n\tfor i := 0; i < value.NumField(); i++ {\n\t\tft := value.Type().Field(i)\n\t\tif len(ft.PkgPath) > 0 || ft.Anonymous {\n\t\t\tcontinue // skip embedded or unexported fields\n\t\t}\n\n\t\tf := value.Field(i)\n\t\tif !f.CanInterface() {\n\t\t\tcontinue // this should never happen, but ... you never know\n\t\t}\n\n\t\tif s, ok := f.Interface().(string); ok {\n\t\t\tif !utf8.ValidString(s) {\n\t\t\t\treturn fmt.Errorf(\"%w: '%s:%v'\", ErrNotUTF8, ft.Name, s)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bc9a0ef24248e8f21ea269512102c531", "score": "0.5410886", "text": "func (_ GlUtil) StringFromUbyte(str *Ubyte) string {\r\n\treturn C.GoString((*C.char)(unsafe.Pointer(str)))\r\n}", "title": "" }, { "docid": "ac879ff9c4daaaab0ad4c0ff03ba527c", "score": "0.53807354", "text": "func UTF8ToCP1252(s string) string {\n\tbb := []byte{}\n\tfor _, r := range s {\n\t\tbb = append(bb, byte(r))\n\t}\n\treturn string(bb)\n}", "title": "" }, { "docid": "293ef18d9f4f4f8518c03e63e51cea65", "score": "0.5341639", "text": "func Utf16ToUtf8(str *C.gunichar2, len_ int64, items_read *C.glong, items_written *C.glong) (return__ string, __err__ error) {\n\tvar __cgo_error__ *C.GError\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf16_to_utf8(str, C.glong(len_), items_read, items_written, &__cgo_error__)\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\tif __cgo_error__ != nil {\n\t\t__err__ = errors.New(C.GoString((*C.char)(unsafe.Pointer(__cgo_error__.message))))\n\t}\n\treturn\n}", "title": "" }, { "docid": "e2b4556632b3515a3a62024a20df9bba", "score": "0.53299224", "text": "func EucToUtf8(data string) (string, error) {\n\tin := bytes.NewBufferString(data)\n\tout := new(bytes.Buffer)\n\treader := transform.NewReader(in, japanese.EUCJP.NewDecoder())\n\t_, e := io.Copy(out, reader)\n\treturn out.String(), e\n}", "title": "" }, { "docid": "2c632f6f14acb5f74a35aa9f252e266e", "score": "0.5292622", "text": "func EncodeToStringUc(b []byte) string { return encode(b, UcAlphabet) }", "title": "" }, { "docid": "d4a6b68d462164cd7abd9aee872f1ab1", "score": "0.5280289", "text": "func fileToString(fPath string) string {\n\tfByte, err := ioutil.ReadFile(fPath)\n\tif err != nil {\n\t\tpanic(\"Unable to read \" + fPath)\n\t}\n\treturn string(fByte)\n}", "title": "" }, { "docid": "7ece95de505950a7bfbcc10e12db8052", "score": "0.5271936", "text": "func Utf8Collate(str1 string, str2 string) (return__ int) {\n\t__cgo__str1 := (*C.gchar)(unsafe.Pointer(C.CString(str1)))\n\t__cgo__str2 := (*C.gchar)(unsafe.Pointer(C.CString(str2)))\n\tvar __cgo__return__ C.gint\n\t__cgo__return__ = C.g_utf8_collate(__cgo__str1, __cgo__str2)\n\tC.free(unsafe.Pointer(__cgo__str1))\n\tC.free(unsafe.Pointer(__cgo__str2))\n\treturn__ = int(__cgo__return__)\n\treturn\n}", "title": "" }, { "docid": "b58cf4452623f9a346f0ed70b88ffcb6", "score": "0.5271079", "text": "func UTF8ToGB18030(src string) string {\n\treturn mahonia.NewDecoder(\"GB18030\").ConvertString(src)\n}", "title": "" }, { "docid": "573fb30fa0d0846a173aa6fec588f320", "score": "0.5241835", "text": "func Ucs4ToUtf8(str *C.gunichar, len_ int64, items_read *C.glong, items_written *C.glong) (return__ string, __err__ error) {\n\tvar __cgo_error__ *C.GError\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_ucs4_to_utf8(str, C.glong(len_), items_read, items_written, &__cgo_error__)\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\tif __cgo_error__ != nil {\n\t\t__err__ = errors.New(C.GoString((*C.char)(unsafe.Pointer(__cgo_error__.message))))\n\t}\n\treturn\n}", "title": "" }, { "docid": "bc79315634afbcc33232a22b91231df3", "score": "0.52276593", "text": "func Utf8Casefold(str string, len_ int64) (return__ string) {\n\t__cgo__str := (*C.gchar)(unsafe.Pointer(C.CString(str)))\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf8_casefold(__cgo__str, C.gssize(len_))\n\tC.free(unsafe.Pointer(__cgo__str))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "17d7d65c5b4ac327cac80786fee6fe23", "score": "0.51927024", "text": "func utf8toBIFF8UnicodeLong(value string) string {\n\tbuf := new(bytes.Buffer)\n\tln := utf8.RuneCountInString(value)\n\tutf16str := utf16.Encode([]rune(value))\n\tputVar(buf, uint16(ln), uint8(0x0001), utf16str)\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "c6fc0d87ade3f374cc03515e3a72bb52", "score": "0.51806426", "text": "func escFSString(useLocal bool, name string) (string, error) {\n\tb, err := escFSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "6a0b360d27a45a2250a27881837a2cc4", "score": "0.51800615", "text": "func Utf8CollateKey(str string, len_ int64) (return__ string) {\n\t__cgo__str := (*C.gchar)(unsafe.Pointer(C.CString(str)))\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf8_collate_key(__cgo__str, C.gssize(len_))\n\tC.free(unsafe.Pointer(__cgo__str))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "0113e00a15b140afcff0de83ab85505b", "score": "0.5176922", "text": "func (v *Token) AsUTF8String() (ret string, err error) {\n\tv.mustBeValue()\n\treturn string(v.Bytes), nil\n}", "title": "" }, { "docid": "81c86cfc757c5dc0467a8adbf6d40638", "score": "0.516841", "text": "func Utf8ToGbk(str []byte) (b []byte, err error) {\n\tr := transform.NewReader(bytes.NewReader(str), simplifiedchinese.GBK.NewEncoder())\n\tb, err = ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "ed75ecf9b077df05b5d9bc2aa7d2a2d0", "score": "0.5149896", "text": "func decodeStringUTF8(l int64, r io.Reader) (string, error) {\n\tvar builder strings.Builder\n\tvar b [bufCap]byte\n\ti := l\n\tfor i > bufCap {\n\t\terr := ioutilx.ReadNBufUnsafe(r, b[:])\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\ti -= bufCap\n\t\tbuilder.Write(b[:])\n\t}\n\terr := ioutilx.ReadNBufUnsafe(r, b[:i])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbuilder.Write(b[:i])\n\n\treturn builder.String(), nil\n}", "title": "" }, { "docid": "caadca62fb8780be957257d7097dcd86", "score": "0.51428837", "text": "func Utf8GetChar(p string) (return__ rune) {\n\t__cgo__p := (*C.gchar)(unsafe.Pointer(C.CString(p)))\n\tvar __cgo__return__ C.gunichar\n\t__cgo__return__ = C.g_utf8_get_char(__cgo__p)\n\tC.free(unsafe.Pointer(__cgo__p))\n\treturn__ = rune(__cgo__return__)\n\treturn\n}", "title": "" }, { "docid": "1078a905198f3bdc1ad7e345fecf6850", "score": "0.5140441", "text": "func stringToASCIIBytes(s string) ([]byte, error) {\n\tlength := len(s)\n\tb := make([]byte, length)\n\t// convert the name into 11 bytes\n\tr := []rune(s)\n\t// take the first 8 characters\n\tfor i := 0; i < length; i++ {\n\t\tval := int(r[i])\n\t\t// we only can handle values less than max byte = 255\n\t\tif val > 255 {\n\t\t\treturn nil, fmt.Errorf(\"non-ASCII character in name: %s\", s)\n\t\t}\n\t\tb[i] = byte(val)\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "94708dc496073e538edd806390647aac", "score": "0.5134704", "text": "func PyUnicode_AsString(unicode *PyObject) string {\n\tcu := C.__PyUnicode_AsUTF8(go2c(unicode))\n\treturn C.GoString(cu)\n}", "title": "" }, { "docid": "a52a1ac7c9f6bb1b381d52cfb002bc47", "score": "0.51258385", "text": "func EncodeUTFString(data string) []byte {\n\tres := make([]byte, len(data)+2)\n\tbyteLen := Get2ByteInt(len(data))\n\tres[0] = byteLen[0]\n\tres[1] = byteLen[1]\n\tfor i, v := range []byte(data) {\n\t\tres[i+2] = v\n\t}\n\treturn res\n}", "title": "" }, { "docid": "d3d3d77f0cd02871b1b31eeced1f9cf4", "score": "0.5122855", "text": "func getStdlibString() string {\n\ts := \"\"\n\tfs.WalkDir(\n\t\tstdlibFs,\n\t\t\".\",\n\t\tfunc(path string, d fs.DirEntry, 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(path, \".cz\") {\n\t\t\t\tc, err := ioutil.ReadFile(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts += string(c)\n\t\t\t\ts += \"\\n\"\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\n\treturn s\n}", "title": "" }, { "docid": "05b3f3531974454503c1c08ed6e18bce", "score": "0.5110754", "text": "func convertRegexpToUnicode(patternStr string) string {\n\tvar sb strings.Builder\n\tpos := 0\n\tfor i := 0; i < len(patternStr)-11; {\n\t\tr, size := utf8.DecodeRuneInString(patternStr[i:])\n\t\tif r == '\\\\' {\n\t\t\ti++\n\t\t\tif patternStr[i] == 'u' && patternStr[i+5] == '\\\\' && patternStr[i+6] == 'u' {\n\t\t\t\tif first, ok := decodeHex(patternStr[i+1 : i+5]); ok {\n\t\t\t\t\tif isUTF16FirstSurrogate(rune(first)) {\n\t\t\t\t\t\tif second, ok := decodeHex(patternStr[i+7 : i+11]); ok {\n\t\t\t\t\t\t\tif isUTF16SecondSurrogate(rune(second)) {\n\t\t\t\t\t\t\t\tr = utf16.DecodeRune(rune(first), rune(second))\n\t\t\t\t\t\t\t\tsb.WriteString(patternStr[pos : i-1])\n\t\t\t\t\t\t\t\tsb.WriteRune(r)\n\t\t\t\t\t\t\t\ti += 11\n\t\t\t\t\t\t\t\tpos = i\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++\n\t\t} else {\n\t\t\ti += size\n\t\t}\n\t}\n\tif pos > 0 {\n\t\tsb.WriteString(patternStr[pos:])\n\t\treturn sb.String()\n\t}\n\treturn patternStr\n}", "title": "" }, { "docid": "526aa5fb04af5226de1c94e86cfe21d2", "score": "0.5101365", "text": "func Convert(dstCharset string, srcCharset string, src string) (dst string, err error) {\n\tif dstCharset == srcCharset {\n\t\treturn src, nil\n\t}\n\tdst = src\n\t// Converting `src` to UTF-8.\n\tif srcCharset != \"UTF-8\" {\n\t\tif e := getEncoding(srcCharset); e != nil {\n\t\t\ttmp, err := ioutil.ReadAll(\n\t\t\t\ttransform.NewReader(bytes.NewReader([]byte(src)), e.NewDecoder()),\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", gerror.Wrapf(err, `convert string \"%s\" to utf8 failed`, srcCharset)\n\t\t\t}\n\t\t\tsrc = string(tmp)\n\t\t} else {\n\t\t\treturn dst, gerror.NewCodef(gcode.CodeInvalidParameter, `unsupported srcCharset \"%s\"`, srcCharset)\n\t\t}\n\t}\n\t// Do the converting from UTF-8 to `dstCharset`.\n\tif dstCharset != \"UTF-8\" {\n\t\tif e := getEncoding(dstCharset); e != nil {\n\t\t\ttmp, err := ioutil.ReadAll(\n\t\t\t\ttransform.NewReader(bytes.NewReader([]byte(src)), e.NewEncoder()),\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", gerror.Wrapf(err, `convert string from utf8 to \"%s\" failed`, dstCharset)\n\t\t\t}\n\t\t\tdst = string(tmp)\n\t\t} else {\n\t\t\treturn dst, gerror.NewCodef(gcode.CodeInvalidParameter, `unsupported dstCharset \"%s\"`, dstCharset)\n\t\t}\n\t} else {\n\t\tdst = src\n\t}\n\treturn dst, nil\n}", "title": "" }, { "docid": "f26ce2d29ad7f1b98e43911ec0b8686c", "score": "0.50649095", "text": "func file2String(fileName string) (string, error) {\n\tdat, err := ioutil.ReadFile(fileName)\n\treturn string(dat), err\n}", "title": "" }, { "docid": "91a45722e8a496f145702bf36600ff8f", "score": "0.50527036", "text": "func Utf8Strrchr(p string, len_ int64, c rune) (return__ string) {\n\t__cgo__p := (*C.gchar)(unsafe.Pointer(C.CString(p)))\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf8_strrchr(__cgo__p, C.gssize(len_), C.gunichar(c))\n\tC.free(unsafe.Pointer(__cgo__p))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "d85df0f74cd18ec4d08048a77cfadb4e", "score": "0.50130093", "text": "func decodeMUTF8(bytes []byte) string {\n\treturn string(bytes)\n}", "title": "" }, { "docid": "8186b9e764d616ddb2f01f831cbedbf9", "score": "0.5011962", "text": "func unquoteString(s string) (string, error) {\n\tret := new(bytes.Buffer)\n\tfor i := 0; i < len(s); i++ {\n\t\tif s[i] == '\\\\' {\n\t\t\ti++\n\t\t\tif i == len(s) {\n\t\t\t\treturn \"\", errors.New(\"Missing a closing quotation mark in string\")\n\t\t\t}\n\t\t\tswitch s[i] {\n\t\t\tcase '\"':\n\t\t\t\tret.WriteByte('\"')\n\t\t\tcase 'b':\n\t\t\t\tret.WriteByte('\\b')\n\t\t\tcase 'f':\n\t\t\t\tret.WriteByte('\\f')\n\t\t\tcase 'n':\n\t\t\t\tret.WriteByte('\\n')\n\t\t\tcase 'r':\n\t\t\t\tret.WriteByte('\\r')\n\t\t\tcase 't':\n\t\t\t\tret.WriteByte('\\t')\n\t\t\tcase '\\\\':\n\t\t\t\tret.WriteByte('\\\\')\n\t\t\tcase 'u':\n\t\t\t\tif i+5 > len(s) {\n\t\t\t\t\treturn \"\", errors.Errorf(\"Invalid unicode: %s\", s[i+1:])\n\t\t\t\t}\n\t\t\t\tchar, size, err := decodeEscapedUnicode(hack.Slice(s[i+1 : i+5]))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", errors.Trace(err)\n\t\t\t\t}\n\t\t\t\tret.Write(char[0:size])\n\t\t\t\ti += 5\n\t\t\tdefault:\n\t\t\t\t// For all other escape sequences, backslash is ignored.\n\t\t\t\tret.WriteByte(s[i])\n\t\t\t}\n\t\t} else {\n\t\t\tret.WriteByte(s[i])\n\t\t}\n\t}\n\treturn ret.String(), nil\n}", "title": "" }, { "docid": "4ff0fddb9288d8e10bc230674f136862", "score": "0.49957645", "text": "func UnicharToUtf8(c rune, outbuf string) (return__ int) {\n\t__cgo__outbuf := (*C.gchar)(unsafe.Pointer(C.CString(outbuf)))\n\tvar __cgo__return__ C.gint\n\t__cgo__return__ = C.g_unichar_to_utf8(C.gunichar(c), __cgo__outbuf)\n\tC.free(unsafe.Pointer(__cgo__outbuf))\n\treturn__ = int(__cgo__return__)\n\treturn\n}", "title": "" }, { "docid": "8ff53423241555a4ce6b3dff797af183", "score": "0.4977511", "text": "func QuoteToASCII(s string) string", "title": "" }, { "docid": "d78b5531352ab9145da523bfe94a86cd", "score": "0.49576205", "text": "func Utf8Strncpy(dest string, src string, n int64) (return__ string) {\n\t__cgo__dest := (*C.gchar)(unsafe.Pointer(C.CString(dest)))\n\t__cgo__src := (*C.gchar)(unsafe.Pointer(C.CString(src)))\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_utf8_strncpy(__cgo__dest, __cgo__src, C.gsize(n))\n\tC.free(unsafe.Pointer(__cgo__dest))\n\tC.free(unsafe.Pointer(__cgo__src))\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "ce148acead475fe9f76d6ab496277f89", "score": "0.4953459", "text": "func utf8toBIFF8UnicodeShort(value string) string {\n\tbuf := new(bytes.Buffer)\n\tln := utf8.RuneCountInString(value)\n\tutf16str := utf16.Encode([]rune(value))\n\tputVar(buf, uint8(ln), uint8(0x0001), utf16str)\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "66998429a9f171ee8c52deb880d50ece", "score": "0.4935737", "text": "func main() {\n\t// Write the string\n\t// encoded to Windows-1252\n\tencoder := charmap.Windows1252.NewEncoder()\n\ts, e := encoder.String(\"This is sample text with runes Š\")\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\tioutil.WriteFile(\"temp/example.txt\", []byte(s), os.ModePerm)\n\n\t// Decoder to UTF-8\n\tf, e := os.Open(\"temp/example.txt\")\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\tdefer f.Close()\n\tdecoder := charmap.Windows1252.NewDecoder()\n\treader := decoder.Reader(f)\n\tb, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(string(b))\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "0edce2eee975619dd07d357b81efc498", "score": "0.49330604", "text": "func FSString(useLocal bool, name string) (string, error) {\n\tb, err := FSByte(useLocal, name)\n\treturn string(b), err\n}", "title": "" }, { "docid": "22392a00e54995a99cccfb8e85d6eb34", "score": "0.4930276", "text": "func ToUnicode(s string) (string, error) {\n\treturn idna.ToUnicode(s)\n}", "title": "" }, { "docid": "ba24d47c59088949b0e0cdc6707c59a1", "score": "0.4928805", "text": "func encode(s string, special string, enc Encoding) string {\n\tswitch enc {\n\tcase UTF8:\n\t\treturn encodeUtf8(s, special)\n\tcase ISO_8859_1:\n\t\treturn encodeIso(s, special)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported encoding %v\", enc))\n\t}\n}", "title": "" }, { "docid": "0e95047010d96a0e35ce47a5ebf0c1ee", "score": "0.49176407", "text": "func String() {\n\ts := \"hello, world\"\n\thello := s[:5]\n\tworld := s[7:]\n\n\tfmt.Println(hello)\n\tfmt.Println(world)\n\n\tt := \"hello, 世界\"\n\tfmt.Println(len(t)) // => 13\n\tfmt.Println(utf8.RuneCountInString(t)) // => 9\n\n\tfor i := 0; i < len(t); {\n\t\tr, size := utf8.DecodeRuneInString(t[i:])\n\t\tfmt.Printf(\"%d\\t%c\\n\", i, r)\n\t\ti += size\n\t}\n\n\tfor i, r := range t {\n\t\tfmt.Printf(\"%d\\t%q\\t%d\\n\", i, r, r)\n\t}\n\n\tu := \"プログラム\"\n\tfmt.Printf(\"% x\\n\", u)\n\tv := []rune(u)\n\tfmt.Printf(\"%x\\n\", v)\n\n\tfmt.Println(string(65)) // => A\n\tfmt.Println(string(0x4eac)) // => 京\n\tfmt.Println(string(1234567)) // => �\n\n\tfmt.Println(basenameImproved(\"a/b/c.go\")) // => c\n\tfmt.Println(basenameImproved(\"c.d.go\")) // => c.d\n\tfmt.Println(basenameImproved(\"abc\")) // => abc\n}", "title": "" }, { "docid": "6b351dba2b32aa597369f81e0b907a0b", "score": "0.49060768", "text": "func UTF8ToGsm0338(text string) string {\n\ts := text\n\n\tfor k, v := range utf8GsmChars {\n\t\ts = strings.Replace(s, k, v, -1)\n\t}\n\n\ts = utf8Regex.ReplaceAllString(s, \"?\")\n\n\treturn s\n}", "title": "" }, { "docid": "074fa4fe9df0885255e4bf549c101b1b", "score": "0.49056563", "text": "func encodeString(buf *bytes.Buffer, s string) {\n\tbuf.WriteByte('\"')\n\tstart := 0\n\tfor i := 0; i < len(s); {\n\t\tif b := s[i]; b < utf8.RuneSelf {\n\t\t\tif 0x20 <= b && b != '\\\\' && b != '\"' && b != '<' && b != '>' && b != '&' {\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif start < i {\n\t\t\t\tbuf.WriteString(s[start:i])\n\t\t\t}\n\t\t\tswitch b {\n\t\t\tcase '\\\\', '\"':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte(b)\n\t\t\tcase '\\n':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte('n')\n\t\t\tcase '\\r':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte('r')\n\t\t\tcase '\\t':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte('t')\n\t\t\tdefault:\n\t\t\t\t// This encodes bytes < 0x20 except for \\n and \\r,\n\t\t\t\t// as well as <, > and &. The latter are escaped because they\n\t\t\t\t// can lead to security holes when user-controlled strings\n\t\t\t\t// are rendered into JSON and served to some browsers.\n\t\t\t\tbuf.WriteString(`\\u00`)\n\t\t\t\tbuf.WriteByte(hex[b>>4])\n\t\t\t\tbuf.WriteByte(hex[b&0xF])\n\t\t\t}\n\t\t\ti++\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\tc, size := utf8.DecodeRuneInString(s[i:])\n\t\tif c == utf8.RuneError && size == 1 {\n\t\t\tif start < i {\n\t\t\t\tbuf.WriteString(s[start:i])\n\t\t\t}\n\t\t\tbuf.WriteString(`\\ufffd`)\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\t// U+2028 is LINE SEPARATOR.\n\t\t// U+2029 is PARAGRAPH SEPARATOR.\n\t\t// They are both technically valid characters in JSON strings,\n\t\t// but don't work in JSONP, which has to be evaluated as JavaScript,\n\t\t// and can lead to security holes there. It is valid JSON to\n\t\t// escape them, so we do so unconditionally.\n\t\t// See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion.\n\t\tif c == '\\u2028' || c == '\\u2029' {\n\t\t\tif start < i {\n\t\t\t\tbuf.WriteString(s[start:i])\n\t\t\t}\n\t\t\tbuf.WriteString(`\\u202`)\n\t\t\tbuf.WriteByte(hex[c&0xF])\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\ti += size\n\t}\n\tif start < len(s) {\n\t\tbuf.WriteString(s[start:])\n\t}\n\tbuf.WriteByte('\"')\n}", "title": "" }, { "docid": "fa37bfd4061607e2439f5280f28b5780", "score": "0.48853958", "text": "func Utf8ToUtf16(str string, len_ int64, items_read *C.glong, items_written *C.glong) (return__ *C.gunichar2, __err__ error) {\n\t__cgo__str := (*C.gchar)(unsafe.Pointer(C.CString(str)))\n\tvar __cgo_error__ *C.GError\n\treturn__ = C.g_utf8_to_utf16(__cgo__str, C.glong(len_), items_read, items_written, &__cgo_error__)\n\tC.free(unsafe.Pointer(__cgo__str))\n\tif __cgo_error__ != nil {\n\t\t__err__ = errors.New(C.GoString((*C.char)(unsafe.Pointer(__cgo_error__.message))))\n\t}\n\treturn\n}", "title": "" }, { "docid": "56d564f576598e6c033dc8c93cbfea2b", "score": "0.4855005", "text": "func _escFSByte(useLocal bool, name string) ([]byte, error) {\n\tif useLocal {\n\t\tf, err := _escLocal.Open(name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb, err := ioutil.ReadAll(f)\n\t\tf.Close()\n\t\treturn b, err\n\t}\n\tf, err := _escStatic.prepare(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f.data, nil\n}", "title": "" }, { "docid": "6a146d610f12ac4a07d030c9359b6210", "score": "0.4854919", "text": "func utf8Validator(){\n\n}", "title": "" }, { "docid": "704d7e76ba5eb6f163c50278d3af5a99", "score": "0.4853738", "text": "func UTF8ToWindows1252(input []byte) ([]byte, error) {\n\tif utf8.Valid(input) {\n\t\treader := bytes.NewReader(input)\n\t\tres, err := transformEncoding(reader, charmap.Windows1252.NewEncoder())\n\t\treturn res, err\n\t}\n\treturn input, nil\n}", "title": "" }, { "docid": "514dbaa423f4d637b4fabe4281852b62", "score": "0.48452696", "text": "func EncodePath(pathName string) string {\n\tif reservedObjectNames.MatchString(pathName) {\n\t\treturn pathName\n\t}\n\tvar encodedPathname strings.Builder\n\tfor _, s := range pathName {\n\t\tif 'A' <= s && s <= 'Z' || 'a' <= s && s <= 'z' || '0' <= s && s <= '9' { // §2.3 Unreserved characters (mark)\n\t\t\tencodedPathname.WriteRune(s)\n\t\t\tcontinue\n\t\t}\n\t\tswitch s {\n\t\tcase '-', '_', '.', '~', '/': // §2.3 Unreserved characters (mark)\n\t\t\tencodedPathname.WriteRune(s)\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tl := utf8.RuneLen(s)\n\t\t\tif l < 0 {\n\t\t\t\t// if utf8 cannot convert return the same string as is\n\t\t\t\treturn pathName\n\t\t\t}\n\t\t\tu := make([]byte, l)\n\t\t\tutf8.EncodeRune(u, s)\n\t\t\tfor _, r := range u {\n\t\t\t\thex := hex.EncodeToString([]byte{r})\n\t\t\t\tencodedPathname.WriteString(\"%\" + strings.ToUpper(hex))\n\t\t\t}\n\t\t}\n\t}\n\treturn encodedPathname.String()\n}", "title": "" }, { "docid": "0dff3a4766ba9f36ec36b08f66155b44", "score": "0.48450446", "text": "func _escFSMustString(useLocal bool, name string) string {\n\treturn string(_escFSMustByte(useLocal, name))\n}", "title": "" }, { "docid": "0dff3a4766ba9f36ec36b08f66155b44", "score": "0.48450446", "text": "func _escFSMustString(useLocal bool, name string) string {\n\treturn string(_escFSMustByte(useLocal, name))\n}", "title": "" }, { "docid": "0dff3a4766ba9f36ec36b08f66155b44", "score": "0.48450446", "text": "func _escFSMustString(useLocal bool, name string) string {\n\treturn string(_escFSMustByte(useLocal, name))\n}", "title": "" }, { "docid": "eec88802094b40e1c7de2fbfc74d64a1", "score": "0.4844863", "text": "func _escFSByte(useLocal bool, name string) ([]byte, error) {\n\tif useLocal {\n\t\tf, err := _escLocal.Open(name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb, err := ioutil.ReadAll(f)\n\t\t_ = f.Close()\n\t\treturn b, err\n\t}\n\tf, err := _escStatic.prepare(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f.data, nil\n}", "title": "" }, { "docid": "eec88802094b40e1c7de2fbfc74d64a1", "score": "0.4844863", "text": "func _escFSByte(useLocal bool, name string) ([]byte, error) {\n\tif useLocal {\n\t\tf, err := _escLocal.Open(name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb, err := ioutil.ReadAll(f)\n\t\t_ = f.Close()\n\t\treturn b, err\n\t}\n\tf, err := _escStatic.prepare(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f.data, nil\n}", "title": "" } ]
ad431fe72ccae74232f898e3a69a1aba
Read method to the client struct reads string by string from the bufio reader tied to the connection, splitting the messages by MESSAGE_BOUNDARY and sending each message to the inbound channel
[ { "docid": "db1a534ac88934208495896d7c46aad9", "score": "0.825374", "text": "func (client *Client) Read() {\n\t//\n\tbuff := \"\"\n\tfor {\n\t\ttempBuff, err := client.reader.ReadString('-')\n\t\tif err != nil {\n\t\t\tError.Println(err)\n\t\t\tif err == io.EOF {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tbuff += string(tempBuff)\n\t\tif strings.Contains(buff, MESSAGE_BOUNDARY) {\n\t\t\ts := strings.Split(buff, MESSAGE_BOUNDARY)[0]\n\t\t\to := buff[len(s)+len(MESSAGE_BOUNDARY):]\n\t\t\tclient.inbound <- Unpack([]byte(s))\n\t\t\tbuff = o\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "336829dda4816c40e9a29eb1f4ba1123", "score": "0.6829615", "text": "func (c *Client) read() {\n // log.Println(\"Starting cli read\")\n defer func() {\n c.party.unregister <- c\n c.conn.Close()\n }()\n\n c.conn.SetReadLimit(maxMesasgeSize)\n c.conn.SetReadDeadline(time.Now().Add(pongWait))\n c.conn.SetPongHandler(func(string) error {\n c.conn.SetReadDeadline(time.Now().Add(pongWait))\n return nil\n })\n for {\n // _, message, err := c.conn.ReadMessage()\n message := Payload{}\n err := c.conn.ReadJSON(&message)\n if err != nil {\n log.Printf(\"Error reading JSON:\", err)\n if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway,\n websocket.CloseAbnormalClosure,\n websocket.CloseNormalClosure) {\n log.Printf(\"Socket closed error: %v\", err)\n // c.conn.Close()\n }\n break //quit read\n }\n\n // log.Println(\"Message received from client:\", message)\n // message = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n //send messsage we received from client to the party\n c.party.broadcast <- message\n }\n\n}", "title": "" }, { "docid": "5fd41079f1376aece3de33718be0a1ab", "score": "0.6763105", "text": "func (cl *Client) readMessage() {\n\tdefer func() {\n\t\tcl.server.removeClient <- cl\n\t\tcl.webSocket.Close()\n\t}()\n\n\tfor {\n\t\tvar msg InputMessage\n\t\terr := cl.webSocket.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"client %s %v\", cl.name, err)\n\t\t\tbreak\n\t\t}\n\t\toutMsg := OutputMessage{cl.name, msg.Body}\n\t\tcl.server.broadcast <- &outMsg\n\t}\n}", "title": "" }, { "docid": "2c033fb342eaa5ee9644082b4adcb6dc", "score": "0.67026204", "text": "func (c *Client) Read(reqCh chan<- clientAndMessage, rmCh chan<- *Client) {\n\treader := bufio.NewReader(c.conn)\n\tfor {\n\t\t// Get new request\n\t\tline, err := reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error reading from\", c.conn.RemoteAddr(), \":\", err.Error())\n\t\t\trmCh <- c\n\t\t\treturn\n\t\t}\n\t\tlines, _, err := c.tok.Tokenise(line)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue // TODO: Do something?\n\t\t}\n\t\tfor _, line := range lines {\n\t\t\tmsg, err := baps3.LineToMessage(line)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tcontinue // TODO: Do something?\n\t\t\t}\n\t\t\treqCh <- clientAndMessage{c, *msg}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "045b7ba3464e2c5540ac8d2e08eef3a0", "score": "0.657963", "text": "func (c *Client) read() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error {\n\t\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\t\treturn nil\n\t})\n\n\tfor {\n\t\tvar msg Message\n\t\terr := c.conn.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error: %v\", err)\n\t\t\tbreak\n\t\t}\n\t\tmsg.UserID = c.user.UserID\n\t\tmsg.UserName = c.user.Name\n\n\t\tswitch (msg.Type) {\n\t\t\tcase \"message\":\n\t\t\t\tmsg.UserAvatar = c.user.AvatarURL\n\t\t\t\tmsg.Date = time.Now().UTC()\n\n\t\t\t\tc.hub.broadcast <- msg\n\n\t\t\tcase \"request\":\n\t\t\t\tmsg.Client = c\n\t\t\t\tc.hub.request <- msg\n\n\t\t\tdefault:\n\t\t\t\tlog.Printf(\"Error: unrecognised message %v\", msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b92de184e2f983b0ced20e4a83804739", "score": "0.65616983", "text": "func read(r io.Reader) <-chan coelho.Message {\n\tlines := make(chan coelho.Message)\n\tgo func() {\n\t\tdefer close(lines)\n\t\tscan := bufio.NewScanner(r)\n\t\tfor scan.Scan() {\n\t\t\tmsg := amqp.Delivery{}\n\t\t\tline := strings.Split(scan.Text(), \" \")\n\t\t\tlines <- coelho.Message{body(line), rk(line), msg}\n\t\t}\n\t}()\n\treturn lines\n}", "title": "" }, { "docid": "92a53c6a93f194a2d25b9b7fa0ad6dbd", "score": "0.654596", "text": "func (c *Client) readLoop() {\n\treader := bufio.NewReader(c.conn)\n\n\tfor {\n\t\tmsg, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tbreak\n\t\t}\n\n\t\tparsed, err := parseMessage(msg)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tbreak\n\t\t}\n\n\t\tmessageStream <- parsed\n\t}\n}", "title": "" }, { "docid": "5f65dec4574e3b670bf67e7a2a9b5891", "score": "0.6523837", "text": "func (c *Client) Read(cb DataCallback) {\n\tswitch c.protocol {\n\tcase Websocket:\n\t\tfor {\n\t\t\tdata := &model.Message{}\n\t\t\terr := c.socket.ReadJSON(data)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcb(data)\n\t\t}\n\n\tcase GRPC:\n\t\tfor {\n\t\t\tin, err := c.stream.Recv()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvar data map[string]interface{}\n\t\t\tdata[\"Token\"] = in.Token\n\t\t\tdata[\"DBType\"] = in.DbType\n\t\t\tdata[\"Project\"] = in.Project\n\t\t\tdata[\"Group\"] = in.Group\n\t\t\tdata[\"Type\"] = in.Type\n\t\t\tdata[\"ID\"] = in.Id\n\t\t\tvar temp interface{}\n\t\t\terr = json.Unmarshal(in.Where, &temp)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdata[\"Where\"] = temp\n\n\t\t\tmsg := &model.Message{Type: in.Type, ID: in.Id, Data: data}\n\t\t\tcb(msg)\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "07a5af8ae632713f6c501e4a7117794f", "score": "0.65236706", "text": "func reader(conn *websocket.Conn) {\n\tfor {\n\t\tmessageType, p, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(string(p))\n\t\t// if string(p) == \"hello\" || string(p) == \"world\" {\n\t\t// \tfmt.Println(\"Specific\")\n\t\t// \tstr := \"\"\n\t\t// \tfmt.Scan(&str)\n\t\t// \tconn.WriteMessage(1, []byte(str))\n\t\t// }\n\t\tif err = conn.WriteMessage(messageType, p); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8ab8af1fe9174df1541ebb081945ea5f", "score": "0.6513714", "text": "func (H HTTPMessageReader) ReadMessage(conn io.Reader) ([]byte, error) {\n\ttp := textproto.NewReader(bufio.NewReader(conn))\n\tstartLine, err := tp.ReadLine()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogrus.Debug(startLine)\n\n\theaders, err := tp.ReadMIMEHeader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogrus.Debug(headers)\n\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages#body\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages#body_2\n\t// 1. without body\n\tvar body []byte\n\n\t// first check form type\n\tisFormContentType := false\n\tif vv, ok := headers[headerKeyContentType]; ok {\n\t\tlogrus.Debug(vv[0])\n\t\tparts := strings.Split(vv[0], \";\")\n\t\tcontentType := strings.TrimSpace(parts[0])\n\t\t// 3. Multiple-resource bodies\n\t\tif contentType == headerFormContentType {\n\t\t\tisFormContentType = true\n\t\t\tif len(parts) < 2 {\n\t\t\t\treturn nil, errors.New(\"expect boundary= part in \" + headerKeyContentType)\n\t\t\t}\n\t\t\tboundaryPart := strings.TrimSpace(parts[1])\n\t\t\tif !strings.HasPrefix(boundaryPart, boundaryPrefix) {\n\t\t\t\treturn nil, errors.New(\"expect boundary= part in \" + headerKeyContentType)\n\t\t\t}\n\n\t\t\tlastBoundary := \"--\" + strings.TrimPrefix(boundaryPart, boundaryPrefix) + \"--\"\n\t\t\tscanner := bufio.NewScanner(tp.R)\n\t\t\tfor scanner.Scan() {\n\t\t\t\tline := scanner.Bytes()\n\t\t\t\tbody = append(body, line...)\n\t\t\t\tbody = append(body, []byte(CRLF)...)\n\t\t\t\tif string(line) == lastBoundary {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := scanner.Err(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// 2. Single-resource bodies: use Content-Length as size\n\tif !isFormContentType {\n\t\tif vv, ok := headers[headerKeyContentLength]; ok {\n\t\t\tsize, err := strconv.Atoi(vv[0])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tbody = make([]byte, size)\n\t\t\t_, err = tp.R.Read(body)\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// TODO: 4. Transfer-Encoding\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding\n\n\tmsg := dumpHTTPMessage(startLine, headers, body)\n\n\tif logrus.GetLevel() == logrus.DebugLevel {\n\t\tspew.Dump(msg)\n\t}\n\n\treturn msg, err\n}", "title": "" }, { "docid": "adb96ed3c5917b03814562bfe985dfc9", "score": "0.65112966", "text": "func (c *client) read() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.setReadDeadline()\n\tc.conn.SetPongHandler(func(string) error {\n\t\tc.setReadDeadline()\n\t\treturn nil\n\t})\n\n\tfor {\n\t\tvar msg Message\n\t\terr := c.conn.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"Websocket client error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tc.hub.in <- clientMessage{c, msg}\n\t}\n}", "title": "" }, { "docid": "c6bbcb4ea82b1749a8a671977e00eed2", "score": "0.65086365", "text": "func (c *client) read(){\n\tdefer c.socket.Close()\n\n\tfor {\n\t\tvar msg *message\n\t\terr := c.socket.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\tcustlog.Trace.Println(err)\n\t\t\treturn\n\t\t}\n\t\t// send msg to the forward channel of the client\n\t\tcustlog.Info.Printf(\"Message received from %s: %s\", c.color, msg.Message)\n\t\tmsg.When = time.Now()\n\t\tmsg.Code = c.color\n\t\tc.room.forward <- msg\n\t}\n}", "title": "" }, { "docid": "d974eed505bcde8d3de1524e55e93ead", "score": "0.6506914", "text": "func (c *Client) Read() {\n\tdefer func() {\n\t\tc.Hub.Disconnect <- c\n\t\tc.Conn.Close()\n\t}()\n\n\tfor {\n\t\t_, p, err := c.Conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tvar response Message\n\t\tjson.Unmarshal(p, &response)\n\n\t\tmessage := Message{response.Type, response.ClientID, response.Body}\n\t\tc.Hub.Broadcast <- message\n\t}\n}", "title": "" }, { "docid": "452812fb279fc4a64562fbadeac08588", "score": "0.64971703", "text": "func handleRead(conn net.Conn, done chan string) {\n\tfor {\n\t\tbuf := make([]byte, 2048)\n\t\treqLen, err := conn.Read(buf)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error to read message because of \", err)\n\t\t\treturn\n\t\t}\n\t\tres := string(buf[:reqLen-1])\n\t\tstrs := strings.Split(res, \"\\n\")\n\t\tfor _, str := range strs {\n\t\t\tif str == \"EOF\" {\n\t\t\t\tclose(done)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Println(\"read from socket: \", str)\n\t\t\tdone <- str\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f6496e3957d5ef80f46ba1505a223678", "score": "0.6487627", "text": "func (c *Client) Read() {\n\tfor {\n\t\tvar msg = &Message{\n\t\t\tFrom: c.id,\n\t\t\tWhen: time.Now(),\n\t\t}\n\t\tif err := c.socket.ReadJSON(msg); err != nil {\n\t\t\tbreak\n\t\t}\n\t\tc.room.forward <- msg\n\t}\n\tc.socket.Close()\n}", "title": "" }, { "docid": "6b8630a2d677aafef1e44f32a4d5e85a", "score": "0.6485178", "text": "func ReadMessage(reader io.Reader) (MessageReader, error) {\n\tmBuffer := bytes.NewBuffer(nil)\n\n\t//vertion and type\n\tfor mBuffer.Len() < 6 {\n\t\tb := make([]byte, 1)\n\t\tif _, err := reader.Read(b); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmBuffer.Write(b)\n\t}\n\theader := mBuffer.Bytes()\n\t//length of data in message.4 bytes stored by LittleEndian model.\n\tn := binary.LittleEndian.Uint32(header[2:])\n\n\tfor mBuffer.Len() < 6+int(n) {\n\t\tb := make([]byte, 1)\n\n\t\tif _, err := reader.Read(b); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmBuffer.Write(b)\n\t}\n\n\tdata := mBuffer.Bytes()\n\n\treturn &messageReader{\n\t\traw: mBuffer,\n\t\tmType: data[1],\n\t\tdata: bytes.NewReader(data[6:]),\n\t}, nil\n}", "title": "" }, { "docid": "cce89f587a5a04817afdacd94dce02b7", "score": "0.6475456", "text": "func reader(conn *websocket.Conn) {\r\n\tfor {\r\n\t\t// read in a message\r\n\t\t// messageType, p, err := conn.ReadMessage()\r\n\t\t// if err != nil {\r\n\t\t// \tlog.Println(err)\r\n\t\t// \treturn\r\n\t\t// }\r\n\t\tvar message map[string]interface{}\r\n\r\n\t\t// err := conn.ReadJSON(message)\r\n\t\t_, p, err := conn.ReadMessage()\r\n\r\n\t\t// print out that message for clarity\r\n\t\t// fmt.Println(string(p))\r\n\r\n\t\t// var message map[string]interface{}\r\n\t\t// err = json.Unmarshal(p, &message)\r\n\r\n\t\tif err != nil {\r\n\t\t\t// fmt.Println(\"error in reader: \", err)\r\n\t\t\t// fmt.Println(\"error parsing message, ignoring and waiting for next\")\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\tjson.Unmarshal(p, &message)\r\n\t\tfmt.Printf(\"message:\\n%v\\n\", message)\r\n\r\n\t\tvar request string = message[\"req\"].(string)\r\n\t\tvar body map[string]interface{}\r\n\t\tif _, ok := message[\"body\"]; ok {\r\n\t\t\tbody = message[\"body\"].(map[string]interface{})\r\n\t\t}\r\n\r\n\t\tif request == CONFIG.GET_EVERYTHING {\r\n\t\t\tgo getEverything(conn, request)\r\n\t\t} else if request == CONFIG.CREATE_SCENE {\r\n\t\t\tgo createScene(conn, request, body)\r\n\t\t} else if request == CONFIG.DEL_SCENE {\r\n\t\t\tgo deleteScene(conn, request, body)\r\n\t\t} else if request == CONFIG.CREATE_ROOM {\r\n\t\t\tgo createRoom(conn, request, body)\r\n\t\t} else if request == CONFIG.DEL_ROOM {\r\n\t\t\tgo deleteRoom(conn, request, body)\r\n\t\t} else if request == CONFIG.CREATE_DEVICE {\r\n\t\t\tgo createDevice(conn, request, body)\r\n\t\t} else if request == CONFIG.DEL_DEVICE {\r\n\t\t\tgo deleteDevice(conn, request, body)\r\n\t\t} else if request == CONFIG.SET_SCENE {\r\n\t\t\tgo setScene(conn, request, body)\r\n\t\t} else if request == CONFIG.EDIT_SCENE {\r\n\t\t\tgo editScene(conn, request, body)\r\n\t\t}\r\n\r\n\t\t// if err := conn.WriteMessage(messageType, p); err != nil {\r\n\t\t// \tlog.Println(err)\r\n\t\t// \treturn\r\n\t\t// }\r\n\r\n\t}\r\n}", "title": "" }, { "docid": "d548cea844e94590232e6a89c5989ec3", "score": "0.6437265", "text": "func readFromClient(clientChan chan<- RequestCommand, ws *websocket.Conn) {\n\tfor {\n\t\t_, b, err := ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tfmt.Fprintln(os.Stderr, \"Remote user closed the connection\")\n\t\t\t\tws.Close()\n\t\t\t\tclose(clientChan)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tclose(clientChan)\n\t\t\tfmt.Fprintln(os.Stderr, \"Can not read message.\")\n\t\t\treturn\n\t\t}\n\t\t// read json message from rws\n\t\tmsg := RequestCommand{}\n\t\tif err := json.Unmarshal(b, &msg); err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"Can not parse data\")\n\t\t\tws.Close()\n\t\t\tclose(clientChan)\n\t\t\tbreak\n\t\t}\n\n\t\tclientChan <- msg\n\t}\n}", "title": "" }, { "docid": "c0d71f60383dbe85b8576960ed1303f1", "score": "0.6404754", "text": "func ReadMessage(conn *net.Conn) ([]byte, error) {\n\tdataSizeBuffer := make([]byte, 4)\n\t(*conn).Read(dataSizeBuffer)\n\tmaxBytes := binary.BigEndian.Uint32(dataSizeBuffer)\n\n\tbufferSize, reqInitialBufferSize := 512, 1024\n\tbuffer, req := make([]byte, bufferSize, bufferSize), make([]byte, reqInitialBufferSize, reqInitialBufferSize)\n\tlowIndex := 0\n\tfor {\n\t\tlenRead, err := (*conn).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\treturn []byte{}, err\n\t\t}\n\n\t\t// final buffer needs more space\n\t\tif lenRead > len(req)-lowIndex+1 {\n\t\t\treq = extendBuffer(req, lenRead)\n\t\t}\n\n\t\tcopy(req[lowIndex:], buffer)\n\t\tlowIndex += lenRead\n\n\t\tif lowIndex >= int(maxBytes) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn req[:lowIndex], nil\n}", "title": "" }, { "docid": "619f9320e386efc7999bb6874d2d9c8e", "score": "0.6388679", "text": "func (c *TCPClient) ReadMessage(kind byte) interface{} {\n\tmsgReader := bytes.NewReader(c.read())\n\tdecoder := gob.NewDecoder(msgReader)\n\n\tswitch kind {\n\tcase TCP_DHE:\n\t\tvar decoded DHExchange\n\t\terr := decoder.Decode(&decoded)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn decoded\n\n\tcase TCP_SRP_LOGIN:\n\t\tvar decoded SRPLogin\n\t\terr := decoder.Decode(&decoded)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn decoded\n\n\tcase TCP_SRP_LOGIN_RESP:\n\t\tvar decoded SRPLoginResponse\n\t\terr := decoder.Decode(&decoded)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn decoded\n\n\tcase TCP_SIMPLE_SRP_LOGIN_RESP:\n\t\tvar decoded SimpleSRPLoginResponse\n\t\terr := decoder.Decode(&decoded)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn decoded\n\n\tdefault:\n\t\tvar decoded []byte\n\t\terr := decoder.Decode(&decoded)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn decoded\n\t}\n}", "title": "" }, { "docid": "63b9c8b144ab01b80b45cdbe305a71d2", "score": "0.63878155", "text": "func (c *Client) Read() (msg Message, err error) {\n\tc.conn.SetReadDeadline(time.Now().Add(time.Second * 240))\n\n\tif !c.scanner.Scan() {\n\t\terr = c.scanner.Err()\n\t\treturn\n\t}\n\n\tm, err := parseMessage(c.scanner.Text())\n\n\tswitch strings.ToLower(m.command) {\n\tcase \"notice\":\n\t\tmsg = Notice{m}\n\tcase \"nick\":\n\t\tmsg = Nick{m}\n\tcase \"user\":\n\t\tmsg = User{m}\n\tcase \"pass\":\n\t\tmsg = Pass{m}\n\tcase \"ping\":\n\t\tmsg = Ping{m}\n\tcase \"pong\":\n\t\tmsg = Pong{m}\n\tcase \"join\":\n\t\tmsg = Join{m}\n\tcase \"part\":\n\t\tmsg = Part{m}\n\tcase \"privmsg\":\n\t\tmsg = PrivateMessage{m}\n\tcase \"mode\":\n\t\tmsg = Mode{m}\n\tdefault:\n\t\tif m.command[0] >= '0' && m.command[0] <= '9' {\n\t\t\tmsg = Reply{m}\n\t\t} else {\n\t\t\tmsg = m\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f0db212242210afc4532a9e7e2472103", "score": "0.6353299", "text": "func (c *Client) ReadMessage(user *proto.User, room *proto.Room) {\n\tdefer c.Wg.Done()\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tmsg := &proto.Message{\n\t\t\tId: user.Id,\n\t\t\tName: user.Name,\n\t\t\tContent: scanner.Text(),\n\t\t\tTimestamp: time.Now().String(),\n\t\t\tRoom: room.Id,\n\t\t}\n\n\t\t_, err := c.Client.BroadcastMessage(context.Background(), msg)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Error Sending Message: %v\", err)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "231347c513cfd0983f81781d2f9c7722", "score": "0.6343393", "text": "func (h *Handler) ReadMessage(w http.ResponseWriter, r *http.Request) {\n\tupgrader := websocket.Upgrader{}\n\tc, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tfmt.Println(\"WS error: \", err)\n\t\treturn\n\t}\n\tdefer c.Close()\n\n\t// generate random ID for each connected generator\n\tid := h.getID(8)\n\n\t// notify that new generator connected\n\tfmt.Fprintf(h.out, \"%s%s connected%s\\n\", colorGreen, id, colorDefault)\n\n\tfor {\n\t\tmsg := types.Message{}\n\t\terr = c.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\t// notify that generator disconnected\n\t\t\tfmt.Fprintf(h.out, \"%s%s disconnected%s\\n\", colorRed, id, colorDefault)\n\t\t\treturn\n\t\t}\n\n\t\t// send message to cmd print\n\t\th.msgChan <- receivedMessage{\n\t\t\tMessage: msg,\n\t\t\tid: id,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c25ec881a697391c669515265910eed1", "score": "0.6342122", "text": "func (c *Client) Read() (err error) {\n\tdefer func() {\n\t\tc.Pool.UnRegister <- c\n\t\tif errC := c.Conn.Close(); errC != nil && err == nil {\n\t\t\terrC = err\n\t\t}\n\t}()\n\n\tfor {\n\t\tmt, msg, err := c.Conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Println(mt, msg)\n\n\t\t//if mt == websocket.TextMessage {\n\t\t//\n\t\t//\t// evaluate game state\n\t\t//\tgameStateKey, err := evaluateMessage(msg)\n\t\t//\tif err != nil {\n\t\t//\t\tlog.Println(err,gameStateKey)\n\t\t//\t\treturn\n\t\t//\t}\n\t\t//\n\t\t//\t// TODO: send the message to game server\n\t\t//}\n\t}\n\n}", "title": "" }, { "docid": "543f771410af5beba07d4e9ba4782022", "score": "0.63304687", "text": "func Read(conn net.Conn) ([]byte, error) {\n\tvar (\n\t\t// the message buffer\n\t\tbuf []byte\n\n\t\t// tmp buffer to read a single byte\n\t\tb = make([]byte, 1)\n\n\t\t// total bytes read\n\t\tl = 0\n\t)\n\n\t// Let's read enough bytes to get the message header (msg type, remaining length)\n\tfor {\n\t\t// If we have read 5 bytes and still not done, then there's a problem.\n\t\tif l > 5 {\n\t\t\treturn nil, fmt.Errorf(\"connect/getMessage: 4th byte of remaining length has continuation bit set\")\n\t\t}\n\n\t\tn, err := conn.Read(b[0:])\n\t\tif err != nil {\n\t\t\t//glog.Debugf(\"Read error: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Technically i don't think we will ever get here\n\t\tif n == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tbuf = append(buf, b...)\n\t\tl += n\n\n\t\t// Check the remlen byte (1+) to see if the continuation bit is set. If so,\n\t\t// increment cnt and continue reading. Otherwise break.\n\t\tif l > 1 && b[0] < 0x80 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Get the remaining length of the message\n\tremlen, _ := binary.Uvarint(buf[1:])\n\tbuf = append(buf, make([]byte, remlen)...)\n\n\tfor l < len(buf) {\n\t\tn, err := conn.Read(buf[l:])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tl += n\n\t}\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "5ff6afd5b0fc6e052fa89e4d9b5e81d4", "score": "0.63073844", "text": "func ReadMsg(conn net.Conn,handler MsgHandler) {\n \n handler.Connected(conn)\n \n\tdefer conn.Close()\n\n\tconst MSG_BUF_LEN = 1024 * 9\n\tconst READ_BUF_LEN = 1024 //1KB\n\n\tfmt.Printf(\"Client: %s\\n\", conn.RemoteAddr())\n\n\tmsgBuf := bytes.NewBuffer(make([]byte, 0, MSG_BUF_LEN))\n\treadBuf := make([]byte, READ_BUF_LEN)\n\n\thead := uint32(0)\n\tbodyLen := 0 //bodyLen is a flag,when readed head,but body'len is not enougth\n\n\tfor {\n\t\tn, err := conn.Read(readBuf)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\thandler.Closed(conn)\n\t\t\t} else {\n\t\t\t\thandler.Exception(conn,err)\n\t\t\t}\n\t\t\t//close the connection\n\t\t\tbreak\n\t\t}\n\t\t_, err = msgBuf.Write(readBuf[:n])\n\n\t\tif err != nil {\n\t\t fmt.Println(\"Buffer write error: \", err)\n\t\t os.Exit(1)\n\t\t}\n\n\t\tfor {\n\t\t\t//read the msg head\n\t\t\tif bodyLen == 0 && msgBuf.Len() >= HeaderSize {\n\t\t\t\terr := binary.Read(msgBuf, binary.LittleEndian, &head)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"msg head Decode error: \", err)\n\t\t\t\t}\n\t\t\t\tbodyLen = int(head)\n\n\t\t\t\tif bodyLen > MSG_BUF_LEN {\n\t\t\t\t\tfmt.Println(\"msg body too long: \", bodyLen)\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t//has head,now read body\n\t\t\tif bodyLen > 0 && msgBuf.Len() >= bodyLen {\n\t\t\t\thandler.Process(conn,msgBuf.Next(bodyLen))\n\t\t\t\tbodyLen = 0\n\t\t\t} else {\n\t\t\t\t//msgBuf.Len() < bodyLen ,one msg receiving is not complete\n\t\t\t\t//need to receive again\n\t\t\t\tbreak\n\t\t\t}\n\t\t} //for of msg buf\n\t} //for of conn read\n}", "title": "" }, { "docid": "eedb8724b5a3d661b3fa12ebf91d82be", "score": "0.6294695", "text": "func (c *Client) Read() {\n defer func() {\n c.Pool.Unregister <- c\n c.Conn.Close()\n }()\n\n \n for {\n messageType, p, err := c.Conn.ReadMessage()\n if err != nil {\n log.Println(err)\n return\n }\n\n //convert json string to struct \"getting client location\n var info ClientDetails\n in := []byte(p)\n err = json.Unmarshal(in, &info)\n if err != nil {\n panic(err)\n }\n\n //assign struct\n c.Details = info\n\n message := Message{Type: messageType, Body: string(p)}\n c.Pool.Broadcast <- message\n //fmt.Printf(\"Message Received: %+v\\n\", message)\n //fmt.Println(\"Message Received: \" + info.ID)\n clientGeo := GeoPack{Type: \"Location\", ID: c.Details.ID, Longitude: c.Details.Longitude, Latitude: c.Details.Latitude}\n c.Pool.GeoStream <- clientGeo\n\n }\n}", "title": "" }, { "docid": "8e072979efde39c3c075ff836860758c", "score": "0.6288208", "text": "func (b *IB) read() {\n\tr := bufio.NewReader(b.Conn)\n\tfor {\n\t\tselect {\n\t\tcase <-b.Quit:\n\t\t\tlog.Println(\"Client quitting\")\n\t\t\tb.Conn.Close()\n\t\t\tos.Exit(0)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tstr, err := r.ReadString(DELIM_BYTE)\n\t\t\tif err == nil {\n\t\t\t\td := strings.TrimRight(str, DELIM_STR)\n\t\t\t\tfmt.Printf(d)\n\t\t\t\tb.processReceiver(d)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Could not read: %s\", err)\n\t\t\t\tb.Quit <- true\n\t\t\t}\n\n\t\t\t//b.processReceiver(d)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "9282b717135b322ce831fb3e192af727", "score": "0.62865794", "text": "func handleMessages (conn net.Conn) {\n\treader := bufio.NewReader(conn)\n\tscanner := bufio.NewScanner(reader)\n\n\tdefer conn.Close()\n\n\tscanner.Split(ScanCRLF)\n\n\tfor scanner.Scan() {\n\t\t// Pass newMessage into TCPMessageChannel\n\t\tCommunicationChannelTCPMessages <- TCPMessageChannel{scanner.Bytes(), conn.RemoteAddr().String()}\n\t}\n\n}", "title": "" }, { "docid": "98ec56ab4f7de2de0829c55c3f30e584", "score": "0.628503", "text": "func (client *ircClient) read() error {\n\treader := bufio.NewReader(client.connection)\n\treadChan := make(chan string)\n\n\tgo func() {\n\t\tfor {\n\t\t\tmsgStr, err := reader.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\tif err != io.EOF {\n\t\t\t\t\tclient.quitStream <- true\n\t\t\t\t} else {\n\t\t\t\t\tprintln(\"err == io.EOF\")\n\t\t\t\t\tclient.quitStream <- true\n\t\t\t\t}\n\t\t\t\tprintln(\"error: \", err)\n\t\t\t\tprintln(\"recv> \", msgStr)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treadChan <- msgStr\n\t\t}\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase msgStr := <-readChan:\n\t\t\tclient.parseServerString(msgStr)\n\n\t\tcase shouldQuit := <-client.quitStream:\n\t\t\tif shouldQuit {\n\t\t\t\tprintln(\"quitting\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e1aadef71e18f2117e9d184ab1ca6c42", "score": "0.6274221", "text": "func readMessage(conn *websocket.Conn) ([]uint8, error) {\n\t// only to be called from runClient\n\tvar buffer []byte\n\tfor {\n\t\t_, p, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(p) < 2 {\n\t\t\tlog.Panicf(\"message too short\")\n\t\t}\n\n\t\tif buffer == nil {\n\t\t\t// first message\n\t\t\tbuffer = append(buffer, p...)\n\t\t} else if p[0] == continuationMessageType {\n\t\t\t// continuation message\n\t\t\tbuffer = append(buffer, p[2:]...)\n\t\t} else {\n\t\t\tlog.Panicf(\"expected continuation message\")\n\t\t}\n\n\t\tif p[1] == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn buffer, nil\n}", "title": "" }, { "docid": "11020c36fcaf7097ee914feea35bee2c", "score": "0.6271819", "text": "func reader(conn *websocket.Conn) {\n\tfor {\n\t\t// read in a message\n\t\tmessageType, p, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\t// print out that message for clarity\n\t\tlog.Println(string(p))\n\n\t\tif err := conn.WriteMessage(messageType, p); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "ce4b2e52b0548b9cd01e3bf2d023ed9f", "score": "0.626502", "text": "func (client *Client) ReadMessage(key string) {\n\tdefer func() {\n\t\tclient.ClientService.MainService.UnRegister<- client\n\t\t// println(\"I Am Leaving nigga\")\n\t\t(client.Conns[key]).Conn.Close()\n\t\t// close(client.Message)\n\t\tclient.MainService.DeleteClientConn <- &entity.ClientConnExistance{\n\t\t\tIP: key,\n\t\t\tID: client.ID,\n\t\t}\n\t\t// recover if error happened...\n\t\trecover()\n\t}()\n\tclient.Conns[key].Conn.SetReadLimit(maxMessageSize)\n\t// client.Conns[key].Conn.SetReadDeadline(time.Now().Add(pongWait))\n\tclient.Conns[key].Conn.SetPongHandler(func(string) error { /*client.Conns[key].Conn.SetReadDeadline(time.Now().Add(pongWait)); */return nil })\n\tfor {\n\t\t// print(\"Im running\")\n\t\tmessage := &entity.InMess{}\n\t\terr := client.Conns[key].Conn.ReadJSON(message)\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\t// websocket.\n\t\t\t// println(err.Error())\n\t\t\tbreak\n\t\t}\n\t\t// println(string(Helper.MarshalThis(message)))\n\t\tif message == nil {\n\t\t\tcontinue\n\t\t}\n\t\t// Brodcast the message\n\t\tif message.GetStatus() <= 0 || message.GetStatus() > 13 {\n\t\t\t// println(\"Not A Valid Message ... \")\n\t\t\tcontinue\n\t\t}\n\n\t\t// the Message has passed\n\t\t// the first stage of chackmessageg whether\n\t\t// they are a valid message or not\n\t\t// now i am gonna map the message to their specific Object\n\t\tvar body entity.XMessage\n\t\tbody = client.FilterMessage(message)\n\t\tif body == nil {\n\t\t\tcontinue\n\t\t}\n\t\tswitch body.GetStatus() {\n\t\tcase entity.MsgSeen:\n\t\t\t{\n\n\t\t\t\t// print(\" Incomming Seen message .................\" , body);\n\t\t\t\tif body.(*entity.SeenMessage).Body.SenderID == \"\" {\n\t\t\t\t\tbody = nil\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tbody.(*entity.SeenMessage).SenderID = client.User.ID\n\t\t\t\tclient.ClientService.Message <- body\n\t\t\t}\n\t\tcase entity.MsgTyping, entity.MsgStopTyping:\n\t\t\t{\n\t\t\t\tbody.(*entity.TypingMessage).Body.TyperID = client.User.ID\n\t\t\t\tif body.(*entity.TypingMessage).Body.ReceiverID == \"\" {\n\t\t\t\t\tbody = nil\n\t\t\t\t\tbreak\n\n\t\t\t\t}\n\t\t\t\tbody.(*entity.TypingMessage).SenderID = client.User.ID\n\t\t\t\tclient.ClientService.Message <- body\n\t\t\t}\n\t\tcase entity.MsgIndividualTxt:\n\t\t\t{\n\t\t\t\tif body.(*entity.EEMessage).Body.ReceiverID == \"\" ||\n\t\t\t\t\tbody.(*entity.EEMessage).Body.Text == \"\" {\n\t\t\t\t\tbody = nil\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tbody.(*entity.EEMessage).SenderID = client.User.ID\n\t\t\t\t// Send the Message and if the Message Sendmessageg was succesful sent it to\n\t\t\t\t// both the Users\n\t\t\t\t// Since the ClientService may have a lot of Call i will handle the Sending or saving of the message to\n\t\t\t\t// the database here message the client ReadMessage service loop\n\t\t\t\talie, messaj := client.SendAlieMessage(body.(*entity.EEMessage))\n\t\t\t\tif alie != nil {\n\t\t\t\t\tme := client.ClientService.UserSer.GetUserByID(func() string {\n\t\t\t\t\t\tif alie.A == client.ID {\n\t\t\t\t\t\t\treturn client.ID\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn alie.B\n\t\t\t\t\t}())\n\t\t\t\t\tif me == nil {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\thim := client.ClientService.UserSer.GetUserByID(func() string {\n\t\t\t\t\t\tif alie.A == client.ID {\n\t\t\t\t\t\t\treturn alie.B\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn alie.A\n\t\t\t\t\t}())\n\t\t\t\t\tif him == nil {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tclient.ClientService.Message <- &entity.NewAlie{\n\t\t\t\t\t\tStatus: entity.MsgNewAlie,\n\t\t\t\t\t\tBody: entity.NewAlieBody{\n\t\t\t\t\t\t\tReceiverID: client.ID,\n\t\t\t\t\t\t\tUser: him,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tSenderID: client.ID,\n\t\t\t\t\t}\n\t\t\t\t\tclient.ClientService.Message <- &entity.NewAlie{\n\t\t\t\t\t\tStatus: entity.MsgNewAlie,\n\t\t\t\t\t\tBody: entity.NewAlieBody{\n\t\t\t\t\t\t\tReceiverID: him.ID,\n\t\t\t\t\t\t\tUser: me,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tSenderID: client.ID,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// sending the message if the message in not nil\n\t\t\t\tif messaj != nil {\n\t\t\t\t\t// println(\" Seending the Message to the Clients \\n\\n\\n\")\n\t\t\t\t\tmessaj.SenderID = client.ID\n\t\t\t\t\tclient.ClientService.Message <- messaj\n\t\t\t\t}\n\t\t\t}\n\t\tcase entity.MsgGroupTxt:\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3973765d5d7034bf3fe6d2a9bad0e0be", "score": "0.6260761", "text": "func read(r io.Reader, msg *Message) error {\n\t// read data length\n\tvar length int64\n\terr := binary.Read(r, binary.BigEndian, &length)\n\t// check tcp error\n\tif /*err = tcpErrorCheck(err);*/err != nil {\n\t\treturn err\n\t}\n\n\tif length < 0 {\n\t\treturn fmt.Errorf(\"read error, data length < 0, length=%d\", length)\n\t}\n\tif length > maxMessageLength {\n\t\treturn errDataLenOvertakeMaxLen\n\t}\n\n\t// rend data\n\tbuffer := make([]byte, length)\n\tn, err := io.ReadFull(r, buffer)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read error=%s\", err.Error())\n\t}\n\tif int64(n) != length {\n\t\treturn fmt.Errorf(\"read error\")\n\t}\n\n\t// decode data\n\treturn decode(buffer, msg)\n}", "title": "" }, { "docid": "ece31b06180812cb29d2852c1b48ccb4", "score": "0.62560475", "text": "func (r *FCPClient) reciever() {\n\tscanner := bufio.NewScanner(r.socket)\n\tstarted := false\n\tmsg := message{}\n\tparams := []string{}\n\tvar datalen int64 = 0\n\tvar data []byte = nil\n\n\tfor {\n\t\tif ok := scanner.Scan(); !ok {\n\t\t\tbreak\n\t\t}\n\t\tif !started {\n\t\t\tmsg.name = scanner.Text()\n\t\t\tstarted = true\n\t\t\tif ok := scanner.Scan(); !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tparam, val := SplitParam(scanner.Text())\n\t\tswitch param {\n\t\tcase \"EndMessage\":\n\t\t\tparams = append(params, scanner.Text())\n\t\t\tmsg.params = make([]string, len(params))\n\t\t\tcopy(msg.params, params)\n\t\t\tr.msgHandler <- msg\n\t\t\tstarted = false\n\t\t\tparams = []string{\"\"}\n\t\t\tdatalen = 0\n\t\t\tdata = nil\n\t\tcase \"DataLength\":\n\t\t\tparams = append(params, scanner.Text())\n\t\t\tdatalen, _ = strconv.ParseInt(val, 10, 64)\n\t\tcase \"Data\":\n\t\t\tparams = append(params, scanner.Text())\n\t\t\tdata = make([]byte, datalen)\n\t\t\trb, err := io.ReadFull(r.socket, data)\n\t\t\tif int64(rb) < datalen {\n\t\t\t\tfmt.Println(\"Was expecting\", datalen, \"bytes, got\", rb, \"Bytes instead. \", err)\n\t\t\t}\n\t\t\tmsg.data = make([]byte, datalen)\n\t\t\tcopy(msg.data, data)\n\n\t\t\tmsg.params = make([]string, len(params))\n\t\t\tcopy(msg.params, params)\n\t\t\tr.msgHandler <- msg\n\t\t\tstarted = false\n\t\t\tparams = []string{\"\"}\n\t\t\tdatalen = 0\n\t\t\tdata = nil\n\n\t\tdefault:\n\t\t\tparams = append(params, scanner.Text())\n\n\t\t}\n\n\t\tfmt.Println(\"RAW DUMP:\", scanner.Text())\n\t}\n\tfmt.Println(\"Connection Closed\")\n\tos.Exit(1)\n}", "title": "" }, { "docid": "abf11b5e7d8939968eea6302a70c37d3", "score": "0.62235224", "text": "func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.Rule, bot *models.Bot) {\n\tuser := bot.CLIUser\n\tif user == \"\" {\n\t\tuser = \"Flottbot-CLI-User\"\n\t}\n\tfmt.Println(`MMMMMMMMMMMMMMMMMMMMMMMWNNWMMMMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMNkl;;;;lONMMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMNo. . .dNMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMK: .cXMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMWk,. .;OWMMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMWKc. .lXMMMMMMMMMMMMMMMMMMMMM\nMMMMXkdooooooooooooooo;. .;ooooooooooooooodkXMMMM ______ __ __ __ __\nMMMK:. .cXMMM / __/ /___ / /_/ /_/ /_ ____ / /_\nMMMO' ,0MMM / /_/ / __ \\/ __/ __/ __ \\/ __ \\/ __/\nMMMO' .;lodl;. ..;ldol,. ,0MMM / __/ / /_/ / /_/ /_/ /_/ / /_/ / /_\nMMMO' .,kNMMMMNk;. .;ONMMMMNx,. ,0MMM /_/ /_/\\____/\\__/\\__/_.___/\\____/\\__/\nMMMO' .xWMMMMMMWx. 'kMMMMMMMWd. ,0MMM\nMMMO' .oNMMMMMMWd. .xWMMMMMMNl. ,0MMM\nMMMO' .l0NWWN0l. .o0NWWNOc. ,0MMM __ __ __\nMMMO' ..,;;,.. ..,;;,. ,0MMM _____/ /_____ ______/ /____ ____/ /\nMMMO' ,0MMM / ___/ __/ __ / ___/ __/ _ \\/ __ /\nMMMXl................ ................oXMMM (__ ) /_/ /_/ / / / /_/ __/ /_/ /\nMMMMWKkkkdc:::::cdkkxl.. ..cxkkdc:::::cdkkOKWMMMM /____/\\__/\\__,_/_/ \\__/\\___/\\__,_/\nMMMMMMMMMK:......c0WMW0occo0WMW0c......cXMMMMMMMMM\nMMMMMMMMMW0:.,'. .'cx0XNNNNX0xc.. .',':0MMMMMMMMMM\nMMMMMMMMMMMNXNKd'. ..',,,,'.. .,dXNXNMMMMMMMMMMM\nMMMMMMMMMMMMMMMNc. ...... .lNMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMNkc,...lkkkkl...,ckNMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMWN0kONMMMMNOOKNWMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM`)\n\tfmt.Println(version.String())\n\tfmt.Println(\"Enter CLI mode: hit <Enter>. <Ctrl-C> to exit.\")\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tfmt.Print(\"\\n\", bot.Name, \"> \")\n\t\treq := scanner.Text()\n\t\tif strings.TrimSpace(req) != \"\" {\n\t\t\tmessage := models.NewMessage()\n\n\t\t\tmessage.Type = models.MsgTypeDirect\n\t\t\tmessage.Service = models.MsgServiceCLI\n\t\t\tmessage.Input = req\n\n\t\t\tmessage.Vars[\"_user.id\"] = user\n\t\t\tmessage.Vars[\"_user.firstname\"] = user\n\t\t\tmessage.Vars[\"_user.name\"] = user\n\t\t\tinputMsgs <- message\n\t\t}\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tbot.Log.Debugf(\"Error reading standard input: %v\", err)\n\t}\n}", "title": "" }, { "docid": "5fba90dd5b9da84db8fb90afbdb4b8ee", "score": "0.6220903", "text": "func (p *Proxy) readMessage(src io.ReadWriter) (*FooMessage, error) {\n\tmessageComplete := false\n\t//directional copy (64k buffer)\n\tbuff := make([]byte, 0xffff)\n\tpos := 0\n\n\tfor messageComplete != true {\n\t\tn, err := src.Read(buff[pos:])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpos += n\n\t\tif bytes.ContainsAny(buff[:pos], \"\\n\") {\n\t\t\tmessageComplete = true\n\t\t}\n\t}\n\n\tfmt.Printf(\"Read data: %s\", buff[:pos])\n\n\treturn &FooMessage{\n\t\traw: buff[:pos],\n\t}, nil\n}", "title": "" }, { "docid": "122d7ca5867b07efcc83f7fd16247a84", "score": "0.62164885", "text": "func ReadMessage(conn io.Reader, msg proto.Message) error {\n\tvar buf bytes.Buffer\n\tn, err := io.Copy(&buf, conn)\n\tplog.Debug(\"size of byte is\", \"\", n)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = proto.Unmarshal(buf.Bytes(), msg)\n\treturn err\n}", "title": "" }, { "docid": "b293bc2740cd12f770fd8014d3b934db", "score": "0.6189155", "text": "func (c *Client) Read() {\n\tdefer func() {\n\t\tManager.Unregister <- c\n\t\tc.Socket.Close()\n\t}()\n\n\tfor {\n\t\t_, message, err := c.Socket.ReadMessage()\n\t\tif err != nil {\n\t\t\tManager.Unregister <- c\n\t\t\tc.Socket.Close()\n\t\t\tbreak\n\t\t}\n\t\tjsonMessage, _ := json.Marshal(&Message{Sender: c.ID, Content: string(message)})\n\t\tManager.Broadcast <- jsonMessage\n\t}\n}", "title": "" }, { "docid": "c56a81a45164efd5885eabf92818eed6", "score": "0.6185605", "text": "func (handler *ClientHandler) ReadInLengthBuffer() (err error) {\n\tvar b int = 0\n\treadIn := 0\n\thandler.msgLen = 0\nReadLen:\n\tb, err = handler.Conn.Read(handler.Buff.Bytes()[readIn:4])\n\tif err != nil {\n\t\tif err != io.EOF {\n\t\t\thandler.Close()\n\t\t}\n\t\tif nerr, ok := err.(net.Error); ok && nerr.Temporary() {\n\t\t\tgoto ReadLen\n\t\t}\n\t\treturn\n\t}\n\treadIn += b\n\tif readIn < 4 {\n\t\tgoto ReadLen\n\t}\n\thandler.msgLen = ParseMessageLength(handler.Buff.Bytes()[:4])\n\treturn\n}", "title": "" }, { "docid": "b258bbe3c9a01afc38534e40cd52f414", "score": "0.6169368", "text": "func ReadMsg(s io.Reader) (t MsgType, id, name3 string, wait, size uint32, err error) {\n // \"r0001004echo00000005\" => ('r', \"0001\", \"echo\", 0, 5, nil)\n // \"R000100000005\" => ('R', \"0001\", \"\", 0, 5, nil)\n // \"e00010000138800000014\" => ('e', \"0001\", \"\", 5000, 20, nil)\n b := make([]byte, 128)\n\n // A message has a minimum size of 13, so read first 13 bytes\n // e.g. \"n001a00000000\" = <notification> <short name> <no payload>\n readz := 13\n readz, err = readn(s, b[:readz])\n if err != nil {\n if err == io.EOF && readz >= 9 && b[0] == byte(MsgTypeProtocolError) {\n // OK to read until EOF for MsgTypeProtocolError as they are shorter than other messages\n err = nil\n } else {\n return\n }\n }\n\n // type\n t = MsgType(b[0])\n z := 1\n\n if t == MsgTypeHeartbeat {\n // load\n var n uint64\n n, err = strconv.ParseUint(string(b[z:z+4]), 16, 16)\n z += 4\n if err != nil {\n return\n }\n wait = uint32(n)\n\n } else if t != MsgTypeNotification && t != MsgTypeProtocolError {\n // requestID\n id = string(b[z:z+4])\n z += 4\n }\n\n if t == MsgTypeSingleReq || t == MsgTypeStreamReq || t == MsgTypeNotification {\n // name\n // text3Size\n name3z, e := strconv.ParseUint(string(b[z:z+3]), 16, 16)\n z += 3\n if e != nil {\n err = e\n return\n }\n\n // Read remainder of message\n newz := z + int(name3z) + 8 // 8 = payload size\n\n if cap(b) < newz {\n // Grow buffer (only happens with really long name3)\n newb := make([]byte, newz)\n copy(newb, b)\n b = newb\n }\n\n if newz > readz {\n if _, err = readn(s, b[readz:newz]); err != nil {\n return\n }\n }\n\n // text3Value\n name3 = string(b[z:z+int(name3z)])\n z += int(name3z)\n\n } else if t == MsgTypeRetryRes {\n // wait\n n, e := strconv.ParseUint(string(b[z:z+8]), 16, 32)\n if e != nil {\n err = e\n return\n }\n wait = uint32(n)\n z += 8\n // read remainding 8 bytes of the message\n if _, err = readn(s, b[z:z+8]); err != nil {\n return\n }\n }\n\n // payloadSize (or time if t==MsgTypeHeartbeat)\n n, e := strconv.ParseUint(string(b[z:z+8]), 16, 32)\n if e != nil {\n err = e\n return\n }\n size = uint32(n)\n\n return\n}", "title": "" }, { "docid": "50cf060926dce090718fe1e919f9fc06", "score": "0.61666054", "text": "func read(r *bufio.Reader, pb proto.Message) error {\n\tb, err := r.ReadSlice('\\n')\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := strconv.Atoi(string(b[:len(b)-1]))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif n < 0 {\n\t\treturn errors.New(\"appengine: negative message length\")\n\t}\n\tb = make([]byte, n)\n\t_, err = io.ReadFull(r, b)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn proto.Unmarshal(b, pb)\n}", "title": "" }, { "docid": "04fe2ac888db12643202754741234272", "score": "0.6155884", "text": "func (c *Client) handleRead() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\texception.LogError(err, \"Error in reading message from socket connection\", exception.INTERNAL_SOCKET_ERROR)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(message)\n\t\tc.hub.event <- message\n\t}\n}", "title": "" }, { "docid": "030945c4de157f4deb50e90310b8f9e5", "score": "0.61526674", "text": "func (*ClientCutText) Read(c Conn) (ClientMessage, error) {\n\tmsg := ClientCutText{}\n\tvar pad [3]byte\n\tif err := binary.Read(c, binary.BigEndian, &pad); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := binary.Read(c, binary.BigEndian, &msg.Length); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmsg.Text = make([]byte, msg.Length)\n\tif err := binary.Read(c, binary.BigEndian, &msg.Text); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &msg, nil\n}", "title": "" }, { "docid": "9cecfb85dad5b528354c19e3ea8ffb75", "score": "0.6147989", "text": "func (c *client) read() {\n\tdefer c.socket.Close()\n\tfor {\n\t\tvar msg *message\n\t\terr := c.socket.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tmsg.When = time.Now()\n\t\tmsg.Name = c.userData[\"name\"].(string)\n\t\tif avatarURL, ok := c.userData[\"avatar_url\"]; ok {\n\t\t\tmsg.AvatarURL = avatarURL.(string)\n\t\t}\n\n\t\tc.room.forward <- msg\n\t}\n}", "title": "" }, { "docid": "5774062ce4972b894ab9da8f662dee73", "score": "0.6144329", "text": "func (client *GoClient) Read() {\n\tfor { // read line by line\n\t\tin, _ := client.read_write.Reader.ReadString('\\n') \n\t\tclient.input <- in\n\t}\n}", "title": "" }, { "docid": "d019c00ec62aa6a9d075e30fc8b456f5", "score": "0.61391914", "text": "func read(in io.ByteReader) (Message, error) {\n\tvar msg []byte\n\tfor {\n\t\tswitch c, err := in.ReadByte(); {\n\t\tcase err == io.EOF && len(msg) > 0:\n\t\t\treturn Message{}, errors.New(\"unexpected end of file\")\n\n\t\tcase err != nil:\n\t\t\treturn Message{}, err\n\n\t\tcase c == '\\000':\n\t\t\treturn Message{}, errors.New(\"unexpected null\")\n\n\t\t\t//\t\tcase c == '\\n':\n\t\t\t//\t\t\t// Technically an invalid message, but instead we just strip it.\n\n\t\tcase c == '\\r':\n\t\t\tswitch c, err = in.ReadByte(); {\n\t\t\tcase err == io.EOF:\n\t\t\t\treturn Message{}, errors.New(\"unexpected end of file\")\n\t\t\tcase err != nil:\n\t\t\t\treturn Message{}, err\n\t\t\tcase c != '\\n':\n\t\t\t\treturn Message{}, errors.New(\"unexpected carrage return\")\n\t\t\tcase len(msg) == 0:\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\treturn Parse(msg)\n\t\t\t}\n\n\t\tcase len(msg) >= MaxBytes-len(eom):\n\t\t\tn, _ := junk(in)\n\t\t\terr := TooLongError{Message: msg[:len(msg)-1], NTrunc: n + 1}\n\t\t\treturn Message{}, err\n\n\t\tdefault:\n\t\t\tmsg = append(msg, c)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "603975e4cc060350c9ae09871f8d36e4", "score": "0.6137479", "text": "func socketReader(conn *websocket.Conn, move chan string, p int) {\n\tvar messageType int\n\tvar msg []byte\n\tvar err error\n\n\t// Indefinite loop terminates when client asks to close socket/server or\n\t// socket read fails.\n\tfor {\n\t\tmessageType, msg, err = conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tmove <- \"N\" // close TODO\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\n\t\tif messageType != websocket.TextMessage {\n\t\t\tif VerboseGlobal {\n\t\t\t\tlog.Println(\"Reader: Ignored non-text message\")\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif VerboseGlobal {\n\t\t\tlog.Println(\"Reader: received [\", string(msg), \"]\")\n\t\t}\n\n\t\tvar msgMap map[string]interface{}\n\n\t\tjson.Unmarshal(msg, &msgMap)\n\n\t\tif msgMap[\"Type\"] == \"Flip\" {\n\t\t\tmove <- fmt.Sprintf(\"F%1d%03d\", p, msgMap[\"Tile\"])\n\t\t} else if msgMap[\"Type\"] == \"End\" {\n\t\t\tmove <- \"E\"\n\t\t}\n\t} // For loop\n\tSessWG.Done()\n}", "title": "" }, { "docid": "b7b760dca9ccb28d282806d8b7306b3d", "score": "0.61327386", "text": "func reader(conn *websocket.Conn) {\n\tfor {\n\t\t// read in a message\n\t\tmessageType, msg, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\t// print out that message for clarity\n\t\tfmt.Println(string(msg))\n\n\t\tresp := fmt.Sprintf(\"%s\", \"Server Response!\")\n\t\tif err := conn.WriteMessage(messageType, []byte(resp)); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "4b5ebdc1be9de5cb3c1a91aa2bc65426", "score": "0.61311615", "text": "func ReadMessage(conn *net.TCPConn, data *bytes.Buffer) (\n\tlength int, err error) {\n\n\tif err = Read(conn, 4, data); err != nil {\n\t\treturn\n\t}\n\n\tlength = int(bytes2int(data.Next(4)))\n\tif length == 0 {\n\t\treturn\n\t}\n\n\tif err = Read(conn, length, data); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "54444073fcc5e43c8f52afc807326f7e", "score": "0.613068", "text": "func (listener *Listener) readFromClient(clientChan chan *playerMessage) {\n\tdefer listener.panicCatcher(clientChan)\n\tfor {\n\t\tbytes := make([]byte, 1024)\n\t\tbytesRead, err := listener.conn.Read(bytes)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\t//fmt.Println(\"CLIENT SENT A MESSAGE!\", string(bytes[:bytesRead]))\n\t\tmessage := new(playerMessage)\n\t\terr = json.Unmarshal(bytes[:bytesRead], &message)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tclientChan <- message\n\t}\n}", "title": "" }, { "docid": "e1e8d6273d812c038b65d58b2ad956c0", "score": "0.61306554", "text": "func reader(conn *websocket.Conn) {\n\tfor {\n\t\tmsgType, p, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(\"[INCOMING] \", string(p))\n\n\t\terr = conn.WriteMessage(msgType, p)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "41332becacd28e1691afc1248a40fa6d", "score": "0.6130643", "text": "func (handler *ClientHandler) Read() (err error) {\n\terr = handler.ReadInLengthBuffer()\n\tif err != nil {\n\t\treturn\n\t}\n\tvar bytesRead, b int = 0, 0\n\thandler.checkBufferSize(handler.msgLen)\n\tfor {\n\t\tif bytesRead >= handler.msgLen {\n\t\t\tbreak\n\t\t}\n\t\tb, err = handler.Conn.Read(handler.Buff.Bytes()[4+bytesRead:])\n\t\tif err != nil {\n\t\t\tif nerr, ok := err.(net.Error); ok && nerr.Temporary() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tbytesRead += b\n\t}\n\treturn\n}", "title": "" }, { "docid": "e660e69e3195a14bf252c49f8478ccd0", "score": "0.61215705", "text": "func (c *Client) Read() (*message.Message, error) {\n\tmsg, err := message.Read(c.Conn)\n\treturn msg, err\n}", "title": "" }, { "docid": "3f0d6c904467fad02d3425543ac7239b", "score": "0.61184895", "text": "func ReadMessage(reader io.Reader) ([]byte, error) {\n\tvar length uint32\n\n\terr := binary.Read(reader, binary.BigEndian, &length)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := make([]byte, length)\n\t_, err = io.ReadFull(reader, buf)\n\n\treturn buf, err\n}", "title": "" }, { "docid": "1370abe3505a653b52cf7e5c8237ca6b", "score": "0.6097534", "text": "func (c *Client) readPump() {\n\tdefer closeClientConn(c)\n\tfor {\n\t\t_, msg, err := c.conn.ReadMessage()\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Can't receive!\")\n\t\t\tbreak\n\t\t}\n\n\t\tfmt.Println(\"[\" + time.Now().Format(time.RFC850) + \"] Received from Client (\" + c.id.String() + \")\")\n\t\tvar msgIn Message\n\t\tif err = json.Unmarshal(msg, &msgIn); err != nil {\n\t\t\tfmt.Println(\"unmarshal error:\", err)\n\t\t}\n\n\t\t// TODO: handle different client requests here\n\t\t/* switch msgIn.Type {\n\t\tcase :\n\t\tcase :\n\t\t} */\n\n\t}\n}", "title": "" }, { "docid": "3ecf5261b59a0a21f9858c849d0b480b", "score": "0.60920495", "text": "func (c *client) read() {\n\n\t// Ensure the resource is closed by deferring a call to `Close()`\n\tdefer c.socket.Close()\n\n\t//Continuously read messages for the life of the function. If an error is encountered, break from the function\n\tfor {\n\t\t_, msg, err := c.socket.ReadMessage()\n\t\tif err != nil {\n\n\t\t\treturn\n\t\t}\n\t\tc.room.forward <- msg\n\t}\n}", "title": "" }, { "docid": "e2988f685c8a56c29af92eaf57150f61", "score": "0.6082326", "text": "func (cli *Client) ReadMsg() error {\n\tdefer func() {\n\t\t//ban quited user here\n\t\t//TODO: when user quited , log its status (notify frontend the quit msg)\n\t\tcli.hub.unregister <- cli\n\t\tcli.conn.Close()\n\t}()\n\t//configurations\n\tcli.conn.SetReadLimit(ReadMaxLimit)\n\tcli.conn.SetReadDeadline(time.Now().Add(ReadDeadline))\n\tcli.conn.SetPongHandler(func(appData string) error {\n\t\tcli.conn.SetReadDeadline(time.Now().Add(ReadDeadline))\n\t\treturn nil\n\t})\n\t//websocket coroutine here .\n\tfor {\n\t\t_, msg, err := cli.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\t//websocket connection error\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Fatal(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t//solve msg and sp characters\n\t\t//TODO: filter some dirty words ;\n\t\t//msg = bytes.Trim(msg, \"\\n\")\n\t\tcli.hub.broadcast <- msg\n\t}\n\n}", "title": "" }, { "docid": "19c837e21b5238d9e11e7076fe579058", "score": "0.6067667", "text": "func read(r io.Reader) <-chan message {\n\tlines := make(chan message)\n\tgo func() {\n\t\tdefer close(lines)\n\t\tscan := bufio.NewScanner(r)\n\t\tfor scan.Scan() {\n\t\t\tlines <- message(scan.Bytes())\n\t\t}\n\t}()\n\treturn lines\n}", "title": "" }, { "docid": "8d109505c2ee273f1c89ce6eb045d9f2", "score": "0.6064045", "text": "func (sub *SubConn) ReadMessage() (channel string, message []byte, err error) {\n\tdefer sub.rmtx.Unlock()\n\tsub.rmtx.Lock()\n\n\tfor {\n\t\tvar args []interface{}\n\n\t\tif err = sub.dec.Decode(&args); err != nil {\n\t\t\tsub.conn.Close()\n\t\t\treturn\n\t\t}\n\n\t\tif len(args) != 3 {\n\t\t\tcontinue\n\t\t}\n\n\t\targ0, _ := args[0].([]byte)\n\t\targ1, _ := args[1].([]byte)\n\t\targ2, _ := args[2].([]byte)\n\n\t\tif arg0 == nil || arg1 == nil || arg2 == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif string(arg0) == \"message\" {\n\t\t\tchannel, message = string(arg1), arg2\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6859018bb9cdfb5a423634000c5f2212", "score": "0.60638595", "text": "func readmsgs(conn net.Conn){\n reader := bufio.NewReader(conn)\n for {\n msg, _ := reader.ReadString('\\n')\n fmt.Printf(msg)\n }\n}", "title": "" }, { "docid": "df1f8ff3c6eb10d907abd69403037707", "score": "0.60638106", "text": "func (c *Client) Read() {\n\tdefer c.socket.Close()\n\tfor {\n\t\t_, msg, err := c.socket.ReadMessage()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t// Send messages to Room.forward channel.\n\t\tc.room.forward <- msg\n\t}\n}", "title": "" }, { "docid": "d5f23395585582faeb8ca7211450498e", "score": "0.6032707", "text": "func (cr *Channel) readLoop() {\n\tfor {\n\n\t\tmsg, err := cr.sub.Next(cr.ctx)\n\t\tif err != nil {\n\t\t\tclose(cr.Messages)\n\t\t\treturn\n\t\t}\n\t\t// only forward messages delivered by others\n\t\tif msg.ReceivedFrom == cr.self {\n\t\t\tcontinue\n\t\t}\n\t\tvar cm Message\n\n\t\tswitch cr.roomType {\n\n\t\tcase StateMessageType:\n\n\t\t\tcm = new(StateMessage)\n\t\t\tbreak\n\t\tcase MissionMessageType:\n\n\t\t\tcm = new(MissionMessage)\n\t\t\tbreak\n\t\tcase GoalMessageType:\n\n\t\t\tcm = new(GoalMessage)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tcm = new(DiscoveryMessage)\n\t\t}\n\t\t//cm := new(Message)\n\t\terr = json.Unmarshal(msg.Data, cm)\n\t\tif err != nil {\n\t\t\tlog.Println(\"eeerrrr\")\n\t\t\tlog.Println(err)\n\t\t\t//log.Println(msg)\n\t\t\tcontinue\n\t\t}\n\t\t//log.Println(\"messages received\")\n\t\t// send valid messages onto the Messages channel\n\t\t//fmt.Println(reflect.TypeOf(cm).String())\n\t\t//fmt.Println(cm)\n\t\tcr.Messages <- &cm\n\t}\n}", "title": "" }, { "docid": "89c040cb548deb26a1e03d0027b4d3a1", "score": "0.60223174", "text": "func Read(ctx context.Context, c *websocket.Conn, v proto.Message) error {\n\treturn read(ctx, c, v)\n}", "title": "" }, { "docid": "02e698cb1a917b2b7949994cdc03f557", "score": "0.6008656", "text": "func (h *connection) readFromClient(logCxt *log.Entry) {\n\tdefer func() {\n\t\th.cancelCxt()\n\t\tclose(h.readC)\n\t\th.shutDownWG.Done()\n\t\tlogCxt.Info(\"Read goroutine finished\")\n\t}()\n\tr := gob.NewDecoder(h.conn)\n\tfor {\n\t\tvar envelope syncproto.Envelope\n\t\terr := r.Decode(&envelope)\n\t\tif err != nil {\n\t\t\tlogCxt.WithError(err).Info(\"Failed to read from client\")\n\t\t\tbreak\n\t\t}\n\t\tif envelope.Message == nil {\n\t\t\tlog.Error(\"nil message from client\")\n\t\t\tbreak\n\t\t}\n\t\tselect {\n\t\tcase h.readC <- envelope.Message:\n\t\tcase <-h.cxt.Done():\n\t\t\treturn\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "490a8bb7551e0ae1926a7f56096f8067", "score": "0.6005788", "text": "func read(conn net.Conn, ch chan interface{}) {\n\tdefer close(ch) // make sure we close the channel when we stop reading\n\n\tdec := gob.NewDecoder(conn)\n\tbuf := data{}\n\tfor {\n\t\terr := dec.Decode(&buf) // try to de-serialize the data\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tch <- buf.Value // unpack the payload\n\t}\n}", "title": "" }, { "docid": "22ded3486aa7bed8ec787c26af65e1a8", "score": "0.60029656", "text": "func Read(connection *websocket.Conn, inputChan chan component.PlayerInput, outputChan chan interface{}) {\n\tfmt.Printf(\"Starting reader for %p\\n\", &connection)\n\n\t// Send initial message to indicate connection\n\tinputChan <- component.PlayerInput{X: 0, Y: 0, Valid: false, Clicked: false, Disconnected: false, Conn: connection, OutputChan: outputChan}\n\n\t// Read until connection is closed\n\tfor {\n\t\t_, message, err := connection.ReadMessage()\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Read connection closed for %p\\n\", &connection)\n\t\t\tconnection.Close()\n\t\t\tinputChan <- component.PlayerInput{Conn: connection, Disconnected: true, OutputChan: outputChan}\n\t\t\tbreak\n\t\t}\n\t\tfmt.Printf(\"%s\\n\", message)\n\t}\n}", "title": "" }, { "docid": "b864c4b687584c13bda2b166d27ceba5", "score": "0.6001184", "text": "func (c *Connection) ReadMessage() (string, error) {\n\tresponse, _, err := c.Buffer.ReadLine()\n\tif err == io.EOF || err == syscall.EINVAL {\n\t\tc.Close()\n\t\treturn \"\", fmt.Errorf(\"Client closed connection\")\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.TrimSpace(string(response)), nil\n}", "title": "" }, { "docid": "bd01d34a3e4a3ffc84b0c74bc22a030e", "score": "0.5993344", "text": "func (peerConn *PeerConn) processInMessageString(msgStr string) error {\n\t// Parse Message header from last 24 bytes header message\n\tjsonDecodeBytesRaw, err := hex.DecodeString(msgStr)\n\tif err != nil {\n\t\treturn NewPeerError(HexDecodeMessageError, err, nil)\n\t}\n\n\t// cache message hash\n\thashMsgRaw := common.HashH(jsonDecodeBytesRaw).String()\n\tif peerConn.listenerPeer != nil {\n\t\tif err := peerConn.listenerPeer.HashToPool(hashMsgRaw); err != nil {\n\t\t\tLogger.log.Error(err)\n\t\t\treturn NewPeerError(HashToPoolError, err, nil)\n\t\t}\n\t}\n\t// unzip data before process\n\tjsonDecodeBytes, err := common.GZipToBytes(jsonDecodeBytesRaw)\n\tif err != nil {\n\t\tLogger.log.Error(\"Can not unzip from message\")\n\t\tLogger.log.Error(err)\n\t\treturn NewPeerError(UnzipMessageError, err, nil)\n\t}\n\n\tLogger.log.Debugf(\"In message content : %s\", string(jsonDecodeBytes))\n\n\t// Parse Message body\n\tmessageBody := jsonDecodeBytes[:len(jsonDecodeBytes)-wire.MessageHeaderSize]\n\n\tmessageHeader := jsonDecodeBytes[len(jsonDecodeBytes)-wire.MessageHeaderSize:]\n\n\t// get cmd type in header message\n\tcommandInHeader := bytes.Trim(messageHeader[:wire.MessageCmdTypeSize], \"\\x00\")\n\tcommandType := string(messageHeader[:len(commandInHeader)])\n\t// convert to particular message from message cmd type\n\tmessage, err := wire.MakeEmptyMessage(string(commandType))\n\tif err != nil {\n\t\tLogger.log.Error(\"Can not find particular message for message cmd type\")\n\t\tLogger.log.Error(err)\n\t\treturn NewPeerError(MessageTypeError, err, nil)\n\t}\n\n\tif len(jsonDecodeBytes) > message.MaxPayloadLength(wire.Version) {\n\t\tLogger.log.Errorf(\"Msg size exceed MsgType %s max size, size %+v | max allow is %+v \\n\", commandType, len(jsonDecodeBytes), message.MaxPayloadLength(1))\n\t\treturn NewPeerError(MessageTypeError, err, nil)\n\t}\n\t// check forward\n\tif peerConn.config.MessageListeners.GetCurrentRoleShard != nil {\n\t\tcRole, cShard := peerConn.config.MessageListeners.GetCurrentRoleShard()\n\t\tif cShard != nil {\n\t\t\tfT := messageHeader[wire.MessageCmdTypeSize]\n\t\t\tif fT == MessageToShard {\n\t\t\t\tfS := messageHeader[wire.MessageCmdTypeSize+1]\n\t\t\t\tif *cShard != fS {\n\t\t\t\t\tif peerConn.config.MessageListeners.PushRawBytesToShard != nil {\n\t\t\t\t\t\terr1 := peerConn.config.MessageListeners.PushRawBytesToShard(peerConn, &jsonDecodeBytesRaw, *cShard)\n\t\t\t\t\t\tif err1 != nil {\n\t\t\t\t\t\t\tLogger.log.Error(err1)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn NewPeerError(CheckForwardError, err, nil)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif cRole != \"\" {\n\t\t\tfT := messageHeader[wire.MessageCmdTypeSize]\n\t\t\tif fT == MessageToBeacon && cRole != \"beacon\" {\n\t\t\t\tif peerConn.config.MessageListeners.PushRawBytesToBeacon != nil {\n\t\t\t\t\terr1 := peerConn.config.MessageListeners.PushRawBytesToBeacon(peerConn, &jsonDecodeBytesRaw)\n\t\t\t\t\tif err1 != nil {\n\t\t\t\t\t\tLogger.log.Error(err1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn NewPeerError(CheckForwardError, err, nil)\n\t\t\t}\n\t\t}\n\t}\n\n\terr = json.Unmarshal(messageBody, &message)\n\tif err != nil {\n\t\tLogger.log.Error(\"Can not parse struct from json message\")\n\t\tLogger.log.Error(err)\n\t\treturn NewPeerError(ParseJsonMessageError, err, nil)\n\t}\n\trealType := reflect.TypeOf(message)\n\tLogger.log.Debugf(\"Cmd message type of struct %s\", realType.String())\n\n\t// cache message hash\n\tif peerConn.listenerPeer != nil {\n\t\thashMsg := message.Hash()\n\t\tif err := peerConn.listenerPeer.HashToPool(hashMsg); err != nil {\n\t\t\tLogger.log.Error(err)\n\t\t\treturn NewPeerError(CacheMessageHashError, err, nil)\n\t\t}\n\t}\n\n\t// process message for each of message type\n\terrProcessMessage := peerConn.processMessageForEachType(realType, message)\n\tif errProcessMessage != nil {\n\t\tLogger.log.Error(errProcessMessage)\n\t}\n\n\t// MONITOR INBOUND MESSAGE\n\tstoreInboundPeerMessage(message, time.Now().Unix(), peerConn.remotePeer.GetPeerID())\n\treturn nil\n}", "title": "" }, { "docid": "f48009251bce2ae887cc4f6494d764ac", "score": "0.5990433", "text": "func readSub(subscription *pubsub.Subscription, incomingMessagesChan chan pubsub.Message, ctx context.Context) {\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\t{\n\t\t\t\tclose(incomingMessagesChan)\n\t\t\t\tsubscription.Cancel()\n\t\t\t\treturn\n\t\t\t}\n\t\tdefault:\n\t\t}\n\t\tmsg, err := subscription.Next(context.Background())\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error reading from buffer\")\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif string(msg.Data) == \"\" {\n\t\t\treturn\n\t\t}\n\t\tif string(msg.Data) != \"\\n\" {\n\t\t\taddr, err := peer.IDFromBytes(msg.From)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error occurred when reading message From field...\")\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\t// This checks if sender address of incoming message is ours. It is need because we get our messages when subscribed to the same topic.\n\t\t\tif addr == myself.ID() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tincomingMessagesChan <- *msg\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "bac922dda7399d752efcfe7a2c96aba7", "score": "0.59887075", "text": "func readInput(conn net.Conn, parseChannel chan string, logger Logger) {\n\tdefer conn.Close()\n\t// readLength is the length of our buffer.\n\treadLength := 512\n\t// metricCount is how many metrics to parse per read.\n\tmetricCount := 0\n\t// overflow tracks any messages that span two buffers.\n\toverflow := \"\"\n\t// buf is a reusable buffer for reading from the connection.\n\tbuf := make([]byte, readLength)\n\n\t// Read data from the connection until it is closed.\n\tfor {\n\t\tlength, err := conn.Read(buf)\n\t\tif err != nil {\n\t\t\t// EOF will present as an error, but it could just signal a hangup.\n\t\t\tbreak\n\t\t}\n\t\tconn.Write([]byte(\"\"))\n\t\tif length > 0 {\n\t\t\t// Check for multiple metrics delimited by a newline character.\n\t\t\tmetrics := strings.Split(overflow+string(buf[:length]), \"\\n\")\n\t\t\t// If the buffer is full, the last metric likely has not fully been sent\n\t\t\t// yet. Try to parse it and if it throws an error, we'll prepend it to the\n\t\t\t// next connection read presuming that it will span to the next data read.\n\t\t\tmetricCount = len(metrics)\n\t\t\toverflow = \"\"\n\t\t\tif length == readLength {\n\t\t\t\t// Attempt to parse the last metric. If that fails parse, we'll\n\t\t\t\t// reduce the size by one and save the overflow for the next read.\n\t\t\t\t_, err = ParseMetricString(metrics[len(metrics)-1])\n\t\t\t\tif err != nil {\n\t\t\t\t\toverflow = metrics[len(metrics)-1]\n\t\t\t\t\tmetricCount = len(metrics) - 1\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Send the metrics to be parsed.\n\t\t\tfor i := 0; i < metricCount; i++ {\n\t\t\t\tif len(metrics[i]) > MinimumLengthMessage {\n\t\t\t\t\tparseChannel <- metrics[i]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Zero out the buffer for the next read.\n\t\tfor b := range buf {\n\t\t\tbuf[b] = 0\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a8b0de7e3b395a17cd51afcd4ae5d73d", "score": "0.598763", "text": "func (d *Decoder) readMessage() error {\n\tvar (\n\t\tout = d.buffer\n\t\terr error\n\t)\n\n\tif out, err = d.readBlock(out); err != nil {\n\t\treturn err\n\t}\n\n\tl := binary.BigEndian.Uint32(d.block)\n\tn := numblocks(int(l)) - 1 // the remaining number of blocks to read\n\n\tfor n > 0 {\n\t\tif out, err = d.readBlock(out); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn--\n\t}\n\n\td.window = d.buffer[4 : 4+l]\n\treturn nil\n}", "title": "" }, { "docid": "e3dd40c462bd7c05aed3f90f9e2bc94c", "score": "0.5982953", "text": "func (c *connection) reader() {\n\tfor {\n\t\t_, message, err := c.ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tif bytes.Contains(message, []byte(`\"command\":\"hello\"`)) {\n\t\t\tc.send <- []byte(`{\n\t\t\t\t\"command\": \"hello\",\n\t\t\t\t\"protocols\": [ \"http://livereload.com/protocols/official-7\" ],\n\t\t\t\t\"serverName\": \"Verbis\"\n\t\t\t}`)\n\t\t}\n\t}\n\tc.ws.Close()\n}", "title": "" }, { "docid": "fec24d55322eca6e3a28096f3ffa030c", "score": "0.5975773", "text": "func Read(r io.Reader) (*Message, error) {\n\t// the first 32 bit contains the length of this message\n\tlengthBuf := make([]byte, 4)\n\tif _, err := io.ReadFull(r, lengthBuf); err != nil {\n\t\treturn nil, err\n\t}\n\tlength := binary.BigEndian.Uint32(lengthBuf)\n\n\t// keep-alive message\n\tif length == 0 { return nil, nil }\n\n\t// get message buf\n\tmessageBuf := make([]byte, length)\n\tif _, err := io.ReadFull(r, messageBuf); err != nil {\n\t\treturn nil, err\n\t}\n\n\tm := Message{\n\t\t// the first 8 bit of message buf is message id\n\t\tID: messageID(messageBuf[0]),\n\t\tPayload: messageBuf[1:],\t// and last if message payload\n\t}\n\treturn &m, nil\n}", "title": "" }, { "docid": "65aa12735e9132236e07b3d4b7777532", "score": "0.5969499", "text": "func (c *client) read() {\n\tfor {\n\t\t// read in a message from client\n\t\t_, p, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t\t// broadcast this message on the room\n\t\tc.room.broadcast <- p\n\t}\n\n\t// In case there is any error, break from the loop and close the connection without waiting for a close message\n\tc.conn.Close()\n}", "title": "" }, { "docid": "b69ee56d4b195137a55353a48e21f27f", "score": "0.59685737", "text": "func readSub(subscription *pubsub.Subscription, incomingMessagesChan chan pubsub.Message) {\n\tctx := globalCtx\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\t\tmsg, err := subscription.Next(context.Background())\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error reading from buffer\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif string(msg.Data) == \"\" {\n\t\t\treturn\n\t\t}\n\t\tif string(msg.Data) != \"\\n\" {\n\t\t\taddr, err := peer.IDFromBytes(msg.From)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error occurred when reading message From field...\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// This checks if sender address of incoming message is ours. It is need because we get our messages when subscribed to the same topic.\n\t\t\tif addr == myself.ID() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tincomingMessagesChan <- *msg\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "ff94eddd80cfa5c0a32e8313a4dfd716", "score": "0.59667283", "text": "func (c *Client) read() {\n\tdefer func() {\n\t\thub.removeClient <- c\n\t\tc.ws.Close()\n\t}()\n\n\tfor {\n\t\t_, message, err := c.ws.ReadMessage()\n\t\tif err != nil {\n\t\t\thub.removeClient <- c\n\t\t\tc.ws.Close()\n\t\t\tbreak\n\t\t}\n\n\t\thub.Broadcast <- message\n\t}\n}", "title": "" }, { "docid": "cb84b64992cd0db26d7be0721c07bc6c", "score": "0.5965528", "text": "func (c *Client) listenRead() {\n\tlog.Println(\"Listening read from client\")\n\tfor {\n\t\tselect {\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tc.server.Del(c)\n\t\t\tc.doneCh <- true // for listenWrite method\n\t\t\treturn\n\n\t\t\t// read data from websocket connection\n\t\tdefault:\n\t\t\tvar msg Message\n\n\t\t\tmsgType, byteArr, err := c.Conn.ReadMessage()\n\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tc.doneCh <- true\n\t\t\t\t} else if websocket.IsCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\t\t//log.Printf(\"error: %v\", err)\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\t//log.Printf(\"error: %v-------------------------444------------------------------------\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.server.Err(err)\n\t\t\t} else {\n\t\t\t\tif msgType == websocket.TextMessage {\n\t\t\t\t\t//log.Printf(\"MESSAGE: %v-------------------------------555------------------------------\", string(byteArr))\n\t\t\t\t\tjson.Unmarshal(byteArr, &msg)\n\t\t\t\t\t//log.Printf(\"msg: %v-------------------------------555------------------------------\", msg.Msg)\n\t\t\t\t\tc.server.SendAll(&msg)\n\t\t\t\t} else {\n\t\t\t\t\tjson.Unmarshal(byteArr, &msg)\n\t\t\t\t\tc.server.SendAll(&msg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "be39e1195a3ddd5c6c7c45b7242d7267", "score": "0.59653157", "text": "func (j *JSONHubProtocol) ReadMessage(buf *bytes.Buffer) (m interface{}, complete bool, err error) {\n\tdata, err := parseTextMessageFormat(buf)\n\tswitch {\n\tcase errors.Is(err, io.EOF):\n\t\treturn nil, false, err\n\t\t// Other errors never happen, because parseTextMessageFormat will only return err\n\t\t// from bytes.Buffer.ReadBytes() which is always io.EOF or nil\n\t}\n\n\tmessage := hubMessage{}\n\terr = message.UnmarshalJSON(data)\n\t_ = j.dbg.Log(evt, \"read\", msg, string(data))\n\tif err != nil {\n\t\treturn nil, true, &jsonError{string(data), err}\n\t}\n\n\tswitch message.Type {\n\tcase 1, 4:\n\t\tjsonInvocation := jsonInvocationMessage{}\n\t\tif err = jsonInvocation.UnmarshalJSON(data); err != nil {\n\t\t\terr = &jsonError{string(data), err}\n\t\t}\n\t\targuments := make([]interface{}, len(jsonInvocation.Arguments))\n\t\tfor i, a := range jsonInvocation.Arguments {\n\t\t\targuments[i] = a\n\t\t}\n\t\tinvocation := invocationMessage{\n\t\t\tType: jsonInvocation.Type,\n\t\t\tTarget: jsonInvocation.Target,\n\t\t\tInvocationID: jsonInvocation.InvocationID,\n\t\t\tArguments: arguments,\n\t\t\tStreamIds: jsonInvocation.StreamIds,\n\t\t}\n\t\treturn invocation, true, err\n\tcase 2:\n\t\tstreamItem := streamItemMessage{}\n\t\tif err = streamItem.UnmarshalJSON(data); err != nil {\n\t\t\terr = &jsonError{string(data), err}\n\t\t}\n\t\treturn streamItem, true, err\n\tcase 3:\n\t\tcompletion := completionMessage{}\n\t\tif err = completion.UnmarshalJSON(data); err != nil {\n\t\t\terr = &jsonError{string(data), err}\n\t\t}\n\t\treturn completion, true, err\n\tcase 5:\n\t\tinvocation := cancelInvocationMessage{}\n\t\tif err = invocation.UnmarshalJSON(data); err != nil {\n\t\t\terr = &jsonError{string(data), err}\n\t\t}\n\t\treturn invocation, true, err\n\tcase 7:\n\t\tcm := closeMessage{}\n\t\tif err = cm.UnmarshalJSON(data); err != nil {\n\t\t\terr = &jsonError{string(data), err}\n\t\t}\n\t\treturn cm, true, err\n\tdefault:\n\t\treturn message, true, nil\n\t}\n}", "title": "" }, { "docid": "a7581680d0ef68d7c4666b3b2c938a52", "score": "0.595366", "text": "func ReadMessage(reader *bufio.Reader) (*Message, error) {\n\tmessage := &Message{}\n\n\tsizeBytes := make([]byte, 4)\n\n\t_, err := reader.Read(sizeBytes)\n\tif err != nil {\n\t\treturn message, err\n\t}\n\n\tsize := binary.LittleEndian.Uint32(sizeBytes)\n\n\tdata := make([]byte, size)\n\n\t_, err = reader.Read(data)\n\tif err != nil {\n\t\treturn message, err\n\t}\n\n\terr = proto.Unmarshal(data, message)\n\n\treturn message, err\n}", "title": "" }, { "docid": "9272ab805e77e4a016cdf75cebdbc988", "score": "0.59451044", "text": "func Read(ctx context.Context, c *websocket.Conn, v proto.Message) error {\n\terr := read(ctx, c, v)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read protobuf: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dfb10b360a4ea054b52d50f089832bd7", "score": "0.5938561", "text": "func (c *connection) reader() {\n\tvar msg string\n\tfor {\n\t\tif err := websocket.Message.Receive(c.ws, &msg); err != nil {\n\t\t\tbreak\n\t\t}\n\t\tvar req map[string]string\n\t\tif err := json.Unmarshal([]byte(msg), &req); err != nil {\n\t\t\tfmt.Println(\"Error, couldn't unmarshal client request\")\n\t\t} else {\n\t\t\tfmt.Println(\"Received: \", req)\n\t\t\tif req[\"cmd\"] == \"req\" {\n\t\t\t\tc.requests <- &request{Title: req[\"Title\"], Album: req[\"Album\"], Artist: req[\"Artist\"]}\n\t\t\t}\n\t\t}\n\t}\n\tc.ws.Close()\n}", "title": "" }, { "docid": "d6a8232f2c3d325046c0264f543110eb", "score": "0.5931734", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.hub.UnregisterClient(c)\n\t\tc.conn.Close()\n\t}()\n\n\tc.conn.SetReadLimit(maxMessageSize)\n\t_ = c.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error {\n\t\treturn c.conn.SetReadDeadline(time.Now().Add(pongWait))\n\t})\n\n\tvar err error\n\tvar message []byte\n\tfor {\n\t\t_, message, err = c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tclientMessage := ClientMessage{\n\t\t\tClient: c,\n\t\t\tPayload: message,\n\t\t}\n\t\tc.hub.SendMessage(clientMessage)\n\t}\n}", "title": "" }, { "docid": "ce368cd7dff1faa696b92f614c394731", "score": "0.5922487", "text": "func ReadMsg(in []byte, dir Direction) (*Message, error) {\n\tvar err error\n\tmsg := &Message{\n\t\tdirection: dir,\n\t\torigBytes: in,\n\t\tlock: &sync.Mutex{},\n\t}\n\tswitch {\n\tcase isRequest(in):\n\t\tmsg.Request, err = http.ReadRequest(bufio.NewReader(bytes.NewReader(in)))\n\t\tif err != nil {\n\t\t\treturn msg, err\n\t\t}\n\t\tif msg.Request.ContentLength > 0 {\n\t\t\tmsg.Body, err = ioutil.ReadAll(msg.Request.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn msg, err\n\t\t\t}\n\t\t}\n\tcase isResponse(in):\n\t\tmsg.Response, err = http.ReadResponse(bufio.NewReader(bytes.NewReader(in)), nil)\n\t\tif err != nil {\n\t\t\treturn msg, err\n\t\t}\n\t\tif msg.Response.ContentLength > 0 {\n\t\t\tmsg.Body, err = ioutil.ReadAll(msg.Response.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn msg, err\n\t\t\t}\n\t\t}\n\tdefault:\n\t\treturn msg, errors.New(\"data submitted to ReadMsg neither a request nor response\")\n\t}\n\tmsg.Type = msg.GetType()\n\treturn msg, nil\n}", "title": "" }, { "docid": "6bcf71231760db4faeaa0668e17d17b0", "score": "0.59195083", "text": "func (c *Client) read() {\n\tfor {\n\t\tc.mtx.RLock()\n\t\tid := c.id\n\t\tc.mtx.RUnlock()\n\n\t\terr := c.conn.SetDeadline(time.Now().Add(c.cfg.ClientTimeout))\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"%s: unable to set deadline: %v\", id, err)\n\t\t\tc.cancel()\n\t\t\treturn\n\t\t}\n\t\tdata, err := c.reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\tif errors.Is(err, io.EOF) {\n\t\t\t\tlog.Errorf(\"%s: EOF\", id)\n\t\t\t\tc.cancel()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvar nErr *net.OpError\n\t\t\tif !errors.As(err, &nErr) {\n\t\t\t\tlog.Errorf(\"%s: unable to read bytes: %v\", id, err)\n\t\t\t\tc.cancel()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif nErr.Op == \"read\" && nErr.Net == \"tcp\" {\n\t\t\t\tswitch {\n\t\t\t\tcase nErr.Timeout():\n\t\t\t\t\tlog.Errorf(\"%s: read timeout: %v\", id, err)\n\t\t\t\tcase !nErr.Timeout():\n\t\t\t\t\tlog.Errorf(\"%s: read error: %v\", id, err)\n\t\t\t\t}\n\t\t\t\tc.cancel()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Errorf(\"unable to read bytes: %v %T\", err, err)\n\t\t\tc.cancel()\n\t\t\treturn\n\t\t}\n\t\tmsg, reqType, err := IdentifyMessage(data)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"unable to identify message %q: %v\", data, err)\n\t\t\tc.cancel()\n\t\t\treturn\n\t\t}\n\t\tc.readCh <- readPayload{msg, reqType}\n\t}\n}", "title": "" }, { "docid": "0cb31256d275daa55df491e9b962b5e1", "score": "0.5918244", "text": "func ReadMessage(brdr *bufio.Reader) (Message, error) {\n\t// Implementation note: we use a buffered reader, so we're robust to\n\t// the case in which we receive a batch of messages.\n\tvar hdr header\n\terr := binary.Read(brdr, binary.BigEndian, &hdr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn Message{}, err\n\t}\n\tlog.Println(hdr)\n\tcontent := make([]byte, hdr.Length)\n\terr = binary.Read(brdr, binary.BigEndian, content)\n\t// TODO(bassosimone): decide whether we want to tolerate EOF (it\n\t// seems to me the original protocol does not).\n\tif err != nil && err != io.EOF {\n\t\tlog.Println(err)\n\t\treturn Message{}, err\n\t}\n\treturn Message{hdr, content}, nil\n}", "title": "" }, { "docid": "24e7ed41fa65306dc2c9e050f0411062", "score": "0.5905239", "text": "func ReadMessage(conn *Conn) (*Message, error) {\n\ts, msg := \"\", &Message{}\n\tif err := Codec.Receive(conn, &s); err != nil {\n\t\treturn nil, err\n\t} else if err := cast.DecodeJSON(cast.NewBuffer(s), msg); err != nil {\n\t\treturn nil, err\n\t}\n\treturn msg, nil\n}", "title": "" }, { "docid": "3c54a2638f259776cb49c56d4f339b5b", "score": "0.5901062", "text": "func (h *ServerHandler) Read(p []byte) (n int, err error) {\n\tfor {\n\t\tselect {\n\t\tcase message := <-h.serverMessages:\n\t\t\tif len(message) == 0 {\n\t\t\t\tlogger.Warn(h.user, \"Empty message received\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif message[0] == '.' {\n\t\t\t\t// Handle hidden message (don't display to the user, interpreted by dtail client)\n\t\t\t\twholePayload := []byte(fmt.Sprintf(\"%s\\n\", message))\n\t\t\t\tn = copy(p, wholePayload)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Handle normal server message (display to the user)\n\t\t\twholePayload := []byte(fmt.Sprintf(\"SERVER|%s|%s\\n\", h.hostname, message))\n\t\t\tn = copy(p, wholePayload)\n\t\t\treturn\n\n\t\tcase message := <-h.aggregatedMessages:\n\t\t\t// Send mapreduce-aggregated data as a message.\n\t\t\tdata := fmt.Sprintf(\"AGGREGATE➔%s➔%s\\n\", h.hostname, message)\n\t\t\twholePayload := []byte(data)\n\t\t\tn = copy(p, wholePayload)\n\t\t\treturn\n\n\t\tcase line := <-h.lines:\n\t\t\t// Send normal file content data as a message.\n\t\t\tserverInfo := []byte(fmt.Sprintf(\"REMOTE|%s|%3d|%v|%s|\",\n\t\t\t\th.hostname, line.TransmittedPerc, line.Count, line.SourceID))\n\t\t\twholePayload := append(serverInfo, line.Content[:]...)\n\t\t\tn = copy(p, wholePayload)\n\t\t\treturn\n\n\t\tcase <-time.After(time.Second):\n\t\t\t// Once in a while check whether we are done.\n\t\t\tselect {\n\t\t\tcase <-h.done.Done():\n\t\t\t\treturn 0, io.EOF\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5905fff80d65e1ff84107681b1077bcf", "score": "0.5898046", "text": "func (s *Service) handleMsg(p *peer) error {\n\t// Read the next message from the remote peer, and ensure it's fully consumed\n\t// rawMsg, err := p.rw.ReadBytes('\\n')\n\t_, err := p.rw.ReadBytes('\\n')\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t/*\n\t\tif len(rawMsg) > MaxMsgSize {\n\t\t\treturn errResp(ErrMsgTooLarge, \"%v > %v\", msg.Size, protocol.Constants.MaxMsgSize)\n\t\t}\n\n\t\tdefer msg.Discard()\n\t*/\n\n\tswitch {\n\t}\n\n\t/*\n\n\t\tstr, err := rw.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\tif str == \"\" {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif str != \"\\n\" {\n\t\t\t\tchain := make([]Block, 0)\n\t\t\t\tif err := json.Unmarshal([]byte(str), &chain); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t*/\n\n\treturn nil\n}", "title": "" }, { "docid": "ec4c1cd01f19ad5da9996635a5924bab", "score": "0.5897716", "text": "func (c *ZmqClient3) Read(p []byte) (n int, err error) {\n\tif c.indx >= int64(len(c.prevData)) {\n\t\tc.indx = 0\n\t\tvar msg zmq4.Msg\n\t\tmsg, err = c.socket.Recv()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tc.prevData = msg.Bytes() // handle all frames?\n\t}\n\tn = copy(p, c.prevData[c.indx:])\n\tc.indx += int64(n)\n\treturn\n}", "title": "" }, { "docid": "e55fe7333cf52e518444cb8b4a30c654", "score": "0.5890776", "text": "func (c *connection) readPump() {\n //if for loop ends close socket properly\n\tdefer func() {\n\t\tmyHub.unregister <- c\n\t\tcloseSocket(c);\n\t}()\n c.ws.SetReadLimit(maxMessageSize)\n\tfor {\n\t\t_, message, err := c.ws.ReadMessage()\n log.Println(string(message[:]))\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n msg := strings.Split(string(message[:]),\";\")\n log.Println(msg)\n switch(msg[0]){\n case \"new-user\":\n c.name = msg[1]\n myHub.broadcast <- message\n default:\n myHub.broadcast <- message\n }\n\t}\n}", "title": "" }, { "docid": "0ae1e62f1ce536a23cbb87452a1e873a", "score": "0.5884796", "text": "func (*ServerCutText) Read(c Conn) (ServerMessage, error) {\n\tmsg := ServerCutText{}\n\n\tvar pad [1]byte\n\tif err := binary.Read(c, binary.BigEndian, &pad); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := binary.Read(c, binary.BigEndian, &msg.Length); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmsg.Text = make([]byte, msg.Length)\n\tif err := binary.Read(c, binary.BigEndian, &msg.Text); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &msg, nil\n}", "title": "" }, { "docid": "5eedebb34827b07e18630c31010ded40", "score": "0.5882479", "text": "func (self *OscServer) readMessage(reader *bufio.Reader) (msg *OscMessage, err error) {\n\t// First, read the OSC address\n\taddress, err := readPaddedString(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create a new message\n\tmsg = NewOscMessage(address)\n\n\t// Now, read all arguments\n\tif err = self.readArguments(msg, reader); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn msg, nil\n}", "title": "" }, { "docid": "e14d49714ec61ba83a6f3eb1a251be1d", "score": "0.58701134", "text": "func ReadMessage() (message.Message, []byte, int, error) {\n\tvar (\n\t\t// buf for head\n\t\tb = make([]byte, 5)\n\n\t\t// total bytes read\n\t\tn = 0\n\t)\n\n\tfor {\n\t\t_, err := conn.Read(b[n : n+1])\n\t\tif err != nil {\n\t\t\treturn nil, b, 0, err\n\t\t}\n\n\t\t// 第一个字节是packet标志位,第二个字节开始为packet body的长度编码,采用的是变长编码\n\t\t// 在变长编码中,编码的第二个字节开始为0x80时,表示后面还有字节\n\t\tif n >= 1 && b[n] < 0x80 {\n\t\t\tbreak\n\t\t}\n\t\tn++\n\n\t}\n\n\t// fmt.Println(\"[DEBUG] [ReadPacket] Start -\", b)\n\n\t// 获取剩余长度\n\tremLen, _ := binary.Uvarint(b[1 : n+1])\n\tmtype := message.MessageType(b[0] >> 4)\n\n\tbuf := make([]byte, n+1+int(remLen))\n\tcopy(buf, b[:n+1])\n\n\tif remLen == 0 {\n\t\tmsg, err := mtype.New()\n\t\tdn, err := msg.Decode(buf)\n\t\tif err != nil {\n\t\t\treturn nil, buf, 0, err\n\t\t}\n\n\t\treturn msg, nil, dn, nil\n\t}\n\n\t_, err := conn.Read(buf[n+1:]) //[len(b)+1:]\n\tif err != nil {\n\t\treturn nil, buf, 0, err\n\t}\n\n\tmsg, err := mtype.New()\n\tdn, err := msg.Decode(buf)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, buf, 0, err\n\t}\n\n\treturn msg, nil, dn, nil\n}", "title": "" }, { "docid": "2358ab71bbfbdee673790caadd2f811b", "score": "0.58670783", "text": "func (t *TcpRelay) handleConnection(conn io.ReadCloser) {\n\n\tstats.Add(\"connectCount\", 1)\n\tstream := NewStreamTracker(t.pool) // Allocate a StreamTracker and get buffer from pool\n\tdefer stream.CleanUp() // Return buffer to pool when we're done\n\n\tvar keepProcessing, finished bool\n\tvar msg *message.Message\n\n\tfor {\n\t\tlog.Debug(\"---------------------\")\n\t\tvar err error\n\n\t\t// Try to read from the stream and deal with the result\n\t\tkeepProcessing, finished = stream.Read(conn)\n\t\tif finished {\n\t\t\tbreak\n\t\t}\n\t\tif !keepProcessing {\n\t\t\tcontinue\n\t\t}\n\n\t\tif !stream.FindHeader() || !stream.FindMessage() {\n\t\t\t// Just need to read more data\n\t\t\tcontinue\n\t\t}\n\n\t\t// This happens if we got an unparseable header\n\t\tif !stream.IsValid() {\n\t\t\tstats.Add(\"invalidCount\", 1)\n\t\t\tlog.Warn(\"Skipping invalid message\")\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\n\t\t// We should now have a header, so let's parse it\n\t\terr = stream.ParseHeader()\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Unable to parse header: %s\", err)\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\n\t\tif !stream.HasEnoughCapacity() {\n\t\t\tlog.Warn(\"Dropping message since it would exceed buffer capacity\")\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\n\t\t// Read until we have enough to deserialize the body\n\t\tif !stream.HasReadEntireMessage() {\n\t\t\t// We could optimize here by reading again in a loop so we\n\t\t\t// don't re-parse the header. But, once the stream is warmed up,\n\t\t\t// we almost always get a whole message on the first read. So\n\t\t\t// optimizing is kinda silly.\n\t\t\tlog.Debug(\"Not enough data, reading more\")\n\t\t\tcontinue\n\t\t}\n\n\t\t// We got the whole thing, so count it\n\t\tstats.Add(\"receivedCount\", 1)\n\t\tatomic.AddInt64(&sentCount, 1)\n\n\t\tok, err := stream.ParseMessage()\n\t\tif err != nil {\n\t\t\tstats.Add(\"skipped\", 1)\n\t\t\tlog.Warnf(\"Unable to deserialize protobuf message: %s\", err)\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\t\tif !ok {\n\t\t\tstats.Add(\"skipped\", 1)\n\t\t\tlog.Warn(\"Nil message or missing required fields!\")\n\t\t\tstream.Reset()\n\t\t\tcontinue\n\t\t}\n\n\t\t// This has to happen before cleaning up the buffer.\n\t\tmsg = stream.GetMessage()\n\t\tif t.matcher == nil || t.matcher.Match(msg) {\n\t\t\t// XXX we can substantially improve performance by handling\n\t\t\t// message relaying in a thread pool instead of on the main\n\t\t\t// goroutine. Will involve holding onto the buffer, and would\n\t\t\t// require different behavior here.\n\t\t\tt.connection.RelayMessage(msg)\n\t\t}\n\n\t\t// If we took in more than one message in this read, we need to get a new\n\t\t// buffer and populate it with the remaining data and set the readLen.\n\t\tif !stream.HandleOverread() {\n\t\t\tstream.Reset()\n\t\t}\n\t}\n\n\t// This is Debug level because it's noisy if the service is health checked...\n\tlog.Debug(\"Disconnecting socket\")\n\tconn.Close()\n}", "title": "" }, { "docid": "66237797153a7d47d9b66e9407ce521a", "score": "0.5864387", "text": "func (c *Connection) ReadMessage() (*Message, error) {\n\trd := textproto.NewReader(c.rw)\n\tline, err := rd.ReadLine()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseLine(line)\n}", "title": "" }, { "docid": "740a4a603e3167f6436d2311dca014db", "score": "0.58619064", "text": "func (d *Dispatcher) processInMessageString(msgStr string) error {\n\t// NOTE: copy from peerConn.processInMessageString\n\t// Parse Message header from last 24 bytes header message\n\tjsonDecodeBytesRaw, err := hex.DecodeString(msgStr)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"msgStr: %v\", msgStr)\n\t}\n\n\t// TODO(0xbunyip): separate caching from peerConn\n\t// // cache message hash\n\t// hashMsgRaw := common.HashH(jsonDecodeBytesRaw).String()\n\t// if peerConn.listenerPeer != nil {\n\t// \tif err := peerConn.listenerPeer.HashToPool(hashMsgRaw); err != nil {\n\t// \t\tLogger.Error(err)\n\t// \t\treturn NewPeerError(HashToPoolError, err, nil)\n\t// \t}\n\t// }\n\t// unzip data before process\n\tjsonDecodeBytes, err := common.GZipToBytes(jsonDecodeBytesRaw)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// fmt.Printf(\"In message content : %s\", string(jsonDecodeBytes))\n\n\t// Parse Message body\n\tmessageBody := jsonDecodeBytes[:len(jsonDecodeBytes)-wire.MessageHeaderSize]\n\n\tmessageHeader := jsonDecodeBytes[len(jsonDecodeBytes)-wire.MessageHeaderSize:]\n\n\t// get cmd type in header message\n\tcommandInHeader := bytes.Trim(messageHeader[:wire.MessageCmdTypeSize], \"\\x00\")\n\tcommandType := string(messageHeader[:len(commandInHeader)])\n\t// convert to particular message from message cmd type\n\tmessage, err := wire.MakeEmptyMessage(string(commandType))\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif len(jsonDecodeBytes) > message.MaxPayloadLength(wire.Version) {\n\t\treturn errors.WithStack(err)\n\t}\n\t// check forward TODO\n\t/*if peerConn.config.MessageListeners.GetCurrentRoleShard != nil {\n\t\tcRole, cShard := peerConn.config.MessageListeners.GetCurrentRoleShard()\n\t\tif cShard != nil {\n\t\t\tfT := messageHeader[wire.MessageCmdTypeSize]\n\t\t\tif fT == MessageToShard {\n\t\t\t\tfS := messageHeader[wire.MessageCmdTypeSize+1]\n\t\t\t\tif *cShard != fS {\n\t\t\t\t\tif peerConn.config.MessageListeners.PushRawBytesToShard != nil {\n\t\t\t\t\t\terr1 := peerConn.config.MessageListeners.PushRawBytesToShard(peerConn, &jsonDecodeBytesRaw, *cShard)\n\t\t\t\t\t\tif err1 != nil {\n\t\t\t\t\t\t\tLogger.Error(err1)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn NewPeerError(CheckForwardError, err, nil)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif cRole != \"\" {\n\t\t\tfT := messageHeader[wire.MessageCmdTypeSize]\n\t\t\tif fT == MessageToBeacon && cRole != \"beacon\" {\n\t\t\t\tif peerConn.config.MessageListeners.PushRawBytesToBeacon != nil {\n\t\t\t\t\terr1 := peerConn.config.MessageListeners.PushRawBytesToBeacon(peerConn, &jsonDecodeBytesRaw)\n\t\t\t\t\tif err1 != nil {\n\t\t\t\t\t\tLogger.Error(err1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn NewPeerError(CheckForwardError, err, nil)\n\t\t\t}\n\t\t}\n\t}*/\n\n\terr = json.Unmarshal(messageBody, &message)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\trealType := reflect.TypeOf(message)\n\t// fmt.Printf(\"Cmd message type of struct %s\", realType.String())\n\n\t// // cache message hash\n\t// if peerConn.listenerPeer != nil {\n\t// \thashMsg := message.Hash()\n\t// \tif err := peerConn.listenerPeer.HashToPool(hashMsg); err != nil {\n\t// \t\tLogger.Error(err)\n\t// \t\treturn NewPeerError(CacheMessageHashError, err, nil)\n\t// \t}\n\t// }\n\n\t// process message for each of message type\n\terrProcessMessage := d.processMessageForEachType(realType, message)\n\tif errProcessMessage != nil {\n\t\treturn errors.WithStack(errProcessMessage)\n\t}\n\n\t// MONITOR INBOUND MESSAGE\n\t//storeInboundPeerMessage(message, time.Now().Unix(), peerConn.remotePeer.GetPeerID())\n\treturn nil\n}", "title": "" }, { "docid": "20745592e77b7d6f0668ec037bf05102", "score": "0.5861892", "text": "func ReadTCPChannel(conn *net.TCPConn, delimiter []byte, fromSocket chan ByteMessage) error {\n\tvar message []byte\n\tbuffer := make([]byte, SocketBuffer)\n\n\tfor {\n\t\tif n, err := conn.Read(buffer); err != nil || n == 0 {\n\t\t\tif n == 0 && err == nil {\n\t\t\t\terr = errors.New(\"No bytes\")\n\t\t\t}\n\t\t\tLogger.Println(\"Closing read:\", conn.RemoteAddr(), err)\n\t\t\tconn.Close()\n\t\t\treturn err\n\t\t} else {\n\n\t\t\tmessage = append(message, buffer[0:n]...)\n\t\t\tm := bytes.Split(message, delimiter)\n\t\t\tfor i, entry := range m {\n\t\t\t\tif i < len(m)-1 {\n\t\t\t\t\tfromSocket <- ByteMessage{Msg: entry, RemoteAddr: conn.RemoteAddr()}\n\t\t\t\t} else {\n\t\t\t\t\t// overflow\n\t\t\t\t\tmessage = entry\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b39b1bc76aca071dc1c80e14065808f", "score": "0.58599424", "text": "func socketReadMessage(connection net.Conn) (pb.Envelope, error) {\n\n\tlog.Print(\"Reading ... \")\n\n\t// Read the first four bytes to determine data length\n\tdataLengthBuf := make([]byte, 4) // Size of uint32\n\t_, err := connection.Read(dataLengthBuf)\n\tif err != nil {\n\t\tlog.Printf(\"Socket error (read msg-length): %v\", err)\n\t\treturn pb.Envelope{}, err\n\t}\n\tdataLength := int(binary.LittleEndian.Uint32(dataLengthBuf))\n\n\t// Read the length of the data, keep in mind each call to .Read() may not\n\t// fill the entire buffer length that we specify, so instead we use two buffers\n\t// readBuf is the result of each .Read() operation, which is then concatinated\n\t// onto dataBuf which contains all of data read so far and we keep calling\n\t// .Read() until the running total is equal to the length of the message that\n\t// we're expecting or we get an error.\n\treadBuf := make([]byte, readBufSize)\n\tdataBuf := make([]byte, 0)\n\ttotalRead := 0\n\tfor {\n\t\tn, err := connection.Read(readBuf)\n\t\tdataBuf = append(dataBuf, readBuf[:n]...)\n\t\ttotalRead += n\n\t\tif totalRead == dataLength {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Read error: %s\", err)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif err != nil {\n\t\tlog.Printf(\"Socket error (read data): %v\", err)\n\t\treturn pb.Envelope{}, err\n\t}\n\t// Unmarshal the protobuf envelope\n\tenvelope := &pb.Envelope{}\n\terr = proto.Unmarshal(dataBuf, envelope)\n\tif err != nil {\n\t\tlog.Printf(\"unmarshaling envelope error: %v\", err)\n\t\treturn pb.Envelope{}, err\n\t}\n\treturn *envelope, nil\n}", "title": "" }, { "docid": "8032651adbf0fadec2105cba3f0284e2", "score": "0.58598375", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.leaveAllChannels()\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\n\t\t\tc.leaveAllChannels()\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(message)\n\t\tc.messages <- message\n\t}\n}", "title": "" }, { "docid": "651bf89ff5475f4240401729025de0ba", "score": "0.5853034", "text": "func handleTCPConnection(c net.Conn) {\n\tlogger.Debug().Msg(\"Handling incoming socket: \"+ c.RemoteAddr().String())\n\n\t// Create buffer to which data can be written\n\t// Ensure buffer can be read with bufio package from Golang\n\tdataBuffer := make([]byte, 4096)\n\tbufferReader := bufio.NewReader(c)\n\t\n\t// Create loop to get the size of the message and thereby outputting the entire message\n\tfor {\n\t\t// Start preparing capability to read from the generated buffer\n\t\tbufferByteReader, err := bufferReader.ReadByte()\n\t\tif err != nil {\n\t\t\t// fmt.Println(\"Error hit in bytereader: \",err)\n\t\t\tlogger.Error().Err(err).Msg(\"Error hit in bytereader function\")\n\t\t\treturn\n\t\t}\n\n\t\t// Based on the amount of data buffered in the dataBuffer buffer we can get data from it\n\t\t// For some reason this function only works with bufferByteReader active\n\t\tdataInBuffer := bufferReader.Buffered()\n\t\t// fmt.Println(\"Buffersize is \", dataInBuffer)\n\n\t\t// read the full message, or return an error\n\t\treadBytes, err := io.ReadFull(bufferReader, dataBuffer[:int(dataInBuffer)])\n\t\tif err != nil {\n\t\t\t// fmt.Println(\"Error hit in readbyte function: \",err)\n\t\t\tlogger.Error().Err(err).Msg(\"Error hit in readbyte function\")\n\t\t\treturn\n\t\t}\n\n\t\t// Convert buffer to string if there is more than 0 bytes available to convert\n\t\tif bufferByteReader > 0 && readBytes > 0 {\n\t\t\t// Convert data to string for logging purposes\n\t\t\tbytesConvertedToString := string(dataBuffer[:int(dataInBuffer)])\n\n\t\t\t// Validate message index based on available log messages\n\t\t\tmessageIndex := strings.IndexAny(bytesConvertedToString, \"ABCDEGHMNOPQRSTUV\")\n\t\t\tlogger.Trace().Str(\"Index\", string(messageIndex)).Msg(\"Calculated messageindex for message\")\n\n\t\t\t// Use index to get full message\n\t\t\tindexedMessage := string(dataBuffer[messageIndex:int(dataInBuffer)])\n\t\t\t\n\t\t\t// OR Create regexp to ensure all unwanted characters are stripped\n\t\t\t// avrRegex, err := regexp.Compile(\"[^a-zA-Z0-9|\\n ]+\")\n\t\t\t// if err != nil {\n\t\t\t// \tlogger.Trace().Err(err).Msg(\"regular expression error\")\n\t\t\t// }\n\t\t\t// processedAvrString := avrRegex.ReplaceAllString(bytesConvertedToString, \"\")\n\t\t\t\n\t\t\t// Strip of all unwanted characters from the regular expression\n\t\t\t// stripProcessedString := strings.TrimLeft(processedAvrString, \"abcdefghikjlmnopqrstuvwxyz1234567890{}?!@#$%^&*()[]123456789�\")\t\t\t\n\t\t\t\n\t\t\t// Optional loglines for debugging\n\t\t\tlogger.Trace().Str(\"bytesize\", string(bufferByteReader)).Msg(\"BufferBytereader calculated\")\n\n\t\t\t// Create goroutine that stores data to different functions\n\t\t\tgo writeToDataStore(indexedMessage)\n\t\t\t// go writeToRemoteEndpoint(stringConversion)\n\t\t\tc.Close()\n\t\t\treturn\n\t\t}\n\t\tc.Close()\n\t\treturn\n\t}\n}", "title": "" } ]
c8449d4f36189d82c5f7527772286e74
NewGetSepaLiquidityUnauthorized creates a GetSepaLiquidityUnauthorized with default headers values
[ { "docid": "4e495b8389750db0cdaf0031c2f6257d", "score": "0.78495824", "text": "func NewGetSepaLiquidityUnauthorized() *GetSepaLiquidityUnauthorized {\n\treturn &GetSepaLiquidityUnauthorized{}\n}", "title": "" } ]
[ { "docid": "d618a8c7657809d2869cdabc7f833f6f", "score": "0.6242166", "text": "func NewGetSepaLiquidityForbidden() *GetSepaLiquidityForbidden {\n\treturn &GetSepaLiquidityForbidden{}\n}", "title": "" }, { "docid": "7d20ce2d7d1438a2202aa2a89870a720", "score": "0.5864573", "text": "func NewGetSepaLiquidityNotFound() *GetSepaLiquidityNotFound {\n\treturn &GetSepaLiquidityNotFound{}\n}", "title": "" }, { "docid": "b07701d5f9a324f7bb11816fc13d6ec0", "score": "0.57577395", "text": "func NewGetSepaLiquidityServiceUnavailable() *GetSepaLiquidityServiceUnavailable {\n\treturn &GetSepaLiquidityServiceUnavailable{}\n}", "title": "" }, { "docid": "be37af6385af324c507403d93d782101", "score": "0.5755363", "text": "func NewGetSepaLiquidityBadRequest() *GetSepaLiquidityBadRequest {\n\treturn &GetSepaLiquidityBadRequest{}\n}", "title": "" }, { "docid": "bfb8a2edb9dadf9d0a17387ea3cce15c", "score": "0.5480474", "text": "func NewGetMetaUnauthorized() *GetMetaUnauthorized {\n\treturn &GetMetaUnauthorized{}\n}", "title": "" }, { "docid": "4cf35e4757b8103c06c819ffa71770d7", "score": "0.5445355", "text": "func NewGetServiceUnauthorized() *GetServiceUnauthorized {\n\treturn &GetServiceUnauthorized{}\n}", "title": "" }, { "docid": "716d7bce244184e191557d575471b8bb", "score": "0.5394335", "text": "func NewGetHostUnauthorized() *GetHostUnauthorized {\n\treturn &GetHostUnauthorized{}\n}", "title": "" }, { "docid": "36563e4d83b5e28300c2232558554be3", "score": "0.5381745", "text": "func NewGetHostRequirementsUnauthorized() *GetHostRequirementsUnauthorized {\n\n\treturn &GetHostRequirementsUnauthorized{}\n}", "title": "" }, { "docid": "c1f0f41722605cef51c14bd15218d7d0", "score": "0.5375084", "text": "func NewMetaUnauthorized(body *MetaUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "7ed1e29eb74e7f47dacc5f39df3f7267", "score": "0.53666127", "text": "func NewGetSimulationUnauthorized() *GetSimulationUnauthorized {\n\treturn &GetSimulationUnauthorized{}\n}", "title": "" }, { "docid": "343ed5ec66dbcb6dc2eb5ddce4f047a3", "score": "0.53592676", "text": "func NewGetHostRequirementsUnauthorized() *GetHostRequirementsUnauthorized {\n\treturn &GetHostRequirementsUnauthorized{}\n}", "title": "" }, { "docid": "f204848984ebe923a234730727f33a4b", "score": "0.53214025", "text": "func NewGetSupplierUnauthorized() *GetSupplierUnauthorized {\n\treturn &GetSupplierUnauthorized{}\n}", "title": "" }, { "docid": "f159f133d98ac51455d8de343ec5bfca", "score": "0.5310566", "text": "func NewGetDefinitionsUnauthorized() *GetDefinitionsUnauthorized {\n\treturn &GetDefinitionsUnauthorized{}\n}", "title": "" }, { "docid": "73f895b725a8ffd62a67bb8c8b99f9dc", "score": "0.5298729", "text": "func NewMetaGetUnauthorized() *MetaGetUnauthorized {\n\treturn &MetaGetUnauthorized{}\n}", "title": "" }, { "docid": "1f9ce511e70c3b7544b6820b34aca40e", "score": "0.52277476", "text": "func NewResolveUnauthorized(body *ResolveUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "932ec0bff1dd15927f5df3feff89c00b", "score": "0.5226121", "text": "func NewGetSepaLiquidityTooManyRequests() *GetSepaLiquidityTooManyRequests {\n\treturn &GetSepaLiquidityTooManyRequests{}\n}", "title": "" }, { "docid": "4e2f7e7347dd4a2727b3f32d9619070a", "score": "0.51956445", "text": "func NewGetTeamUnauthorized() *GetTeamUnauthorized {\n\treturn &GetTeamUnauthorized{}\n}", "title": "" }, { "docid": "c3d746fa814c7a3423148eb15e92e9e3", "score": "0.51548123", "text": "func NewGetUsageUnauthorized() *GetUsageUnauthorized {\n\n\treturn &GetUsageUnauthorized{}\n}", "title": "" }, { "docid": "2f0678e0ccf8c32ae8e70814b7846fce", "score": "0.51376873", "text": "func NewGetCodeVersionUnauthorized() *GetCodeVersionUnauthorized {\n\n\treturn &GetCodeVersionUnauthorized{}\n}", "title": "" }, { "docid": "6bc0ca35eab9df818b6b7b03478e883f", "score": "0.51140225", "text": "func NewProjectUnauthorized(body *ProjectUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "8ba5dcabaeb82eba7407096e7bd5de0e", "score": "0.5101919", "text": "func NewDecompressUnauthorized() *DecompressUnauthorized {\n\n\treturn &DecompressUnauthorized{}\n}", "title": "" }, { "docid": "39e0891f002200a55f1d66e1e2b353ff", "score": "0.5093238", "text": "func NewDataUnauthorized(body *DataUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "c1ef02cc79730a87a2497da15649819d", "score": "0.5089438", "text": "func NewGetPriceGroupUnauthorized() *GetPriceGroupUnauthorized {\n\treturn &GetPriceGroupUnauthorized{}\n}", "title": "" }, { "docid": "2589df8aea870646a57c81e8f939e6a4", "score": "0.5085247", "text": "func NewGetSepaLiquidityOK() *GetSepaLiquidityOK {\n\treturn &GetSepaLiquidityOK{}\n}", "title": "" }, { "docid": "84527dd528a19e6050fb68318f3d7fd4", "score": "0.5076561", "text": "func NewWeaviateGroupsGetUnauthorized() *WeaviateGroupsGetUnauthorized {\n\treturn &WeaviateGroupsGetUnauthorized{}\n}", "title": "" }, { "docid": "95fc515ebe39889f9483a1130b08ee0e", "score": "0.50700665", "text": "func NewGetKubermaticSettingsUnauthorized() *GetKubermaticSettingsUnauthorized {\n\treturn &GetKubermaticSettingsUnauthorized{}\n}", "title": "" }, { "docid": "2b1b1f2acd9d90edec956eee567cb0b8", "score": "0.5058161", "text": "func NewGetLanguagesUnauthorized() *GetLanguagesUnauthorized {\n\treturn &GetLanguagesUnauthorized{}\n}", "title": "" }, { "docid": "bdeca8ca226825a61cf11b7b81b465bc", "score": "0.5055001", "text": "func NewPatchSepainstantIDUnauthorized() *PatchSepainstantIDUnauthorized {\n\treturn &PatchSepainstantIDUnauthorized{}\n}", "title": "" }, { "docid": "3af5afd9aef06e85fc9064682a3b4538", "score": "0.5054831", "text": "func Unauthorized() APIResponse {\n return APIResponse{ \"The credentials are invalids\", 401 }\n}", "title": "" }, { "docid": "4f62979521d2b7f37d949354f56c9df6", "score": "0.50544906", "text": "func NewGetFunnelUnauthorized() *GetFunnelUnauthorized {\n\treturn &GetFunnelUnauthorized{}\n}", "title": "" }, { "docid": "771377df922d439172b3d0c15de6a6d3", "score": "0.50488514", "text": "func NewGetIPAMvlansUnauthorized() *GetIPAMvlansUnauthorized {\n\treturn &GetIPAMvlansUnauthorized{}\n}", "title": "" }, { "docid": "b89f5c8ed9063378b38e0783c5e3feca", "score": "0.5019091", "text": "func NewGetAviCloudsUnauthorized() *GetAviCloudsUnauthorized {\n\treturn &GetAviCloudsUnauthorized{}\n}", "title": "" }, { "docid": "8031bd5598c64fddd18f7615bd6eb549", "score": "0.5015099", "text": "func NewGetSectorsUnauthorized() *GetSectorsUnauthorized {\n\treturn &GetSectorsUnauthorized{}\n}", "title": "" }, { "docid": "2cf7a78cd472f6338bfd8708be3223cb", "score": "0.49853775", "text": "func NewGetConstraintTemplateUnauthorized() *GetConstraintTemplateUnauthorized {\n\treturn &GetConstraintTemplateUnauthorized{}\n}", "title": "" }, { "docid": "83470e02c3790f3859403cb8f92877db", "score": "0.49846876", "text": "func NewStationMetaUnauthorized(body *StationMetaUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "71ef501f966444884e445d5908aa8c81", "score": "0.49734232", "text": "func NewGetValidationRequestUnauthorized() *GetValidationRequestUnauthorized {\n\treturn &GetValidationRequestUnauthorized{}\n}", "title": "" }, { "docid": "c6235d5be11b75f41c7531b2c1b39a25", "score": "0.4968582", "text": "func NewCancelUnauthorized() *CancelUnauthorized {\n\n\treturn &CancelUnauthorized{}\n}", "title": "" }, { "docid": "bc276a210df3e6434580bb13d290253b", "score": "0.49616763", "text": "func NewGetFeatureFlagUnauthorized() *GetFeatureFlagUnauthorized {\n\treturn &GetFeatureFlagUnauthorized{}\n}", "title": "" }, { "docid": "1bb6e5feeba4a0533ace6b2832b1344e", "score": "0.4948942", "text": "func NewGetThermalSimulationsUnauthorized() *GetThermalSimulationsUnauthorized {\n\treturn &GetThermalSimulationsUnauthorized{}\n}", "title": "" }, { "docid": "e724b44a37851b5b849ff39084e24337", "score": "0.49463257", "text": "func NewGetCashierUnauthorized() *GetCashierUnauthorized {\n\treturn &GetCashierUnauthorized{}\n}", "title": "" }, { "docid": "b71218303619de33d30c44386c8076b1", "score": "0.49224472", "text": "func NewHeader() *Header {\n\treturn &Header{\n\t\tTyp: \"JWT\",\n\t\tAlg: \"HS256\",\n\t}\n}", "title": "" }, { "docid": "e76fc7cab8c345e39419ccd443c703f3", "score": "0.4920851", "text": "func NewGetSupportedFormatsUnauthorized() *GetSupportedFormatsUnauthorized {\n\treturn &GetSupportedFormatsUnauthorized{}\n}", "title": "" }, { "docid": "20026b06a8016c85c8edadd1c1b913ee", "score": "0.4914993", "text": "func NewRecentlyUnauthorized(body *RecentlyUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "e01fe33135e0cf7ca6ad275cc99f362a", "score": "0.4901603", "text": "func NewErrUnauthorized(message string) error {\n\treturn &ErrUnauthorized{\n\t\tmessage: message,\n\t}\n}", "title": "" }, { "docid": "0abd6b793058767c1354e4df5e8d01d3", "score": "0.48817736", "text": "func NewGetCredentialsUnauthorized() *GetCredentialsUnauthorized {\n\treturn &GetCredentialsUnauthorized{}\n}", "title": "" }, { "docid": "3a21e912bb9601999e9750e8f74dd544", "score": "0.48661748", "text": "func NewHealthCheckGetUnauthorized() *HealthCheckGetUnauthorized {\n\treturn &HealthCheckGetUnauthorized{}\n}", "title": "" }, { "docid": "97222c34350bb8f4295e8cd91003cc2f", "score": "0.4863517", "text": "func NewGetPolicyUnauthorized() *GetPolicyUnauthorized {\n\treturn &GetPolicyUnauthorized{}\n}", "title": "" }, { "docid": "b98ac8030ccd8f81289511b7520303cb", "score": "0.48494178", "text": "func NewPcloudCloudinstancesStockimagesGetUnauthorized() *PcloudCloudinstancesStockimagesGetUnauthorized {\n\treturn &PcloudCloudinstancesStockimagesGetUnauthorized{}\n}", "title": "" }, { "docid": "216833747714191a606d9248b91953b1", "score": "0.48341662", "text": "func NewGetLibraryAPIVersionUnauthorized() *GetLibraryAPIVersionUnauthorized {\n\treturn &GetLibraryAPIVersionUnauthorized{}\n}", "title": "" }, { "docid": "8bc77c340554bbe8fd39af0d3d9f2aef", "score": "0.48314494", "text": "func NewGetMyNamespaceUnauthorized() *GetMyNamespaceUnauthorized {\n\n\treturn &GetMyNamespaceUnauthorized{}\n}", "title": "" }, { "docid": "02b824d872744132ce4f6c791973549e", "score": "0.48309466", "text": "func unauthorized(w http.ResponseWriter, r *http.Request) {\n\thttp.Error(w, \"The provided signature in the \"+HeaderSignature+\" header does not match.\", 403)\n}", "title": "" }, { "docid": "52afcc37c5c450e58ca0520c7f1966f0", "score": "0.48258448", "text": "func NewSensorMetaUnauthorized(body *SensorMetaUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "3425b68392cdc448b12ec8aeefd32451", "score": "0.48177743", "text": "func NewGetInputContentUnauthorized() *GetInputContentUnauthorized {\n\treturn &GetInputContentUnauthorized{}\n}", "title": "" }, { "docid": "790b03ff520b20ed65cf05cb8b9fda00", "score": "0.48135355", "text": "func NewGetOktaIDPUnauthorized() *GetOktaIDPUnauthorized {\n\treturn &GetOktaIDPUnauthorized{}\n}", "title": "" }, { "docid": "ecfbcce0d70fb69466d4e6993d140f89", "score": "0.4811363", "text": "func NewGetAPIVersionUnauthorized() *GetAPIVersionUnauthorized {\n\treturn &GetAPIVersionUnauthorized{}\n}", "title": "" }, { "docid": "545648216318b859fd1e172d2f91a8ae", "score": "0.4792088", "text": "func NewGetSearchSeriesUnauthorized() *GetSearchSeriesUnauthorized {\n\treturn &GetSearchSeriesUnauthorized{}\n}", "title": "" }, { "docid": "58a91bef2e8b801f0b5234d8c3b785ee", "score": "0.47853997", "text": "func NewStationUnauthorized(body *StationUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "857680b954a3206fa877af0a572590e5", "score": "0.47825325", "text": "func NewGetSingleBeadSimulationUnauthorized() *GetSingleBeadSimulationUnauthorized {\n\treturn &GetSingleBeadSimulationUnauthorized{}\n}", "title": "" }, { "docid": "f2772ec9a67f479e764c2a1cf5b10f8c", "score": "0.47526816", "text": "func NewPcloudVolumegroupsGetallUnauthorized() *PcloudVolumegroupsGetallUnauthorized {\n\treturn &PcloudVolumegroupsGetallUnauthorized{}\n}", "title": "" }, { "docid": "17fb4d48c2e522122ce70a0d994cac65", "score": "0.4743745", "text": "func noAuthHeaders(ctx context.Context, opts *rpcOptions, req *http.Request) (*oauth2.Token, map[string]string, error) {\n\treturn nil, nil, nil\n}", "title": "" }, { "docid": "3c13e482ce20ec30100564992b66e685", "score": "0.47339532", "text": "func NewGetAssetTagsUnauthorized() *GetAssetTagsUnauthorized {\n\treturn &GetAssetTagsUnauthorized{}\n}", "title": "" }, { "docid": "23098d89935b78bf664d6e940ea1a5c5", "score": "0.47191787", "text": "func NewGetAlertUnauthorized() *GetAlertUnauthorized {\n\treturn &GetAlertUnauthorized{}\n}", "title": "" }, { "docid": "053c876e8bc71e3c6b057b8e2632681f", "score": "0.47016615", "text": "func newBasicAuthentication(userName, password string) vstAuthentication {\n\treturn &vstAuthenticationImpl{\n\t\tencryption: \"plain\",\n\t\tuserName: userName,\n\t\tpassword: password,\n\t}\n}", "title": "" }, { "docid": "651dcf70cac66428a9dc770b5f82f2eb", "score": "0.4697541", "text": "func TestInvalidHeader(t *testing.T) {\n\tclearInventoryTable(t)\n\n\treq, err := http.NewRequest(http.MethodGet, \"/api/v1/inventory\", nil)\n\t// Header key field must be set to 'Authorization'\n\treq.Header.Set(\"Auth\", ACCESS_TOKEN)\n\tif err != nil {\n\t\tt.Errorf(\"Failed to create request\")\n\t}\n\n\tres := executeRequest(req)\n\tcheckResponseCode(t, http.StatusUnauthorized, res.Code)\n\n\t// Header value field must have the 'Bearer ' prefix\n\treq.Header.Set(\"Authorization\", strings.TrimPrefix(ACCESS_TOKEN, \"Bearer \"))\n\n\tres = executeRequest(req)\n\tcheckResponseCode(t, http.StatusUnauthorized, res.Code)\n}", "title": "" }, { "docid": "f1d3af7d46821f88bccb18fe10058dbd", "score": "0.46955344", "text": "func Unauthorized(reason, message string) *Error {\n\treturn New(401, reason, message)\n}", "title": "" }, { "docid": "128d7f3eb6c75a55c306d0c70397f6b7", "score": "0.46933073", "text": "func NewUnauthorizedError(id string, details string) AppError {\n\treturn newAppError(id, details).SetStatusCode(http.StatusUnauthorized)\n}", "title": "" }, { "docid": "efdf6df3b00d07902f7ac2be35d7d1a0", "score": "0.46926025", "text": "func newDefaultStatusCode(log *zerolog.Logger) statusCode {\n\treturn statusCode{code: 503, defaultResp: true, log: log}\n}", "title": "" }, { "docid": "fc72f6337adc977a93ee9276b1cb5cbd", "score": "0.46834567", "text": "func NewGetPorositySimulationsUnauthorized() *GetPorositySimulationsUnauthorized {\n\treturn &GetPorositySimulationsUnauthorized{}\n}", "title": "" }, { "docid": "0580f23f9b14f49b5ab41364ce8676c5", "score": "0.4678338", "text": "func NewGetSpoonUnauthorized() *GetSpoonUnauthorized {\n\n\treturn &GetSpoonUnauthorized{}\n}", "title": "" }, { "docid": "8780894d1ebeae95d1648566c9897021", "score": "0.4675237", "text": "func NewGetAviVipNetworksUnauthorized() *GetAviVipNetworksUnauthorized {\n\treturn &GetAviVipNetworksUnauthorized{}\n}", "title": "" }, { "docid": "c9b1c0354d7f493610b1342bae85d02d", "score": "0.46733367", "text": "func NewVoiceLangGetUnauthorized() *VoiceLangGetUnauthorized {\n\treturn &VoiceLangGetUnauthorized{}\n}", "title": "" }, { "docid": "7e9e6892081b4010f9f4a7cd22914ddf", "score": "0.4671737", "text": "func NewPostSepainstantUnauthorized() *PostSepainstantUnauthorized {\n\treturn &PostSepainstantUnauthorized{}\n}", "title": "" }, { "docid": "86df32570c994202244b45a8c9103e00", "score": "0.46691543", "text": "func NewHeader() Header {\n\tvar v Header\n\tv.Default()\n\treturn v\n}", "title": "" }, { "docid": "26d3e63cf76a45659668e1f8304955c5", "score": "0.46681783", "text": "func NewGetBucketsUnauthorized() *GetBucketsUnauthorized {\n\treturn &GetBucketsUnauthorized{}\n}", "title": "" }, { "docid": "27a62c70204e28e3c9064d3bc9c2a57d", "score": "0.46592498", "text": "func NewGetStockDataUsingGETUnauthorized() *GetStockDataUsingGETUnauthorized {\n\treturn &GetStockDataUsingGETUnauthorized{}\n}", "title": "" }, { "docid": "fb00d23e9c1cba360868d37031edc7ea", "score": "0.46585461", "text": "func (http *HTTP) Unauthorized() *HTTP {\n\treturn &HTTP{code: 401, message: \"Unauthorized\"}\n}", "title": "" }, { "docid": "8258e5a20de589685b99ef73a9483410", "score": "0.46565527", "text": "func NewPublicSearchCreatorUnauthorized() *PublicSearchCreatorUnauthorized {\n\treturn &PublicSearchCreatorUnauthorized{}\n}", "title": "" }, { "docid": "a964bc0ce7fe810be293be0650c9caac", "score": "0.46547356", "text": "func NewTailUnauthorized(body *TailUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "3cf133ce6e2f495437395593235da1c1", "score": "0.4647944", "text": "func newRawAuthentication(jwt string) vstAuthentication {\n\treturn &vstAuthenticationImpl{\n\t\tencryption: \"raw\",\n\t\tjwt: jwt,\n\t}\n}", "title": "" }, { "docid": "e8f61fb5b5e6657949d0e80a15dcc804", "score": "0.46475556", "text": "func (e *Error) Unauthorized() error { return &errUnauthorized }", "title": "" }, { "docid": "a39c6adf47d056a20ba74071b2a8456b", "score": "0.46360192", "text": "func NewGetEntitiesUnauthorized() *GetEntitiesUnauthorized {\n\treturn &GetEntitiesUnauthorized{}\n}", "title": "" }, { "docid": "f31f0969f4a1d0abb514ddf1dd772583", "score": "0.46344063", "text": "func Unauthorized(w http.ResponseWriter, r *http.Request) {\n\tlogger.Error(\"[HTTP:Unauthorized] %s\", r.URL)\n\n\tbuilder := response.New(w, r)\n\tbuilder.WithStatus(http.StatusUnauthorized)\n\tbuilder.WithHeader(\"Content-Type\", \"text/plain\")\n\tbuilder.WithHeader(\"X-Reader-Google-Bad-Token\", \"true\")\n\tbuilder.WithBody(\"Unauthorized\")\n\tbuilder.Write()\n}", "title": "" }, { "docid": "2255ab650db94c3c9258bb2676abdbef", "score": "0.462702", "text": "func NewSystemidGET2Unauthorized() *SystemidGET2Unauthorized {\n\treturn &SystemidGET2Unauthorized{}\n}", "title": "" }, { "docid": "d889a8705b26ba73e16b14673287962e", "score": "0.46264136", "text": "func NewGetSepaLiquidityConflict() *GetSepaLiquidityConflict {\n\treturn &GetSepaLiquidityConflict{}\n}", "title": "" }, { "docid": "4d4504cf05b0ec89377bcbf02268e51a", "score": "0.46240035", "text": "func noAuthHeaders(c context.Context, uri string, opts *rpcOptions) (*oauth2.Token, map[string]string, error) {\n\treturn nil, nil, nil\n}", "title": "" }, { "docid": "58d725aea7b01db8fb1775ab77914218", "score": "0.46227652", "text": "func NewGetProcessorsUnauthorized() *GetProcessorsUnauthorized {\n\treturn &GetProcessorsUnauthorized{}\n}", "title": "" }, { "docid": "eb7f35e5a7bfa05cf49d58b4e3bbae8b", "score": "0.46187577", "text": "func NewGetFlowsUnauthorized() *GetFlowsUnauthorized {\n\treturn &GetFlowsUnauthorized{}\n}", "title": "" }, { "docid": "468d25fba9da25fd33695e657e9c3376", "score": "0.458674", "text": "func NewGetPlayerMetricUnauthorized() *GetPlayerMetricUnauthorized {\n\treturn &GetPlayerMetricUnauthorized{}\n}", "title": "" }, { "docid": "831c76f0a61e4880b78a91589a209a7d", "score": "0.4585014", "text": "func NewMethodUnauthorized(body MethodUnauthorizedResponseBody) oauthsecured.Unauthorized {\n\tv := oauthsecured.Unauthorized(body)\n\treturn v\n}", "title": "" }, { "docid": "1b13fed5362b688ad5187883b947e683", "score": "0.458002", "text": "func NewGetLogsUnauthorized() *GetLogsUnauthorized {\n\treturn &GetLogsUnauthorized{}\n}", "title": "" }, { "docid": "e2301c4fcc8ed1ae7c2dcfb67ff29aad", "score": "0.45737314", "text": "func (c Client) newAuthdRequest(method string, path string, body *gabs.Container) (*http.Request, error) {\n\tif c.AuthToken != nil && !c.AuthToken.IsValid() {\n\t\terr := c.Authenticate()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := c.newRequest(method, path, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"APIC-Challenge\", c.AuthToken.Token)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "b65e59ceed9efafa1bbbba68d74f36fe", "score": "0.45695257", "text": "func NewHeader(defaults http.Header) *Header {\n\thdr := make(http.Header)\n\tfor k, vs := range defaults {\n\t\thdr[k] = vs\n\t}\n\n\treturn &Header{\n\t\tHeader: hdr,\n\t\tRemove: make(map[string]struct{}),\n\t}\n}", "title": "" }, { "docid": "4af8ab8a362dc30f2a86951d67168d2c", "score": "0.4568908", "text": "func NewListProjectUnauthorized() *ListProjectUnauthorized {\n\n\treturn &ListProjectUnauthorized{}\n}", "title": "" }, { "docid": "a7cc605b819f91c35df65abc50302d74", "score": "0.4557575", "text": "func unauthorized(c *gin.Context){\n\n\tresponse := error_utils.NewUnauthorizedError(\"unauthorized\")\n\tc.Writer.WriteHeader(response.HttpStatusCode)\n\tc.Writer.Header().Add(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(c.Writer).Encode(response)\n\tc.Abort()\n}", "title": "" }, { "docid": "27f0052ae6ae37bcf6ede4a20f20dfc4", "score": "0.4552794", "text": "func Unauthorized(id, format string, a ...interface{}) error {\n\treturn &Error{\n\t\tId: id,\n\t\tCode: http.StatusUnauthorized,\n\t\tMessage: fmt.Sprintf(format, a...),\n\t}\n}", "title": "" }, { "docid": "8e8f230479ed4678185ef8b8d9b3ef55", "score": "0.45490068", "text": "func NewDescribeElasticIpStockRequestWithoutParam() *DescribeElasticIpStockRequest {\n\n return &DescribeElasticIpStockRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/elasticIpStock\",\n Method: \"GET\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "4d23143c1bce71c901f7c452d27c64ba", "score": "0.4548521", "text": "func NewCreateOverrideUnauthorized() *CreateOverrideUnauthorized {\n\treturn &CreateOverrideUnauthorized{}\n}", "title": "" }, { "docid": "937acefc2e5ac0b2cf85828bac9ff25e", "score": "0.4545256", "text": "func NewGetHealthStatusUnauthorized() *GetHealthStatusUnauthorized {\n\n\treturn &GetHealthStatusUnauthorized{}\n}", "title": "" }, { "docid": "1d6c88c1baf71f322c630524bc1f8363", "score": "0.45419544", "text": "func NewGetControllerConfigUnauthorized() *GetControllerConfigUnauthorized {\n\treturn &GetControllerConfigUnauthorized{}\n}", "title": "" }, { "docid": "aca5354732b7ff55eb9b3265218975df", "score": "0.45381787", "text": "func NewGetPdusIDUnauthorized() *GetPdusIDUnauthorized {\n\treturn &GetPdusIDUnauthorized{}\n}", "title": "" } ]
f4c189852e456351d903d6db6da85541
SetPrefixString gets a reference to the given string and assigns it to the PrefixString field.
[ { "docid": "1fae5c7cb35060233f585916b52ef1d3", "score": "0.8213893", "text": "func (o *XmlItem) SetPrefixString(v string) {\n\to.PrefixString = &v\n}", "title": "" } ]
[ { "docid": "b442196b10f5b48961fbaecc063f1eea", "score": "0.7742347", "text": "func SetPrefix(s string, prefix string) string {\n\tif prefix == \"\" {\n\t\treturn s\n\t}\n\n\tif strings.HasPrefix(s, prefix) {\n\t\treturn s\n\t}\n\n\treturn prefix + s\n}", "title": "" }, { "docid": "36064fde195642bcd63ebc2a3dbc62bc", "score": "0.72616714", "text": "func (o *XmlItem) SetPrefixNsString(v string) {\n\to.PrefixNsString = &v\n}", "title": "" }, { "docid": "350f384df75da01e7a7c073d5def1d9a", "score": "0.7142918", "text": "func PrefixString(str, prefix, separator string) string {\n\tif prefix != \"\" {\n\t\treturn fmt.Sprintf(\"%s%s%s\", prefix, separator, str)\n\t}\n\treturn str\n}", "title": "" }, { "docid": "ac59afb41d1bbea1a761ba75cb61d1fb", "score": "0.66841245", "text": "func (o *Object) SetPrefix(prefix *string) {\n\to.prefix = *prefix\n}", "title": "" }, { "docid": "956f96eef93eb8f3487389312cd88d71", "score": "0.6615933", "text": "func (l *lgr) SetPrefix(prefix string) *lgr {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\t_ = l.Prefix.Set(prefix)\n\treturn l\n}", "title": "" }, { "docid": "86555fb775d47dba5c6afb0d51debd1a", "score": "0.65382826", "text": "func (p *Print) SetPrefix(expr hcl.Expression) {\n\tp.prefix = expr\n}", "title": "" }, { "docid": "b4a8888a1d0eb4de135595409be3c95c", "score": "0.65127856", "text": "func (l *CommandLibrary) SetPrefix(prefix string) {\n\tl.prefix = prefix\n}", "title": "" }, { "docid": "fbd5a7c14f208c54d56b8a6bd195278f", "score": "0.64979553", "text": "func (o *SourceGcs) SetPrefix(v string) {\n\to.Prefix = &v\n}", "title": "" }, { "docid": "680e4cf8bb35739bc7497f35ea0077c3", "score": "0.64889663", "text": "func SetPrefix(prefix string) {\n\tstd.SetPrefix(prefix)\n}", "title": "" }, { "docid": "680e4cf8bb35739bc7497f35ea0077c3", "score": "0.64889663", "text": "func SetPrefix(prefix string) {\n\tstd.SetPrefix(prefix)\n}", "title": "" }, { "docid": "680e4cf8bb35739bc7497f35ea0077c3", "score": "0.64889663", "text": "func SetPrefix(prefix string) {\n\tstd.SetPrefix(prefix)\n}", "title": "" }, { "docid": "680e4cf8bb35739bc7497f35ea0077c3", "score": "0.64889663", "text": "func SetPrefix(prefix string) {\n\tstd.SetPrefix(prefix)\n}", "title": "" }, { "docid": "03bf2a61d471a1c4260bc90a1406367f", "score": "0.6384295", "text": "func (l *Logger) SetPrefix(prefix string) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tl.prefix = prefix\n}", "title": "" }, { "docid": "03bf2a61d471a1c4260bc90a1406367f", "score": "0.6384295", "text": "func (l *Logger) SetPrefix(prefix string) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tl.prefix = prefix\n}", "title": "" }, { "docid": "03bf2a61d471a1c4260bc90a1406367f", "score": "0.6384295", "text": "func (l *Logger) SetPrefix(prefix string) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tl.prefix = prefix\n}", "title": "" }, { "docid": "000f4833a97f368017f4e5b1fdb913e9", "score": "0.6359792", "text": "func (g *Generator) SetPrefix(prefix string) {\n\tg.prefix = prefix\n}", "title": "" }, { "docid": "00e4d675cd5948ff62900c8d0abdf271", "score": "0.6356098", "text": "func (o *XmlItem) GetPrefixString() string {\n\tif o == nil || IsNil(o.PrefixString) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PrefixString\n}", "title": "" }, { "docid": "03675b0a7d8dc8e02fc3271d3e664c4d", "score": "0.6346862", "text": "func (l *Logger) SetPrefix(prefix string) *Logger {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tl.prefix = prefix\n\treturn l\n}", "title": "" }, { "docid": "250eb1f17a3f7079aa47e2e1fbc6ca08", "score": "0.63226634", "text": "func (l *Logger) SetPrefix(tag string) {\n\tl.Lock()\n\tdefer l.Unlock()\n\tl.tag = tag\n}", "title": "" }, { "docid": "2523edf6e1f7f352306940723993cb4e", "score": "0.6306401", "text": "func (s *Client) SetPrefix(prefix string) {\n\tif s == nil {\n\t\treturn\n\t}\n\n\ts.prefix = prefix\n}", "title": "" }, { "docid": "21b69b605386fb74136ce134e9b3c9cd", "score": "0.6293266", "text": "func (pc *PatientCreate) SetPrefixID(id int) *PatientCreate {\n\tpc.mutation.SetPrefixID(id)\n\treturn pc\n}", "title": "" }, { "docid": "051a21d7e41a573bfdfb73c772efdb4f", "score": "0.62915355", "text": "func (s *Scope) SetPrefix(prefix string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.prefix = prefix\n}", "title": "" }, { "docid": "8c3517110e526aa39286b24a26efc3a0", "score": "0.6284337", "text": "func (m *PatientMutation) SetPrefixID(id int) {\n\tm.prefix = &id\n}", "title": "" }, { "docid": "8e21aa6ddfc9f9e574c6b20949a311ce", "score": "0.62694806", "text": "func (bot *Bot) SetPrefix(prefix string) *Bot {\n\tbot.Prefix = func(_ *Bot, _ *discordgo.Message, _ bool) string {\n\t\treturn prefix\n\t}\n\treturn bot\n}", "title": "" }, { "docid": "ccba498dac63017b1718a2e59816f07a", "score": "0.62422043", "text": "func SetPrefix(ctx context.Context, prefix string) context.Context {\n\treturn context.WithValue(ctx, prefixKey, prefix)\n}", "title": "" }, { "docid": "b154fdfd7927331cee7c42d33c1c4aac", "score": "0.6229867", "text": "func (_options *CreateGatewayImportRouteFilterOptions) SetPrefix(prefix string) *CreateGatewayImportRouteFilterOptions {\n\t_options.Prefix = core.StringPtr(prefix)\n\treturn _options\n}", "title": "" }, { "docid": "d3d8c3952f75cbec44b9b21f8f9352ce", "score": "0.6229279", "text": "func (l *Logger) SetPrefix(prefix string) {\n\tl.prefix = prefix\n}", "title": "" }, { "docid": "c5e22ab5001e3720af8f004687bc6a7e", "score": "0.6215386", "text": "func (s *AnalyticsAndOperator) SetPrefix(v string) *AnalyticsAndOperator {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "610283b7e1457e4f504172a81cf7a8a0", "score": "0.62053967", "text": "func (s *MetricsAndOperator) SetPrefix(v string) *MetricsAndOperator {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "b13d068d78f3b6ad5fe4be40b5f09fa3", "score": "0.6196781", "text": "func (pc *PatientCreate) SetPrefix(p *Prefix) *PatientCreate {\n\treturn pc.SetPrefixID(p.ID)\n}", "title": "" }, { "docid": "7139c423ccf3b98b704a71dcbd4cd660", "score": "0.6164307", "text": "func (s *Location) SetPrefix(v string) *Location {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "826678f55fece18e7de10e783238c250", "score": "0.61640877", "text": "func (s *Scanner) SetPrefix(prefix string) {\n\ts.prefix = prefix\n}", "title": "" }, { "docid": "723da4c814a49ac51b6b315944cb3a20", "score": "0.61588037", "text": "func (s *ListObjectsV2Output) SetPrefix(v string) *ListObjectsV2Output {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "3b680c1875ac9c8fef572b5f5a707079", "score": "0.6138716", "text": "func SetPrefix(prefix string) { _ = Std.SetPrefix(prefix) }", "title": "" }, { "docid": "8827f85e3e569293484bb66755c08d7b", "score": "0.6138303", "text": "func (s *MetricsFilter) SetPrefix(v string) *MetricsFilter {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "074bd4335bd01ce8cc7c0447a82e2655", "score": "0.61361814", "text": "func (s *AnalyticsFilter) SetPrefix(v string) *AnalyticsFilter {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "27b98f9ef86d28147824fc92b78cd454", "score": "0.6123709", "text": "func SetPrefix(prefix string) {\n\tglobalConfig.prefix = prefix\n}", "title": "" }, { "docid": "4ba314ded89847886148b463f2f5a2fb", "score": "0.6119008", "text": "func (s *LifecycleRuleAndOperator) SetPrefix(v string) *LifecycleRuleAndOperator {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "b08106d0de345fde1613cbaa7ac1dd66", "score": "0.6117134", "text": "func (c *Checker) SetPrefix(prefix string) *Checker {\n\tc.prefix = prefix\n\treturn c\n}", "title": "" }, { "docid": "eb29392a94140a6b93996d6273ba43af", "score": "0.61107546", "text": "func (h *Handler) SetPrefix(prefix string) {\n\th.prefix = prefix\n}", "title": "" }, { "docid": "76a7e04313462ffe4e0256fdc75955a5", "score": "0.6099527", "text": "func (s *BucketCriteriaAdditionalProperties) SetPrefix(v string) *BucketCriteriaAdditionalProperties {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "b4dc98031f67b7cb2b4e21a42e6de920", "score": "0.6087721", "text": "func (s *SubDomainSetting) SetPrefix(v string) *SubDomainSetting {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "40c5b4b560d073aef27c68c89fb882cb", "score": "0.6083986", "text": "func (s *ListObjectVersionsOutput) SetPrefix(v string) *ListObjectVersionsOutput {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "34ccffbfe4a489d76a4b05a722647d97", "score": "0.60834557", "text": "func (s *AnalyticsS3BucketDestination) SetPrefix(v string) *AnalyticsS3BucketDestination {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "a287e9943c94400b6e3b30cb913dadc1", "score": "0.60788685", "text": "func (s *ReplicationRuleAndOperator) SetPrefix(v string) *ReplicationRuleAndOperator {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "526910f9cc6f90f3f5fb02e341275b3c", "score": "0.60769737", "text": "func (s *ErrorReportLocation) SetPrefix(v string) *ErrorReportLocation {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "0b93121c2454ae09967c1bf9d5a59ffe", "score": "0.6072994", "text": "func (s *ListObjectsV2Input) SetPrefix(v string) *ListObjectsV2Input {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "dec04ef7cb672d0ded076d8ae4ba98d2", "score": "0.60673714", "text": "func (plugin *Plugin) SetPrefix(prefix string) *Plugin {\n\tplugin.Prefix = prefix\n\treturn plugin\n}", "title": "" }, { "docid": "deb95651abad6c7438b0a7df5497e42c", "score": "0.6067231", "text": "func (s *LifecycleRule) SetPrefix(v string) *LifecycleRule {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "554be8b0b24aa625d19dcc775895181e", "score": "0.6064336", "text": "func (l *Logger) SetPrefix(prefix string) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tif l.logger != nil {\n\t\tl.logger.SetPrefix(prefix)\n\t}\n}", "title": "" }, { "docid": "a5cf2ca1c58a91e0be3bd756c569d51a", "score": "0.60595685", "text": "func (o *VPCRouterStaticRoute) SetPrefix(v string) {\n\to.Prefix = v\n}", "title": "" }, { "docid": "4b82176643badc6a45637bf253d00b48", "score": "0.60590214", "text": "func (s *ListObjectsOutput) SetPrefix(v string) *ListObjectsOutput {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "80afb3cd5559680db01790e4a7643ba2", "score": "0.60524935", "text": "func (o *CustomColumnDefinitionAllOf) SetPrefix(v string) {\n\to.Prefix = &v\n}", "title": "" }, { "docid": "45608c5d07152f1573c7bc27a3cc9434", "score": "0.6032376", "text": "func (s *Rule) SetPrefix(v string) *Rule {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "5b92ff7b1505171ef794c115bf21bb58", "score": "0.60292864", "text": "func (s *ListObjectVersionsInput) SetPrefix(v string) *ListObjectVersionsInput {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "70884a1f11a0b8863810b4600bfe0672", "score": "0.6021316", "text": "func (s *LifecycleRuleFilter) SetPrefix(v string) *LifecycleRuleFilter {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "e06511f9c0dca5f2fd730f1cf927fadf", "score": "0.60209394", "text": "func (o *FindKeysParams) SetPrefix(prefix *string) {\n\to.Prefix = prefix\n}", "title": "" }, { "docid": "462c38337e629bca3ff3570566afa508", "score": "0.6020875", "text": "func (s *ListObjectsInput) SetPrefix(v string) *ListObjectsInput {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "e321c1996c7b71f397dd4277f7414b00", "score": "0.60154456", "text": "func (s *ExtendedS3DestinationDescription) SetPrefix(v string) *ExtendedS3DestinationDescription {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "90e9a04a4f526ef02a28af779b2dc1dc", "score": "0.59989977", "text": "func (c *ConfigSet) SetPrefix(prefix string) {\n\tc.prefix = prefix\n}", "title": "" }, { "docid": "d1b9309a99fdde6a06b8ede5da31f8dc", "score": "0.59873736", "text": "func (s *S3DestinationDescription) SetPrefix(v string) *S3DestinationDescription {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "948fc939fbe445d0dad121772c2350ee", "score": "0.597782", "text": "func (s *ListMultipartUploadsInput) SetPrefix(v string) *ListMultipartUploadsInput {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "1a97f60053532ae9da35dde932ffbd67", "score": "0.59731656", "text": "func SetPrefix(prefix string) {\n\tDefaultLogger.prefix += \"[\" + prefix + \"] \"\n}", "title": "" }, { "docid": "0c67bcb01ab739be59b04ca1776ff582", "score": "0.5967576", "text": "func (s *InventoryS3BucketDestination) SetPrefix(v string) *InventoryS3BucketDestination {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "be8dcc74c122ea400f6e442496ec4cd4", "score": "0.5962863", "text": "func (s *ReplicationRule) SetPrefix(v string) *ReplicationRule {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "5d35fa52ac281a783e6582152d6f2390", "score": "0.5961426", "text": "func (s *ListMultipartUploadsOutput) SetPrefix(v string) *ListMultipartUploadsOutput {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "74dce7285d818a1d5a0706dbfb388171", "score": "0.5958463", "text": "func (s *ExtendedS3DestinationUpdate) SetPrefix(v string) *ExtendedS3DestinationUpdate {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "13d16305e4d0f64a6acfc480e0a0fd5a", "score": "0.59546113", "text": "func (d *Dictionary) Prefix(s string) { d.prefix = s }", "title": "" }, { "docid": "bc5a1b0ad3bd39a3b74b7e83ff2bc38c", "score": "0.5947559", "text": "func (s *ReplicationRuleFilter) SetPrefix(v string) *ReplicationRuleFilter {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "604c052eddadda22d9877baf999ed431", "score": "0.5944447", "text": "func SetPrefix(prefix string) {\n\tlog.SetPrefix(prefix)\n}", "title": "" }, { "docid": "4da8dc639635dee6a448cd88db14e316", "score": "0.59443295", "text": "func (s *Search) HasPrefixString(str, prefix string) bool {\n\treturn false\n}", "title": "" }, { "docid": "c2d08502a4442020eb9dca7faceb0f6f", "score": "0.59427655", "text": "func (g *Generator) WithPrefix(s string) *Generator {\n\treturn g.WithPrefixBytes([]byte(s))\n}", "title": "" }, { "docid": "744aa722501aa563a7bbc13175494b32", "score": "0.59410924", "text": "func (s *S3DestinationUpdate) SetPrefix(v string) *S3DestinationUpdate {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "71273fbb6dc1f91bd787f62578b4377b", "score": "0.59379286", "text": "func (l *Logger) SetPrefix(prefix string) {\n if prefix == \"\" {\n prefix = fmt.Sprintf(\"%s [%d] \", path.Base(os.Args[0]), os.Getpid())\n }\n l.prefix = prefix\n}", "title": "" }, { "docid": "ae686f1d8498f1cd143745b9840901c4", "score": "0.59256166", "text": "func SetPrefix(prefix string) Option {\n\treturn func(s *Ship) {\n\t\ts.prefix = strings.TrimSuffix(prefix, \"/\")\n\t}\n}", "title": "" }, { "docid": "e1b8099ceba66ef7d807c3f43b943325", "score": "0.5919532", "text": "func (s *ExtendedS3DestinationConfiguration) SetPrefix(v string) *ExtendedS3DestinationConfiguration {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "74a0a4e26d8686fec9702efa4e9a6da0", "score": "0.5908427", "text": "func (s *InventoryFilter) SetPrefix(v string) *InventoryFilter {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "afdd346c888871838e137f165f625828", "score": "0.59029657", "text": "func (l Logger) SetPrefix(prefix string) *Logger {\n\tif prefix == \"\" {\n\t\treturn l.clone()\n\t}\n\n\tlog := l.clone()\n\tlog.customPrefix = []byte(prefix)\n\treturn log\n}", "title": "" }, { "docid": "b5edde751d270ea8991953dce91865e5", "score": "0.5898279", "text": "func (s *StreamingLoggingConfig) SetPrefix(v string) *StreamingLoggingConfig {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "07218a53a57a479be49003b40e057eb8", "score": "0.589794", "text": "func (c *Config) SetPrefix(prefix string) *Config {\n\tc.prefix = []byte(prefix)\n\treturn c\n}", "title": "" }, { "docid": "a4960da7455deaf098398d89eccdb688", "score": "0.58955675", "text": "func (s *S3DestinationConfiguration) SetPrefix(v string) *S3DestinationConfiguration {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "89a5affa60e1e185dadabc6aa097b209", "score": "0.58806396", "text": "func (s *LoggingConfig) SetPrefix(v string) *LoggingConfig {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "3c77d292f80337730e49ab18e97617e6", "score": "0.58337337", "text": "func (l *Logger) SetPrefix(prefix string) {\n\tl.entity.SetPrefix(prefix)\n}", "title": "" }, { "docid": "6cc0819ba9c29dc89f40797f6a1ba085", "score": "0.58200836", "text": "func (_options *CreateGatewayExportRouteFilterOptions) SetPrefix(prefix string) *CreateGatewayExportRouteFilterOptions {\n\t_options.Prefix = core.StringPtr(prefix)\n\treturn _options\n}", "title": "" }, { "docid": "cfc9cf24dcfe61a86da461be02eedc5a", "score": "0.5780513", "text": "func (s *CommonPrefix) SetPrefix(v string) *CommonPrefix {\n\ts.Prefix = &v\n\treturn s\n}", "title": "" }, { "docid": "dcc1924cbf59df4b40b459221222185f", "score": "0.5754148", "text": "func (l *Logger) SetLevelPrefix(level int, prefix string) {\n\tl.config.LevelPrefixes[level] = prefix\n}", "title": "" }, { "docid": "51a29d5a8b1fd69720ba0c5a939be83f", "score": "0.5751689", "text": "func SetBotPrefix(b *botResponse) error {\n\tchannel, err := b.s.Channel(b.m.ChannelID)\n\tif err != nil {\n\t\treturn &botError{ERR_NO_CHANNEL, \"\"}\n\t}\n\n\tguild, ok := Guilds[channel.GuildID]\n\tif !ok {\n\t\tg, err := b.s.Guild(channel.GuildID)\n\t\tif err != nil {\n\t\t\treturn &botError{ERR_NO_GUILD, \"\"}\n\t\t}\n\n\t\tguild = NewGuild(g)\n\t}\n\n\tif !guild.IsOwner(b.m.Author) {\n\t\treturn &botError{ERR_NOT_OWNER, \"\"}\n\t}\n\n\tif len(b.fields) > 1 {\n\t\tprefix := b.fields[1]\n\t\tif len(prefix) > 2 {\n\t\t\treturn &botError{ERR_PREFIX_COMMAND, \"\"}\n\t\t}\n\t\tguild.SetPrefix(prefix)\n\n\t\tb.PrintToDiscord(\"Haynesbot prefix successfully changed to \" + prefix)\n\t} else {\n\t\treturn &botError{ERR_PREFIX_COMMAND, \"\"}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd75a2b8551633b015eea2bbf8e9cf3a", "score": "0.5721575", "text": "func (o *XmlItem) SetPrefixNumber(v float32) {\n\to.PrefixNumber = &v\n}", "title": "" }, { "docid": "b31c36b31aee1524ff7b401be833a064", "score": "0.57045394", "text": "func (a Address) AddrPrefixString() string {\n\thexString := Bytes2Hex(a.Bytes())\n\t// Prefer output of \"0x0\" instead of \"0x\"\n\tif len(hexString) == 0 {\n\t\thexString = \"0\"\n\t}\n\treturn AddrPrefix + hexString\n}", "title": "" }, { "docid": "643a849980c77cf05c9b2abeed7f21db", "score": "0.5700933", "text": "func (b *Bot) SetCommandPrefix(pfx string) *Bot {\r\n\tb.CmdPrefix = pfx\r\n\treturn b\r\n}", "title": "" }, { "docid": "244ca9b1e07fc68f9fd323585197eee0", "score": "0.5691864", "text": "func (s *jsiiProxy_State) AddPrefix(x *string) {\n\t_jsii_.InvokeVoid(\n\t\ts,\n\t\t\"addPrefix\",\n\t\t[]interface{}{x},\n\t)\n}", "title": "" }, { "docid": "00a9e243fc90ed2f68d2492a35b46d0b", "score": "0.5679525", "text": "func (o *XmlItem) SetPrefixBoolean(v bool) {\n\to.PrefixBoolean = &v\n}", "title": "" }, { "docid": "80c56a329f7ab98f872c219d31b6f20f", "score": "0.56657445", "text": "func (s *State) SetWalletPrefix(walletPrefix string) {\n\t// Though the header says it's admissible, that isn't actually supported in\n\t// the current implementation. But it's on the todo list.\n\n\ts.walletPrefix = walletPrefix\n}", "title": "" }, { "docid": "28d17c5305c11a03adbd73619a47a636", "score": "0.56625193", "text": "func (convert *Convert) SetTablePrefix(table, prefix string) {\n\tconvert.TablePrefix[table] = prefix\n}", "title": "" }, { "docid": "8a1b0fddae76a8fe5f57f00c96529f47", "score": "0.5654454", "text": "func proxyholochain_Logger_SetPrefix(refnum C.int32_t, param_prefixFormat C.nstring) {\n\tref := _seq.FromRefNum(int32(refnum))\n\tv := ref.Get().(*holochain.Logger)\n\t_param_prefixFormat := decodeString(param_prefixFormat)\n\tv.SetPrefix(_param_prefixFormat)\n}", "title": "" }, { "docid": "45a07f5126b9fa877323670bb5058829", "score": "0.5643483", "text": "func (o *XmlItem) GetPrefixNsString() string {\n\tif o == nil || IsNil(o.PrefixNsString) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PrefixNsString\n}", "title": "" }, { "docid": "1f318032610e010f03263f587e4c238a", "score": "0.56432456", "text": "func (t *RoutingPolicy_DefinedSets_PrefixSet) NewPrefix(IpPrefix string, MasklengthRange string) (*RoutingPolicy_DefinedSets_PrefixSet_Prefix, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Prefix == nil {\n\t\tt.Prefix = make(map[RoutingPolicy_DefinedSets_PrefixSet_Prefix_Key]*RoutingPolicy_DefinedSets_PrefixSet_Prefix)\n\t}\n\n\tkey := RoutingPolicy_DefinedSets_PrefixSet_Prefix_Key{\n\t\tIpPrefix: IpPrefix,\n\t\tMasklengthRange: MasklengthRange,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Prefix[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Prefix\", key)\n\t}\n\n\tt.Prefix[key] = &RoutingPolicy_DefinedSets_PrefixSet_Prefix{\n\t\tIpPrefix: &IpPrefix,\n\t\tMasklengthRange: &MasklengthRange,\n\t}\n\n\treturn t.Prefix[key], nil\n}", "title": "" }, { "docid": "227f4c65e8e2800533f45464226059e4", "score": "0.56382424", "text": "func (z *E3) SetString(s1, s2, s3 string) *E3 {\n\tz.A0.SetString(s1)\n\tz.A1.SetString(s2)\n\tz.A2.SetString(s3)\n\treturn z\n}", "title": "" }, { "docid": "f47cbb6c3b4b024d4e97a20f36e37372", "score": "0.56260276", "text": "func (rg *Reg) SetString(key string, x string) error {\n\treturn rg.set(key, x)\n}", "title": "" }, { "docid": "cfde25a5afd696aa2182d91f081441a5", "score": "0.56251085", "text": "func SetPrefix(prefix string) {\n\tlogger.Stdout.SetPrefix(prefix)\n}", "title": "" } ]
e41e4491cbdb4909e78356810dd567a0
/ CreateComponentVersionStage creates new component version stage
[ { "docid": "141e7a969cc66b34009ef79bfab7a008", "score": "0.71022964", "text": "func (a *Client) CreateComponentVersionStage(params *CreateComponentVersionStageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateComponentVersionStageOK, *CreateComponentVersionStageNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateComponentVersionStageParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"CreateComponentVersionStage\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/api/v1/{owner}/hub/{entity}/versions/{name}/stages\",\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: &CreateComponentVersionStageReader{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, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *CreateComponentVersionStageOK:\n\t\treturn value, nil, nil\n\tcase *CreateComponentVersionStageNoContent:\n\t\treturn nil, value, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*CreateComponentVersionStageDefault)\n\treturn nil, nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" } ]
[ { "docid": "c52867ee1c8ff39cf27afe3b9d2df53e", "score": "0.58610487", "text": "func NewStage(name, function, pkg string, argnames, args []string) Stage {\n\n\targmap := make(map[string]string, 0)\n\n\tfor i, argname := range argnames {\n\t\targ := args[i]\n\t\targmap[argname] = arg\n\t}\n\n\ts := Stage{name, pkg, function, argmap, []string{}, \"\", \"\"}\n\n\treturn s\n}", "title": "" }, { "docid": "26c3f02104eae8cc5b2dee490a4c386a", "score": "0.5857992", "text": "func (c *MonoBuild) createStage(stageNumber int, configurations map[string]*BuildConfiguration) (*Stage, map[string]*BuildConfiguration, error) {\n\tlog := c.log.WithField(\"method\", \"createStages\")\n\n\tlog.Infof(\"creating `Stage %d`\", stageNumber)\n\n\tstage := &Stage{\n\t\tLabel: fmt.Sprintf(\"Stage %d\", stageNumber),\n\t\tConfigurations: make([]*BuildConfiguration, 0),\n\t}\n\n\tnewConfigurations := make(map[string]*BuildConfiguration, 0)\n\tbefore := len(configurations)\n\tfor _, val := range configurations {\n\t\tif len(val.Dependencies) == 0 {\n\t\t\tstage.Configurations = append(stage.Configurations, val)\n\t\t\tcontinue\n\t\t}\n\t\tadd := true\n\t\tfor _, dep := range val.Dependencies {\n\t\t\tadd = add && c.dependencyProcessed(dep)\n\t\t}\n\t\tif add {\n\t\t\tstage.Configurations = append(stage.Configurations, val)\n\t\t\tcontinue\n\t\t}\n\t\tnewConfigurations[val.Label] = val\n\t}\n\tafter := len(newConfigurations)\n\tif before == after {\n\t\treturn nil, newConfigurations, errors.New(\"dependencies are not valid\")\n\t}\n\treturn stage, newConfigurations, nil\n}", "title": "" }, { "docid": "8ed4ea630e6d48436b9afd5c4694af6c", "score": "0.57634944", "text": "func VersionCreate(c *gin.Context) {\n\tmod := session.Mod(c)\n\trecord := &model.Version{}\n\n\tif err := c.BindJSON(&record); err != nil {\n\t\tlogrus.Warnf(\"Failed to bind version data. %s\", err)\n\n\t\tc.JSON(\n\t\t\thttp.StatusPreconditionFailed,\n\t\t\tgin.H{\n\t\t\t\t\"status\": http.StatusPreconditionFailed,\n\t\t\t\t\"message\": \"Failed to bind version data\",\n\t\t\t},\n\t\t)\n\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\terr := store.CreateVersion(\n\t\tc,\n\t\tmod.ID,\n\t\trecord,\n\t)\n\n\tif err != nil {\n\t\tlogrus.Warnf(\"Failed to create version. %s\", err)\n\n\t\tc.JSON(\n\t\t\thttp.StatusBadRequest,\n\t\t\tgin.H{\n\t\t\t\t\"status\": http.StatusBadRequest,\n\t\t\t\t\"message\": err.Error(),\n\t\t\t},\n\t\t)\n\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tc.JSON(\n\t\thttp.StatusOK,\n\t\trecord,\n\t)\n}", "title": "" }, { "docid": "3ecd7eb57f8af24dbf3f8b863ad88e21", "score": "0.56609327", "text": "func (a *Client) CreateComponentVersion(params *CreateComponentVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateComponentVersionOK, *CreateComponentVersionNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateComponentVersionParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"CreateComponentVersion\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/api/v1/{owner}/hub/{component}/versions\",\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: &CreateComponentVersionReader{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, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *CreateComponentVersionOK:\n\t\treturn value, nil, nil\n\tcase *CreateComponentVersionNoContent:\n\t\treturn nil, value, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*CreateComponentVersionDefault)\n\treturn nil, nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "dabe26de66bfbbdc5df5090938bfe98b", "score": "0.5563316", "text": "func CreateVersion() Version {\n\treturn Version{}\n}", "title": "" }, { "docid": "230b6ab1020053abfa9ee1d31abbec36", "score": "0.5523813", "text": "func (resource *ApiGatewayStage) Create() error {\n\tauth.MakeClient(auth.Sess)\n\tsvc := auth.Client.ApigatewayConn\n\tstageInput := &apigateway.CreateStageInput{\n\t\tRestApiId: &resource.RestApiId,\n\t\tDeploymentId: &resource.DeploymentID,\n\t\tStageName: &resource.StageName,\n\t}\n\t_, err := svc.CreateStage(stageInput)\n\treturn err\n}", "title": "" }, { "docid": "9c6b7a10c119c9ecf47354cfc8b785e6", "score": "0.5476177", "text": "func NewStage() *Stage {\n\treturn &Stage{\n\t\tState: \"Unknown\",\n\t}\n}", "title": "" }, { "docid": "b0d8d4b587d21f6dbbecbe7959c9ac9c", "score": "0.5463848", "text": "func NewCfnStage(scope awscdk.Construct, id *string, props *CfnStageProps) CfnStage {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnStage{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_apigateway.CfnStage\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "86fb19d1ba162be4a55493e8e606f31c", "score": "0.5395906", "text": "func (s *WysteriaServer) CreateVersion(in *wyc.Version) (string, int32, error) {\n\terr := s.shouldServeRequest()\n\tif err != nil {\n\t\treturn \"\", 0, err\n\t}\n\n\tif in.Parent == \"\" {\n\t\treturn \"\", 0, fmt.Errorf(\"%s: require Parent to be set\", wyc.ErrorInvalid)\n\t}\n\tif in.Facets == nil {\n\t\tin.Facets = make(map[string]string)\n\t}\n\n\tfor _, facetKey := range reservedVerFacets {\n\t\t_, ok := in.Facets[facetKey]\n\t\tif !ok {\n\t\t\treturn \"\", 0, fmt.Errorf(\"%s: required facet '%s' not set\", wyc.ErrorInvalid, facetKey)\n\t\t}\n\t}\n\n\tparentResult, err := s.database.RetrieveItem(in.Parent)\n\tif err != nil || len(parentResult) != 1 {\n\t\treturn \"\", 0, fmt.Errorf(\"%s: parent %s not found\", wyc.ErrorNotFound, in.Parent)\n\t}\n\n\tid, versionNumber, err := s.database.InsertNextVersion(in)\n\tif err != nil {\n\t\treturn \"\", 0, err\n\t}\n\tin.Id = id\n\tin.Number = versionNumber\n\tin.Uri = fmt.Sprintf(\"%s/%d\", parentResult[0].Uri, in.Number)\n\n\terr = s.database.UpdateVersion(in.Id, in)\n\tif err != nil {\n\t\treturn \"\", 0, err\n\t}\n\n\treturn in.Id, in.Number, s.searchbase.InsertVersion(in.Id, in)\n}", "title": "" }, { "docid": "ce7ed89eefe71a641cd53fccbe760a68", "score": "0.5270733", "text": "func NewStage(platform, name string, providers []providers.Provider, opts ...StageOption) SplitStage {\n\ts := SplitStage{\n\t\tplatform: platform,\n\t\tname: name,\n\t\tproviders: providers,\n\t}\n\tfor _, opt := range opts {\n\t\topt(&s)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "50ad873b53bde45c75c206e34694ad80", "score": "0.52256215", "text": "func NewStageCreated() *StageCreated {\n\n\treturn &StageCreated{}\n}", "title": "" }, { "docid": "62f7d73f8215c9022a03e77eb12f7a6e", "score": "0.5218239", "text": "func (c *Client) CreateStageInstance(\n\tdata CreateStageInstanceData) (*discord.StageInstance, error) {\n\n\tvar s *discord.StageInstance\n\treturn s, c.RequestJSON(\n\t\t&s, \"POST\",\n\t\tEndpointStageInstances,\n\t\thttputil.WithJSONBody(data), httputil.WithHeaders(data.Header()),\n\t)\n}", "title": "" }, { "docid": "466075f098553c317c9951e41fb1488e", "score": "0.51833266", "text": "func NewCreateComponentVersionDefault(code int) *CreateComponentVersionDefault {\n\treturn &CreateComponentVersionDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "fe065272212bc79f17c22b923cb5a19e", "score": "0.51165265", "text": "func (o AppAutoBranchCreationConfigOutput) Stage() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AppAutoBranchCreationConfig) *string { return v.Stage }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9658792c1f78f7523c5e12b32c0bf6fe", "score": "0.5109561", "text": "func (c Configuration) ReleaseStage() string {\n\tstage := strings.Split(c.Version, \"-\")\n\tif len(stage) < 2 {\n\t\treturn \"\"\n\t}\n\n\treturn stage[1]\n}", "title": "" }, { "docid": "d3d93d2605481e0c7356d379d4247a50", "score": "0.51066357", "text": "func NewStage(ctx *pulumi.Context,\n\tname string, args *StageArgs, opts ...pulumi.ResourceOption) (*Stage, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Deployment == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Deployment'\")\n\t}\n\tif args.RestApi == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'RestApi'\")\n\t}\n\tif args.StageName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'StageName'\")\n\t}\n\tvar resource Stage\n\terr := ctx.RegisterResource(\"aws:apigateway/stage:Stage\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "05443c6a8cc22528d982576a78e62a7e", "score": "0.5090628", "text": "func CreateBuildFromVersion(args BuildCreateArgs) (string, error) {\n\t// find the build variant for this project/build\n\tbuildVariant := args.Project.FindBuildVariant(args.BuildName)\n\tif buildVariant == nil {\n\t\treturn \"\", errors.Errorf(\"could not find build %v in %v project file\", args.BuildName, args.Project.Identifier)\n\t}\n\n\trev := args.Version.Revision\n\tif evergreen.IsPatchRequester(args.Version.Requester) {\n\t\trev = fmt.Sprintf(\"patch_%s_%s\", args.Version.Revision, args.Version.Id)\n\t} else if args.Version.Requester == evergreen.TriggerRequester {\n\t\trev = fmt.Sprintf(\"%s_%s\", args.SourceRev, args.DefinitionID)\n\t} else if args.Version.Requester == evergreen.AdHocRequester {\n\t\trev = args.Version.Id\n\t}\n\n\t// create a new build id\n\tbuildId := fmt.Sprintf(\"%s_%s_%s_%s\",\n\t\targs.Project.Identifier,\n\t\targs.BuildName,\n\t\trev,\n\t\targs.Version.CreateTime.Format(build.IdTimeLayout))\n\n\tactivatedTime := util.ZeroTime\n\tif args.Activated {\n\t\tactivatedTime = time.Now()\n\t}\n\n\t// create the build itself\n\tb := &build.Build{\n\t\tId: util.CleanName(buildId),\n\t\tCreateTime: args.Version.CreateTime,\n\t\tActivated: args.Activated,\n\t\tActivatedTime: activatedTime,\n\t\tProject: args.Project.Identifier,\n\t\tRevision: args.Version.Revision,\n\t\tStatus: evergreen.BuildCreated,\n\t\tBuildVariant: args.BuildName,\n\t\tVersion: args.Version.Id,\n\t\tDisplayName: buildVariant.DisplayName,\n\t\tRevisionOrderNumber: args.Version.RevisionOrderNumber,\n\t\tRequester: args.Version.Requester,\n\t\tTriggerID: args.Version.TriggerID,\n\t\tTriggerType: args.Version.TriggerType,\n\t\tTriggerEvent: args.Version.TriggerEvent,\n\t}\n\n\t// get a new build number for the build\n\tbuildNumber, err := db.GetNewBuildVariantBuildNumber(args.BuildName)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"could not get build number for build variant\"+\n\t\t\t\" %v in %v project file\", args.BuildName, args.Project.Identifier)\n\t}\n\tb.BuildNumber = strconv.FormatUint(buildNumber, 10)\n\n\t// create all of the necessary tasks for the build\n\ttasksForBuild, err := createTasksForBuild(&args.Project, buildVariant, b, &args.Version, args.TaskIDs, args.TaskNames, args.DisplayNames, args.GeneratedBy, args.Aliases, nil, args.DistroAliases)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"error creating tasks for build %s\", b.Id)\n\t}\n\n\tif err = tasksForBuild.InsertUnordered(args.Session); err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"error inserting task for build '%s'\", buildId)\n\t}\n\n\t// create task caches for all of the tasks, and place them into the build\n\ttasks := []task.Task{}\n\tfor _, taskP := range tasksForBuild {\n\t\tif taskP.DisplayTask != nil {\n\t\t\tcontinue // don't add execution parts of display tasks to the UI cache\n\t\t}\n\t\ttasks = append(tasks, *taskP)\n\t}\n\tb.Tasks = CreateTasksCache(tasks)\n\n\t// insert the build\n\t_, err = evergreen.GetEnvironment().DB().Collection(build.Collection).InsertOne(args.Session, b)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"error inserting build %v\", b.Id)\n\t}\n\n\t// success!\n\treturn b.Id, nil\n}", "title": "" }, { "docid": "dffe1c8334b38a49b61be9aa86b962e4", "score": "0.50709033", "text": "func StageCreateHandler(w http.ResponseWriter, r *http.Request) {\n\tvalidToken := true //checkJwt(w,r)\n\tif (validToken){\n\t\tvars := mux.Vars(r)\n\t\teventID := vars[\"eventID\"]\n\t\tvar stage m.Stage\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), 500)\n\t\t}\n\t\n\t\tif err := json.Unmarshal(body, &stage); err != nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\t\tw.WriteHeader(http.StatusBadRequest) // unprocessable entity\n\t\t\tif err := json.NewEncoder(w).Encode(err); err != nil {\n\t\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t\n\t\ts, err := m.CreateStage(eventID, stage, connection(), DATABASE, STAGES)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t} else {\n\t\t\tif strconv.Itoa(s.ID) == \"\"{\n\t\t\t\tw.WriteHeader(http.StatusConflict)\n\t\t\t} else {\n\t\t\t\tw.WriteHeader(http.StatusOK)\t\n\t\t\t\tupdateErr := m.InsertEventStages(eventID, s.ID, connection(), DATABASE, EVENTS)\n\t\t\t\tif updateErr != nil {\n\t\t\t\t\tfmt.Println(\"Something went wrong.\")\n\t\t\t\t}\n\t\t\t\tif err := json.NewEncoder(w).Encode(s); err != nil {\n\t\t\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tfmt.Println(r.URL.String())\n\t\tif err := r.Body.Close(); err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t} else {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t}\n}", "title": "" }, { "docid": "54b06b3faeab55ed25d1df343ae16f57", "score": "0.5070439", "text": "func CreatePipelineRevisionName(pipelineName, hash string) string {\n\treturn util.FixupKubernetesName(pipelineName + \"-\" + hash)\n}", "title": "" }, { "docid": "6d1c1c9730e3b428a5f8f59de9d5571c", "score": "0.50568235", "text": "func NewCreateComponentVersionOK() *CreateComponentVersionOK {\n\treturn &CreateComponentVersionOK{}\n}", "title": "" }, { "docid": "cad5367d0e8442b9d69e3637538206e4", "score": "0.5045924", "text": "func (s *StageStatus) NewSubStage(\n\tdescription string,\n\tmaxProgress int,\n) (*StageStatus, error) {\n\tss, err := NewStageStatus(\n\t\ts.Client,\n\t\ts.JobID, fmt.Sprintf(\"%s.%d\", s.Stage, len(s.SubStageStatus)+1), description,\n\t\tmaxProgress,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.SubStageStatus = append(s.SubStageStatus, ss)\n\treturn ss, err\n}", "title": "" }, { "docid": "0bfe7a4127e50bbe92629bd68c629639", "score": "0.5010977", "text": "func NewXzStage(options *XzStageOptions, inputs *XzStageInputs) *Stage {\n\tvar stageInputs Inputs\n\tif inputs != nil {\n\t\tstageInputs = inputs\n\t}\n\n\treturn &Stage{\n\t\tType: \"org.osbuild.xz\",\n\t\tOptions: options,\n\t\tInputs: stageInputs,\n\t}\n}", "title": "" }, { "docid": "ddc95e8e61d6b232aaa018d605747e74", "score": "0.5001879", "text": "func (o SecretVersionOutput) VersionStages() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *SecretVersion) pulumi.StringArrayOutput { return v.VersionStages }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "928878587a9c9a65d0a651977de4bf73", "score": "0.49875072", "text": "func (c *versions) Create(ctx context.Context, version VersionCreateOptions) (*Version, error) {\n\tbodyBytes, err := json.Marshal(version)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not marshal request body: %w\", err)\n\t}\n\n\tresponse, err := c.client.post(ctx, \"version\", bytes.NewBuffer(bodyBytes))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := Version{}\n\treturn &result, c.client.decodeAndClose(response.Body, &result)\n}", "title": "" }, { "docid": "3c8c5552874abd1a4a54f6c486710a81", "score": "0.49748945", "text": "func NewCfnStage_Override(c CfnStage, scope awscdk.Construct, id *string, props *CfnStageProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_apigateway.CfnStage\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "title": "" }, { "docid": "3ace8d2ef71b4e164941ccc4fdb9f09f", "score": "0.49615288", "text": "func NewVersion(name string, basePath string) *restful.WebService {\n\tws := new(restful.WebService)\n\tws.\n\t\tPath(basePath + \"v1/version\").\n\t\tConsumes(restful.MIME_JSON).\n\t\tProduces(restful.MIME_JSON)\n\n\ttags := []string{\"version\"}\n\n\tvi := version{\n\t\tName: name,\n\t\tVersion: v.Version,\n\t\tRevision: v.Revision,\n\t\tBuildDate: v.BuildDate,\n\t\tGitsha1: v.GitSHA1,\n\t}\n\tws.Route(\n\t\tws.GET(\"/\").\n\t\t\tDoc(\"returns the current version information of this module\").\n\t\t\tMetadata(restfulspec.KeyOpenAPITags, tags).\n\t\t\tReturns(http.StatusOK, \"OK\", version{}).\n\t\t\tOperation(\"info\").\n\t\t\tTo(func(r *restful.Request, rsp *restful.Response) {\n\t\t\t\t_ = rsp.WriteAsJson(vi)\n\t\t\t}).\n\t\t\tDefaultReturns(\"Error\", httperrors.HTTPErrorResponse{}))\n\n\treturn ws\n}", "title": "" }, { "docid": "242bfdce8ef74de7ce5703e73922e817", "score": "0.49476862", "text": "func (db *data) CreateVersion(mod int64, record *model.Version, current *model.User) error {\n\trecord.ModID = mod\n\n\treturn db.Create(\n\t\trecord,\n\t).Error\n}", "title": "" }, { "docid": "d4bdf9026acaf75c5de3ec5f3297487a", "score": "0.49436772", "text": "func newStageMonitor(g reflect.Value, v specsp) (*stageMonitor, error) {\n\tvisible := v[\"visible\"].(bool)\n\tif !visible {\n\t\treturn nil, syscall.ENOENT\n\t}\n\n\teval := buildMonitorEval(g, v)\n\tif eval == nil {\n\t\treturn nil, syscall.EINVAL\n\t}\n\n\tmode := int(v[\"mode\"].(float64))\n\tcolor := int(v[\"color\"].(float64))\n\tlabel := v[\"label\"].(string)\n\tx := v[\"x\"].(float64)\n\ty := v[\"y\"].(float64)\n\treturn &stageMonitor{\n\t\tvisible: visible, mode: mode, color: color, x: x, y: y, label: label, eval: eval,\n\t}, nil\n}", "title": "" }, { "docid": "dd363113af73e3693ed58e473850944e", "score": "0.49338892", "text": "func NewCfnStageV2(scope awscdk.Construct, id *string, props *CfnStageV2Props) CfnStageV2 {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnStageV2{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_apigateway.CfnStageV2\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "70a9575c3d59d5e03e853408502adcf3", "score": "0.49069774", "text": "func NewCreatePipelineAndVersionDefault(code int) *CreatePipelineAndVersionDefault {\n\treturn &CreatePipelineAndVersionDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "3a12b290c9c350f9dc6bb9376d9a98d1", "score": "0.4874381", "text": "func CreateVersionEndpoint(externalURL string) *endpoint.Endpoint {\n\treturn &endpoint.Endpoint{\n\t\tName: \"Version\",\n\t\tOutputInfo: false,\n\t\tURL: fmt.Sprintf(\"%s/%s\", externalURL, \"Version\"),\n\t\tOperations: []models.EndpointOperation{\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/version\", Handler: handlers.HandleVersion},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c4b6d8ae0c25c4f73619d3fb681cc64b", "score": "0.4861482", "text": "func (o AppAutoBranchCreationConfigPtrOutput) Stage() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AppAutoBranchCreationConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Stage\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "be20e881892d1ecda4050d6924d55953", "score": "0.48609436", "text": "func newPodForStage(cr *pipelinev1alpha1.Pipeline,i int) *corev1.Pod {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t}\n\tpod:= &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Spec.Stages[i].Job.ObjectMeta.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: *cr.Spec.Stages[0].Job.Template.Spec.DeepCopy(),\n\t}\n\n\t//copy(cr.Spec.Stages[0].Job.Template.Spec,pod.Spec)\n\treturn pod\n}", "title": "" }, { "docid": "4eb5e1f841a1481d0b0cfdd613705aae", "score": "0.48319587", "text": "func NewVersion() (ver *Version, err error) {\n\tvar date time.Time\n\n\tif BuildDate == \"unspecified\" {\n\t\tdate = time.Now()\n\t} else {\n\t\tdate, err = time.Parse(dateLayout, BuildDate)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parse build date: %w\", err)\n\t\t}\n\t}\n\n\ttag := CommitTag\n\tif tag == \"\" || tag == unspecified {\n\t\ttag = \"v0.0.0\"\n\t}\n\n\tver = &Version{\n\t\tService: ServiceName,\n\t\tTag: tag,\n\t\tCommit: CommitSHA,\n\t\tBranch: CommitBranch,\n\t\tURL: strings.TrimSuffix(OriginURL, \".git\"),\n\t\tDate: date,\n\t}\n\n\terr = ver.initTemplate()\n\treturn\n}", "title": "" }, { "docid": "c0125881097159218453cf4b64b30548", "score": "0.47867176", "text": "func (a *Client) GetComponentVersionStages(params *GetComponentVersionStagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetComponentVersionStagesOK, *GetComponentVersionStagesNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetComponentVersionStagesParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"GetComponentVersionStages\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/{owner}/hub/{entity}/versions/{name}/stages\",\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: &GetComponentVersionStagesReader{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, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *GetComponentVersionStagesOK:\n\t\treturn value, nil, nil\n\tcase *GetComponentVersionStagesNoContent:\n\t\treturn nil, value, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*GetComponentVersionStagesDefault)\n\treturn nil, nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "0ac134f5eb55c42a1f2dbffcc5998e25", "score": "0.47781935", "text": "func (c *Client) CreateApplicationVersion(ctx context.Context, params *CreateApplicationVersionInput, optFns ...func(*Options)) (*CreateApplicationVersionOutput, error) {\n\tif params == nil {\n\t\tparams = &CreateApplicationVersionInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"CreateApplicationVersion\", params, optFns, c.addOperationCreateApplicationVersionMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*CreateApplicationVersionOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "cfb3461d76dbbfb556a6aa492da154bf", "score": "0.4760656", "text": "func (a *adminTerraformVersions) Create(ctx context.Context, options AdminTerraformVersionCreateOptions) (*AdminTerraformVersion, error) {\n\tif err := options.valid(); err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := a.client.NewRequest(\"POST\", \"admin/terraform-versions\", &options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttfv := &AdminTerraformVersion{}\n\terr = req.Do(ctx, tfv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn tfv, nil\n}", "title": "" }, { "docid": "00a4887d8179f8caed933ae0299e9737", "score": "0.47527778", "text": "func NewCreatePipelineAndVersionOK() *CreatePipelineAndVersionOK {\n\treturn &CreatePipelineAndVersionOK{}\n}", "title": "" }, { "docid": "1ae5e52c0259467e5f5b5691b4cdba50", "score": "0.47429824", "text": "func CreateVersionJSON(ctx context.Context, proj project.Project, channel string) error {\n\tclientSecret, err := proj.ClientSecretJSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient, err := apiutils.NewHTTPClient(ctx, clientSecret, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tprojectID := proj.ProjectID()\n\tlog.Outf(\"Deploying files in the project %q to the %q release channel...\", projectID, channel)\n\trequestURL := httpAddr(versionHTTPEndpoint(projectID))\n\tr, w := io.Pipe()\n\terrCh := make(chan error, 1)\n\tvar versionID string\n\t// This goroutine will exit after HTTP call is finished.\n\t// The sendFilesToServerJSON below and client.Post communicate via the pipe\n\t// and former will keep writing stream of bytes, which client post will\n\t// keep reading in a blocking fashion. sendFilesToServerJSON is guaranteed\n\t// to close the writer end of the pipe, thus unblocking the reader and allowing\n\t// the goroutine to exit.\n\tgo func() {\n\t\treq, err := http.NewRequest(\"POST\", requestURL, r)\n\t\tif err != nil {\n\t\t\terrCh <- err\n\t\t\treturn\n\t\t}\n\t\treq.Header.Add(\"Content-Type\", \"application/json\")\n\t\t// This is done to help server select the quota attributed to a\n\t\t// projectID (i.e. developer's project), instead of the CLI project.\n\t\t// https://cloud.google.com/storage/docs/xml-api/reference-headers#xgooguserproject\n\t\treq.Header.Add(\"X-Goog-User-Project\", projectID)\n\t\taddClientHeaders(req)\n\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\terrCh <- err\n\t\t\treturn\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\t// TODO: Change signature of postProcessJSONResponse to return an error, and pipe that error to channel here.\n\t\tpostprocessJSONResponse(resp, errCh, func(body []byte) error {\n\t\t\tv, err := procCreateVersionResponse(channel, body)\n\t\t\tversionID = v\n\t\t\treturn err\n\t\t})\n\t}()\n\tif err := sendFilesToServerJSON(proj, w, func() map[string]interface{} {\n\t\treturn request.CreateVersion(projectID, channel)\n\t}); err != nil {\n\t\treturn err\n\t}\n\tlog.Outf(\"Waiting for server to respond...\")\n\tif err := <-errCh; err != nil {\n\t\treturn err\n\t}\n\tif _, ok := BuiltInReleaseChannels[channel]; ok {\n\t\tchannel = BuiltInReleaseChannels[channel]\n\t}\n\n\tlog.DoneMsgln(fmt.Sprintf(\"Version %s has been successfully created and submitted for deployment to %s channel. \", versionID, channel))\n\treturn nil\n}", "title": "" }, { "docid": "9f80e7f5f72fabe5162ebd39ccbcd6ea", "score": "0.47364023", "text": "func NewStageNotFound() *StageNotFound {\n\n\treturn &StageNotFound{}\n}", "title": "" }, { "docid": "c6cd6202ada42c66291555d6f7d1a6aa", "score": "0.4720434", "text": "func NewStageStatus(client *redis.Client,\n\tjobID, stage, description string,\n\tmaxProgress int) (*StageStatus, error) {\n\n\tif maxProgress == 0 {\n\t\treturn nil, errors.New(\"can't create a stage with 0 maxProgress\")\n\t}\n\n\tss := &StageStatus{\n\t\tJobID: jobID,\n\t\tStage: stage,\n\t\tStageKey: fmt.Sprintf(\"%s-%s\", jobID, stage),\n\t\tDescription: description,\n\t\tClient: client,\n\n\t\tMaxProgress: maxProgress,\n\t\tCurrentProgress: 0,\n\t\tCompleted: false,\n\n\t\tSubStageStatus: make([]*StageStatus, 0),\n\t}\n\n\tss.Client.HSet(ss.StageKey, \"description\", description)\n\tss.Client.HSet(ss.JobID, ss.Stage, ss.StageKey)\n\tss.Client.HSet(ss.StageKey, \"max\", maxProgress)\n\tss.Client.HSet(ss.StageKey, \"current\", 0)\n\n\treturn ss, nil\n}", "title": "" }, { "docid": "a959d3fc80751a789cbaec9b413a2a4a", "score": "0.47164837", "text": "func New(logger log.Logger, jobName *string, stageType string,\n\tcfg interface{}, registerer prometheus.Registerer) (Stage, error) {\n\tinitCreators()\n\tcreator, ok := stageCreators[stageType]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"Unknown stage type: %s\", stageType)\n\t}\n\tparams := StageCreationParams{\n\t\tlogger: logger,\n\t\tconfig: cfg,\n\t\tregisterer: registerer,\n\t\tjobName: jobName,\n\t}\n\treturn creator(params)\n}", "title": "" }, { "docid": "08e9cb0d9e69be07c973a11c69b6b469", "score": "0.47113442", "text": "func (po *PersistOutputInterface) CreateVersionSecret(exjob *ejv1.ExtendedJob, outputContainer corev1.Container, secretName string, secretData map[string]string, sourceDescription string) error {\n\townerName := exjob.GetName()\n\townerID := exjob.GetUID()\n\n\tcurrentVersion, err := getGreatestVersion(po.clientSet, po.namespace, secretName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tversion := currentVersion + 1\n\tsecretLabels := exjob.Spec.Output.SecretLabels\n\tif secretLabels == nil {\n\t\tsecretLabels = map[string]string{}\n\t}\n\tsecretLabels[ejv1.LabelPersistentSecretContainer] = outputContainer.Name\n\tif ig, ok := podutil.LookupEnv(outputContainer.Env, EnvInstanceGroupName); ok {\n\t\tsecretLabels[ejv1.LabelInstanceGroup] = ig\n\t}\n\tsecretLabels[versionedsecretstore.LabelVersion] = strconv.Itoa(version)\n\tsecretLabels[versionedsecretstore.LabelSecretKind] = versionedsecretstore.VersionSecretKind\n\n\tgeneratedSecretName, err := versionedsecretstore.GenerateSecretName(secretName, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsecret := &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: generatedSecretName,\n\t\t\tNamespace: po.namespace,\n\t\t\tLabels: secretLabels,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t{\n\t\t\t\t\tAPIVersion: versionedsecretstore.LabelAPIVersion,\n\t\t\t\t\tKind: \"ExtendedJob\",\n\t\t\t\t\tName: ownerName,\n\t\t\t\t\tUID: ownerID,\n\t\t\t\t\tBlockOwnerDeletion: pointers.Bool(false),\n\t\t\t\t\tController: pointers.Bool(true),\n\t\t\t\t},\n\t\t\t},\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tversionedsecretstore.AnnotationSourceDescription: sourceDescription,\n\t\t\t},\n\t\t},\n\t\tStringData: secretData,\n\t}\n\n\t_, err = po.clientSet.CoreV1().Secrets(po.namespace).Create(secret)\n\treturn err\n}", "title": "" }, { "docid": "9531f491370417fa3043948dfd298d46", "score": "0.4697772", "text": "func testVersion(t *testing.T, c *Client) *Version {\n\ttestVersionLock.Lock()\n\tdefer testVersionLock.Unlock()\n\n\tv, err := c.CreateVersion(&CreateVersionInput{\n\t\tService: testServiceID,\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f21c2890f804602688f453128c05d201", "score": "0.46862257", "text": "func newLogfmtStage(logger log.Logger, config interface{}) (Stage, error) {\n\tcfg, err := parseLogfmtConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// inverseMapping would hold the mapping in inverse which would make lookup easier.\n\t// To explain it simply, the key would be the key from parsed logfmt and value would be the key with which the data in extracted map would be set.\n\tinverseMapping, err := validateLogfmtConfig(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn toStage(&logfmtStage{\n\t\tcfg: cfg,\n\t\tinverseMapping: inverseMapping,\n\t\tlogger: log.With(logger, \"component\", \"stage\", \"type\", \"logfmt\"),\n\t}), nil\n}", "title": "" }, { "docid": "1e5b28bb2ec51cccc834a3989436f496", "score": "0.46762583", "text": "func SendCreateVersionEvent(service *api.Service, version *api.Version) error {\n\tusername := service.Username\n\tserviceName := service.Name\n\tversionName := version.Name\n\teventID := api.EventID(version.VersionID)\n\n\tds := store.NewStore()\n\tdefer ds.Close()\n\ttok, _ := ds.FindtokenByUserID(service.UserID, service.Repository.SubVcs)\n\n\tevent := api.Event{\n\t\tEventID: eventID,\n\t\tService: *service,\n\t\tVersion: *version,\n\t\tOperation: CreateVersionOps,\n\t\tData: map[string]interface{}{\n\t\t\t\"service-name\": serviceName,\n\t\t\t\"version-name\": versionName,\n\t\t\t\"username\": username,\n\t\t\t\"Token\": tok.Vsctoken.AccessToken,\n\t\t},\n\t\tStatus: api.EventStatusPending,\n\t}\n\n\t// log.Infof(\"send create version event: %v\", event)\n\n\tetcdClient := etcd.GetClient()\n\tjsEvent, err := json.Marshal(&event)\n\tif err != nil {\n\t\tlog.Errorf(\"create version event marshal err: %v\", err)\n\t\treturn err\n\t}\n\n\terr = etcdClient.Set(EventsUnfinished+string(eventID), string(jsEvent))\n\tif err != nil {\n\t\tlog.Errorf(\"send create version event err: %v\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "21d1649b2997c1a12dca9ff7c927a45e", "score": "0.46408558", "text": "func initCreators() {\n\tif stageCreators != nil {\n\t\treturn\n\t}\n\tstageCreatorsInitLock.Lock()\n\tdefer stageCreatorsInitLock.Unlock()\n\tif stageCreators != nil {\n\t\treturn\n\t}\n\tstageCreators = map[string]stageCreator{\n\t\tStageTypeDocker: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn NewDocker(params.logger, params.registerer)\n\t\t},\n\t\tStageTypeCRI: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn NewCRI(params.logger, params.config, params.registerer)\n\t\t},\n\t\tStageTypeJSON: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newJSONStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeLogfmt: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newLogfmtStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeRegex: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newRegexStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeMetric: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newMetricStage(params.logger, params.config, params.registerer)\n\t\t},\n\t\tStageTypeLabel: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newLabelStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeLabelDrop: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newLabelDropStage(params.config)\n\t\t},\n\t\tStageTypeTimestamp: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newTimestampStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeOutput: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newOutputStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeMatch: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newMatcherStage(params.logger, params.jobName, params.config, params.registerer)\n\t\t},\n\t\tStageTypeTemplate: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newTemplateStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeTenant: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newTenantStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeReplace: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newReplaceStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeDrop: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newDropStage(params.logger, params.config, params.registerer)\n\t\t},\n\t\tStageTypeSampling: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newSamplingStage(params.logger, params.config, params.registerer)\n\t\t},\n\t\tStageTypeLimit: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newLimitStage(params.logger, params.config, params.registerer)\n\t\t},\n\t\tStageTypeMultiline: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newMultilineStage(params.logger, params.config)\n\t\t},\n\t\tStageTypePack: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newPackStage(params.logger, params.config, params.registerer)\n\t\t},\n\t\tStageTypeLabelAllow: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newLabelAllowStage(params.config)\n\t\t},\n\t\tStageTypeStaticLabels: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newStaticLabelsStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeDecolorize: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newDecolorizeStage(params.config)\n\t\t},\n\t\tStageTypeEventLogMessage: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newEventLogMessageStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeGeoIP: func(params StageCreationParams) (Stage, error) {\n\t\t\treturn newGeoIPStage(params.logger, params.config)\n\t\t},\n\t\tStageTypeNonIndexedLabels: newNonIndexedLabelsStage,\n\t}\n}", "title": "" }, { "docid": "6c81d8b3392fb850a4edd96f5bade59b", "score": "0.46377918", "text": "func CreateAppVersionArchive(appID string, sequence int64, archivePath string) error {\n\tpaths := []string{\n\t\tfilepath.Join(archivePath, \"upstream\"),\n\t\tfilepath.Join(archivePath, \"base\"),\n\t\tfilepath.Join(archivePath, \"overlays\"),\n\t}\n\n\tskippedFilesPath := filepath.Join(archivePath, \"skippedFiles\")\n\tif _, err := os.Stat(skippedFilesPath); err == nil {\n\t\tpaths = append(paths, skippedFilesPath)\n\t}\n\n\ttmpDir, err := ioutil.TempDir(\"\", \"kotsadm\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create temp file\")\n\t}\n\tdefer os.RemoveAll(tmpDir)\n\tfileToUpload := filepath.Join(tmpDir, \"archive.tar.gz\")\n\n\ttarGz := archiver.TarGz{\n\t\tTar: &archiver.Tar{\n\t\t\tImplicitTopLevelFolder: false,\n\t\t},\n\t}\n\tif err := tarGz.Archive(paths, fileToUpload); err != nil {\n\t\treturn errors.Wrap(err, \"failed to create archive\")\n\t}\n\n\tstorageBaseURI := os.Getenv(\"STORAGE_BASEURI\")\n\tif storageBaseURI == \"\" {\n\t\t// KOTS 1.15 and earlier only supported s3 and there was no configuration\n\t\tstorageBaseURI = fmt.Sprintf(\"s3://%s/%s\", os.Getenv(\"S3_ENDPOINT\"), os.Getenv(\"S3_BUCKET_NAME\"))\n\t}\n\n\tparsedURI, err := url.Parse(storageBaseURI)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to parse storage base uri\")\n\t}\n\n\tif parsedURI.Scheme == \"docker\" {\n\t\treturn createAppVersionDocker(appID, sequence, fileToUpload, storageBaseURI)\n\t} else if parsedURI.Scheme == \"s3\" {\n\t\treturn createAppVersionS3(appID, sequence, fileToUpload, parsedURI)\n\t}\n\n\treturn errors.Errorf(\"unknown storage base uri scheme: %q\", parsedURI.Scheme)\n}", "title": "" }, { "docid": "5518dd4feef7679512366c2f5ba87e29", "score": "0.46348882", "text": "func CreateCreateLaunchTemplateVersionRequest() (request *CreateLaunchTemplateVersionRequest) {\n\trequest = &CreateLaunchTemplateVersionRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Ecs\", \"2014-05-26\", \"CreateLaunchTemplateVersion\", \"ecs\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "52d166007d6ea2320fc696acb3cb300e", "score": "0.46152362", "text": "func NewCreateComponentVersionNotFound() *CreateComponentVersionNotFound {\n\treturn &CreateComponentVersionNotFound{}\n}", "title": "" }, { "docid": "944646968d2e371c038f802d649187e7", "score": "0.46119207", "text": "func NewVersion(ctx *pulumi.Context,\n\tname string, args *VersionArgs, opts ...pulumi.ResourceOption) (*Version, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.SiteId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'SiteId'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"project\",\n\t\t\"siteId\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Version\n\terr := ctx.RegisterResource(\"google-native:firebasehosting/v1beta1:Version\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "f60ef613caf6a9611f183d91b449f1f8", "score": "0.46077144", "text": "func NewStageBadRequest() *StageBadRequest {\n\n\treturn &StageBadRequest{}\n}", "title": "" }, { "docid": "3d7c66c92248608f3b7da23bff864254", "score": "0.46065593", "text": "func (h AdminHandler) CreateComponent(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\thook, err := h.hooks.Find(p.ByName(\"id\"))\n\tif err != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tparams := filterParams(r)\n\n\tif err := h.hooks.AddComponent(*hook, r.FormValue(\"c\"), params); err != nil {\n\t\t// TODO: show flash message\n\t\tlog.Printf(\"could not create component: %s\", err)\n\t}\n\thttp.Redirect(w, r, fmt.Sprintf(\"/hooks/edit/%s\", hook.ID), http.StatusSeeOther)\n}", "title": "" }, { "docid": "2cd8a7ecc77f02c7e9bdb10d16fdf196", "score": "0.45999965", "text": "func NewVersion(ctx *pulumi.Context,\n\tname string, args *VersionArgs, opts ...pulumi.ResourceOption) (*Version, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AppId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AppId'\")\n\t}\n\tif args.ServiceId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ServiceId'\")\n\t}\n\tvar resource Version\n\terr := ctx.RegisterResource(\"google-native:appengine/v1:Version\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "872d6796c745456e430e9a886fe90855", "score": "0.45964435", "text": "func NewCfnModuleVersion(scope awscdk.Construct, id *string, props *CfnModuleVersionProps) CfnModuleVersion {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnModuleVersion{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_cloudformation.CfnModuleVersion\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "a6dbc0414563649ce238bf07ae9c8d66", "score": "0.45905495", "text": "func (t *ConcurrentT) spawnStage(name string, n int) *stage {\n\tstage := t.getStage(name)\n\tstage.spawn(n)\n\treturn stage\n}", "title": "" }, { "docid": "f7b8258a5836305a606409720cc3262c", "score": "0.45695624", "text": "func startVersion(nodes nodeListOption, version string) versionStep {\n\treturn func(ctx context.Context, t *test, u *versionUpgradeTest) {\n\t\targs := startArgs(\"--binary=\" + cockroachBinaryPath(version))\n\t\tu.c.Start(ctx, t, nodes, args, startArgsDontEncrypt)\n\t}\n}", "title": "" }, { "docid": "e8a23cf1df2e651bef1420987e2a3237", "score": "0.45687503", "text": "func (c *Controller) StartPipeline(name, version, image string) error {\n\treturn c.Repo.RegisterNewCandidate(name, image, version)\n}", "title": "" }, { "docid": "cba89b9742c5191ada9c3042dcb938c3", "score": "0.45582876", "text": "func NewCreateComponentVersionNoContent() *CreateComponentVersionNoContent {\n\treturn &CreateComponentVersionNoContent{}\n}", "title": "" }, { "docid": "3f180d19e5a6a38ad14e3787d0c2d04f", "score": "0.455135", "text": "func (client *Client) CreateLaunchTemplateVersion(request *CreateLaunchTemplateVersionRequest) (response *CreateLaunchTemplateVersionResponse, err error) {\n\tresponse = CreateCreateLaunchTemplateVersionResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "8990a9faa45d468325f7ef90b0066b8d", "score": "0.4533814", "text": "func NewModuleVersion(ctx *pulumi.Context,\n\tname string, args *ModuleVersionArgs, opts ...pulumi.ResourceOption) (*ModuleVersion, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ModuleName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ModuleName'\")\n\t}\n\tif args.ModulePackage == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ModulePackage'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource ModuleVersion\n\terr := ctx.RegisterResource(\"aws-native:cloudformation:ModuleVersion\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "55d55a5f3f8bebbdc2dc9f6ea95ad4bc", "score": "0.45312694", "text": "func NewMockStage(ctrl *gomock.Controller) *MockStage {\n\tmock := &MockStage{ctrl: ctrl}\n\tmock.recorder = &MockStageMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "b792304726a3485c415b9d593c002002", "score": "0.45229244", "text": "func componentConverter(specVersion SpecVersion) func(*Component) {\n\treturn func(c *Component) {\n\t\tif specVersion < SpecVersion1_1 {\n\t\t\tc.BOMRef = \"\"\n\t\t\tc.ExternalReferences = nil\n\t\t\tif c.Modified == nil {\n\t\t\t\tc.Modified = Bool(false)\n\t\t\t}\n\t\t\tc.Pedigree = nil\n\t\t}\n\n\t\tif specVersion < SpecVersion1_2 {\n\t\t\tc.Author = \"\"\n\t\t\tc.MIMEType = \"\"\n\t\t\tif c.Pedigree != nil {\n\t\t\t\tc.Pedigree.Patches = nil\n\t\t\t}\n\t\t\tc.Supplier = nil\n\t\t\tc.SWID = nil\n\t\t}\n\n\t\tif specVersion < SpecVersion1_3 {\n\t\t\tc.Evidence = nil\n\t\t\tc.Properties = nil\n\t\t}\n\n\t\tif specVersion < SpecVersion1_4 {\n\t\t\tc.ReleaseNotes = nil\n\t\t\tif c.Version == \"\" {\n\t\t\t\tc.Version = \"0.0.0\"\n\t\t\t}\n\t\t}\n\n\t\tif !specVersion.supportsComponentType(c.Type) {\n\t\t\tc.Type = ComponentTypeApplication\n\t\t}\n\t\tconvertExternalReferences(c.ExternalReferences, specVersion)\n\t\tconvertHashes(c.Hashes, specVersion)\n\t\tconvertLicenses(c.Licenses, specVersion)\n\t\tif !specVersion.supportsScope(c.Scope) {\n\t\t\tc.Scope = \"\"\n\t\t}\n\t}\n}", "title": "" }, { "docid": "24c7bbd60288af646f3c94ef6df0197b", "score": "0.4521128", "text": "func uploadVersion(nodes nodeListOption, version string) versionStep {\n\treturn func(ctx context.Context, t *test, u *versionUpgradeTest) {\n\t\t// Put the binary.\n\t\tu.uploadVersion(ctx, t, nodes, version)\n\t}\n}", "title": "" }, { "docid": "8bbc24caa73190c744bbb4edb8793b22", "score": "0.45183533", "text": "func (rm *resourceManager) sdkCreate(\n\tctx context.Context,\n\tr *resource,\n) (*resource, error) {\n\tinput, err := rm.newCreateRequestPayload(ctx, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, respErr := rm.sdkapi.CreateLaunchTemplateVersionWithContext(ctx, input)\n\trm.metrics.RecordAPICall(\"CREATE\", \"CreateLaunchTemplateVersion\", respErr)\n\tif respErr != nil {\n\t\treturn nil, respErr\n\t}\n\t// Merge in the information we read from the API call above to the copy of\n\t// the original Kubernetes object we passed to the function\n\tko := r.ko.DeepCopy()\n\n\tif resp.LaunchTemplateVersion != nil {\n\t\tf0 := &svcapitypes.LaunchTemplateVersion_SDK{}\n\t\tif resp.LaunchTemplateVersion.CreateTime != nil {\n\t\t\tf0.CreateTime = &metav1.Time{*resp.LaunchTemplateVersion.CreateTime}\n\t\t}\n\t\tif resp.LaunchTemplateVersion.CreatedBy != nil {\n\t\t\tf0.CreatedBy = resp.LaunchTemplateVersion.CreatedBy\n\t\t}\n\t\tif resp.LaunchTemplateVersion.DefaultVersion != nil {\n\t\t\tf0.DefaultVersion = resp.LaunchTemplateVersion.DefaultVersion\n\t\t}\n\t\tif resp.LaunchTemplateVersion.LaunchTemplateData != nil {\n\t\t\tf0f3 := &svcapitypes.ResponseLaunchTemplateData{}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.BlockDeviceMappings != nil {\n\t\t\t\tf0f3f0 := []*svcapitypes.LaunchTemplateBlockDeviceMapping{}\n\t\t\t\tfor _, f0f3f0iter := range resp.LaunchTemplateVersion.LaunchTemplateData.BlockDeviceMappings {\n\t\t\t\t\tf0f3f0elem := &svcapitypes.LaunchTemplateBlockDeviceMapping{}\n\t\t\t\t\tif f0f3f0iter.DeviceName != nil {\n\t\t\t\t\t\tf0f3f0elem.DeviceName = f0f3f0iter.DeviceName\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f0iter.Ebs != nil {\n\t\t\t\t\t\tf0f3f0elemf1 := &svcapitypes.LaunchTemplateEBSBlockDevice{}\n\t\t\t\t\t\tif f0f3f0iter.Ebs.DeleteOnTermination != nil {\n\t\t\t\t\t\t\tf0f3f0elemf1.DeleteOnTermination = f0f3f0iter.Ebs.DeleteOnTermination\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif f0f3f0iter.Ebs.Encrypted != nil {\n\t\t\t\t\t\t\tf0f3f0elemf1.Encrypted = f0f3f0iter.Ebs.Encrypted\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif f0f3f0iter.Ebs.Iops != nil {\n\t\t\t\t\t\t\tf0f3f0elemf1.IOPS = f0f3f0iter.Ebs.Iops\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif f0f3f0iter.Ebs.KmsKeyId != nil {\n\t\t\t\t\t\t\tf0f3f0elemf1.KMSKeyID = f0f3f0iter.Ebs.KmsKeyId\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif f0f3f0iter.Ebs.SnapshotId != nil {\n\t\t\t\t\t\t\tf0f3f0elemf1.SnapshotID = f0f3f0iter.Ebs.SnapshotId\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif f0f3f0iter.Ebs.Throughput != nil {\n\t\t\t\t\t\t\tf0f3f0elemf1.Throughput = f0f3f0iter.Ebs.Throughput\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif f0f3f0iter.Ebs.VolumeSize != nil {\n\t\t\t\t\t\t\tf0f3f0elemf1.VolumeSize = f0f3f0iter.Ebs.VolumeSize\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif f0f3f0iter.Ebs.VolumeType != nil {\n\t\t\t\t\t\t\tf0f3f0elemf1.VolumeType = f0f3f0iter.Ebs.VolumeType\n\t\t\t\t\t\t}\n\t\t\t\t\t\tf0f3f0elem.EBS = f0f3f0elemf1\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f0iter.NoDevice != nil {\n\t\t\t\t\t\tf0f3f0elem.NoDevice = f0f3f0iter.NoDevice\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f0iter.VirtualName != nil {\n\t\t\t\t\t\tf0f3f0elem.VirtualName = f0f3f0iter.VirtualName\n\t\t\t\t\t}\n\t\t\t\t\tf0f3f0 = append(f0f3f0, f0f3f0elem)\n\t\t\t\t}\n\t\t\t\tf0f3.BlockDeviceMappings = f0f3f0\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification != nil {\n\t\t\t\tf0f3f1 := &svcapitypes.LaunchTemplateCapacityReservationSpecificationResponse{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference != nil {\n\t\t\t\t\tf0f3f1.CapacityReservationPreference = resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget != nil {\n\t\t\t\t\tf0f3f1f1 := &svcapitypes.CapacityReservationTargetResponse{}\n\t\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId != nil {\n\t\t\t\t\t\tf0f3f1f1.CapacityReservationID = resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId\n\t\t\t\t\t}\n\t\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn != nil {\n\t\t\t\t\t\tf0f3f1f1.CapacityReservationResourceGroupARN = resp.LaunchTemplateVersion.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupArn\n\t\t\t\t\t}\n\t\t\t\t\tf0f3f1.CapacityReservationTarget = f0f3f1f1\n\t\t\t\t}\n\t\t\t\tf0f3.CapacityReservationSpecification = f0f3f1\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions != nil {\n\t\t\t\tf0f3f2 := &svcapitypes.LaunchTemplateCPUOptions{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions.CoreCount != nil {\n\t\t\t\t\tf0f3f2.CoreCount = resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions.CoreCount\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions.ThreadsPerCore != nil {\n\t\t\t\t\tf0f3f2.ThreadsPerCore = resp.LaunchTemplateVersion.LaunchTemplateData.CpuOptions.ThreadsPerCore\n\t\t\t\t}\n\t\t\t\tf0f3.CPUOptions = f0f3f2\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CreditSpecification != nil {\n\t\t\t\tf0f3f3 := &svcapitypes.CreditSpecification{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.CreditSpecification.CpuCredits != nil {\n\t\t\t\t\tf0f3f3.CPUCredits = resp.LaunchTemplateVersion.LaunchTemplateData.CreditSpecification.CpuCredits\n\t\t\t\t}\n\t\t\t\tf0f3.CreditSpecification = f0f3f3\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.DisableApiTermination != nil {\n\t\t\t\tf0f3.DisableAPITermination = resp.LaunchTemplateVersion.LaunchTemplateData.DisableApiTermination\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.EbsOptimized != nil {\n\t\t\t\tf0f3.EBSOptimized = resp.LaunchTemplateVersion.LaunchTemplateData.EbsOptimized\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.ElasticGpuSpecifications != nil {\n\t\t\t\tf0f3f6 := []*svcapitypes.ElasticGPUSpecificationResponse{}\n\t\t\t\tfor _, f0f3f6iter := range resp.LaunchTemplateVersion.LaunchTemplateData.ElasticGpuSpecifications {\n\t\t\t\t\tf0f3f6elem := &svcapitypes.ElasticGPUSpecificationResponse{}\n\t\t\t\t\tif f0f3f6iter.Type != nil {\n\t\t\t\t\t\tf0f3f6elem.Type = f0f3f6iter.Type\n\t\t\t\t\t}\n\t\t\t\t\tf0f3f6 = append(f0f3f6, f0f3f6elem)\n\t\t\t\t}\n\t\t\t\tf0f3.ElasticGPUSpecifications = f0f3f6\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.ElasticInferenceAccelerators != nil {\n\t\t\t\tf0f3f7 := []*svcapitypes.LaunchTemplateElasticInferenceAcceleratorResponse{}\n\t\t\t\tfor _, f0f3f7iter := range resp.LaunchTemplateVersion.LaunchTemplateData.ElasticInferenceAccelerators {\n\t\t\t\t\tf0f3f7elem := &svcapitypes.LaunchTemplateElasticInferenceAcceleratorResponse{}\n\t\t\t\t\tif f0f3f7iter.Count != nil {\n\t\t\t\t\t\tf0f3f7elem.Count = f0f3f7iter.Count\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f7iter.Type != nil {\n\t\t\t\t\t\tf0f3f7elem.Type = f0f3f7iter.Type\n\t\t\t\t\t}\n\t\t\t\t\tf0f3f7 = append(f0f3f7, f0f3f7elem)\n\t\t\t\t}\n\t\t\t\tf0f3.ElasticInferenceAccelerators = f0f3f7\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.EnclaveOptions != nil {\n\t\t\t\tf0f3f8 := &svcapitypes.LaunchTemplateEnclaveOptions{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.EnclaveOptions.Enabled != nil {\n\t\t\t\t\tf0f3f8.Enabled = resp.LaunchTemplateVersion.LaunchTemplateData.EnclaveOptions.Enabled\n\t\t\t\t}\n\t\t\t\tf0f3.EnclaveOptions = f0f3f8\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.HibernationOptions != nil {\n\t\t\t\tf0f3f9 := &svcapitypes.LaunchTemplateHibernationOptions{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.HibernationOptions.Configured != nil {\n\t\t\t\t\tf0f3f9.Configured = resp.LaunchTemplateVersion.LaunchTemplateData.HibernationOptions.Configured\n\t\t\t\t}\n\t\t\t\tf0f3.HibernationOptions = f0f3f9\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile != nil {\n\t\t\t\tf0f3f10 := &svcapitypes.LaunchTemplateIAMInstanceProfileSpecification{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile.Arn != nil {\n\t\t\t\t\tf0f3f10.ARN = resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile.Arn\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile.Name != nil {\n\t\t\t\t\tf0f3f10.Name = resp.LaunchTemplateVersion.LaunchTemplateData.IamInstanceProfile.Name\n\t\t\t\t}\n\t\t\t\tf0f3.IAMInstanceProfile = f0f3f10\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.ImageId != nil {\n\t\t\t\tf0f3.ImageID = resp.LaunchTemplateVersion.LaunchTemplateData.ImageId\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceInitiatedShutdownBehavior != nil {\n\t\t\t\tf0f3.InstanceInitiatedShutdownBehavior = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceInitiatedShutdownBehavior\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions != nil {\n\t\t\t\tf0f3f13 := &svcapitypes.LaunchTemplateInstanceMarketOptions{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.MarketType != nil {\n\t\t\t\t\tf0f3f13.MarketType = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.MarketType\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions != nil {\n\t\t\t\t\tf0f3f13f1 := &svcapitypes.LaunchTemplateSpotMarketOptions{}\n\t\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil {\n\t\t\t\t\t\tf0f3f13f1.BlockDurationMinutes = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes\n\t\t\t\t\t}\n\t\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil {\n\t\t\t\t\t\tf0f3f13f1.InstanceInterruptionBehavior = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior\n\t\t\t\t\t}\n\t\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice != nil {\n\t\t\t\t\t\tf0f3f13f1.MaxPrice = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice\n\t\t\t\t\t}\n\t\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil {\n\t\t\t\t\t\tf0f3f13f1.SpotInstanceType = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType\n\t\t\t\t\t}\n\t\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil != nil {\n\t\t\t\t\t\tf0f3f13f1.ValidUntil = &metav1.Time{*resp.LaunchTemplateVersion.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil}\n\t\t\t\t\t}\n\t\t\t\t\tf0f3f13.SpotOptions = f0f3f13f1\n\t\t\t\t}\n\t\t\t\tf0f3.InstanceMarketOptions = f0f3f13\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.InstanceType != nil {\n\t\t\t\tf0f3.InstanceType = resp.LaunchTemplateVersion.LaunchTemplateData.InstanceType\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.KernelId != nil {\n\t\t\t\tf0f3.KernelID = resp.LaunchTemplateVersion.LaunchTemplateData.KernelId\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.KeyName != nil {\n\t\t\t\tf0f3.KeyName = resp.LaunchTemplateVersion.LaunchTemplateData.KeyName\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.LicenseSpecifications != nil {\n\t\t\t\tf0f3f17 := []*svcapitypes.LaunchTemplateLicenseConfiguration{}\n\t\t\t\tfor _, f0f3f17iter := range resp.LaunchTemplateVersion.LaunchTemplateData.LicenseSpecifications {\n\t\t\t\t\tf0f3f17elem := &svcapitypes.LaunchTemplateLicenseConfiguration{}\n\t\t\t\t\tif f0f3f17iter.LicenseConfigurationArn != nil {\n\t\t\t\t\t\tf0f3f17elem.LicenseConfigurationARN = f0f3f17iter.LicenseConfigurationArn\n\t\t\t\t\t}\n\t\t\t\t\tf0f3f17 = append(f0f3f17, f0f3f17elem)\n\t\t\t\t}\n\t\t\t\tf0f3.LicenseSpecifications = f0f3f17\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions != nil {\n\t\t\t\tf0f3f18 := &svcapitypes.LaunchTemplateInstanceMetadataOptions{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpEndpoint != nil {\n\t\t\t\t\tf0f3f18.HTTPEndpoint = resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpEndpoint\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpPutResponseHopLimit != nil {\n\t\t\t\t\tf0f3f18.HTTPPutResponseHopLimit = resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpPutResponseHopLimit\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpTokens != nil {\n\t\t\t\t\tf0f3f18.HTTPTokens = resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.HttpTokens\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.State != nil {\n\t\t\t\t\tf0f3f18.State = resp.LaunchTemplateVersion.LaunchTemplateData.MetadataOptions.State\n\t\t\t\t}\n\t\t\t\tf0f3.MetadataOptions = f0f3f18\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Monitoring != nil {\n\t\t\t\tf0f3f19 := &svcapitypes.LaunchTemplatesMonitoring{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Monitoring.Enabled != nil {\n\t\t\t\t\tf0f3f19.Enabled = resp.LaunchTemplateVersion.LaunchTemplateData.Monitoring.Enabled\n\t\t\t\t}\n\t\t\t\tf0f3.Monitoring = f0f3f19\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.NetworkInterfaces != nil {\n\t\t\t\tf0f3f20 := []*svcapitypes.LaunchTemplateInstanceNetworkInterfaceSpecification{}\n\t\t\t\tfor _, f0f3f20iter := range resp.LaunchTemplateVersion.LaunchTemplateData.NetworkInterfaces {\n\t\t\t\t\tf0f3f20elem := &svcapitypes.LaunchTemplateInstanceNetworkInterfaceSpecification{}\n\t\t\t\t\tif f0f3f20iter.AssociateCarrierIpAddress != nil {\n\t\t\t\t\t\tf0f3f20elem.AssociateCarrierIPAddress = f0f3f20iter.AssociateCarrierIpAddress\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.AssociatePublicIpAddress != nil {\n\t\t\t\t\t\tf0f3f20elem.AssociatePublicIPAddress = f0f3f20iter.AssociatePublicIpAddress\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.DeleteOnTermination != nil {\n\t\t\t\t\t\tf0f3f20elem.DeleteOnTermination = f0f3f20iter.DeleteOnTermination\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.Description != nil {\n\t\t\t\t\t\tf0f3f20elem.Description = f0f3f20iter.Description\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.DeviceIndex != nil {\n\t\t\t\t\t\tf0f3f20elem.DeviceIndex = f0f3f20iter.DeviceIndex\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.Groups != nil {\n\t\t\t\t\t\tf0f3f20elemf5 := []*string{}\n\t\t\t\t\t\tfor _, f0f3f20elemf5iter := range f0f3f20iter.Groups {\n\t\t\t\t\t\t\tvar f0f3f20elemf5elem string\n\t\t\t\t\t\t\tf0f3f20elemf5elem = *f0f3f20elemf5iter\n\t\t\t\t\t\t\tf0f3f20elemf5 = append(f0f3f20elemf5, &f0f3f20elemf5elem)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tf0f3f20elem.Groups = f0f3f20elemf5\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.InterfaceType != nil {\n\t\t\t\t\t\tf0f3f20elem.InterfaceType = f0f3f20iter.InterfaceType\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.Ipv6AddressCount != nil {\n\t\t\t\t\t\tf0f3f20elem.IPv6AddressCount = f0f3f20iter.Ipv6AddressCount\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.Ipv6Addresses != nil {\n\t\t\t\t\t\tf0f3f20elemf8 := []*svcapitypes.InstanceIPv6Address{}\n\t\t\t\t\t\tfor _, f0f3f20elemf8iter := range f0f3f20iter.Ipv6Addresses {\n\t\t\t\t\t\t\tf0f3f20elemf8elem := &svcapitypes.InstanceIPv6Address{}\n\t\t\t\t\t\t\tif f0f3f20elemf8iter.Ipv6Address != nil {\n\t\t\t\t\t\t\t\tf0f3f20elemf8elem.IPv6Address = f0f3f20elemf8iter.Ipv6Address\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tf0f3f20elemf8 = append(f0f3f20elemf8, f0f3f20elemf8elem)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tf0f3f20elem.IPv6Addresses = f0f3f20elemf8\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.NetworkCardIndex != nil {\n\t\t\t\t\t\tf0f3f20elem.NetworkCardIndex = f0f3f20iter.NetworkCardIndex\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.NetworkInterfaceId != nil {\n\t\t\t\t\t\tf0f3f20elem.NetworkInterfaceID = f0f3f20iter.NetworkInterfaceId\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.PrivateIpAddress != nil {\n\t\t\t\t\t\tf0f3f20elem.PrivateIPAddress = f0f3f20iter.PrivateIpAddress\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.PrivateIpAddresses != nil {\n\t\t\t\t\t\tf0f3f20elemf12 := []*svcapitypes.PrivateIPAddressSpecification{}\n\t\t\t\t\t\tfor _, f0f3f20elemf12iter := range f0f3f20iter.PrivateIpAddresses {\n\t\t\t\t\t\t\tf0f3f20elemf12elem := &svcapitypes.PrivateIPAddressSpecification{}\n\t\t\t\t\t\t\tif f0f3f20elemf12iter.Primary != nil {\n\t\t\t\t\t\t\t\tf0f3f20elemf12elem.Primary = f0f3f20elemf12iter.Primary\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif f0f3f20elemf12iter.PrivateIpAddress != nil {\n\t\t\t\t\t\t\t\tf0f3f20elemf12elem.PrivateIPAddress = f0f3f20elemf12iter.PrivateIpAddress\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tf0f3f20elemf12 = append(f0f3f20elemf12, f0f3f20elemf12elem)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tf0f3f20elem.PrivateIPAddresses = f0f3f20elemf12\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.SecondaryPrivateIpAddressCount != nil {\n\t\t\t\t\t\tf0f3f20elem.SecondaryPrivateIPAddressCount = f0f3f20iter.SecondaryPrivateIpAddressCount\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f20iter.SubnetId != nil {\n\t\t\t\t\t\tf0f3f20elem.SubnetID = f0f3f20iter.SubnetId\n\t\t\t\t\t}\n\t\t\t\t\tf0f3f20 = append(f0f3f20, f0f3f20elem)\n\t\t\t\t}\n\t\t\t\tf0f3.NetworkInterfaces = f0f3f20\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Placement != nil {\n\t\t\t\tf0f3f21 := &svcapitypes.LaunchTemplatePlacement{}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Placement.Affinity != nil {\n\t\t\t\t\tf0f3f21.Affinity = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.Affinity\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Placement.AvailabilityZone != nil {\n\t\t\t\t\tf0f3f21.AvailabilityZone = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.AvailabilityZone\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Placement.GroupName != nil {\n\t\t\t\t\tf0f3f21.GroupName = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.GroupName\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Placement.HostId != nil {\n\t\t\t\t\tf0f3f21.HostID = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.HostId\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Placement.HostResourceGroupArn != nil {\n\t\t\t\t\tf0f3f21.HostResourceGroupARN = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.HostResourceGroupArn\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Placement.PartitionNumber != nil {\n\t\t\t\t\tf0f3f21.PartitionNumber = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.PartitionNumber\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Placement.SpreadDomain != nil {\n\t\t\t\t\tf0f3f21.SpreadDomain = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.SpreadDomain\n\t\t\t\t}\n\t\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.Placement.Tenancy != nil {\n\t\t\t\t\tf0f3f21.Tenancy = resp.LaunchTemplateVersion.LaunchTemplateData.Placement.Tenancy\n\t\t\t\t}\n\t\t\t\tf0f3.Placement = f0f3f21\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.RamDiskId != nil {\n\t\t\t\tf0f3.RamDiskID = resp.LaunchTemplateVersion.LaunchTemplateData.RamDiskId\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.SecurityGroupIds != nil {\n\t\t\t\tf0f3f23 := []*string{}\n\t\t\t\tfor _, f0f3f23iter := range resp.LaunchTemplateVersion.LaunchTemplateData.SecurityGroupIds {\n\t\t\t\t\tvar f0f3f23elem string\n\t\t\t\t\tf0f3f23elem = *f0f3f23iter\n\t\t\t\t\tf0f3f23 = append(f0f3f23, &f0f3f23elem)\n\t\t\t\t}\n\t\t\t\tf0f3.SecurityGroupIDs = f0f3f23\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.SecurityGroups != nil {\n\t\t\t\tf0f3f24 := []*string{}\n\t\t\t\tfor _, f0f3f24iter := range resp.LaunchTemplateVersion.LaunchTemplateData.SecurityGroups {\n\t\t\t\t\tvar f0f3f24elem string\n\t\t\t\t\tf0f3f24elem = *f0f3f24iter\n\t\t\t\t\tf0f3f24 = append(f0f3f24, &f0f3f24elem)\n\t\t\t\t}\n\t\t\t\tf0f3.SecurityGroups = f0f3f24\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.TagSpecifications != nil {\n\t\t\t\tf0f3f25 := []*svcapitypes.LaunchTemplateTagSpecification{}\n\t\t\t\tfor _, f0f3f25iter := range resp.LaunchTemplateVersion.LaunchTemplateData.TagSpecifications {\n\t\t\t\t\tf0f3f25elem := &svcapitypes.LaunchTemplateTagSpecification{}\n\t\t\t\t\tif f0f3f25iter.ResourceType != nil {\n\t\t\t\t\t\tf0f3f25elem.ResourceType = f0f3f25iter.ResourceType\n\t\t\t\t\t}\n\t\t\t\t\tif f0f3f25iter.Tags != nil {\n\t\t\t\t\t\tf0f3f25elemf1 := []*svcapitypes.Tag{}\n\t\t\t\t\t\tfor _, f0f3f25elemf1iter := range f0f3f25iter.Tags {\n\t\t\t\t\t\t\tf0f3f25elemf1elem := &svcapitypes.Tag{}\n\t\t\t\t\t\t\tif f0f3f25elemf1iter.Key != nil {\n\t\t\t\t\t\t\t\tf0f3f25elemf1elem.Key = f0f3f25elemf1iter.Key\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif f0f3f25elemf1iter.Value != nil {\n\t\t\t\t\t\t\t\tf0f3f25elemf1elem.Value = f0f3f25elemf1iter.Value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tf0f3f25elemf1 = append(f0f3f25elemf1, f0f3f25elemf1elem)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tf0f3f25elem.Tags = f0f3f25elemf1\n\t\t\t\t\t}\n\t\t\t\t\tf0f3f25 = append(f0f3f25, f0f3f25elem)\n\t\t\t\t}\n\t\t\t\tf0f3.TagSpecifications = f0f3f25\n\t\t\t}\n\t\t\tif resp.LaunchTemplateVersion.LaunchTemplateData.UserData != nil {\n\t\t\t\tf0f3.UserData = resp.LaunchTemplateVersion.LaunchTemplateData.UserData\n\t\t\t}\n\t\t\tf0.LaunchTemplateData = f0f3\n\t\t}\n\t\tif resp.LaunchTemplateVersion.LaunchTemplateId != nil {\n\t\t\tf0.LaunchTemplateID = resp.LaunchTemplateVersion.LaunchTemplateId\n\t\t}\n\t\tif resp.LaunchTemplateVersion.LaunchTemplateName != nil {\n\t\t\tf0.LaunchTemplateName = resp.LaunchTemplateVersion.LaunchTemplateName\n\t\t}\n\t\tif resp.LaunchTemplateVersion.VersionDescription != nil {\n\t\t\tf0.VersionDescription = resp.LaunchTemplateVersion.VersionDescription\n\t\t}\n\t\tif resp.LaunchTemplateVersion.VersionNumber != nil {\n\t\t\tf0.VersionNumber = resp.LaunchTemplateVersion.VersionNumber\n\t\t}\n\t\tko.Status.LaunchTemplateVersion = f0\n\t}\n\tif resp.Warning != nil {\n\t\tf1 := &svcapitypes.ValidationWarning{}\n\t\tif resp.Warning.Errors != nil {\n\t\t\tf1f0 := []*svcapitypes.ValidationError{}\n\t\t\tfor _, f1f0iter := range resp.Warning.Errors {\n\t\t\t\tf1f0elem := &svcapitypes.ValidationError{}\n\t\t\t\tif f1f0iter.Code != nil {\n\t\t\t\t\tf1f0elem.Code = f1f0iter.Code\n\t\t\t\t}\n\t\t\t\tif f1f0iter.Message != nil {\n\t\t\t\t\tf1f0elem.Message = f1f0iter.Message\n\t\t\t\t}\n\t\t\t\tf1f0 = append(f1f0, f1f0elem)\n\t\t\t}\n\t\t\tf1.Errors = f1f0\n\t\t}\n\t\tko.Status.Warning = f1\n\t}\n\n\trm.setStatusDefaults(ko)\n\n\treturn &resource{ko}, nil\n}", "title": "" }, { "docid": "8c76b9d6fbefb296fa301f5ceaf7b171", "score": "0.45157766", "text": "func ArtifactPrepareVersionCommand() *cobra.Command {\n\tmetadata := artifactPrepareVersionMetadata()\n\tvar stepConfig artifactPrepareVersionOptions\n\tvar startTime time.Time\n\tvar commonPipelineEnvironment artifactPrepareVersionCommonPipelineEnvironment\n\n\tvar createArtifactPrepareVersionCmd = &cobra.Command{\n\t\tUse: \"artifactPrepareVersion\",\n\t\tShort: \"Prepares and potentially updates the artifact's version before building the artifact.\",\n\t\tLong: `Prepares and potentially updates the artifact's version before building the artifact.\n\nThe continuous delivery process requires that each build is done with a unique version number.\n\nThe version generated using this step will contain:\n\n* Version (major.minor.patch) from descriptor file in master repository is preserved. Developers should be able to autonomously decide on increasing either part of this version number.\n* Timestamp\n* CommitId (by default the long version of the hash)\n\nOptionally, but enabled by default, the new version is pushed as a new tag into the source code repository (e.g. GitHub).\nIf this option is chosen, git credentials and the repository URL needs to be provided.\nSince you might not want to configure the git credentials in Jenkins, committing and pushing can be disabled using the ` + \"`\" + `commitVersion` + \"`\" + ` parameter as described below.\nIf you require strict reproducibility of your builds, this should be used.`,\n\t\tPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tstartTime = time.Now()\n\t\t\tlog.SetStepName(\"artifactPrepareVersion\")\n\t\t\tlog.SetVerbose(GeneralConfig.Verbose)\n\t\t\treturn PrepareConfig(cmd, &metadata, \"artifactPrepareVersion\", &stepConfig, config.OpenPiperFile)\n\t\t},\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\ttelemetryData := telemetry.CustomData{}\n\t\t\ttelemetryData.ErrorCode = \"1\"\n\t\t\thandler := func() {\n\t\t\t\tcommonPipelineEnvironment.persist(GeneralConfig.EnvRootPath, \"commonPipelineEnvironment\")\n\t\t\t\ttelemetryData.Duration = fmt.Sprintf(\"%v\", time.Since(startTime).Milliseconds())\n\t\t\t\ttelemetry.Send(&telemetryData)\n\t\t\t}\n\t\t\tlog.DeferExitHandler(handler)\n\t\t\tdefer handler()\n\t\t\ttelemetry.Initialize(GeneralConfig.NoTelemetry, \"artifactPrepareVersion\")\n\t\t\tartifactPrepareVersion(stepConfig, &telemetryData, &commonPipelineEnvironment)\n\t\t\ttelemetryData.ErrorCode = \"0\"\n\t\t},\n\t}\n\n\taddArtifactPrepareVersionFlags(createArtifactPrepareVersionCmd, &stepConfig)\n\treturn createArtifactPrepareVersionCmd\n}", "title": "" }, { "docid": "46a355dd83fd27ef76de8ddc829f414b", "score": "0.45047903", "text": "func newVersionInfo(status configv1.ClusterVersionStatus) (*versionInfo, error) {\n\tif len(status.History) == 0 {\n\t\treturn nil, fmt.Errorf(\"failed to get history of ClusterVersion version\")\n\t}\n\tcurrent := status.History[0]\n\tret := &versionInfo{\n\t\tversion: current.Version,\n\t\tstate: current.State,\n\t\t// soak a day after a Z-stream upgrade\n\t\tstable: current.State == configv1.CompletedUpdate && current.CompletionTime != nil && time.Since(current.CompletionTime.Time) > 24*time.Hour,\n\t\tstableDuration: \"1 day\",\n\t}\n\tcv, err := semver.Make(current.Version)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to determine semantic version: %s\", current.Version)\n\t}\n\tret.semanticVersion = cv\n\tif ret.stable && len(status.History) > 1 {\n\t\tprevious := status.History[1]\n\t\tpv, err := semver.Make(previous.Version)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to determine semantic version: %s\", previous.Version)\n\t\t}\n\t\tif cv.Minor > pv.Minor {\n\t\t\t// soak a week after a Y-stream upgrade\n\t\t\tret.stable = time.Since(current.CompletionTime.Time) > 7*24*time.Hour\n\t\t\tret.stableDuration = \"7 days\"\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "2da43f8d7f151501100ca6bbeb74fc2e", "score": "0.44980076", "text": "func (mr *MockStoreMockRecorder) CreateAppVersion(appID, baseSequence, filesInDir, source, skipPreflights, gitops, renderer interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateAppVersion\", reflect.TypeOf((*MockStore)(nil).CreateAppVersion), appID, baseSequence, filesInDir, source, skipPreflights, gitops, renderer)\n}", "title": "" }, { "docid": "5a4cee9c931c2720b60cc68589d92c99", "score": "0.44964525", "text": "func (s *Stage) New(kind, result string) {\n\ts.Kind = kind\n\ts.Result = result\n}", "title": "" }, { "docid": "8c86233c61dcc80a5dbc9c8573ba8160", "score": "0.44944447", "text": "func CfnStage_IsConstruct(x interface{}) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_apigateway.CfnStage\",\n\t\t\"isConstruct\",\n\t\t[]interface{}{x},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "72094c3ce4c48fa03867d2266398be22", "score": "0.44943282", "text": "func NewVersion(identifier string, features []string) Version {\n\treturn Version{\n\t\tIdentifier: identifier,\n\t\tFeatures: features,\n\t}\n}", "title": "" }, { "docid": "89464515c7892cc4b43ffb79021e8149", "score": "0.44931182", "text": "func Version() Info {\n\tcoreWithPreRelease := scmTag\n\tif len(coreWithPreRelease) == 0 {\n\t\tcoreWithPreRelease = \"0.0.0-alpha\"\n\t}\n\tbuild := scmCommit\n\tif len(build) == 0 {\n\t\tbuild = \"manual\"\n\t}\n\treturn Info{\n\t\tCoreWithPreRelease: coreWithPreRelease,\n\t\tBuild: build,\n\t}\n}", "title": "" }, { "docid": "c00970930a093d982bb33a7bf39b5cbd", "score": "0.44904062", "text": "func (mvc *ModuleVersionCreate) Save(ctx context.Context) (*ModuleVersion, error) {\n\tif mvc.major == nil {\n\t\treturn nil, errors.New(\"ent: missing required field \\\"major\\\"\")\n\t}\n\tif err := moduleversion.MajorValidator(*mvc.major); err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"major\\\": %v\", err)\n\t}\n\tif mvc.minor == nil {\n\t\treturn nil, errors.New(\"ent: missing required field \\\"minor\\\"\")\n\t}\n\tif err := moduleversion.MinorValidator(*mvc.minor); err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"minor\\\": %v\", err)\n\t}\n\tif mvc.patch == nil {\n\t\treturn nil, errors.New(\"ent: missing required field \\\"patch\\\"\")\n\t}\n\tif err := moduleversion.PatchValidator(*mvc.patch); err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"patch\\\": %v\", err)\n\t}\n\tif mvc.tag == nil {\n\t\treturn nil, errors.New(\"ent: missing required field \\\"tag\\\"\")\n\t}\n\tif len(mvc.module) > 1 {\n\t\treturn nil, errors.New(\"ent: multiple assignments on a unique edge \\\"module\\\"\")\n\t}\n\tif mvc.module == nil {\n\t\treturn nil, errors.New(\"ent: missing required edge \\\"module\\\"\")\n\t}\n\treturn mvc.sqlSave(ctx)\n}", "title": "" }, { "docid": "ac68901bec0954be8838695aa4711d44", "score": "0.44889325", "text": "func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {\n\tdefer util.EntryFunction(\"NodeStageVolume\")()\n\n\tcapRsp, _ := ns.NodeGetCapabilities(context.Background(), nil)\n\tif flag := util.ContainsNodeServiceCapability(capRsp.GetCapabilities(),\n\t\tcsi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME); flag == false {\n\t\tglog.Errorf(\"driver capability %v\", capRsp.GetCapabilities())\n\t\treturn nil, status.Error(codes.Unimplemented, \"Node has not unstage capability.\")\n\t}\n\n\t// Check arguments\n\tglog.Info(\"Check input arguments.\")\n\tif len(req.GetVolumeId()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID missing in request.\")\n\t}\n\tif len(req.GetStagingTargetPath()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Target path missing in request.\")\n\t}\n\tif req.GetVolumeCapability() == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume capability missing in request.\")\n\t}\n\t// Set parameter\n\tvolumeId := req.GetVolumeId()\n\ttargetPath := req.GetStagingTargetPath()\n\n\t// create sc object\n\tglog.Info(\"Get storage class from map.\")\n\tsc, err := manager.NewNeonsanStorageClassFromMap(req.VolumeAttributes)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t}\n\n\t// Check volume exist\n\tglog.Infof(\"Find volume [%s] in pool [%s].\", volumeId, sc.Pool)\n\tvolInfo, err := manager.FindVolume(volumeId, sc.Pool)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tif volInfo == nil {\n\t\tglog.Errorf(\"Not found volume [%s] in pool [%s].\", volumeId, sc.Pool)\n\t\treturn nil, status.Errorf(codes.NotFound, \"Volume [%s] does not exist\", volumeId)\n\t}\n\tglog.Infof(\"Found volume [%s] in pool [%s] info [%v]\", volumeId, sc.Pool, volInfo)\n\n\t// Attach volume\n\t// map volume\n\tglog.Infof(\"Map volume [%s] in pool [%s].\", volumeId, sc.Pool)\n\terr = manager.AttachVolume(volumeId, sc.Pool)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tglog.Infof(\"Succeed to map volume [%s].\", volumeId)\n\n\t// find volume device path\n\tglog.Infof(\"Find volume [%s] mapping info.\", volumeId)\n\tvar attInfo *manager.AttachInfo = nil\n\tfor i := 1; i < 6; i++ {\n\t\tattInfo, err = manager.FindAttachedVolumeWithoutPool(volumeId)\n\t\tif err != nil {\n\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t}\n\t\tif attInfo != nil {\n\t\t\tbreak\n\t\t}\n\t\tglog.Warningf(\"Cannot find attached volume [%s], [%d] remaining retries...\", volumeId, i)\n\t\ttime.Sleep(time.Duration(i) * time.Second)\n\t}\n\n\tglog.Infof(\"Found volume [%s] attached info [%v]\", volumeId, attInfo)\n\tif attInfo == nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"Cannot find attached volume [%s].\", volumeId)\n\t} else if attInfo.Pool != sc.Pool {\n\t\treturn nil, status.Errorf(codes.Internal, \"Volume [%s] pool mismatch: expect pool [%s], \"+\n\t\t\t\"but actually [%s].\", volumeId, sc.Pool, attInfo.Pool)\n\t}\n\n\t// if volume already mounted\n\tglog.Infof(\"Check targetPath [%s] mount info.\", targetPath)\n\tnotMnt, err := mount.New(\"\").IsLikelyNotMountPoint(targetPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tif err = os.MkdirAll(targetPath, 0750); err != nil {\n\t\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t\t}\n\t\t\tnotMnt = true\n\t\t} else {\n\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t}\n\t}\n\n\t// already mount\n\tglog.Infof(\"Is target path [%s] mounted: [%t].\", targetPath, !notMnt)\n\tif !notMnt {\n\t\tglog.Warningf(\"Target path [%s] has been mounted.\", targetPath)\n\t\treturn &csi.NodeStageVolumeResponse{}, nil\n\t}\n\tglog.Infof(\"Target path [%s] has not been mounted yet.\", targetPath)\n\n\t// do mount\n\tdevicePath := attInfo.Device\n\tfsType := sc.VolumeFsType\n\tglog.Infof(\"Mounting [%s] to [%s] with format [%s]...\", volumeId, targetPath, fsType)\n\tdiskMounter := &mount.SafeFormatAndMount{Interface: mount.New(\"\"), Exec: mount.NewOsExec()}\n\tif err := diskMounter.FormatAndMount(devicePath, targetPath, fsType, []string{}); err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tglog.Infof(\"Mount [%s] to [%s] succeed.\", volumeId, targetPath)\n\n\treturn &csi.NodeStageVolumeResponse{}, nil\n}", "title": "" }, { "docid": "afdf5bd118619c0046a52fd4ef408d88", "score": "0.44885704", "text": "func Dsbevd2stage(jobz byte, uplo mat.MatUplo, n, kd int, ab *mat.Matrix, w *mat.Vector, z *mat.Matrix, work *mat.Vector, lwork int, iwork *[]int, liwork int) (info int, err error) {\n\tvar lower, lquery, wantz bool\n\tvar anrm, bignum, eps, one, rmax, rmin, safmin, sigma, smlnum, zero float64\n\tvar ib, inde, indhous, indwk2, indwrk, iscale, lhtrd, liwmin, llwork, llwrk2, lwmin, lwtrd int\n\n\tzero = 0.0\n\tone = 1.0\n\n\t// Test the input parameters.\n\twantz = jobz == 'V'\n\tlower = uplo == Lower\n\tlquery = (lwork == -1 || liwork == -1)\n\n\tif n <= 1 {\n\t\tliwmin = 1\n\t\tlwmin = 1\n\t} else {\n\t\tib = Ilaenv2stage(2, \"DsytrdSb2st\", []byte{jobz}, n, kd, -1, -1)\n\t\tlhtrd = Ilaenv2stage(3, \"DsytrdSb2st\", []byte{jobz}, n, kd, ib, -1)\n\t\tlwtrd = Ilaenv2stage(4, \"DsytrdSb2st\", []byte{jobz}, n, kd, ib, -1)\n\t\tif wantz {\n\t\t\tliwmin = 3 + 5*n\n\t\t\tlwmin = 1 + 5*n + 2*pow(n, 2)\n\t\t} else {\n\t\t\tliwmin = 1\n\t\t\tlwmin = max(2*n, n+lhtrd+lwtrd)\n\t\t}\n\t}\n\tif jobz != 'N' {\n\t\terr = fmt.Errorf(\"jobz != 'N': jobz='%c'\", jobz)\n\t} else if !(lower || uplo == Upper) {\n\t\terr = fmt.Errorf(\"!(lower || uplo == Upper): uplo=%s\", uplo)\n\t} else if n < 0 {\n\t\terr = fmt.Errorf(\"n < 0: n=%v\", n)\n\t} else if kd < 0 {\n\t\terr = fmt.Errorf(\"kd < 0: kd=%v\", kd)\n\t} else if ab.Rows < kd+1 {\n\t\terr = fmt.Errorf(\"ab.Rows < kd+1: ab.Rows=%v, kd=%v\", ab.Rows, kd)\n\t} else if z.Rows < 1 || (wantz && z.Rows < n) {\n\t\terr = fmt.Errorf(\"z.Rows < 1 || (wantz && z.Rows < n): jobz='%c', z.Rows=%v, n=%v\", jobz, z.Rows, n)\n\t}\n\n\tif err == nil {\n\t\twork.Set(0, float64(lwmin))\n\t\t(*iwork)[0] = liwmin\n\n\t\tif lwork < lwmin && !lquery {\n\t\t\terr = fmt.Errorf(\"lwork < lwmin && !lquery: lwork=%v, lwmin=%v, lquery=%v\", lwork, lwmin, lquery)\n\t\t} else if liwork < liwmin && !lquery {\n\t\t\terr = fmt.Errorf(\"liwork < liwmin && !lquery: liwork=%v, liwmin=%v, lquery=%v\", liwork, liwmin, lquery)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\tgltest.Xerbla2(\"Dsbevd2stage\", err)\n\t\treturn\n\t} else if lquery {\n\t\treturn\n\t}\n\n\t// Quick return if possible\n\tif n == 0 {\n\t\treturn\n\t}\n\n\tif n == 1 {\n\t\tw.Set(0, ab.Get(0, 0))\n\t\tif wantz {\n\t\t\tz.Set(0, 0, one)\n\t\t}\n\t\treturn\n\t}\n\n\t// Get machine constants.\n\tsafmin = Dlamch(SafeMinimum)\n\teps = Dlamch(Precision)\n\tsmlnum = safmin / eps\n\tbignum = one / smlnum\n\trmin = math.Sqrt(smlnum)\n\trmax = math.Sqrt(bignum)\n\n\t// Scale matrix to allowable range, if necessary.\n\tanrm = Dlansb('M', uplo, n, kd, ab, work)\n\tiscale = 0\n\tif anrm > zero && anrm < rmin {\n\t\tiscale = 1\n\t\tsigma = rmin / anrm\n\t} else if anrm > rmax {\n\t\tiscale = 1\n\t\tsigma = rmax / anrm\n\t}\n\tif iscale == 1 {\n\t\tif lower {\n\t\t\tif err = Dlascl('B', kd, kd, one, sigma, n, n, ab); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err = Dlascl('Q', kd, kd, one, sigma, n, n, ab); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Call DsytrdSb2st to reduce band symmetric matrix to tridiagonal form.\n\tinde = 1\n\tindhous = inde + n\n\tindwrk = indhous + lhtrd\n\tllwork = lwork - indwrk + 1\n\tindwk2 = indwrk + n*n\n\tllwrk2 = lwork - indwk2 + 1\n\n\tif err = DsytrdSb2st('N', jobz, uplo, n, kd, ab, w, work.Off(inde-1), work.Off(indhous-1), lhtrd, work.Off(indwrk-1), llwork); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// For eigenvalues only, call DSTERF. For eigenvectors, call SSTEDC.\n\tif !wantz {\n\t\tif info, err = Dsterf(n, w, work.Off(inde-1)); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tif info, err = Dstedc('I', n, w, work.Off(inde-1), work.Off(indwrk-1).Matrix(n, opts), work.Off(indwk2-1), llwrk2, iwork, liwork); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif err = work.Off(indwk2-1).Matrix(n, opts).Gemm(NoTrans, NoTrans, n, n, n, one, z, work.Off(indwrk-1).Matrix(n, opts), zero); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tDlacpy(Full, n, n, work.Off(indwk2-1).Matrix(n, opts), z)\n\t}\n\n\t// If matrix was scaled, then rescale eigenvalues appropriately.\n\tif iscale == 1 {\n\t\tw.Scal(n, one/sigma, 1)\n\t}\n\n\twork.Set(0, float64(lwmin))\n\t(*iwork)[0] = liwmin\n\n\treturn\n}", "title": "" }, { "docid": "887b94f0e2fc74f55d6e8f9ee3909e11", "score": "0.4487555", "text": "func (uds *utxoDiffStore) Stage(stagingArea *model.StagingArea, blockHash *externalapi.DomainHash,\n\tutxoDiff externalapi.UTXODiff, utxoDiffChild *externalapi.DomainHash) {\n\n\tstagingShard := uds.stagingShard(stagingArea)\n\n\tstagingShard.utxoDiffToAdd[*blockHash] = utxoDiff\n\n\tif utxoDiffChild != nil {\n\t\tstagingShard.utxoDiffChildToAdd[*blockHash] = utxoDiffChild\n\t}\n}", "title": "" }, { "docid": "99fd61fbb274af600a8167f8222113e8", "score": "0.44860217", "text": "func PostProjectProjectNameStageStageNameServiceHandlerFunc(params service.PostProjectProjectNameStageStageNameServiceParams) middleware.Responder {\n\tcommon.Lock()\n\tdefer common.UnLock()\n\tlogger := utils.NewLogger(\"\", \"\", \"configuration-service\")\n\tprojectConfigPath := config.ConfigDir + \"/\" + params.ProjectName\n\tservicePath := projectConfigPath + \"/\" + params.Service.ServiceName\n\n\tif !common.StageExists(params.ProjectName, params.StageName) {\n\t\treturn service.NewPostProjectProjectNameStageStageNameServiceDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String(\"Stage \" + params.StageName + \" does not exist.\")})\n\t}\n\n\tif common.ServiceExists(params.ProjectName, params.StageName, params.Service.ServiceName) {\n\t\treturn service.NewPostProjectProjectNameStageStageNameServiceBadRequest().WithPayload(&models.Error{Code: 400, Message: swag.String(\"Service already exists\")})\n\t}\n\tlogger.Debug(\"Creating new resource(s) in: \" + projectConfigPath + \" in stage \" + params.StageName)\n\tlogger.Debug(\"Checking out branch: \" + params.StageName)\n\terr := common.CheckoutBranch(params.ProjectName, params.StageName)\n\tif err != nil {\n\t\tlogger.Error(err.Error())\n\t\treturn service.NewPostProjectProjectNameStageStageNameServiceDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String(\"Could not check out branch\")})\n\t}\n\terr = os.MkdirAll(servicePath, os.ModePerm)\n\tif err != nil {\n\t\tlogger.Error(err.Error())\n\t\treturn service.NewPostProjectProjectNameStageStageNameServiceDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String(\"Could not create service directory\")})\n\t}\n\n\tnewServiceMetadata := &serviceMetadata{\n\t\tServiceName: params.Service.ServiceName,\n\t\tCreationTimestamp: time.Now().String(),\n\t}\n\n\tmetadataString, err := yaml.Marshal(newServiceMetadata)\n\terr = common.WriteFile(servicePath+\"/metadata.yaml\", metadataString)\n\n\tcommon.StageAndCommitAll(params.ProjectName, \"Added service: \"+params.Service.ServiceName)\n\treturn service.NewPostProjectProjectNameStageStageNameServiceNoContent()\n}", "title": "" }, { "docid": "49459f4bc9ee2fd59446bbc85d6d0bcf", "score": "0.44797587", "text": "func NewVersion(ver semver.Version, releaseType string) semver.Version {\n\tswitch releaseType {\n\tcase \"major\":\n\t\tver.Major++\n\t\tver.Minor = 0\n\t\tver.Patch = 0\n\tcase \"minor\":\n\t\tver.Minor++\n\t\tver.Patch = 0\n\tcase \"patch\":\n\t\tver.Patch++\n\t}\n\treturn ver\n}", "title": "" }, { "docid": "6d8a10c572a2b5354f500373052e91f4", "score": "0.4473962", "text": "func NewVersionEndpoint(version, revision string) func(http.ResponseWriter, *http.Request, httprouter.Params) {\n\tif version == \"\" {\n\t\tversion = versionEndpointValueNotSet\n\t}\n\tif revision == \"\" {\n\t\trevision = versionEndpointValueNotSet\n\t}\n\n\tresponse, err := json.Marshal(struct {\n\t\tRevision string `json:\"revision\"`\n\t\tVersion string `json:\"version\"`\n\t}{\n\t\tRevision: revision,\n\t\tVersion: version,\n\t})\n\tif err != nil {\n\t\tlog.Errorf(\"error creating /version endpoint response: %v\", err)\n\t}\n\n\treturn func(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {\n\t\tw.Write(response)\n\t}\n}", "title": "" }, { "docid": "428382fab7f502093a57089cbc5b5b25", "score": "0.44703272", "text": "func TestCreateProjectIncorrectStageNameCmd(t *testing.T) {\n\tcredentialmanager.MockAuthCreds = true\n\n\tshipyardFileName := \"shipyard.yaml\"\n\tshipyardContent := `stages:\n- name: dev\n deployment_strategy: direct\n- name: staging-projectA\n deployment_strategy: blue_green_service\n- name: production\n deployment_strategy: blue_green_service`\n\n\tdefer testShipyard(t, shipyardFileName, shipyardContent)()\n\n\targs := []string{\n\t\t\"create\",\n\t\t\"project\",\n\t\t\"sockshop\",\n\t\tfmt.Sprintf(\"--shipyard=%s\", shipyardFileName),\n\t}\n\trootCmd.SetArgs(args)\n\terr := rootCmd.Execute()\n\n\tif err != nil {\n\t\tif !errorContains(err, \"contains upper case letter(s) or special character(s)\") {\n\t\t\tt.Errorf(\"An error occured: %v\", err)\n\t\t}\n\t} else {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "a7823b5e5bd9230fcb3f7a07067e503f", "score": "0.44611004", "text": "func CreateCreateLaunchTemplateVersionResponse() (response *CreateLaunchTemplateVersionResponse) {\n\tresponse = &CreateLaunchTemplateVersionResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "5df6253788281bc0aba4bcd40df68a61", "score": "0.44603723", "text": "func (c *Controller) CompleteStageFor(name, version, stage string) error {\n\treturn c.Repo.CompleteStage(name, version, stage)\n}", "title": "" }, { "docid": "3c96abd9759ddf96ab8d55e643df1fff", "score": "0.44571504", "text": "func NewVersion(ctx context.Context, dirname string) (*Version, error) {\n\tconf, ok := ctx.Value(CtxKeyConfig).(*config.Config)\n\tif !ok {\n\t\treturn nil, errors.New(\"no config in context\")\n\t}\n\tcli, ok := ctx.Value(CtxKeyClient).(*client.Client)\n\tif !ok {\n\t\treturn nil, errors.New(\"no push extension client in context\")\n\t}\n\n\tfileInfos, err := ioutil.ReadDir(dirname)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to ReadDir\")\n\t}\n\n\tvar version = Version{\n\t\tName: filepath.Base(dirname),\n\t\tDirname: dirname,\n\t\tSpec: new(apistructs.Spec),\n\t\tSpecContent: nil,\n\t\tDiceContent: nil,\n\t\tReadmeContent: nil,\n\t\tSwaggerContent: nil,\n\t\tconf: conf,\n\t\tclient: cli,\n\t}\n\tfor _, fileInfo := range fileInfos {\n\t\tif fileInfo.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tswitch {\n\t\tcase strings.EqualFold(fileInfo.Name(), \"spec.yml\") || strings.EqualFold(fileInfo.Name(), \"spec.yaml\"):\n\t\t\tversion.SpecContent, err = ioutil.ReadFile(filepath.Join(dirname, fileInfo.Name()))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"failed to ReadFile\")\n\t\t\t}\n\t\t\tif err = yaml.Unmarshal(version.SpecContent, version.Spec); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"failed to parse \"+fileInfo.Name())\n\t\t\t}\n\n\t\tcase strings.EqualFold(fileInfo.Name(), \"dice.yml\") || strings.EqualFold(fileInfo.Name(), \"dice.yaml\"):\n\t\t\tversion.DiceContent, _ = ioutil.ReadFile(filepath.Join(dirname, fileInfo.Name()))\n\n\t\tcase strings.EqualFold(fileInfo.Name(), \"readme.md\") || strings.EqualFold(fileInfo.Name(), \"readme.markdown\"):\n\t\t\tversion.ReadmeContent, _ = ioutil.ReadFile(filepath.Join(dirname, fileInfo.Name()))\n\n\t\tcase strings.EqualFold(fileInfo.Name(), \"swagger.json\") || strings.EqualFold(fileInfo.Name(), \"swagger.yml\") ||\n\t\t\tstrings.EqualFold(fileInfo.Name(), \"swagger.yaml\"):\n\t\t\tversion.SwaggerContent, _ = ioutil.ReadFile(filepath.Join(dirname, fileInfo.Name()))\n\t\t}\n\t}\n\n\tif version.Spec == nil || len(version.SpecContent) == 0 {\n\t\treturn nil, errors.Errorf(\"spec file not found in %s\", dirname)\n\t}\n\n\t// replace registry\n\tif conf.Registry != \"\" && len(version.DiceContent) > 0 {\n\t\tcontent, _, err := replaceDiceRegistry(version.DiceContent, version.Spec.Type, conf.Registry)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Errorf(\"failed to replace registry in dice.yml, dirname: %s\", dirname)\n\t\t}\n\t\tversion.DiceContent = content\n\t}\n\n\treturn &version, nil\n}", "title": "" }, { "docid": "e11eb10d7a64f2f8a2bc0431fd41ed0b", "score": "0.44421947", "text": "func NewVersion(identifier string, features []string) *Version {\n\treturn &Version{\n\t\tIdentifier: identifier,\n\t\tFeatures: features,\n\t}\n}", "title": "" }, { "docid": "9255af432b5a147485d9d0fa02fb75da", "score": "0.44388855", "text": "func (m *MockVersionStore) CreateAppVersion(appID string, baseSequence *int64, filesInDir, source string, skipPreflights bool, gitops types5.DownstreamGitOps, renderer types10.Renderer) (int64, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateAppVersion\", appID, baseSequence, filesInDir, source, skipPreflights, gitops, renderer)\n\tret0, _ := ret[0].(int64)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8fbabe58e1e6680b2025b6ca1b90c70b", "score": "0.44371158", "text": "func Stage_IsConstruct(x interface{}) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_apigateway.Stage\",\n\t\t\"isConstruct\",\n\t\t[]interface{}{x},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c672b66667c575794f6b62ed5b0bfb7f", "score": "0.44361013", "text": "func (objectSet *VersionObjectSet) CreateObject(payload *nimbleos.Version) (*nimbleos.Version, error) {\n\treturn nil, fmt.Errorf(\"Unsupported operation 'create' on Version\")\n}", "title": "" }, { "docid": "bf99ef82f7de5472c03f1a90d42bbfaa", "score": "0.44345543", "text": "func (o *CreateFlowVersionParams) WithBody(body *models.VersionedFlowSnapshot) *CreateFlowVersionParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "9413439cf4de23e030dea23dbcf9fc8a", "score": "0.44321814", "text": "func (g *jsiiProxy_GoFunction) AddVersion(name *string, codeSha256 *string, description *string, provisionedExecutions *float64, asyncInvokeConfig *awslambda.EventInvokeConfigOptions) awslambda.Version {\n\tvar returns awslambda.Version\n\n\t_jsii_.Invoke(\n\t\tg,\n\t\t\"addVersion\",\n\t\t[]interface{}{name, codeSha256, description, provisionedExecutions, asyncInvokeConfig},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1c995d2f60cbbd5c83c134b048d14fb2", "score": "0.4430811", "text": "func NewCfnResourceVersion(scope awscdk.Construct, id *string, props *CfnResourceVersionProps) CfnResourceVersion {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnResourceVersion{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_cloudformation.CfnResourceVersion\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "b3ba8d6678a008bb6ac550abbf2e0d39", "score": "0.4424128", "text": "func (a *KubernetesApiService) CreateKubernetesVersion(ctx context.Context) ApiCreateKubernetesVersionRequest {\n\treturn ApiCreateKubernetesVersionRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "136ada872437db99b79645b04889496b", "score": "0.44237238", "text": "func NewCfnStageV2_Override(c CfnStageV2, scope awscdk.Construct, id *string, props *CfnStageV2Props) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_apigateway.CfnStageV2\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "title": "" }, { "docid": "3f8e8ffa8a5f544cbeddfe68db16bc93", "score": "0.4423139", "text": "func (mr *MockVersionStoreMockRecorder) CreateAppVersion(appID, baseSequence, filesInDir, source, skipPreflights, gitops, renderer interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateAppVersion\", reflect.TypeOf((*MockVersionStore)(nil).CreateAppVersion), appID, baseSequence, filesInDir, source, skipPreflights, gitops, renderer)\n}", "title": "" }, { "docid": "9a6a2cbbc90c32c05c669d316a7f329d", "score": "0.44230822", "text": "func CalculateNewVersion(changelog *model.Changelog, previousVersion string, isCurrentPreview bool) (*semver.Version, error) {\n\tversion, err := semver.NewVersion(previousVersion)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Printf(\"Lastest version is: %s\", version.String())\n\n\tvar newVersion semver.Version\n\tif version.Major() == 0 {\n\t\t// preview version calculation\n\t\tif changelog.HasBreakingChanges() || changelog.Modified.HasAdditiveChanges() {\n\t\t\tnewVersion = version.IncMinor()\n\t\t} else {\n\t\t\tnewVersion = version.IncPatch()\n\t\t}\n\t} else {\n\t\tif isCurrentPreview {\n\t\t\tif strings.Contains(previousVersion, \"beta\") {\n\t\t\t\tbetaNumber, err := strconv.Atoi(strings.Split(version.Prerelease(), \"beta.\")[1])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tnewVersion, err = version.SetPrerelease(\"beta.\" + strconv.Itoa(betaNumber+1))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif changelog.HasBreakingChanges() {\n\t\t\t\t\tnewVersion = version.IncMajor()\n\t\t\t\t} else if changelog.Modified.HasAdditiveChanges() {\n\t\t\t\t\tnewVersion = version.IncMinor()\n\t\t\t\t} else {\n\t\t\t\t\tnewVersion = version.IncPatch()\n\t\t\t\t}\n\t\t\t\tnewVersion, err = newVersion.SetPrerelease(\"beta.1\")\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\tif strings.Contains(previousVersion, \"beta\") {\n\t\t\t\treturn nil, fmt.Errorf(\"must have stable previous version\")\n\t\t\t}\n\t\t\t// release version calculation\n\t\t\tif changelog.HasBreakingChanges() {\n\t\t\t\tnewVersion = version.IncMajor()\n\t\t\t} else if changelog.Modified.HasAdditiveChanges() {\n\t\t\t\tnewVersion = version.IncMinor()\n\t\t\t} else {\n\t\t\t\tnewVersion = version.IncPatch()\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.Printf(\"New version is: %s\", newVersion.String())\n\treturn &newVersion, nil\n}", "title": "" }, { "docid": "7b42133737369780e2f3df48fd82d69d", "score": "0.44137618", "text": "func AddNewBuilds(activated bool, v *Version, p *Project, tasks TaskVariantPairs, generatedBy string) error {\n\ttaskIds := NewPatchTaskIdTable(p, v, tasks)\n\n\tnewBuildIds := make([]string, 0)\n\tnewBuildStatuses := make([]VersionBuildStatus, 0)\n\n\texistingBuilds, err := build.Find(build.ByVersion(v.Id).WithFields(build.BuildVariantKey, build.IdKey))\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tvariantsProcessed := map[string]bool{}\n\tfor _, b := range existingBuilds {\n\t\tvariantsProcessed[b.BuildVariant] = true\n\t}\n\n\tfor _, pair := range tasks.ExecTasks {\n\t\tif _, ok := variantsProcessed[pair.Variant]; ok { // skip variant that was already processed\n\t\t\tcontinue\n\t\t}\n\t\tvariantsProcessed[pair.Variant] = true\n\t\t// Extract the unique set of task names for the variant we're about to create\n\t\ttaskNames := tasks.ExecTasks.TaskNames(pair.Variant)\n\t\tdisplayNames := tasks.DisplayTasks.TaskNames(pair.Variant)\n\t\tbuildArgs := BuildCreateArgs{\n\t\t\tProject: *p,\n\t\t\tVersion: *v,\n\t\t\tTaskIDs: taskIds,\n\t\t\tBuildName: pair.Variant,\n\t\t\tActivated: activated,\n\t\t\tTaskNames: taskNames,\n\t\t\tDisplayNames: displayNames,\n\t\t\tGeneratedBy: generatedBy,\n\t\t}\n\t\tbuildId, err := CreateBuildFromVersion(buildArgs)\n\t\tgrip.Info(message.Fields{\n\t\t\t\"op\": \"creating build for version\",\n\t\t\t\"variant\": pair.Variant,\n\t\t\t\"activated\": activated,\n\t\t\t\"version\": v.Id,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\n\t\tnewBuildIds = append(newBuildIds, buildId)\n\t\tnewBuildStatuses = append(newBuildStatuses,\n\t\t\tVersionBuildStatus{\n\t\t\t\tBuildVariant: pair.Variant,\n\t\t\t\tBuildId: buildId,\n\t\t\t\tActivated: activated,\n\t\t\t},\n\t\t)\n\t}\n\n\treturn errors.WithStack(VersionUpdateOne(\n\t\tbson.M{VersionIdKey: v.Id},\n\t\tbson.M{\n\t\t\t\"$push\": bson.M{\n\t\t\t\tVersionBuildIdsKey: bson.M{\"$each\": newBuildIds},\n\t\t\t\tVersionBuildVariantsKey: bson.M{\"$each\": newBuildStatuses},\n\t\t\t},\n\t\t},\n\t))\n}", "title": "" }, { "docid": "966aef45c89fcc5e4486e5ca62c63df6", "score": "0.440465", "text": "func (container *Container) getVersion(vm *duktape.Context) (result int) {\n\tlogger.Debug(\"Entering Container.getVersion\", vm)\n\tdefer func() { logger.Debug(\"Exiting Container.getVersion\", result) }()\n\n\t// Return the chaincode version.\n\tvm.PushString(version)\n\treturn 1\n}", "title": "" }, { "docid": "4dbdea498406428a8daa3b26857a5d1c", "score": "0.4397806", "text": "func (m *MockStore) CreateAppVersion(appID string, baseSequence *int64, filesInDir, source string, skipPreflights bool, gitops types5.DownstreamGitOps, renderer types10.Renderer) (int64, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateAppVersion\", appID, baseSequence, filesInDir, source, skipPreflights, gitops, renderer)\n\tret0, _ := ret[0].(int64)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "291cd5a949d38d0df5397bdf0b10e3c7", "score": "0.43740064", "text": "func PrepareWorkspaceStage(directory string) error {\n\tlogrus.Infof(\"Preparing workspace for staging in %s\", directory)\n\tlogrus.Infof(\"Cloning repository to %s\", directory)\n\trepo, err := git.CloneOrOpenGitHubRepo(\n\t\tdirectory, git.DefaultGithubOrg, git.DefaultGithubRepo, false,\n\t)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"clone k/k repository\")\n\t}\n\n\ttoken, ok := os.LookupEnv(github.TokenEnvKey)\n\tif !ok {\n\t\treturn errors.Errorf(\"%s env variable is not set\", github.TokenEnvKey)\n\t}\n\n\tif err := repo.SetURL(git.DefaultRemote, (&url.URL{\n\t\tScheme: \"https\",\n\t\tUser: url.UserPassword(\"git\", token),\n\t\tHost: \"github.com\",\n\t\tPath: filepath.Join(git.DefaultGithubOrg, git.DefaultGithubRepo),\n\t}).String()); err != nil {\n\t\treturn errors.Wrap(err, \"changing git remote of repository\")\n\t}\n\n\t// Prewarm the SPDX licenses cache. As it is one of the main\n\t// remote operations, we do it now to have the data and fail early\n\t// is something goes wrong.\n\ts := spdx.NewSPDX()\n\tlogrus.Infof(\"Caching SPDX license set to %s\", s.Options().LicenseCacheDir)\n\tdoptions := license.DefaultDownloaderOpts\n\tdoptions.CacheDir = s.Options().LicenseCacheDir\n\tdownloader, err := license.NewDownloaderWithOptions(doptions)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"creating license downloader\")\n\t}\n\t// Fetch the SPDX licenses\n\tif _, err := downloader.GetLicenses(); err != nil {\n\t\treturn errors.Wrap(err, \"retrieving SPDX licenses\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d9d02e256753a5b74e5912bb4fdf5452", "score": "0.4373643", "text": "func newMultilineStage(logger log.Logger, config interface{}) (Stage, error) {\n\tcfg := &MultilineConfig{}\n\terr := mapstructure.WeakDecode(config, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = validateMultilineConfig(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &multilineStage{\n\t\tlogger: log.With(logger, \"component\", \"stage\", \"type\", \"multiline\"),\n\t\tcfg: cfg,\n\t}, nil\n}", "title": "" }, { "docid": "607fe11d67c8c3011c86642798c24128", "score": "0.43732557", "text": "func NewVersion(version string) *Version {\n\tv := Version{}\n\tv.SetTodayDate()\n\tvV := v.SetVersion(version)\n\tif vV != nil {\n\t\tv.Name = version\n\t}\n\tv.Tags = make(map[string]string)\n\treturn &v\n}", "title": "" } ]
ee8f7623a1e9a7721ff12600a7235e7b
AssertInt64InRange assert value is in range [low, high]
[ { "docid": "a4d8f864ebc5783d233389c2c2ae0534", "score": "0.86527693", "text": "func AssertInt64InRange(t assert.TestingT, low, high, value int64) {\n\tassert.True(t, value >= low && value <= high,\n\t\t\"Expected value in range [%d, %d], found %d\", low, high, value)\n}", "title": "" } ]
[ { "docid": "3ff728d6952cc4952e92bd450a9c48aa", "score": "0.66152805", "text": "func ensureInRange(n int16, min int16, max int16) int16 {\n\tif n < min {\n\t\treturn min\n\t} else if n > max {\n\t\treturn max\n\t} else {\n\t\treturn n\n\t}\n}", "title": "" }, { "docid": "a7984a859af90e52764e8011431cb824", "score": "0.6606813", "text": "func checkFloatInRange(t *testing.T, got float64, low float64, high float64) {\n\tt.Helper()\n\tif got < low || got >= high {\n\t\tt.Errorf(\"check failed: `%v` not in range [%v, %v)\", got, low, high)\n\t}\n}", "title": "" }, { "docid": "1c090aab9cbf83c1768d68f616174e63", "score": "0.6604802", "text": "func (m MatchAssertionBuilder) InRange(min int, max int) feature.StepFn {\n\treturn func(ctx context.Context, t feature.T) {\n\t\teventshub.StoreFromContext(ctx, m.storeName).AssertInRange(t, min, max, toFixedContextMatchers(ctx, m.matchers)...)\n\t}\n}", "title": "" }, { "docid": "0fc54489fb4d5451cc629b8cf5a56ee4", "score": "0.65950316", "text": "func InRange(v int64, t T) bool {\n\tt, ok := t.(Basic)\n\tif !ok {\n\t\treturn false\n\t}\n\tswitch t {\n\tcase Int:\n\t\treturn v >= math.MinInt32 && v <= math.MaxInt32\n\tcase Uint:\n\t\treturn v >= 0 && v <= math.MaxUint32\n\tcase Int8:\n\t\treturn v >= math.MinInt8 && v <= math.MaxInt8\n\tcase Uint8:\n\t\treturn v >= 0 && v <= math.MaxUint8\n\t}\n\treturn false\n}", "title": "" }, { "docid": "52755b4272299d4967992bffe520e232", "score": "0.6567373", "text": "func (_m *Validator) RangeInt64(name string, val int64, min int64, max int64, msg ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, name, val, min, max)\n\t_ca = append(_ca, msg...)\n\t_m.Called(_ca...)\n}", "title": "" }, { "docid": "784cf7d2547cc16afddfcf3bce2107a3", "score": "0.6563032", "text": "func (m MatchAssertionBuilder) InRange(min int, max int) feature.StepFn {\n\treturn func(ctx context.Context, t feature.T) {\n\t\teventshub.StoreFromContext(ctx, m.storeName).AssertInRange(t, min, max, m.matchers...)\n\t}\n}", "title": "" }, { "docid": "8115fee7eec51dda0821681d7bcc0895", "score": "0.6462839", "text": "func validateIntWithinRange(name string, value interface{}, min, max int) error {\n\tif value == nil {\n\t\treturn nil\n\t}\n\n\tfval, ok := value.(float64)\n\tif !ok {\n\t\treturn fmt.Errorf(\"%s must be of type Number\", name)\n\t}\n\n\tival := int(fval)\n\n\tif ival < min || ival > max {\n\t\treturn fmt.Errorf(\"out-of-range value for %s, must be within %d-%d\", name, min, max)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cc09cfc0216966d3229965f1f68a9daf", "score": "0.6422767", "text": "func AssertInt64(t *testing.T, label string, expected int64, actual int64) {\n if expected != actual {\n t.Fatalf(\"Expected %s to be '%d' but was '%d'.\", label, expected, actual)\n }\n}", "title": "" }, { "docid": "9e61488023da89286bc649e473dcff3d", "score": "0.63689834", "text": "func isInRange(start, end, added int64) bool {\n\treturn start <= added && added <= end\n}", "title": "" }, { "docid": "7bd1ce3c50e67316811925b615af7f15", "score": "0.63350135", "text": "func ValidateDynInt64Range(fromInclusive int64, toInclusive int64) func(int64) error {\n\treturn func(value int64) error {\n\t\tif value > toInclusive || value < fromInclusive {\n\t\t\treturn fmt.Errorf(\"value %v not in [%v, %v] range\", value, fromInclusive, toInclusive)\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "17626bb142f92ddc08009229e407b540", "score": "0.6334613", "text": "func IntegerInRange(min int, max int) int {\n\trand.Seed(time.Now().UnixNano())\n\treturn rand.Intn(max-min+1) + min\n}", "title": "" }, { "docid": "1ea1e3fb40c5d375f084cdaafc2b6bd1", "score": "0.62974334", "text": "func TestUint64n(t *testing.T) {\n\tconst iters = 10000\n\tvar counts [10]uint64\n\tfor i := 0; i < iters; i++ {\n\t\tcounts[Uint64n(uint64(len(counts)))]++\n\t}\n\texp := iters / uint64(len(counts))\n\tlower, upper := exp-(exp/10), exp+(exp/10)\n\tfor i, n := range counts {\n\t\tif !(lower < n && n < upper) {\n\t\t\tt.Errorf(\"Expected range of %v-%v for index %v, got %v\", lower, upper, i, n)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7000fba428a8ad35958af3a347cd807c", "score": "0.6291924", "text": "func assertBetween(t *testing.T, actual int, r [2]int, msg string) {\n\tassert.GreaterOrEqual(t, actual, r[0], msg)\n\tassert.LessOrEqual(t, actual, r[1], msg)\n}", "title": "" }, { "docid": "b1f6c6ea9d454866dbfb91814c68aa95", "score": "0.62452376", "text": "func inRange(left float64, right float64, target float64) bool {\r\n\treturn target >= left && target < right\r\n}", "title": "" }, { "docid": "5f21eec75e44d937d39da49e394a09c9", "score": "0.60844487", "text": "func IntBetween(field int, high int, low int) bool {\n\tif (field <= high) && (field >= low) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a84988d698515dc7da59cd40a1c953f8", "score": "0.6079121", "text": "func (r *Range) CheckUint64( val uint64 ) bool {\n return r.Check( float64(val) )\n}", "title": "" }, { "docid": "aa0f0f123b6da2417f205d441862fca4", "score": "0.6070786", "text": "func Uint64Range(start, end uint64) (uint64, error) {\n\tvar val uint64\n\tvar err error\n\n\tif start >= end {\n\t\treturn val, errors.New(\"start value must be less than end value\")\n\t}\n\n\t// Get uniformly distributed numbers in the range 0 to size. Using the\n\t// arc4random_uniform algorithm.\n\t// https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/crypt/arc4random_uniform.c\n\tsize := end - start // Get range size\n\tmin := (math.MaxUint64 - size) % size\n\n\tfor {\n\t\tval, err = Uint64()\n\t\tif err != nil {\n\t\t\treturn val, err\n\t\t}\n\n\t\tif val >= min {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tval = val % size\n\t// End arc4random_uniform\n\n\t// Add start to val to shift numbers to correct range.\n\treturn val + start, nil\n}", "title": "" }, { "docid": "c1bf2c133d677a65266058b25cda2845", "score": "0.6058093", "text": "func TestShouldGenerateIntegersRange(t *testing.T) {\n\n\tresult, err := IntegersRange(4, 10)\n\texpected := []int{4, 5, 6, 7, 8, 9, 10}\n\n\tassert.Nil(t, err, \"Error should be nil\")\n\tassert.Equal(t, expected, result, \"Should generate range from 4 to 10\")\n}", "title": "" }, { "docid": "48aa8276a310cc2b2367d7c5090ab271", "score": "0.6049308", "text": "func (s *Sink) Int64Range(key string, from, to int64) *Sink {\n\tif atomic.LoadInt32(s.state) > sinkClosed {\n\t\ts.Lock()\n\t\tdelete(s.negativeFilters, key)\n\t\ts.positiveFilters[key] = &int64RangeFilter{From: from, To: to}\n\t\ts.Unlock()\n\t}\n\treturn s\n}", "title": "" }, { "docid": "4a7787b1977db4416f4f7fba948bd0ed", "score": "0.60191417", "text": "func (n *Number) InRange(min, max interface{}) *Number {\n\ta, ok := canonNumber(n.checker, min)\n\tif !ok {\n\t\treturn n\n\t}\n\tb, ok := canonNumber(n.checker, max)\n\tif !ok {\n\t\treturn n\n\t}\n\tif !(n.value >= a && n.value <= b) {\n\t\tn.checker.Fail(\"expected number in range [%v; %v], got %v\", a, b, n.value)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "84853b7f584a7b42e04295a9969196d1", "score": "0.6007711", "text": "func IntRangeChecker(lower, upper int, includeLower, includeUpper bool) func(interface{}) error {\n\treturn func(attr interface{}) error {\n\t\tif f, ok := attr.(int); ok {\n\t\t\te := IntLowerBoundChecker(lower, includeLower)(f)\n\t\t\tif e == nil {\n\t\t\t\te = IntUpperBoundChecker(upper, includeUpper)(f)\n\t\t\t}\n\t\t\treturn e\n\t\t}\n\t\treturn fmt.Errorf(\"expected type int, received %T\", attr)\n\t}\n}", "title": "" }, { "docid": "c1a999bdc5b44808dac11f13d07f542c", "score": "0.59984875", "text": "func TestRange(t *testing.T) {\n\tseq, err := New(23, 231342)\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\n\tfor i := uint64(23); i < 231343; i++ {\n\t\tj, err := seq.Next()\n\t\tif err != nil {\n\t\t\tt.Error(err.Error())\n\t\t}\n\n\t\tif i != j {\n\t\t\tt.Error(\"mismatch during maximum value testing\")\n\t\t}\n\t}\n\n\tfor i := 0; i < 10; i++ {\n\t\tval, err := seq.Next()\n\t\tif err == nil {\n\t\t\tt.Error(\"should have raised error after maximum reached\")\n\t\t}\n\t\tif val != 0 {\n\t\t\tt.Error(\"returning non-zero valued response!\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6e206f6a34cfe4e79a03d20701e58a4b", "score": "0.59594226", "text": "func ValidateNumberUint64(value uint64, lowerBound uint64, upperBound uint64) uint64 {\n\n\tif value > upperBound {\n\t\treturn upperBound\n\t} else if value < lowerBound {\n\t\treturn lowerBound\n\t} else {\n\t\treturn value\n\t}\n}", "title": "" }, { "docid": "b8596eb02c0f1ce0b424e059eb23b23b", "score": "0.59588206", "text": "func between(value int, lower int, upper int) bool {\n\treturn value >= lower && value <= upper\n}", "title": "" }, { "docid": "e25bfbd3cf981154792267da55b179d1", "score": "0.5943434", "text": "func InRangeF64(a, b, c float64) bool {\n\tif a > c { // swap bounds if necessary to get a < b < c\n\t\ta, c = c, a\n\t}\n\tif b < a {\n\t\treturn false\n\t}\n\tif b > c {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "45625e3556190b5719d55e45728a84f2", "score": "0.5939024", "text": "func ValidateInt64(name string, data, minValue, maxValue int64) error {\n\tif data < minValue {\n\t\treturn fmt.Errorf(\"invalid input data, %s is too little (min value: %d)\", name, minValue)\n\t}\n\n\tif data > maxValue {\n\t\treturn fmt.Errorf(\"invalid input data, %s is too large (max value: %d)\", name, maxValue)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "862dc42dc50b86656d3080b1162555c5", "score": "0.5926215", "text": "func RandomIntInRange(min, max int) int {\n\tif min == max {\n\t\tlog.Printf(\"warn: min==max (%v == %v)\", min, max)\n\t\treturn min\n\t}\n\treturn rand.Intn(max-min) + min\n}", "title": "" }, { "docid": "9c8d0f49c877c5b724deb69c19bfe784", "score": "0.5920944", "text": "func ValidateLBoundUint64(s string, i *uint64, min uint64) error {\n\tvar err error\n\tif *i, err = strconv.ParseUint(s, 10, 64); err != nil {\n\t\treturn err\n\t}\n\tif *i < min {\n\t\treturn fmt.Errorf(\"Error, value %d is less than the minimun %d\", i, min)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8cd188568ac5d03344bdc19696235e0", "score": "0.59170985", "text": "func isInRange(yr yang.YRange, val yang.Number) bool {\n\treturn (val.Less(yr.Max) || val.Equal(yr.Max)) &&\n\t\t(yr.Min.Less(val) || yr.Min.Equal(val))\n}", "title": "" }, { "docid": "b6733c22539909109009f6cd01706246", "score": "0.5916388", "text": "func IntRangeChecker(lower, upper int, includeLower, includeUpper bool) func(int) error {\n\treturn func(i int) error {\n\t\te := IntLowerBoundChecker(lower, includeLower)(i)\n\t\tif e == nil {\n\t\t\te = IntUpperBoundChecker(upper, includeUpper)(i)\n\t\t}\n\t\treturn e\n\t}\n}", "title": "" }, { "docid": "10bbd8c749855392dddb1143eeef1acc", "score": "0.59045297", "text": "func RBInt64(i int64, min int64, max int64) bool {\n\n\tswitch {\n\tcase i >= min && i <= max:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n\n}", "title": "" }, { "docid": "fd02c09ff3540fe8646fce29664f9dc8", "score": "0.5871651", "text": "func between(start *big.Int, elt *big.Int, end *big.Int, inclusive bool) bool {\n\tif end.Cmp(start) > 0 {\n\t\treturn (start.Cmp(elt) < 0 && elt.Cmp(end) < 0) || (inclusive && elt.Cmp(end) == 0)\n\t}\n\treturn start.Cmp(elt) < 0 || elt.Cmp(end) < 0 || (inclusive && elt.Cmp(end) == 0)\n}", "title": "" }, { "docid": "271ef7e64a8e903429159cc4d6f69db8", "score": "0.5866597", "text": "func checkInRange(m []Interval) {\n\tsort.Slice(m,\n\t\tfunc(i, j int) bool {\n\t\t\tif m[i].offset < m[j].offset {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif m[i].end == m[j].offset && m[i].end < m[j].end {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t)\n}", "title": "" }, { "docid": "c6322cd438ec0a399e6f99bcaf256ed5", "score": "0.58384573", "text": "func Int63nRange(min, max int64) int64 {\n\trng.Lock()\n\tdefer rng.Unlock()\n\treturn rng.rand.Int63n(max-min) + min\n}", "title": "" }, { "docid": "32d437373213e30596c1233310f18b74", "score": "0.58359075", "text": "func RandRangeInt64(min, max int64) int64 {\n\tif min > max {\n\t\tlogger.Panic(\"The min is greater than max!\")\n\t}\n\n\tif min < 0 {\n\t\tf64Min := math.Abs(float64(min))\n\t\ti64Min := int64(f64Min)\n\t\tresult, _ := rand.Int(rand.Reader, big.NewInt(max+1+i64Min))\n\t\treturn result.Int64() - i64Min\n\t}\n\tresult, _ := rand.Int(rand.Reader, big.NewInt(max-min+1))\n\treturn min + result.Int64()\n}", "title": "" }, { "docid": "70c2f518e01893d7a2b4654ca80195ce", "score": "0.58265877", "text": "func InRange(n int, min int, max int) bool {\n\treturn min <= n && n <= max\n}", "title": "" }, { "docid": "4cf506ae607cc283fbf2470791d62710", "score": "0.5819733", "text": "func (n *Number) InRange(min, max interface{}) *Number {\n\ta, ok := canonNumber(&n.chain, min)\n\tif !ok {\n\t\treturn n\n\t}\n\tb, ok := canonNumber(&n.chain, max)\n\tif !ok {\n\t\treturn n\n\t}\n\tif !(n.value >= a && n.value <= b) {\n\t\tn.chain.fail(\"\\nexpected number in range:\\n [%v; %v]\\n\\nbut got:\\n %v\",\n\t\t\ta, b, n.value)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "5cdf59d09aaed47c7909dcf77b368aa0", "score": "0.5807379", "text": "func validateAsNumberInRange(number string, min int, max int) bool {\n num, err := strconv.Atoi(number)\n if err == nil && num >= min && num <= max {\n return true\n }\n return false\n}", "title": "" }, { "docid": "0ca54e9906b606a231928f05eaf05c61", "score": "0.57900786", "text": "func Float64Between(low, high float64) Float64 {\n\tif low >= high {\n\t\tpanic(fmt.Sprintf(\"Impossible checks passed to Float64Between:\"+\n\t\t\t\" the lower limit (%f) should be less than the upper limit (%f)\",\n\t\t\tlow, high))\n\t}\n\n\treturn func(f float64) error {\n\t\tif f < low {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"the value (%f) must be between %f and %f - too small\",\n\t\t\t\tf, low, high)\n\t\t}\n\t\tif f > high {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"the value (%f) must be between %f and %f - too big\",\n\t\t\t\tf, low, high)\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "1a3a450feb9970e32598035bf5331ed5", "score": "0.57820576", "text": "func IntRange(i interface{}, args []string) error {\n\tin, ok := getint(i)\n\tif !ok {\n\t\treturn fmt.Errorf(\"Value must be an integer\")\n\t}\n\tmin, ok := convInt(args[0])\n\tif !ok {\n\t\treturn fmt.Errorf(\"Internal error: min arg is not an integer\")\n\t}\n\tmax, ok := convInt(args[1])\n\tif !ok {\n\t\treturn fmt.Errorf(\"Internal error: max arg is not an integer\")\n\t}\n\tif in < min {\n\t\treturn fmt.Errorf(\"Value must be at least %d\", min)\n\t}\n\tif in > max {\n\t\treturn fmt.Errorf(\"Value must be at most %d\", max)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "72017ca8904e37eedf44723aee27e78b", "score": "0.574991", "text": "func IntUpperBoundChecker(upper int, includeUpper bool) func(int) error {\n\treturn func(i int) error {\n\t\tif i < upper || includeUpper && i == upper {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"range check %v >%v %v failed\", upper, equalSign[includeUpper], i)\n\t}\n}", "title": "" }, { "docid": "0b43e8dd0db3f2d57d5ec109c4d0e5a7", "score": "0.5744164", "text": "func getRandomValueInRange(min int, max int, exclude intSet) int {\n\tmaxAttempts := (max - min) * 100000\n\trand.Seed(time.Now().UnixNano())\n\t// +1 because our ranges are inclusive\n\tresult := rand.Intn(max-min+1) + min\n\n\tfor attempts := 0; exclude.has(result) && attempts < maxAttempts; attempts++ {\n\t\tresult = rand.Intn(max-min+1) + min\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "4bfaca0fcaa55e52cc9653796b68cd10", "score": "0.5743855", "text": "func IntUpperBoundChecker(upper int, includeUpper bool) func(interface{}) error {\n\treturn func(attr interface{}) error {\n\t\tif f, ok := attr.(int); ok {\n\t\t\tif f < upper || includeUpper && f == upper {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"range check %v >%v %v failed\", upper, equalSign[includeUpper], f)\n\t\t}\n\t\treturn fmt.Errorf(\"expected type int, received %T\", attr)\n\t}\n}", "title": "" }, { "docid": "da8c4b461706e31864f640d8fdbb94ac", "score": "0.57049674", "text": "func TestErrInvalidSingleOutOfRangeHigh(t *testing.T) {\n\tassertionErrTest(\"65536\", t)\n}", "title": "" }, { "docid": "a1aacc2d177eff1bcf7d0547515c5ea4", "score": "0.56962925", "text": "func RandomInRange(lo, hi int) int {\n\tif lo < 0 || lo > hi {\n\t\tpanic(\"RandomInRange: invalid range\")\n\t}\n\treturn lo + weak.Intn(hi-lo+1)\n}", "title": "" }, { "docid": "49657e0e85038053d7ca859e025742da", "score": "0.568886", "text": "func newInt64Contains(min, max int64, node bool) *int64Contains {\n\treturn &int64Contains{\n\t\tnode: node,\n\t\tmin: min,\n\t\tmax: max,\n\t\tat: min,\n\t}\n}", "title": "" }, { "docid": "ea276b6e54bb6d8403ccedb5a7838f90", "score": "0.5687929", "text": "func AssertInt64(num interface{}) (int64, error) {\n\tswitch num.(type) {\n\tcase int32:\n\t\tv := num.(int32)\n\t\treturn int64(v), nil\n\tcase int64:\n\t\treturn num.(int64), nil\n\tcase float32:\n\t\tv := num.(float32)\n\t\treturn int64(v), nil\n\tcase float64:\n\t\tv := num.(float64)\n\t\treturn int64(v), nil\n\tdefault:\n\t\treturn 0, errors.New(\"assertInt64: Unexpected data-type\")\n\t}\n}", "title": "" }, { "docid": "c2507cc3d793e917c96c5071d84fbfe5", "score": "0.56860054", "text": "func randInRange(maxRange int) int {\n return int(rand.Float32() * float32(maxRange))\n}", "title": "" }, { "docid": "f47cb06c461de562ba4dc8f43156ed8f", "score": "0.568261", "text": "func IntBetween(min, max int) schema.SchemaValidateFunc {\n\treturn func(i interface{}, k string) (s []string, es []error) {\n\t\tv, ok := i.(int)\n\t\tif !ok {\n\t\t\tes = append(es, fmt.Errorf(\"expected type of %s to be int\", k))\n\t\t\treturn\n\t\t}\n\n\t\tif v < min || v > max {\n\t\t\tes = append(es, fmt.Errorf(\"expected %s to be in the range (%d - %d), got %d\", k, min, max, v))\n\t\t\treturn\n\t\t}\n\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "f47cb06c461de562ba4dc8f43156ed8f", "score": "0.568261", "text": "func IntBetween(min, max int) schema.SchemaValidateFunc {\n\treturn func(i interface{}, k string) (s []string, es []error) {\n\t\tv, ok := i.(int)\n\t\tif !ok {\n\t\t\tes = append(es, fmt.Errorf(\"expected type of %s to be int\", k))\n\t\t\treturn\n\t\t}\n\n\t\tif v < min || v > max {\n\t\t\tes = append(es, fmt.Errorf(\"expected %s to be in the range (%d - %d), got %d\", k, min, max, v))\n\t\t\treturn\n\t\t}\n\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "486ee0d847c6012cfe19c09bf5e4f39c", "score": "0.56738645", "text": "func (r *Range) CheckInt( val int ) bool {\n return r.Check( float64(val) )\n}", "title": "" }, { "docid": "1dd3e668daa7f68badca200d41c0b29f", "score": "0.56695276", "text": "func TestInListAndIsInRange(t *testing.T) {\n var haystack = []int{0, 2, 4, 6, 8, 10, 12}\n testcases := []struct{\n num int\n haystack []int\n min, max int\n expected bool\n }{\n {0, haystack, 0, 10, true},\n {10, haystack, 0, 10, true},\n {4, haystack, 0, 10, true},\n {5, haystack, 0, 10, false},\n {12, haystack, 0, 10, false},\n }\n\n for _, test := range testcases {\n actual := BuildIntChain().IsInList(test.haystack).IsInRange(test.min, test.max).ValidateInt(test.num)\n t.Logf(\"IsInList(%v).IsInRange(%d, %d).ValidateInt(%d) = %v, expected = %v\\n\", test.haystack, test.min, test.max, test.num, actual, test.expected)\n if actual != test.expected {\n t.Errorf(\"[FAIL]\")\n } else {\n t.Log(\"[PASS]\")\n }\n }\n}", "title": "" }, { "docid": "a38fa4b73c2ae84213be8b75150d9e50", "score": "0.56536996", "text": "func TestMaxMinUint32(t *testing.T) {\n\tmin := uint32(15)\n\tmax := uint32(25)\n\ttestTable := []struct {\n\t\tvalue uint32\n\t\tminValue uint32\n\t\tmaxValue uint32\n\t}{\n\t\t{value: 10, minValue: 10, maxValue: 25},\n\t\t{value: 15, minValue: 15, maxValue: 25},\n\t\t{value: 20, minValue: 15, maxValue: 25},\n\t\t{value: 25, minValue: 15, maxValue: 25},\n\t\t{value: 30, minValue: 15, maxValue: 30},\n\t}\n\tfor _, tst := range testTable {\n\t\tassert.Equal(t, tst.minValue, Min(tst.value, min))\n\t\tassert.Equal(t, tst.maxValue, Max(tst.value, max))\n\t}\n}", "title": "" }, { "docid": "6e78a224af34b15626657baa5e4444e7", "score": "0.5652853", "text": "func TestIntn(t *testing.T) {\n\tconst iters = 10000\n\tvar counts [10]int\n\tfor i := 0; i < iters; i++ {\n\t\tcounts[Intn(len(counts))]++\n\t}\n\texp := iters / len(counts)\n\tlower, upper := exp-(exp/10), exp+(exp/10)\n\tfor i, n := range counts {\n\t\tif !(lower < n && n < upper) {\n\t\t\tt.Errorf(\"Expected range of %v-%v for index %v, got %v\", lower, upper, i, n)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1199429ca6e7434ba35dc7d71ce59262", "score": "0.5623329", "text": "func bitRange(x int64, nbits uint8) bool {\n\treturn -((1<<(nbits-1))-1) <= x && x <= 1<<(nbits-1)\n}", "title": "" }, { "docid": "3ca5d6dcbeccfe2bec07275aaee20e55", "score": "0.5607717", "text": "func randInRange(min, max int) int {\n\treturn rand.Intn(max-min) + min\n}", "title": "" }, { "docid": "c2bb1d273086f780c9c8c33ad0b87f66", "score": "0.5605543", "text": "func isInRange(value float64, data *[]dataRange) bool {\n\n\tfor i, _ := range *data {\n\t\tif value >= (*data)[i].lower && value < (*data)[i].upper {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "421b3093d2adeaba6c1d505cf2cb8859", "score": "0.55941516", "text": "func RandIntInRange(min, max int) int {\n\trand.Seed(time.Now().Unix())\n\treturn rand.Intn(max-min) + min\n}", "title": "" }, { "docid": "962fa9ca1e0f6f268f0230052a44090b", "score": "0.55860883", "text": "func ValueBetween(min, max int64, fact float64) int64 {\n\trt, _ := rand.Int(rand.Reader, big.NewInt(max-min)) // Ignore errors here\n\treturn int64(fact * float64(min+rt.Int64()))\n}", "title": "" }, { "docid": "850fa6684900ec714a41b24b9737f93a", "score": "0.55859077", "text": "func Int64WithMinAndMaxLimit(input, min, max int64) int64 {\n\tif input < min {\n\t\treturn min\n\t}\n\n\tif input > max {\n\t\treturn max\n\t}\n\n\treturn input\n}", "title": "" }, { "docid": "369157d64081f97536a41f87eda1542c", "score": "0.5583591", "text": "func ValidateUint64(name string, data, minValue, maxValue uint64) error {\n\tif data < minValue {\n\t\treturn fmt.Errorf(\"invalid input data, %s is too little (min value: %d)\", name, minValue)\n\t}\n\n\tif data > maxValue {\n\t\treturn fmt.Errorf(\"invalid input data, %s is too large (max value: %d)\", name, maxValue)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1cce8b422d6b380e27d08e5eca83d47b", "score": "0.5548924", "text": "func (this *DomainRecord) inRange(val, start, end int64)bool {\n\tif !((val >= start) && (val <= end)) {\n\t\treturn false\n\t}else {\n\t\treturn true\n\t}\n\t\n\t\n\n}", "title": "" }, { "docid": "d6e3d595ae3f1a1fbce992c35ad95164", "score": "0.55263263", "text": "func randomIntInRange(min, max int) int {\n\tif min == max {\n\t\treturn min\n\t}\n\treturn rand.Intn(max-min) + min\n}", "title": "" }, { "docid": "922b6b95664af40fab0d046a3d5c8dd9", "score": "0.55138004", "text": "func isNumInRange(s string, l, h int) bool {\n\tn, err := strconv.Atoi(s)\n\treturn err == nil && l <= n && n <= h\n}", "title": "" }, { "docid": "40ae9721e25efb2e66dbd574b6d13452", "score": "0.5505606", "text": "func ValidateRange(offset, limit int) error {\n\tif offset < 0 {\n\t\treturn fmt.Errorf(`Offset value should be >= 0`)\n\t}\n\n\tif limit < 0 {\n\t\treturn fmt.Errorf(`Limit value should be >= 0`)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a418c05aaa436d4f0c375a28d1c476b5", "score": "0.5504986", "text": "func moduloInt64Checked(x, y int64) (int64, bool) {\n\t// In twos complement, negating MinInt64 would result in a valid of MaxInt64+1.\n\tif x == math.MinInt64 && y == -1 {\n\t\treturn 0, false\n\t}\n\treturn x % y, true\n}", "title": "" }, { "docid": "c4778d458d3c4a6e9d07392100f48533", "score": "0.55018777", "text": "func (s *Sink) Int64NotRange(key string, from, to int64) *Sink {\n\tif atomic.LoadInt32(s.state) > sinkClosed {\n\t\ts.Lock()\n\t\tdelete(s.positiveFilters, key)\n\t\ts.negativeFilters[key] = &int64RangeFilter{From: from, To: to}\n\t\ts.Unlock()\n\t}\n\treturn s\n}", "title": "" }, { "docid": "3356938bfee0ce86b9b899e0978eb78f", "score": "0.5499093", "text": "func Int64s(x, y interface{}) bool { return x.(int64) < y.(int64) }", "title": "" }, { "docid": "3c213605c1d2397abc2ab11f60f7f31f", "score": "0.54718435", "text": "func ExpectEqualInt64s(t *testing.T, expected, actual int64) {\n\tif expected != actual {\n\t\tt.Fatalf(\"Expected equal int64 values: (%d) (%d)\", expected, actual)\n\t}\n}", "title": "" }, { "docid": "3a4eb98031d667d0258744943b5e0b30", "score": "0.5467207", "text": "func TestNumeric_SetInt64(t *testing.T) {\n\ttests := []int64{\n\t\tmathh.MinInt64,\n\t\tmathh.MinInt64 + 1,\n\t\tmathh.MinInt64 / 2,\n\t\tmathh.MinInt64/2 + 1,\n\t\t0,\n\t\t1,\n\t\t10,\n\t\t100,\n\t\t1000 % mathh.MaxInt64,\n\t\t10000 % mathh.MaxInt64,\n\t\t100000 % mathh.MaxInt64,\n\t\t1000000 % mathh.MaxInt64,\n\t\t10000000 % mathh.MaxInt64,\n\t\t100000000 % mathh.MaxInt64,\n\t\t1000000000 % mathh.MaxInt64,\n\t\t10000000000 % mathh.MaxInt64,\n\t\t100000000000 % mathh.MaxInt64,\n\t\tmathh.MaxInt64/2 - 1,\n\t\tmathh.MaxInt64 / 2,\n\t\tmathh.MaxInt64/2 + 1,\n\t\tmathh.MaxInt64 - 1,\n\t\tmathh.MaxInt64,\n\t}\n\tfor _, v := range tests {\n\t\tvar n Numeric\n\t\tn.SetInt64(v)\n\n\t\tif str := strconvh.FormatInt64(v); n.String() != str {\n\t\t\tt.Errorf(\"expect %v, got %v\", str, n.String())\n\t\t}\n\t\tif i := n.Int64(); i != v {\n\t\t\tt.Errorf(\"expect %v, got %v\", v, i)\n\t\t}\n\n\t\tn2 := NewInt64(v)\n\t\tif str := strconvh.FormatInt64(v); n2.String() != str {\n\t\t\tt.Errorf(\"expect %v, got %v\", str, n2.String())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9aa5e3699bb7a3c526bba9f35a41bfe3", "score": "0.54640114", "text": "func TestOutOfRange(t *testing.T) {\r\n\tintTags := []struct {\r\n\t\ttagType int64\r\n\t\tvalue int64\r\n\t}{\r\n\t\t{1, math.MaxInt8 + 1},\r\n\t\t{1, math.MinInt8 - 1},\r\n\t\t{2, math.MaxInt16 + 1},\r\n\t\t{2, math.MinInt16 - 1},\r\n\t\t{3, math.MaxInt32 + 1},\r\n\t\t{3, math.MinInt32 - 1},\r\n\t}\r\n\r\n\tfor _, tag := range intTags {\r\n\t\t_, err := Json2Nbt([]byte(fmt.Sprintf(testNumberRangeJsonTemplate, tag.tagType, \"\", tag.value)))\r\n\t\tif err == nil {\r\n\t\t\tt.Error(fmt.Sprintf(\"Tag type %d value %d failed to throw out of range error\", tag.tagType, tag.value))\r\n\t\t}\r\n\t}\r\n\r\n\tfloatTags := []struct {\r\n\t\ttagType int64\r\n\t\tvalue float64\r\n\t}{\r\n\t\t{5, math.MaxFloat32 * 1.1},\r\n\t\t{5, -(math.MaxFloat32 * 1.1)},\r\n\t\t// Not testing for small limits; it wasn't working as expected\r\n\t\t// {5, math.SmallestNonzeroFloat32 / 1.1},\r\n\t\t// {5, -(math.SmallestNonzeroFloat32 / 1.1)},\r\n\t}\r\n\r\n\tfor _, tag := range floatTags {\r\n\t\t_, err := Json2Nbt([]byte(fmt.Sprintf(testNumberRangeJsonTemplate, tag.tagType, \"\", tag.value)))\r\n\t\tif err == nil {\r\n\t\t\tt.Error(fmt.Sprintf(\"Tag type %d value %g failed to throw out of range error\", tag.tagType, tag.value))\r\n\t\t}\r\n\t}\r\n\r\n\tlongAsStringTags := []struct {\r\n\t\ttagType int64\r\n\t\tvalue string\r\n\t}{\r\n\t\t{4, \"\\\"9223372036854775808\\\"\"},\r\n\t\t{4, \"\\\"-9223372036854775809\\\"\"},\r\n\t}\r\n\r\n\tfor _, tag := range longAsStringTags {\r\n\t\t_, err := Json2Nbt([]byte(fmt.Sprintf(testNumberRangeJsonTemplate, tag.tagType, \"\", tag.value)))\r\n\t\tif err == nil {\r\n\t\t\tt.Error(fmt.Sprintf(\"Tag type %d value %s failed to throw out of range error\", tag.tagType, tag.value))\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "2b47e7db8dd50de8560b7129d9b2b6cc", "score": "0.5443278", "text": "func UInt64s(x, y interface{}) bool { return x.(uint64) < y.(uint64) }", "title": "" }, { "docid": "afae1cb0fed550168cdc9f27ddb0ed48", "score": "0.54247373", "text": "func IntRange(min, size int) int {\n\treturn (rand.Int() % size) + min\n}", "title": "" }, { "docid": "f39c8d08ea297cc590b05fc15bfc0c40", "score": "0.5423228", "text": "func Int64(list []int64, value int64) bool {\n\tfor _, listValue := range list {\n\t\tif listValue == value {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b4af349e119e16c4818d3e104cb400ac", "score": "0.5418947", "text": "func TestRange(t *testing.T) {\n\ttype args struct {\n\t\tstart int\n\t\tend int\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twantLines []int\n\t}{\n\t\t{\n\t\t\tname: \"range: start=1, end=5\",\n\t\t\targs: args{\n\t\t\t\tstart: 1,\n\t\t\t\tend: 5,\n\t\t\t},\n\t\t\twantLines: []int{1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\tname: \"range: start=1, end=1\",\n\t\t\targs: args{\n\t\t\t\tstart: 1,\n\t\t\t\tend: 1,\n\t\t\t},\n\t\t\twantLines: []int{1},\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tif gotLines := Range(tt.args.start, tt.args.end); !reflect.DeepEqual(gotLines, tt.wantLines) {\n\t\t\t\tt.Errorf(\"Range() = %v, want %v\", gotLines, tt.wantLines)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "bc7364ebe66294b254b792cb056acd2d", "score": "0.5414938", "text": "func NewQueryIntInRange(key string, min int, max int, or int) lazy.Value {\n\treturn NewRequestValue(func(req *web.Request) (interface{}, error) {\n\t\tif v := req.Query.GetIntOr(key, or); v >= min && v <= max {\n\t\t\treturn v, nil\n\t\t}\n\t\treturn or, nil\n\t})\n}", "title": "" }, { "docid": "0f1329b39e9b25c1341da1f1d0bb1cd4", "score": "0.5412249", "text": "func Int64(value1 int64, value2 int64) int {\n\n\tswitch {\n\n\tcase value1 > value2:\n\t\treturn 1\n\tcase value1 == value2:\n\t\treturn 0\n\tdefault:\n\t\treturn -1\n\t}\n}", "title": "" }, { "docid": "4ebff7fa7aa01de42efadda764d56bda", "score": "0.54071385", "text": "func CompareBound64(first *Bound64, second *Bound64) bool {\n\tfirstBoundRange := first.Upper - first.Lower\n\tsecondBoundRange := second.Upper - second.Lower\n\n\tif firstBoundRange > secondBoundRange {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "51f21b4812b6f7316d7236edd00a1481", "score": "0.53969604", "text": "func compareTimeToRange(test, start, end time.Time) int {\n\t// we don't care about monotonic clock readings for this purpose\n\ttest = test.Round(0)\n\tstart = start.Round(0)\n\tend = end.Round(0)\n\n\tif test.Before(start) {\n\t\treturn -1\n\t}\n\n\tif test.Equal(end) || test.After(end) {\n\t\treturn 1\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "3740bd258aeff22e05843d6fe928e395", "score": "0.53950864", "text": "func subtractInt64Checked(x, y int64) (int64, bool) {\n\tif (y < 0 && x > math.MaxInt64+y) || (y > 0 && x < math.MinInt64+y) {\n\t\treturn 0, false\n\t}\n\treturn x - y, true\n}", "title": "" }, { "docid": "1e26fce4b7e86f475a161c264973c9e5", "score": "0.5393806", "text": "func IntRange(n int) int {\n\tsign := 1\n\tif random.Intn(2) == 0 {\n\t\tsign = -1\n\t}\n\treturn random.Intn(n) * sign\n}", "title": "" }, { "docid": "06f361b6c2dae414030b078cb5f73fe1", "score": "0.53904706", "text": "func validRange(sc *stmtctx.StatementContext, ran *ranger.Range, encoded bool) bool {\n\tvar low, high []byte\n\tif encoded {\n\t\tlow, high = ran.LowVal[0].GetBytes(), ran.HighVal[0].GetBytes()\n\t} else {\n\t\tvar err error\n\t\tlow, err = codec.EncodeKey(sc, nil, ran.LowVal[0])\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\thigh, err = codec.EncodeKey(sc, nil, ran.HighVal[0])\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t}\n\tif ran.LowExclude {\n\t\tlow = kv.Key(low).PrefixNext()\n\t}\n\tif !ran.HighExclude {\n\t\thigh = kv.Key(high).PrefixNext()\n\t}\n\treturn bytes.Compare(low, high) < 0\n}", "title": "" }, { "docid": "694ab86f14707644a56f13b149b19101", "score": "0.53896594", "text": "func RangeValidator(min, max int) ValidatorFunc {\n\treturn func(value interface{}) error {\n\t\tval := value.(int)\n\n\t\tif val < min || val > max {\n\t\t\treturn &ErrOutOfRange{\n\t\t\t\tValue: val,\n\t\t\t\tMin: min,\n\t\t\t\tMax: max,\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "1be7e797a75163eb8cdfd5c88b74eca9", "score": "0.5380389", "text": "func RandomInRange(min, max int) int {\n\trand.Seed(time.Now().Unix())\n\treturn rand.Intn(max-min) + min\n}", "title": "" }, { "docid": "31beea5de4ab3d5ecfdae38bcb768787", "score": "0.53794146", "text": "func (funcs IntValidator) Range(s int, t int) IntValidator {\n\tfuncs = append(funcs, func(v int) error {\n\t\tif v < s || v > t {\n\t\t\treturn fmt.Errorf(\"must be %d ~ %d\", s, t)\n\t\t}\n\t\treturn nil\n\t})\n\treturn funcs\n}", "title": "" }, { "docid": "46ca1bb28558fabc96199911fdcc43dd", "score": "0.53695536", "text": "func (r *Range) Check(value float64) bool {\n var no bool = false\n var yes bool = true\n\n if r.AlertOnInside {\n no = true\n yes = false\n }\n // see https://www.monitoring-plugins.org/doc/guidelines.html#THRESHOLDFORMAT\n if r.Start <= value && value <= r.End {\n return no\n } else {\n return yes\n }\n return yes\n}", "title": "" }, { "docid": "12bf8ea650877aac1a611a5371c6ea5a", "score": "0.5367827", "text": "func containsInt64(valid []int64, value int64) bool {\n\tfor _, v := range valid {\n\t\tif v == value {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "12bf8ea650877aac1a611a5371c6ea5a", "score": "0.5367827", "text": "func containsInt64(valid []int64, value int64) bool {\n\tfor _, v := range valid {\n\t\tif v == value {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7f757e85b49b43f842c96773b1f92533", "score": "0.53656155", "text": "func assertWithinFeeBounds(t testing.TB, amount string, target string, maxFeeStroops int64) {\n\tsuffix := \" XLM\"\n\tamount = strings.TrimSuffix(amount, suffix)\n\tamountX, err := stellarnet.ParseStellarAmount(amount)\n\trequire.NoError(t, err)\n\ttargetX, err := stellarnet.ParseStellarAmount(target)\n\trequire.NoError(t, err)\n\tlowestX := targetX - maxFeeStroops\n\trequire.LessOrEqual(t, amountX, targetX)\n\trequire.LessOrEqual(t, lowestX, amountX)\n}", "title": "" }, { "docid": "62acd57aca5f0633b9c852db84b95ac4", "score": "0.5356169", "text": "func BoundInt(val, min, max int) int {\n\tswitch {\n\tcase val > max:\n\t\treturn max\n\tcase val < min:\n\t\treturn min\n\tdefault:\n\t\treturn val\n\t}\n}", "title": "" }, { "docid": "4098ace261b60d4506afd6b875e85c84", "score": "0.53476644", "text": "func (r *rangeImpl) CheckInt(val int) bool {\n\treturn r.Check(float64(val))\n}", "title": "" }, { "docid": "7bec76f8b90e799581e9a011ca75759c", "score": "0.53476435", "text": "func (_m *Validator) InInt64(name string, val int64, list []int64, msg ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, name, val, list)\n\t_ca = append(_ca, msg...)\n\t_m.Called(_ca...)\n}", "title": "" }, { "docid": "9f2739001cc4169f8a1bf52f3be7095c", "score": "0.5340773", "text": "func TimeRangeUint64(from, to uint64) func(Call) error {\n\treturn func(hc Call) error {\n\t\tif c, ok := hc.(hasQueryOptions); ok {\n\t\t\tif from >= to {\n\t\t\t\t// or equal is becuase 'to' is exclusive\n\t\t\t\treturn errors.New(\"'from' timestamp is greater or equal to 'to' timestamp\")\n\t\t\t}\n\t\t\tc.setTimeRangeUint64(from, to)\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.New(\"'TimeRange' option can only be used with Get or Scan request\")\n\t}\n}", "title": "" }, { "docid": "46315c38a1934acae5f1e77de49c44b9", "score": "0.53361946", "text": "func (_m *Validator) RangeInt(name string, val int, min int, max int, msg ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, name, val, min, max)\n\t_ca = append(_ca, msg...)\n\t_m.Called(_ca...)\n}", "title": "" }, { "docid": "ac0ada4ec61d6c196f6ee5a5447551b2", "score": "0.53351355", "text": "func SafeSubUint64(a uint64, b uint64) (result uint64, valid bool) {\n\tvalid = b <= a\n\tresult = a - b\n\treturn\n}", "title": "" }, { "docid": "d73609c65e67401bb1bea001e47ae46c", "score": "0.53346413", "text": "func AssertLessThanOrEqual(t *testing.T, v1 interface{}, v2 interface{}, format string, a...interface{}) {\n\tvar lte bool\n\tswitch v1.(type) {\n\tcase int, int8, int16, int32, int64:\n\t\tlte = reflect.ValueOf(v1).Int() <= reflect.ValueOf(v2).Int()\n\tcase float32, float64:\n\t\tlte = reflect.ValueOf(v1).Float() <= reflect.ValueOf(v2).Float()\n\tdefault:\n\t\tlte = false\n\t}\n\tif !lte {\n\t\tlogFatal(t, assertFuncName(true) + \" failed. \" + format, a)\n\t}\n}", "title": "" }, { "docid": "05b26f252dc2626489bc11fe5cae44d8", "score": "0.53269553", "text": "func MustAbsInt64(n int64) int64 {\n\tif n == -1<<63 {\n\t\tpanic(\"value out of range\")\n\t}\n\ty := n >> 63 // y ← x ⟫ 63\n\treturn (n ^ y) - y // (x ⨁ y) - y\n}", "title": "" }, { "docid": "ba2b2175cb9674afa2cc86ef172fe5f3", "score": "0.5326298", "text": "func (sc *SCell) IsInRange(value uint32) bool {\n\treturn value >= sc.Lower && value <= sc.Upper\n}", "title": "" }, { "docid": "087117e209b90d99fda148f23220f3a3", "score": "0.5318401", "text": "func addInt64Checked(x, y int64) (int64, bool) {\n\tif (y > 0 && x > math.MaxInt64-y) || (y < 0 && x < math.MinInt64-y) {\n\t\treturn 0, false\n\t}\n\treturn x + y, true\n}", "title": "" }, { "docid": "f965b94c6f724d0a56609ed0e782c923", "score": "0.53157055", "text": "func GenRandomInRange(min, max int) int {\n\treturn rand.Intn(max-min) + min\n}", "title": "" } ]
f398221e7451318c2d02d2e6795e8fb4
Specify each Resource group associated with the resources that you want to monitor. Filter values are casesensitive Other integration type support an additional argument:
[ { "docid": "be6d87107625895f2afeb8c50bd3a30f", "score": "0.0", "text": "func (o AzureIntegrationsRedisCachePtrOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AzureIntegrationsRedisCache) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceGroups\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" } ]
[ { "docid": "e8bc467f6de8fcad986baff49d6900b6", "score": "0.58995587", "text": "func (o AzureIntegrationsMonitorOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsMonitor) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "97612bea0e84edb92df6b27976b6309e", "score": "0.5860834", "text": "func (ac *AzureClient) filterResources(resources []string, resourceGroup config.ResourceGroup) []string {\n\tfilteredResources := []string{}\n\n\tfor _, resource := range resources {\n\t\tresourceParts := strings.Split(resource, \"/\")\n\t\tresourceName := resourceParts[len(resourceParts)-1]\n\n\t\tif len(resourceGroup.ResourceNameIncludeRe) != 0 {\n\t\t\tinclude := false\n\t\t\tfor _, rx := range resourceGroup.ResourceNameIncludeRe {\n\t\t\t\tif rx.MatchString(resourceName) {\n\t\t\t\t\tinclude = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !include {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\texclude := false\n\t\tfor _, rx := range resourceGroup.ResourceNameExcludeRe {\n\t\t\tif rx.MatchString(resourceName) {\n\t\t\t\texclude = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif exclude {\n\t\t\tcontinue\n\t\t}\n\n\t\tfilteredResources = append(filteredResources, resource)\n\t}\n\n\treturn filteredResources\n}", "title": "" }, { "docid": "162331dd8a936ee014e791c3609778f2", "score": "0.5574295", "text": "func parseAndGroupResources(allResources []string) ([]string, []string, []string) {\n\tvar globalResources, eastOnlyResources, regionalResources []string\n\tfor _, resourceName := range allResources {\n\t\tif contains(awsterraformer.SupportedGlobalResources, resourceName) {\n\t\t\tglobalResources = append(globalResources, resourceName)\n\t\t} else if contains(awsterraformer.SupportedEastOnlyResources, resourceName) {\n\t\t\teastOnlyResources = append(eastOnlyResources, resourceName)\n\t\t} else {\n\t\t\tregionalResources = append(regionalResources, resourceName)\n\t\t}\n\t}\n\treturn globalResources, eastOnlyResources, regionalResources\n}", "title": "" }, { "docid": "fe0f2d918f095c34ef8ca8c97cd2a546", "score": "0.5502243", "text": "func (o AzureIntegrationsPowerBiDedicatedOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsPowerBiDedicated) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "76e4caaa03f50e4e912196f96eb02c25", "score": "0.5483879", "text": "func (o AzureIntegrationsMysqlFlexibleOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsMysqlFlexible) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "7e359927199bfd23c0a4da8b0a54f36e", "score": "0.5469532", "text": "func (o AzureIntegrationsApiManagementOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsApiManagement) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "dfe780523e32944bde74b2f855d34eb6", "score": "0.54680586", "text": "func GetResourceGroup(filterRgroup string) {\n\ta := wow.New(os.Stdout, spin.Get(spin.Dots), \"Fetching resource groups\")\n\ta.Start()\n\ttime.Sleep(2 * time.Second)\n\ta.Text(\"This would take a few minutes...\").Spinner(spin.Get(spin.Dots))\n\t//List AKS ResourceGroup\n\tcmd := exec.Command(\"az\", \"group\", \"list\")\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprint(err) + \": \" + stderr.String())\n\t\treturn\n\t}\n\ta.PersistWith(spin.Spinner{}, \"....\")\n\tif filterRgroup == \"all\" {\n\t\tfmt.Println(\"Result: \" + out.String())\n\t} else {\n\t\tfmt.Println(\"Result:\", utils.FilterStringMap(out.String(), filterRgroup))\n\t}\n}", "title": "" }, { "docid": "8255fa1c97f18d43c9846189031a77a1", "score": "0.5436374", "text": "func updateResourceGroup(rg resources.ResourceGroup) {\n\tfmt.Println(\"Update resource group\")\n\trg.Tags = &map[string]*string{\n\t\t\"who rocks\": to.StringPtr(\"golang\"),\n\t\t\"where\": to.StringPtr(\"on azure\"),\n\t}\n\t_, err := groupsClient.CreateOrUpdate(groupName, rg)\n\tonErrorFail(err, \"CreateOrUpdateFailed\")\n}", "title": "" }, { "docid": "5384274fc3c0838d7ba3fff6dcf546b2", "score": "0.5424011", "text": "func (o AzureIntegrationsEventHubOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsEventHub) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "c4bdb71d100c0888b931dc54f1b3c8cf", "score": "0.5390478", "text": "func (o AzureIntegrationsAppGatewayOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsAppGateway) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "f32cdb5f6428b1ad54806c1122527c2d", "score": "0.53892887", "text": "func (ac *AzureClient) listFromResourceGroup(resourceGroup string, resourceTypes []string) ([]string, error) {\n\tapiVersion := \"2018-02-01\"\n\n\tvar filterTypesElements []string\n\tfor _, filterType := range resourceTypes {\n\t\tfilterTypesElements = append(filterTypesElements, fmt.Sprintf(\"resourcetype eq '%s'\", filterType))\n\t}\n\tfilterTypes := url.QueryEscape(strings.Join(filterTypesElements, \" or \"))\n\n\tsubscription := fmt.Sprintf(\"subscriptions/%s\", sc.C.Credentials.SubscriptionID)\n\n\tresourcesEndpoint := fmt.Sprintf(\"%s/%s/resourceGroups/%s/resources?api-version=%s&$filter=%s\", sc.C.ResourceManagerURL, subscription, resourceGroup, apiVersion, filterTypes)\n\n\tbody, err := getAzureMonitorResponse(resourcesEndpoint)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar data AzureResourceListResponse\n\terr = json.Unmarshal(body, &data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error unmarshalling response body: %v\", err)\n\t}\n\n\tresources := extractResourceNames(data, subscription)\n\n\treturn resources, nil\n}", "title": "" }, { "docid": "b6e36e32820bcb3ac3fa28f8ea1f965e", "score": "0.5386173", "text": "func (o AzureIntegrationsPostgresqlFlexibleOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsPostgresqlFlexible) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "b0333459c68c5e11f7a420fd0d7989b5", "score": "0.53688306", "text": "func (o AzureIntegrationsMysqlOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsMysql) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "4dd4c3480aad2aac53acd265fc90d4a0", "score": "0.5368516", "text": "func (o AzureIntegrationsFrontDoorOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsFrontDoor) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "105da378f96dca834df7ab8204bc9581", "score": "0.5360995", "text": "func (r RID) ResourceGroup() string { return r.Get(keyRG) }", "title": "" }, { "docid": "29be825ad798f939befab74c24f6d917", "score": "0.5351062", "text": "func DataSourceGroup() *schema.Resource {\n\ttype entity struct {\n\t\tDisplayName string `json:\"display_name\"`\n\t\tRecursive bool `json:\"recursive,omitempty\"`\n\t\tMembers []string `json:\"members,omitempty\" tf:\"slice_set,computed\"`\n\t\tUsers []string `json:\"users,omitempty\" tf:\"slice_set,computed\"`\n\t\tServicePrincipals []string `json:\"service_principals,omitempty\" tf:\"slice_set,computed\"`\n\t\tChildGroups []string `json:\"child_groups,omitempty\" tf:\"slice_set,computed\"`\n\t\tGroups []string `json:\"groups,omitempty\" tf:\"slice_set,computed\"`\n\t\tInstanceProfiles []string `json:\"instance_profiles,omitempty\" tf:\"slice_set,computed\"`\n\t\tExternalID string `json:\"external_id,omitempty\" tf:\"computed\"`\n\t}\n\n\ts := common.StructToSchema(entity{}, func(\n\t\ts map[string]*schema.Schema) map[string]*schema.Schema {\n\t\t// nolint once SDKv2 has Diagnostics-returning validators, change\n\t\ts[\"display_name\"].ValidateFunc = validation.StringIsNotEmpty\n\t\ts[\"recursive\"].Default = true\n\t\ts[\"members\"].Deprecated = \"Please use `users`, `service_principals`, and `child_groups` instead\"\n\t\taddEntitlementsToSchema(&s)\n\t\treturn s\n\t})\n\n\treturn &schema.Resource{\n\t\tSchema: s,\n\t\tReadContext: func(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics {\n\t\t\tvar this entity\n\t\t\tcommon.DataToStructPointer(d, s, &this)\n\t\t\tgroupsAPI := NewGroupsAPI(ctx, m)\n\t\t\tgroupAttributes := \"members,roles,entitlements,externalId\"\n\t\t\tgroup, err := groupsAPI.ReadByDisplayName(this.DisplayName, groupAttributes)\n\t\t\tif err != nil {\n\t\t\t\treturn diag.FromErr(err)\n\t\t\t}\n\t\t\td.SetId(group.ID)\n\t\t\tqueue := []Group{group}\n\t\t\tfor len(queue) > 0 {\n\t\t\t\tcurrent := queue[0]\n\t\t\t\tqueue = queue[1:]\n\t\t\t\tfor _, x := range current.Members {\n\t\t\t\t\tthis.Members = append(this.Members, x.Value)\n\t\t\t\t\tif strings.HasPrefix(x.Ref, \"Users/\") {\n\t\t\t\t\t\tthis.Users = append(this.Users, x.Value)\n\t\t\t\t\t}\n\t\t\t\t\tif strings.HasPrefix(x.Ref, \"Groups/\") {\n\t\t\t\t\t\tthis.ChildGroups = append(this.ChildGroups, x.Value)\n\t\t\t\t\t}\n\t\t\t\t\tif strings.HasPrefix(x.Ref, \"ServicePrincipals/\") {\n\t\t\t\t\t\tthis.ServicePrincipals = append(this.ServicePrincipals, x.Value)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, x := range current.Roles {\n\t\t\t\t\tthis.InstanceProfiles = append(this.InstanceProfiles, x.Value)\n\t\t\t\t}\n\t\t\t\tcurrent.Entitlements.readIntoData(d)\n\t\t\t\tfor _, x := range current.Groups {\n\t\t\t\t\tthis.Groups = append(this.Groups, x.Value)\n\t\t\t\t\tif this.Recursive {\n\t\t\t\t\t\tchildGroup, err := groupsAPI.Read(x.Value, groupAttributes)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn diag.FromErr(err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqueue = append(queue, childGroup)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.ExternalID = group.ExternalID\n\t\t\tsort.Strings(this.Groups)\n\t\t\tsort.Strings(this.Members)\n\t\t\tsort.Strings(this.Users)\n\t\t\tsort.Strings(this.ChildGroups)\n\t\t\tsort.Strings(this.ServicePrincipals)\n\t\t\tsort.Strings(this.InstanceProfiles)\n\t\t\terr = common.StructToData(this, s, d)\n\t\t\tif err != nil {\n\t\t\t\treturn diag.FromErr(err)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6c3e5d80dd6d94fe1b0e4ab6050764a9", "score": "0.53429466", "text": "func (filters NameValuesFilters) ResourcegroupstaggingapiFilters() []*resourcegroupstaggingapi.TagFilter {\n\tm := filters.Map()\n\n\tif len(m) == 0 {\n\t\treturn nil\n\t}\n\n\tresult := make([]*resourcegroupstaggingapi.TagFilter, 0, len(m))\n\n\tfor k, v := range m {\n\t\tfilter := &resourcegroupstaggingapi.TagFilter{\n\t\t\tKey: aws.String(k),\n\t\t\tValues: aws.StringSlice(v),\n\t\t}\n\n\t\tresult = append(result, filter)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "e384e01d2e5af05871c1afc497a92436", "score": "0.5338006", "text": "func (o AzureIntegrationsFirewallsOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsFirewalls) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "719e0992539cf535933b63b6faf81dad", "score": "0.5317549", "text": "func (o AzureIntegrationsMachineLearningOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsMachineLearning) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "308a01fd7db542b89526c0ebc9dd595f", "score": "0.530575", "text": "func groupOverrides() tjconfig.ResourceOption {\n\treturn func(r *tjconfig.Resource) {\n\t\tapiGroup, ok := apiGroupMap[r.Name]\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tr.ShortGroup = apiGroup\n\t\tparts := strings.Split(r.Name, \"_\")\n\t\ti, ok := kindNameRuleMap[apiGroup]\n\t\tif !ok {\n\t\t\ti = 1 // by default we drop only the first token (azurerm)\n\t\t\t// check if group name is a prefix for the resource name\n\t\t\tfor j := 2; j <= len(parts); j++ {\n\t\t\t\t// do not include azurerm in comparison\n\t\t\t\tif strings.Join(parts[1:j], \"\") == apiGroup {\n\t\t\t\t\t// if group name is a prefix for resource name,\n\t\t\t\t\t// we do not include it in Kind name\n\t\t\t\t\ti = j\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif i >= len(parts) {\n\t\t\ti = len(parts) - 1\n\t\t}\n\t\tr.Kind = name.NewFromSnake(strings.Join(parts[i:], \"_\")).Camel\n\t}\n}", "title": "" }, { "docid": "4e465806e0f811d0a32379f2678e4925", "score": "0.53000367", "text": "func listResourceGroups() {\n\tfmt.Println(\"List resource groups\")\n\tgroupsList, err := groupsClient.List(\"\", nil)\n\tonErrorFail(err, \"List failed\")\n\tif groupsList.Value != nil && len(*groupsList.Value) > 0 {\n\t\tallGroupsList := []resources.ResourceGroup{}\n\t\tappendResourceGroups(&allGroupsList, groupsList, to.IntPtr(0))\n\t\tfmt.Println(\"Resource groups in subscription\")\n\t\tfor _, group := range allGroupsList {\n\t\t\ttags := \"\\n\"\n\t\t\tif group.Tags == nil || len(*group.Tags) <= 0 {\n\t\t\t\ttags += \"\\t\\tNo tags yet\\n\"\n\t\t\t} else {\n\t\t\t\tfor k, v := range *group.Tags {\n\t\t\t\t\ttags += fmt.Sprintf(\"\\t\\t%s = %s\\n\", k, *v)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Printf(\"Resource group '%s'\\n\", *group.Name)\n\t\t\telements := map[string]interface{}{\n\t\t\t\t\"ID\": *group.ID,\n\t\t\t\t\"Location\": *group.Location,\n\t\t\t\t\"Provisioning state\": *group.Properties.ProvisioningState,\n\t\t\t\t\"Tags\": tags}\n\t\t\tfor k, v := range elements {\n\t\t\t\tfmt.Printf(\"\\t%s: %s\\n\", k, v)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfmt.Println(\"There aren't any resource groups\")\n\t}\n}", "title": "" }, { "docid": "be0e7ce9e173698496f09bc403b858b7", "score": "0.5298806", "text": "func (o AzureIntegrationsMariaDbOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsMariaDb) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "dcbf5e1267735c6cda706b211f2efe82", "score": "0.5289584", "text": "func (o AzureIntegrationsAppServiceOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsAppService) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "e28370d5c5b1a07088de043c69d953f9", "score": "0.52713937", "text": "func (o AzureIntegrationsSqlOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsSql) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "33a474fcfe5d6fe3dd0325eaa56e6aed", "score": "0.52364826", "text": "func (o AzureIntegrationsFunctionsOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsFunctions) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "e2dea4f110c12340067b77a4cb0561a1", "score": "0.5232071", "text": "func (o AzureIntegrationsPostgresqlOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsPostgresql) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "394c9fc79139f257859dd46807589d2a", "score": "0.5184321", "text": "func (o AzureIntegrationsVpnGatewayOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsVpnGateway) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "4a6d771ee8f65bb6d07a6faed599cd34", "score": "0.516886", "text": "func (o AzureIntegrationsDataFactoryOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsDataFactory) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "564b38a55fcd9bcd1a5f329713519ff4", "score": "0.51687074", "text": "func ServerGroupsAndResources() {\n\tdiscoveryClient := k8s.DiscoveryClientOrDie(\"\")\n\t//allResources(discoveryClient)\n\n\t_, resourceLists, err := discoveryClient.ServerGroupsAndResources()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvar gv string\n\tif gv, err = GroupVersionForResource(resourceLists, cronjob.Resource); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"CronJob Group And Version: \", gv)\n\tif gv, err = GroupVersionForResource(resourceLists, clusterrole.Resource); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"ClusterRole Group And Version: \", gv)\n\tif gv, err = GroupVersionForResource(resourceLists, clusterrolebinding.Resource); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"ClusterRoleBinding Group And Version: \", gv)\n\tif gv, err = GroupVersionForResource(resourceLists, role.Resource); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"Role Group And Version: \", gv)\n\tif gv, err = GroupVersionForResource(resourceLists, rolebinding.Resource); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"RoleBinding Group And Version: \", gv)\n\n\t// Output:\n\n\t//CronJob Group And Version: batch/v1beta1\n\t//ClusterRole Group And Version: rbac.authorization.k8s.io/v1\n\t//ClusterRoleBinding Group And Version: rbac.authorization.k8s.io/v1\n\t//Role Group And Version: rbac.authorization.k8s.io/v1\n\t//RoleBinding Group And Version: rbac.authorization.k8s.io/v1\n}", "title": "" }, { "docid": "31963669928a45fd1bfffc134752a236", "score": "0.51674604", "text": "func (o AzureIntegrationsServiceBusOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsServiceBus) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "eeefcfd967eba7e21988b200248ebfcb", "score": "0.5136955", "text": "func (o AzureIntegrationsVmsOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsVms) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "e4e6ecdc5da67028a7982b92156a3f15", "score": "0.5100579", "text": "func WithResourcesFilter(resourcesFilter func(key kube.ResourceKey, target *unstructured.Unstructured, live *unstructured.Unstructured) bool) SyncOpt {\n\treturn func(ctx *syncContext) {\n\t\tctx.resourcesFilter = resourcesFilter\n\t}\n}", "title": "" }, { "docid": "f7342715a69f40aabcb83328cad09225", "score": "0.5099579", "text": "func (o AzureIntegrationsMonitorPtrOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AzureIntegrationsMonitor) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceGroups\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "71561acc9ada2f0ba9121a6a641256c4", "score": "0.5099436", "text": "func (o AzureIntegrationsRedisCacheOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsRedisCache) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "ec23bedd7156f2736ec4a375d835860b", "score": "0.5073314", "text": "func RunFilters(ctx context.Context, resourceList *framework.ResourceList, filters ...yaml.Filter) error {\n\tvar out []*yaml.RNode\n\tfor _, obj := range resourceList.Items {\n\t\t_, err := obj.Pipe(filters...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tout = append(out, obj)\n\t}\n\n\tresourceList.Items = out\n\n\treturn nil\n}", "title": "" }, { "docid": "abb6ae67ba59056a3451a72b47797b3f", "score": "0.5072731", "text": "func (o AzureIntegrationsSqlManagedOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsSqlManaged) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "4af39234bc173183bdad90c234756f3b", "score": "0.50604147", "text": "func (o AzureIntegrationsLogicAppsOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsLogicApps) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "2192697eae6bd68df01642b1b02ad133", "score": "0.50513816", "text": "func Resource(resource string) schema.GroupResource {\n\treturn schema.GroupResource{Group: GroupName, Resource: resource}\n}", "title": "" }, { "docid": "36cfb9cc3b7bce690d79504fbf7f5720", "score": "0.50506526", "text": "func (r CloudWatchLogGroups) ResourceIdentifiers() []string {\n\treturn r.Names\n}", "title": "" }, { "docid": "93858fc65bbc695b700737d853cd6790", "score": "0.5049072", "text": "func listResources() {\n\tfmt.Println(\"List resources inside the resource group\")\n\tresourcesList, err := groupsClient.ListResources(groupName, \"\", \"\", nil)\n\tonErrorFail(err, \"ListResources failed\")\n\tif resourcesList.Value != nil && len(*resourcesList.Value) > 0 {\n\t\tfmt.Printf(\"Resources in '%s' resource group\\n\", groupName)\n\t\tfor _, resource := range *resourcesList.Value {\n\t\t\ttags := \"\\n\"\n\t\t\tif resource.Tags == nil || len(*resource.Tags) <= 0 {\n\t\t\t\ttags += \"\\t\\t\\tNo tags yet\\n\"\n\t\t\t} else {\n\t\t\t\tfor k, v := range *resource.Tags {\n\t\t\t\t\ttags += fmt.Sprintf(\"\\t\\t\\t%s = %s\\n\", k, *v)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Printf(\"\\tResource '%s'\\n\", *resource.Name)\n\t\t\telements := map[string]interface{}{\n\t\t\t\t\"ID\": *resource.ID,\n\t\t\t\t\"Location\": *resource.Location,\n\t\t\t\t\"Type\": *resource.Type,\n\t\t\t\t\"Tags\": tags,\n\t\t\t}\n\t\t\tfor k, v := range elements {\n\t\t\t\tfmt.Printf(\"\\t\\t%s: %s\\n\", k, v)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfmt.Printf(\"There aren't any resources inside '%s' resource group\\n\", groupName)\n\t}\n}", "title": "" }, { "docid": "7cf8b0819f8a20973f27351bb1a9940e", "score": "0.5040247", "text": "func (o AzureIntegrationsCosmosDbOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsCosmosDb) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "e85b92d412acd843debf7138e738b04b", "score": "0.50155675", "text": "func (p *serviceEvaluator) GroupResource() schema.GroupResource {\n\treturn corev1.SchemeGroupVersion.WithResource(\"services\").GroupResource()\n}", "title": "" }, { "docid": "941e8d1c72c98d4971698f4ade803bb1", "score": "0.500742", "text": "func (o AzureIntegrationsStorageOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsStorage) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "b7c9c8a89a244563564d150c6906b0df", "score": "0.5005754", "text": "func (o AzureIntegrationsVirtualMachineOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsVirtualMachine) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "a93103da22313e0e2e473750561a3bca", "score": "0.5003588", "text": "func (r CloudWatchLogGroups) ResourceName() string {\n\treturn \"cloudwatch-loggroup\"\n}", "title": "" }, { "docid": "4ffd9189aecc2dff355dd333324fa4be", "score": "0.49952194", "text": "func AzureFilterResources(e *State, resources AzureResources, filter string) (r *Results, err error) {\n\tr = new(Results)\n\t// Parse the filter once and then apply it to each item in the loop\n\tbqf, err := boolq.Parse(filter)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\tfilteredResources := AzureResources{Prefix: resources.Prefix}\n\tfor _, res := range resources.Resources {\n\t\tmatch, err := boolq.AskParsedExpr(bqf, res)\n\t\tif err != nil {\n\t\t\treturn r, err\n\t\t}\n\t\tif match {\n\t\t\tfilteredResources.Resources = append(filteredResources.Resources, res)\n\t\t}\n\t}\n\tr.Results = append(r.Results, &Result{Value: filteredResources})\n\treturn\n}", "title": "" }, { "docid": "616bf167f3e5ebf5eabca7aa13dab04a", "score": "0.4993686", "text": "func (o AzureIntegrationsKeyVaultOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsKeyVault) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "33e51275ef7c2a39136eec34a74ddccf", "score": "0.49873918", "text": "func listResourceType(iidGroup IIDGroup, connectionName string) ([]string, error) {\n\t// format) /resource-info-spaces/{iidGroup}/{connectionName}/{resourceType}/{resourceName} [{resourceID}]\n\t// ex) /resource-info-spaces/iids:sg/mock-config01/vpc-01/sg-01 [s9e0ccc0fb04747fbb5cac8aabbd1e:s9e0ccc0fb04747fbb5cac8aabbd1e]\n\n key := \"/resource-info-spaces/\" + string(iidGroup) + \"/\" + connectionName\n keyValueList, err := store.GetList(key, true)\n if err != nil {\n return nil, err\n }\n\n\tresourceTypeList := []string{}\n for _, kv := range keyValueList {\n\t\tresourceTypeList = append(resourceTypeList, utils.GetNodeValue(kv.Key, 4))\n }\n\n return resourceTypeList, nil\n}", "title": "" }, { "docid": "d2b8c6868cc84dcec1921e5ee9d3219e", "score": "0.4970319", "text": "func (o AzureIntegrationsContainersOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsContainers) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "3db0bb072ccde931dad541ec6faa1502", "score": "0.49654272", "text": "func filterAPIGroups(req *restful.Request, groups []metav1.APIGroup) []metav1.APIGroup {\n\tif !isOldKubectl(req.HeaderParameter(\"User-Agent\")) {\n\t\treturn groups\n\t}\n\t// hide API group that has new versions added in 1.5.\n\tvar ret []metav1.APIGroup\n\tfor _, group := range groups {\n\t\tif groupsWithNewVersionsIn1_5.Has(group.Name) {\n\t\t\tcontinue\n\t\t}\n\t\tret = append(ret, group)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "c3f431b0cc16c6391fcd2e67852139c4", "score": "0.4956808", "text": "func Group_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_iam.Group\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "a7fde93320483e249e122da635aead53", "score": "0.4943279", "text": "func updateResourceGroupTags(d *resourceData, c *ArmClient) error {\n\tif err := createClusterResourceGroup(d, c); err != nil { // this should update... let's see if it works\n\t\treturn fmt.Errorf(\"failed to update resource group: %+v\", err)\n\t}\n\n\ttags := d.getTags()\n\n\tcluster, err := d.loadContainerServiceFromApimodel(true, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing API model: %+v\", err)\n\t}\n\tcluster.Tags = expandClusterTags(tags)\n\n\tdeploymentDirectory := path.Join(\"_output\", cluster.Properties.MasterProfile.DNSPrefix)\n\n\treturn cluster.saveTemplates(d, deploymentDirectory)\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "b6e16aec1ae7fc9a218cdf85a99be2d0", "score": "0.4935602", "text": "func Resource(resource string) schema.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "01c307c0b55dbb2e0d311eef78d37d8f", "score": "0.48944753", "text": "func (o AzureIntegrationsLoadBalancerOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsLoadBalancer) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "bf664f7c5e742f1af19a641505f5729c", "score": "0.4879953", "text": "func Resources(s storage.Storer, resTypes []*core.ResourceType, search *api.Search) (list *messages.ListResponse, err error) {\n\n\t// (TODO) > wrap errors here\n\tif err = validation.Validator.Var(resTypes, \"gt=0\"); err != nil {\n\t\treturn\n\t}\n\n\tif err = validation.Validator.Struct(search); err != nil {\n\t\treturn\n\t}\n\n\tif err = mold.Transformer.Struct(nil, search); err != nil {\n\t\treturn\n\t}\n\n\tfilterString := string(search.Filter)\n\n\thasher := hasher.NewBCrypt()\n\tvar exclude []string\n\texclude = make([]string, 0)\n\n\t// Make filter\n\tvar f filter.Filter\n\tif len(search.Filter) > 0 {\n\t\tf, err = filter.CompileString(filterString)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tvar passwords map[string]passwordInfo\n\tvar cs customizer\n\tpwd := &passwordInfo{\n\t\tnot: false,\n\t}\n\n\t// If there is a filter with a password, next lines change the filter\n\t// The new filter will be more inclusive.\n\tif len(search.Filter) > 0 {\n\t\tpasswords = make(map[string]passwordInfo)\n\t\tfor _, resType := range resTypes {\n\t\t\tcs.customize(resType, &f, pwd)\n\n\t\t\tif f.String() != filterString {\n\t\t\t\tpasswords[resType.ID] = *pwd\n\t\t\t}\n\t\t}\n\t}\n\n\t// Make query\n\tvar q storage.Querier\n\tq, err = s.Find(resTypes, f)\n\tdefer q.Close()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// compare plain password with the stored hashed password\n\t// and exclude item that do not match the logic of the filter query.\n\tif len(passwords) > 0 {\n\n\t\tvar res *resource.Resource\n\t\tfor it := q.Iter(); !it.Done(); {\n\t\t\tres = it.Next()\n\n\t\t\tresourceType := res.Meta.ResourceType\n\n\t\t\t// (FIXME) => make this urn configurable\n\t\t\tvalues := res.Values(\"urn:ietf:params:scim:schemas:core:2.0:User\")\n\n\t\t\thashedPassword := (*values)[\"password\"].(datatype.String)\n\n\t\t\tb := hasher.Compare([]byte(hashedPassword), []byte(passwords[resourceType].value))\n\n\t\t\tif passwords[resourceType].operator == \"eq\" && !passwords[resourceType].not && !b {\n\t\t\t\texclude = append(exclude, res.ID)\n\t\t\t}\n\n\t\t\tif passwords[resourceType].operator == \"eq\" && passwords[resourceType].not && b {\n\t\t\t\texclude = append(exclude, res.ID)\n\t\t\t}\n\n\t\t\tif passwords[resourceType].operator == \"ne\" && !passwords[resourceType].not && b {\n\t\t\t\texclude = append(exclude, res.ID)\n\t\t\t}\n\n\t\t\tif passwords[resourceType].operator == \"ne\" && passwords[resourceType].not && !b {\n\t\t\t\texclude = append(exclude, res.ID)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fields projection\n\tfields, err := Attributes(resTypes, &search.Attributes)\n\tif err != nil {\n\t\treturn\n\t}\n\tif fields != nil {\n\t\tq.Fields(fields)\n\t}\n\n\t// Make list\n\tlist = messages.NewListResponse()\n\n\t// Count\n\tlist.TotalResults, err = q.Count()\n\tif err != nil {\n\t\treturn\n\t}\n\t// Remove excluded\n\tlist.TotalResults -= len(exclude)\n\n\tif search.Count > config.Values.PageSize {\n\t\tsearch.Count = config.Values.PageSize\n\t}\n\n\tif search.Count == 0 || search.Count > list.TotalResults {\n\t\tsearch.Count = list.TotalResults\n\t}\n\n\t// Pagination\n\tq.Skip(search.StartIndex - 1).Limit(search.Count - (search.StartIndex - 1))\n\tlist.StartIndex = search.StartIndex\n\n\tif search.Count-(list.StartIndex-1) >= 0 {\n\t\tlist.ItemsPerPage = search.Count - (list.StartIndex - 1)\n\t} else {\n\t\tlist.ItemsPerPage = 0\n\t}\n\n\t// Sorting\n\tif search.SortBy != \"\" {\n\t\tvar sortBy *attr.Path\n\t\tsortBy, err = makeAttr(search.SortBy)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tq.Sort(*sortBy, search.SortOrder != api.DescendingOrder)\n\t}\n\n\tlist.Resources = make([]interface{}, 0)\n\t// Finally, fetch resources\n\tvar r *resource.Resource\n\tfor iter := q.Iter(); !iter.Done(); {\n\t\tr = iter.Next()\n\t\tif !contains(exclude, r.ID) {\n\t\t\tlist.Resources = append(list.Resources, r)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d3404fa5efab24961669c27b3ce5fd51", "score": "0.487704", "text": "func (r ApiDatacentersNatgatewaysRulesGetRequest) Filter(key string, value string) ApiDatacentersNatgatewaysRulesGetRequest {\n\tfilterKey := fmt.Sprintf(FilterQueryParam, key)\n\tr.filters[filterKey] = []string{value}\n\treturn r\n}", "title": "" }, { "docid": "389f4c60acad670e41f74e3167b2e77f", "score": "0.48559535", "text": "func Resource(resource string) unversioned.GroupResource {\n\treturn SchemeGroupVersion.WithResource(resource).GroupResource()\n}", "title": "" }, { "docid": "43dd9e30a152f5d9b524f9caad218261", "score": "0.4854624", "text": "func (r ApiDatacentersServersNicsFirewallrulesGetRequest) Filter(key string, value string) ApiDatacentersServersNicsFirewallrulesGetRequest {\n\tfilterKey := fmt.Sprintf(FilterQueryParam, key)\n\tr.filters[filterKey] = []string{value}\n\treturn r\n}", "title": "" }, { "docid": "754e48688eeeb404e6f91957718d95df", "score": "0.48490012", "text": "func passFilters(obj *unstructured.Unstructured, filter *ResourceFilter) bool {\n\t// check prefix\n\tif !strings.HasPrefix(obj.GetName(), filter.Prefix) {\n\t\tgatewayConfig.Log.Info().Str(\"resource-name\", obj.GetName()).Str(\"prefix\", filter.Prefix).Msg(\"FILTERED: resource name does not match prefix\")\n\t\treturn false\n\t}\n\t// check creation timestamp\n\tcreated := obj.GetCreationTimestamp()\n\tif !filter.CreatedBy.IsZero() && created.UTC().After(filter.CreatedBy.UTC()) {\n\t\tgatewayConfig.Log.Info().Str(\"creation-timestamp\", created.UTC().String()).Str(\"createdBy\", filter.CreatedBy.UTC().String()).Msg(\"FILTERED: resource creation timestamp is after createdBy\")\n\t\treturn false\n\t}\n\t// check labels\n\tif ok := checkMap(filter.Labels, obj.GetLabels()); !ok {\n\t\tgatewayConfig.Log.Info().Interface(\"resource-labels\", obj.GetLabels()).Interface(\"filter-labels\", filter.Labels).Msg(\"FILTERED: labels mismatch\")\n\t\treturn false\n\t}\n\t// check annotations\n\tif ok := checkMap(filter.Annotations, obj.GetAnnotations()); !ok {\n\t\tgatewayConfig.Log.Info().Interface(\"resource-annotations\", obj.GetAnnotations()).Interface(\"filter-annotations\", filter.Annotations).Msg(\"FILTERED: annotations mismatch\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "deb34548d0e72d50e0563924b43d6a71", "score": "0.48304847", "text": "func (inst *Instance) getResources(auth autorest.Authorizer) ([]resourceMeta, error) {\n\tresourceClient := resources.NewClient(inst.cfg.Azure.SubscriptionID)\n\tresourceClient.Authorizer = auth\n\tif err := resourceClient.AddToUserAgent(inst.cfg.Azure.UserAgent); err != nil {\n\t\tinst.logger.Warn().Err(err).Msg(\"adding user agent to client\")\n\t}\n\t// ref: https://godoc.org/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources#Client.ListComplete\n\tresult, err := resourceClient.ListComplete(inst.ctx, inst.cfg.Azure.ResourceFilter, \"\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trl := []resourceMeta{}\n\tfor result.NotDone() {\n\n\t\tif err := result.NextWithContext(inst.ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// ref: https://godoc.org/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources#GenericResource\n\t\tv := result.Value()\n\t\tif v.ID != nil {\n\t\t\t// elide any resources that do not have metrics\n\t\t\tif ok, err := inst.resourceHasMetrics(auth, *v.ID); !ok {\n\t\t\t\tinst.logger.Debug().Str(\"resource_id\", *v.ID).Msg(\"does not support metrics, skipping\")\n\t\t\t\tcontinue\n\t\t\t} else if err != nil {\n\t\t\t\tinst.logger.Warn().Err(err).Str(\"resource_id\", *v.ID).Msg(\"fetching metric namespaces, skipping\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tres := resourceMeta{ID: *v.ID}\n\n\t\t\tvar tags circonus.Tags\n\t\t\tif v.Name != nil {\n\t\t\t\tres.Name = *v.Name\n\t\t\t\ttags = append(tags, circonus.Tag{Category: \"resource_name\", Value: *v.Name})\n\t\t\t}\n\t\t\tif v.Kind != nil {\n\t\t\t\tres.Kind = *v.Kind\n\t\t\t\ttags = append(tags, circonus.Tag{Category: \"resource_kind\", Value: *v.Kind})\n\t\t\t}\n\t\t\tif v.Type != nil {\n\t\t\t\tres.Type = *v.Type\n\t\t\t\ttags = append(tags, circonus.Tag{Category: \"resource_type\", Value: *v.Type})\n\t\t\t}\n\t\t\tif v.Location != nil {\n\t\t\t\ttags = append(tags, circonus.Tag{Category: \"resource_location\", Value: *v.Location})\n\t\t\t}\n\t\t\tfor cat, val := range v.Tags {\n\t\t\t\ttags = append(tags, circonus.Tag{Category: cat, Value: *val})\n\t\t\t}\n\t\t\tres.Tags = tags\n\n\t\t\trl = append(rl, res)\n\t\t}\n\n\t\tif inst.done() {\n\t\t\treturn rl, nil\n\t\t}\n\t}\n\n\tif len(rl) == 0 {\n\t\treturn nil, errors.New(\"zero resources found\")\n\t}\n\n\treturn rl, nil\n}", "title": "" }, { "docid": "feda338ba79ed1a700002cd407a3e734", "score": "0.48184958", "text": "func (d *Deployer) StartGatheringMetrics(config schemas.Config) error {\n\tfor _, region := range d.Stack.Regions {\n\t\tif config.Region != \"\" && config.Region != region.Region {\n\t\t\td.Logger.Debug(\"This region is skipped by user : \" + region.Region)\n\t\t\tcontinue\n\t\t}\n\n\t\td.Logger.Infof(\"[%s]The number of previous autoscaling groups for gathering metrics is %d\", region.Region, len(d.PrevAsgs[region.Region]))\n\n\t\t//select client\n\t\tclient, err := selectClientFromList(d.AWSClients, region.Region)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(d.PrevAsgs[region.Region]) > 0 {\n\t\t\tvar errorList []error\n\t\t\tfor _, asg := range d.PrevAsgs[region.Region] {\n\t\t\t\td.Logger.Debugf(\"Start gathering metrics about autoscaling group : %s\", asg)\n\t\t\t\terr := d.GatherMetrics(client, asg)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrorList = append(errorList, err)\n\t\t\t\t}\n\t\t\t\td.Logger.Debugf(\"Finish gathering metrics about autoscaling group %s.\", asg)\n\t\t\t}\n\n\t\t\tif len(errorList) > 0 {\n\t\t\t\tfor _, e := range errorList {\n\t\t\t\t\td.Logger.Errorf(e.Error())\n\t\t\t\t}\n\t\t\t\treturn errors.New(\"error occurred on gathering metrics\")\n\t\t\t}\n\t\t} else {\n\t\t\td.Logger.Debugf(\"No previous versions to gather metrics : %s\\n\", region.Region)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8bf51e1ac6c44bc596b14df74e3b51e1", "score": "0.48150107", "text": "func (r ApiDatacentersNatgatewaysGetRequest) Filter(key string, value string) ApiDatacentersNatgatewaysGetRequest {\n\tfilterKey := fmt.Sprintf(FilterQueryParam, key)\n\tr.filters[filterKey] = []string{value}\n\treturn r\n}", "title": "" }, { "docid": "5ca10553a2e03813b6eeb63faacde7f8", "score": "0.48108506", "text": "func (ag *ASGroups) ResourceIdentifiers() []string {\n\treturn ag.GroupNames\n}", "title": "" }, { "docid": "652e0b29f2f7a95b198feaf02cfce5cd", "score": "0.4808923", "text": "func UpdateResourceGroup(rgroupName string) {\n\t//Update AKS ResourceGroup\n\ta := wow.New(os.Stdout, spin.Get(spin.Dots), \"Updating resource group : \"+rgroupName)\n\ta.Start()\n\ttime.Sleep(2 * time.Second)\n\ta.Text(\"This would take a few minutes...\").Spinner(spin.Get(spin.Dots))\n\n\tcmd := exec.Command(\"az\", \"group\", \"update\", \"--name\", rgroupName)\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprint(err) + \": \" + stderr.String())\n\t\treturn\n\t}\n\ta.PersistWith(spin.Spinner{}, \"....\")\n\tcolor.Green(\"Resource Group Updated\")\n}", "title": "" }, { "docid": "08c9b3337fceec0882b1148274781568", "score": "0.47981086", "text": "func parameterizeFilter(envs []string, k parameterizertypes.K8sResourceT, p parameterizertypes.ParameterizerT) (bool, error) {\n\tlog.Trace(\"start parameterizeFilter\")\n\tdefer log.Trace(\"end parameterizeFilter\")\n\tkind, apiVersion, metadataName, err := k8sschema.GetInfoFromK8sResource(k)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif len(p.Filters) == 0 {\n\t\t// empty map matches all kinds, apiVersions and names\n\t\treturn true, nil\n\t}\n\tfor _, filter := range p.Filters {\n\t\t// empty kind matches all kinds\n\t\tif filter.Kind != \"\" {\n\t\t\tre, err := regexp.Compile(\"^\" + filter.Kind + \"$\")\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tif !re.MatchString(kind) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\t// empty apiVersion matches all apiVersions\n\t\tif filter.APIVersion != \"\" {\n\t\t\tre, err := regexp.Compile(\"^\" + filter.APIVersion + \"$\")\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tif !re.MatchString(apiVersion) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\t// empty name matches all names\n\t\tif filter.Name != \"\" {\n\t\t\tre, err := regexp.Compile(\"^\" + filter.Name + \"$\")\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tif !re.MatchString(metadataName) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif filter.Envs != nil {\n\t\t\tfound := false\n\t\t\tfor _, env := range envs {\n\t\t\t\tif common.IsStringPresent(filter.Envs, env) {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "cf1abeee91f8e6e18762ee947720188e", "score": "0.47840106", "text": "func (o AzureIntegrationsVirtualNetworksOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsVirtualNetworks) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "5e162f3c218baaf43e1b81afb454cabb", "score": "0.4782725", "text": "func (o AzureIntegrationsExpressRouteOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AzureIntegrationsExpressRoute) []string { return v.ResourceGroups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "4ff66bfcba8c3db304cda1413924d926", "score": "0.47818598", "text": "func setResource(alloc v1.ResourceList, res map[string]int64, grpres map[string]int64) {\n\t// set resource\n\tfor key, val := range res {\n\t\tsetRes(alloc, key, val)\n\t}\n\t// set group resource\n\tfor key, val := range grpres {\n\t\tsetGrpRes(alloc, key, val)\n\t}\n}", "title": "" }, { "docid": "bd7451ca2045926fb7b545d4e3e08d93", "score": "0.47742155", "text": "func NewGroup(ctx *pulumi.Context,\n\tname string, args *GroupArgs, opts ...pulumi.ResourceOption) (*Group, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.DisplayName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DisplayName'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.ServiceName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ServiceName'\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20170301:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20160707:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20160707:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20161010:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20161010:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20180101:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20180101:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20180601preview:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20180601preview:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20190101:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20190101:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20191201:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20191201:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20191201preview:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20191201preview:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20200601preview:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20200601preview:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20201201:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20201201:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:apimanagement/v20210101preview:Group\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:apimanagement/v20210101preview:Group\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource Group\n\terr := ctx.RegisterResource(\"azure-native:apimanagement/v20170301:Group\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "9660944311f90f80886007d2f2d91270", "score": "0.47664216", "text": "func (a AccountsApi) ApiAccountsIdResourceGroupsGet(id string) ([]AzureResourceGroupResource, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Get\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/api/accounts/{id}/resourceGroups\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// authentication '(APIKeyHeader)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-Octopus-ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-Octopus-ApiKey\")\n\t// authentication '(APIKeyQuery)' required\n\t// set key with prefix in query string\n\tlocalVarQueryParams[\"ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"ApiKey\")\n\t// authentication '(NugetApiKeyHeader)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-NuGet-ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-NuGet-ApiKey\")\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tvar successPayload = new([]AzureResourceGroupResource)\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: \"ApiAccountsIdResourceGroupsGet\", 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": "54d84ea7d69f3b712b3e06b6b182ed93", "score": "0.47576296", "text": "func (o AzureIntegrationsMysqlFlexiblePtrOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AzureIntegrationsMysqlFlexible) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceGroups\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "eaa6aaf0c566a0d2057b11abd337b748", "score": "0.47544453", "text": "func apiResources(ctx context.Context, client *kubernetes.Clientset) ([]byte, []byte, []string) {\n\tvar errorArray []string\n\tgroups, resources, err := client.Discovery().ServerGroupsAndResources()\n\tif err != nil {\n\t\terrorArray = append(errorArray, err.Error())\n\t}\n\n\tgroupBytes, err := json.MarshalIndent(groups, \"\", \" \")\n\tif err != nil {\n\t\terrorArray = append(errorArray, err.Error())\n\t}\n\n\tresourcesBytes, err := json.MarshalIndent(resources, \"\", \" \")\n\tif err != nil {\n\t\terrorArray = append(errorArray, err.Error())\n\t}\n\n\treturn groupBytes, resourcesBytes, errorArray\n}", "title": "" }, { "docid": "c2d406f99e6070c02f80956ee9d78cea", "score": "0.47536427", "text": "func (o AzureIntegrationsMysqlPtrOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AzureIntegrationsMysql) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceGroups\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1c33e21e48b795b0ab95614c8bc31f87", "score": "0.47481796", "text": "func (o AzureIntegrationsEventHubPtrOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AzureIntegrationsEventHub) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceGroups\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "9a0b331884d40134eef46a309d2b72f4", "score": "0.47447953", "text": "func enabledResources(groupVersion schema.GroupVersion, resourcesStorageMap map[string]getResourcesStorageFunc, apiResourceConfigSource storage.APIResourceConfigSource) (bool, map[string]rest.Storage) {\n\tenabledResources := map[string]rest.Storage{}\n\tgroupName := groupVersion.Group\n\tif !apiResourceConfigSource.AnyResourcesForGroupEnabled(groupName) {\n\t\tglog.V(1).Infof(\"Skipping disabled API group %q\", groupName)\n\t\treturn false, enabledResources\n\t}\n\tfor resource, fn := range resourcesStorageMap {\n\t\tif apiResourceConfigSource.ResourceEnabled(groupVersion.WithResource(resource)) {\n\t\t\tresources := fn()\n\t\t\tfor k, v := range resources {\n\t\t\t\tenabledResources[k] = v\n\t\t\t}\n\t\t} else {\n\t\t\tglog.V(1).Infof(\"Skipping disabled resource %s in API group %q\", resource, groupName)\n\t\t}\n\t}\n\tif len(enabledResources) == 0 {\n\t\tglog.V(1).Infof(\"Skipping API group %q since there is no enabled resource\", groupName)\n\t\treturn false, enabledResources\n\t}\n\treturn true, enabledResources\n}", "title": "" }, { "docid": "166576f0e4f9696df3b847464573dc1a", "score": "0.47445363", "text": "func TestGroupParameters(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{})\n}", "title": "" }, { "docid": "38a2da432243741b2836ccb954d573e9", "score": "0.47245163", "text": "func (o AzureIntegrationsApiManagementPtrOutput) ResourceGroups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AzureIntegrationsApiManagement) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceGroups\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "ad2575c8dd0867cb8557694a54ca7633", "score": "0.47242475", "text": "func ExampleFilter_Filter_file() {\n\t// setup the configuration\n\td, err := os.MkdirTemp(\"\", \"\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tdefer os.RemoveAll(d)\n\n\terr = os.WriteFile(filepath.Join(d, \"deploy1.yaml\"), []byte(`\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: deployment-1\nspec:\n template:\n spec:\n containers:\n - name: nginx\n image: nginx:1.8.1 # {\"$ref\": \"#/definitions/io.k8s.cli.substitutions.image-1\"}\n`), 0600)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = os.WriteFile(filepath.Join(d, \"deploy2.yaml\"), []byte(`\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: deployment-2\nspec:\n template:\n spec:\n containers:\n - name: nginx\n image: nginx:1.7.9 # {\"$ref\": \"#/definitions/io.k8s.cli.substitutions.image-2\"}\n`), 0600)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = os.WriteFile(filepath.Join(d, \"annotate.star\"), []byte(`\ndef run(items):\n for item in items:\n item[\"metadata\"][\"annotations\"][\"foo\"] = \"bar\"\n\nrun(ctx.resource_list[\"items\"])\n`), 0600)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tfltr := &starlark.Filter{\n\t\tName: \"annotate\",\n\t\tPath: filepath.Join(d, \"annotate.star\"),\n\t}\n\n\t// output contains the transformed resources\n\toutput := &bytes.Buffer{}\n\n\t// run the fltr against the inputs using a kio.Pipeline\n\terr = kio.Pipeline{\n\t\tInputs: []kio.Reader{&kio.LocalPackageReader{PackagePath: d}},\n\t\tFilters: []kio.Filter{fltr},\n\t\tOutputs: []kio.Writer{&kio.ByteWriter{\n\t\t\tWriter: output,\n\t\t\tClearAnnotations: []string{\n\t\t\t\tkioutil.PathAnnotation,\n\t\t\t\tkioutil.LegacyPathAnnotation,\n\t\t\t},\n\t\t}}}.Execute()\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tfmt.Println(output.String())\n\n\t// Output:\n\t// apiVersion: apps/v1\n\t// kind: Deployment\n\t// metadata:\n\t// name: deployment-1\n\t// annotations:\n\t// foo: bar\n\t// spec:\n\t// template:\n\t// spec:\n\t// containers:\n\t// - name: nginx\n\t// image: nginx:1.8.1 # {\"$ref\": \"#/definitions/io.k8s.cli.substitutions.image-1\"}\n\t//---\n\t// apiVersion: apps/v1\n\t// kind: Deployment\n\t// metadata:\n\t// name: deployment-2\n\t// annotations:\n\t// foo: bar\n\t// spec:\n\t// template:\n\t// spec:\n\t// containers:\n\t// - name: nginx\n\t// image: nginx:1.7.9 # {\"$ref\": \"#/definitions/io.k8s.cli.substitutions.image-2\"}\n}", "title": "" }, { "docid": "e65b34bfb0a94847766936088e0a1d51", "score": "0.4705814", "text": "func (_GovernanceSlasher *GovernanceSlasherFilterer) FilterRegistrySet(opts *bind.FilterOpts, registryAddress []common.Address) (*GovernanceSlasherRegistrySetIterator, error) {\n\n\tvar registryAddressRule []interface{}\n\tfor _, registryAddressItem := range registryAddress {\n\t\tregistryAddressRule = append(registryAddressRule, registryAddressItem)\n\t}\n\n\tlogs, sub, err := _GovernanceSlasher.contract.FilterLogs(opts, \"RegistrySet\", registryAddressRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &GovernanceSlasherRegistrySetIterator{contract: _GovernanceSlasher.contract, event: \"RegistrySet\", logs: logs, sub: sub}, nil\n}", "title": "" } ]
7773a9e2ca2e5d02707b597e0915d334
LOSTContainsFold applies the ContainsFold predicate on the "LOST" field.
[ { "docid": "704c099823a06f86a6a2e4f59e1dcd5d", "score": "0.8049938", "text": "func LOSTContainsFold(v string) predicate.Bookreturn {\n\treturn predicate.Bookreturn(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldLOST), v))\n\t})\n}", "title": "" } ]
[ { "docid": "36504fdac73cfbe6f8174f2bbeb9930b", "score": "0.67383754", "text": "func LOSTEqualFold(v string) predicate.Bookreturn {\n\treturn predicate.Bookreturn(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldLOST), v))\n\t})\n}", "title": "" }, { "docid": "cce93f7a0c5122f427420f89dfda1be9", "score": "0.6430966", "text": "func LOSTContains(v string) predicate.Bookreturn {\n\treturn predicate.Bookreturn(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldLOST), v))\n\t})\n}", "title": "" }, { "docid": "edfd1d7a979ae4ad78c40a744458b584", "score": "0.6348907", "text": "func StateContainsFold(v string) predicate.AuthRequest {\n\treturn predicate.AuthRequest(sql.FieldContainsFold(FieldState, v))\n}", "title": "" }, { "docid": "625a4d4abe6c20d062549e457ea8323d", "score": "0.60319537", "text": "func SeriousEventSourceVocabularyContainsFold(v string) predicate.SeriousEvent {\n\treturn predicate.SeriousEvent(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldSeriousEventSourceVocabulary), v))\n\t})\n}", "title": "" }, { "docid": "a7c76c19a9755977954bdb1e8897abc3", "score": "0.5989626", "text": "func BOOKSTATUSDATAContainsFold(v string) predicate.Bookstatus {\n\treturn predicate.Bookstatus(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldBOOKSTATUSDATA), v))\n\t})\n}", "title": "" }, { "docid": "c03dcc93dfa913c315a78cea4a94689e", "score": "0.5897377", "text": "func ProvinceContainsFold(v string) predicate.Province {\n\treturn predicate.Province(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldProvince), v))\n\t})\n}", "title": "" }, { "docid": "9907ceea0ab4fc5e7fca01efeb9dc18d", "score": "0.58802843", "text": "func OpenidContainsFold(v string) predicate.Wechat {\n\treturn predicate.Wechat(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldOpenid), v))\n\t})\n}", "title": "" }, { "docid": "9456a05936b86c12d715182b04852c19", "score": "0.5852574", "text": "func CHECKINDATEContainsFold(v string) predicate.Books {\n\treturn predicate.Books(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCHECKINDATE), v))\n\t})\n}", "title": "" }, { "docid": "f9d42e5af0487c93cf0b144fccbbb0d6", "score": "0.5840767", "text": "func OxygenContainsFold(v string) predicate.Historytaking {\n\treturn predicate.Historytaking(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldOxygen), v))\n\t})\n}", "title": "" }, { "docid": "fcc7bb7a88dec970fd5f6261fc1835e6", "score": "0.5835083", "text": "func StatusContainsFold(v string) predicate.MerchantTransaction {\n\treturn predicate.MerchantTransaction(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "06114aa07aba5a11366894c46c5252bf", "score": "0.58291495", "text": "func StatusContainsFold(v string) predicate.DeviceToken {\n\treturn predicate.DeviceToken(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "adba1385b84ad559a7c6e0a00b95732f", "score": "0.58045894", "text": "func AgentIDContainsFold(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAgentID), v))\n\t})\n}", "title": "" }, { "docid": "36304438452f75a90603fac4a164bfc6", "score": "0.5724807", "text": "func SymptomContainsFold(v string) predicate.Historytaking {\n\treturn predicate.Historytaking(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldSymptom), v))\n\t})\n}", "title": "" }, { "docid": "f8a6a1b920bcba816b3a63ecf97c33ef", "score": "0.56919557", "text": "func WIDContainsFold(v string) predicate.Histogram {\n\treturn predicate.Histogram(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldWID), v))\n\t})\n}", "title": "" }, { "docid": "b3f0a6c317d9d57597900e45099a7f5b", "score": "0.5677926", "text": "func WalletIDContainsFold(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldWalletID), v))\n\t})\n}", "title": "" }, { "docid": "eaacc538877fcec819acdfa4884744a6", "score": "0.5670451", "text": "func SeriousEventTermContainsFold(v string) predicate.SeriousEvent {\n\treturn predicate.SeriousEvent(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldSeriousEventTerm), v))\n\t})\n}", "title": "" }, { "docid": "863393e2ec2a4fcdac8a1180a0804485", "score": "0.564081", "text": "func LOST(v string) predicate.Bookreturn {\n\treturn predicate.Bookreturn(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldLOST), v))\n\t})\n}", "title": "" }, { "docid": "d81a79da326dc414aa786b9399577ea0", "score": "0.56177276", "text": "func LogToEventsContainsFold(v string) predicate.Workflow {\n\treturn predicate.Workflow(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldLogToEvents), v))\n\t})\n}", "title": "" }, { "docid": "37e51e249eae551d5ccd9af4c11f62bc", "score": "0.5583167", "text": "func DistrictContainsFold(v string) predicate.Province {\n\treturn predicate.Province(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDistrict), v))\n\t})\n}", "title": "" }, { "docid": "11e8193e57f5dab42583acb9da116ce1", "score": "0.5558044", "text": "func WIDContainsFold(v string) predicate.Counter {\n\treturn predicate.Counter(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldWID), v))\n\t})\n}", "title": "" }, { "docid": "d68f54cb7e7509dae8ee6fd6d6438659", "score": "0.5553514", "text": "func CodeChallengeContainsFold(v string) predicate.DeviceToken {\n\treturn predicate.DeviceToken(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCodeChallenge), v))\n\t})\n}", "title": "" }, { "docid": "6afe5e9d4492abe5e416e5a8a8198f78", "score": "0.552098", "text": "func PostalContainsFold(v string) predicate.Province {\n\treturn predicate.Province(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPostal), v))\n\t})\n}", "title": "" }, { "docid": "22a03573edabe4a64f77dd736996497d", "score": "0.54599607", "text": "func WxOpenidContainsFold(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldWxOpenid), v))\n\t})\n}", "title": "" }, { "docid": "641f117492e36807c540cb1a5745cffc", "score": "0.54327965", "text": "func BankCodeContainsFold(v string) predicate.MerchantTransaction {\n\treturn predicate.MerchantTransaction(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldBankCode), v))\n\t})\n}", "title": "" }, { "docid": "6eb358f049c3547ca28c3f73e4d4ce1b", "score": "0.5410172", "text": "func TerminalIDContainsFold(v string) predicate.MerchantTransaction {\n\treturn predicate.MerchantTransaction(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTerminalID), v))\n\t})\n}", "title": "" }, { "docid": "75dcc4aeeda6dbe62e94b5c3d84b1f11", "score": "0.53995275", "text": "func UseCaseCodeContainsFold(v string) predicate.UseCase {\n\treturn predicate.UseCase(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldUseCaseCode), v))\n\t})\n}", "title": "" }, { "docid": "6f1a108d34cc3131229d3bb1cc03e597", "score": "0.53927815", "text": "func SubdistrictContainsFold(v string) predicate.Province {\n\treturn predicate.Province(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldSubdistrict), v))\n\t})\n}", "title": "" }, { "docid": "ad1953576a7f9be24f54a57c1752af06", "score": "0.53681767", "text": "func WalletIDContainsFold(v string) predicate.Pointtransaction {\n\treturn predicate.Pointtransaction(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldWalletID), v))\n\t})\n}", "title": "" }, { "docid": "a46eded8b964718fe20c8e67fc839803", "score": "0.5352954", "text": "func CodeChallengeContainsFold(v string) predicate.AuthRequest {\n\treturn predicate.AuthRequest(sql.FieldContainsFold(FieldCodeChallenge, v))\n}", "title": "" }, { "docid": "841ecb92140c965cad91c97316d7e564", "score": "0.53391206", "text": "func ChallengeIDContainsFold(v string) predicate.Challenge {\n\treturn predicate.Challenge(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldChallengeID), v))\n\t})\n}", "title": "" }, { "docid": "1c4a0ac543cc3f807e7eb42ea459af37", "score": "0.5318309", "text": "func AgentNameLastnameContainsFold(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAgentNameLastname), v))\n\t})\n}", "title": "" }, { "docid": "965e4cb228ebd79b200fe1d69c8624bc", "score": "0.5313605", "text": "func PayloadTypeContainsFold(v string) predicate.Message {\n\treturn predicate.Message(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPayloadType), v))\n\t})\n}", "title": "" }, { "docid": "f977805f9907b14b8b745ce787186819", "score": "0.53077084", "text": "func RecipienttellContainsFold(v string) predicate.Deposit {\n\treturn predicate.Deposit(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldRecipienttell), v))\n\t})\n}", "title": "" }, { "docid": "a043549cbbdf8a607f465e71ff2efb0c", "score": "0.530288", "text": "func OutcomeGroupIDContainsFold(v string) predicate.OutcomeGroup {\n\treturn predicate.OutcomeGroup(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldOutcomeGroupID), v))\n\t})\n}", "title": "" }, { "docid": "3369617af4b957b1dab380665a740a4d", "score": "0.52879745", "text": "func UnitContainsFold(v string) predicate.CoinInfo {\n\treturn predicate.CoinInfo(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldUnit), v))\n\t})\n}", "title": "" }, { "docid": "0c12f5c9e442e58d3c747b718089d849", "score": "0.5283826", "text": "func HolderNameContainsFold(v string) predicate.Card {\n\treturn predicate.Card(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldHolderName), v))\n\t})\n}", "title": "" }, { "docid": "412ff0bdd84f4ea5ef5b5f87b3c28d80", "score": "0.52689445", "text": "func UrgencyNameContainsFold(v string) predicate.UrgencyLevel {\n\treturn predicate.UrgencyLevel(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldUrgencyName), v))\n\t})\n}", "title": "" }, { "docid": "1b63a552a3321f84853baaf82868d00d", "score": "0.526541", "text": "func CidContainsFold(v string) predicate.Block {\n\treturn predicate.Block(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCid), v))\n\t})\n}", "title": "" }, { "docid": "9777a5e2495b3fed903ce9b1e8d9bb3b", "score": "0.5236943", "text": "func TitleContainsFold(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "6bb646128e8a929c72cc1212f5f9e71b", "score": "0.5227536", "text": "func DAMAGEDPOINTNAMEContainsFold(v string) predicate.Bookreturn {\n\treturn predicate.Bookreturn(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDAMAGEDPOINTNAME), v))\n\t})\n}", "title": "" }, { "docid": "2eadffea64b67bae7260133cd943331b", "score": "0.5212675", "text": "func NameContainsFold(v string) predicate.SFModel {\n\treturn predicate.SFModel(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "d2a7018417211b191783f3f8070644d7", "score": "0.5210049", "text": "func OutcomeGroupTitleContainsFold(v string) predicate.OutcomeGroup {\n\treturn predicate.OutcomeGroup(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldOutcomeGroupTitle), v))\n\t})\n}", "title": "" }, { "docid": "fdaf77591ed924ffd1e00149c6943926", "score": "0.5209852", "text": "func NameContainsFold(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "b232b5ede4f6aa28b5274a4b9315e4e4", "score": "0.5207445", "text": "func RefreshTokenContainsFold(v string) predicate.ServiceTwitch {\n\treturn predicate.ServiceTwitch(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldRefreshToken), v))\n\t})\n}", "title": "" }, { "docid": "ae500a9eae58f702401b0a8f74015f1f", "score": "0.52013737", "text": "func MessageContainsFold(v string) predicate.Message {\n\treturn predicate.Message(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldMessage), v))\n\t})\n}", "title": "" }, { "docid": "62a6169ba536c921b5246845a6baa382", "score": "0.5187673", "text": "func DepositortellContainsFold(v string) predicate.Deposit {\n\treturn predicate.Deposit(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDepositortell), v))\n\t})\n}", "title": "" }, { "docid": "e109f5316221312911485a85eb9f1ef3", "score": "0.518025", "text": "func UnionIdContainsFold(v string) predicate.Wechat {\n\treturn predicate.Wechat(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldUnionId), v))\n\t})\n}", "title": "" }, { "docid": "25524c33e922f2d4a6bcc4c136f1c4a8", "score": "0.51628643", "text": "func ReferenceContainsFold(v string) predicate.Pointtransaction {\n\treturn predicate.Pointtransaction(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldReference), v))\n\t})\n}", "title": "" }, { "docid": "5f46769fddcffb4dda70d38b7fdcf547", "score": "0.5158862", "text": "func AddressContainsFold(v string) predicate.SFModel {\n\treturn predicate.SFModel(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "45d21634d6f5fa14f787621616be49f0", "score": "0.515792", "text": "func InsurancecompanyContainsFold(v string) predicate.Insurance {\n\treturn predicate.Insurance(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldInsurancecompany), v))\n\t})\n}", "title": "" }, { "docid": "eecf2a17ed1d5858a00bf115f990fa1f", "score": "0.51539737", "text": "func PrivateKeyContainsFold(v string) predicate.KeyStore {\n\treturn predicate.KeyStore(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPrivateKey), v))\n\t})\n}", "title": "" }, { "docid": "b37c4c590383d6fcb65526cfbe779db4", "score": "0.5138504", "text": "func IconContainsFold(v string) predicate.Bag {\n\treturn predicate.Bag(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldIcon), v))\n\t})\n}", "title": "" }, { "docid": "90816555594925a26d573a6819bbab74", "score": "0.5128366", "text": "func WeightListContainsFold(v string) predicate.LoadBalance {\n\treturn predicate.LoadBalance(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldWeightList), v))\n\t})\n}", "title": "" }, { "docid": "da9de6f1f6160d3747c4209d6b350153", "score": "0.5110589", "text": "func OutcomeAnalysisGroupIDContainsFold(v string) predicate.OutcomeAnalysisGroupID {\n\treturn predicate.OutcomeAnalysisGroupID(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldOutcomeAnalysisGroupID), v))\n\t})\n}", "title": "" }, { "docid": "aa7d9968d91ee2d1de23251acf99931d", "score": "0.5108114", "text": "func InfoContainsFold(v string) predicate.Deposit {\n\treturn predicate.Deposit(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldInfo), v))\n\t})\n}", "title": "" }, { "docid": "306cba7988720eecea905e12bb5127e3", "score": "0.5106116", "text": "func NameContainsFold(v string) predicate.CoinInfo {\n\treturn predicate.CoinInfo(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "f31e6180e1d0f454c92b3b5e68838578", "score": "0.5098245", "text": "func UseCaseDescriptionContainsFold(v string) predicate.UseCase {\n\treturn predicate.UseCase(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldUseCaseDescription), v))\n\t})\n}", "title": "" }, { "docid": "200c3792f898f806e60eaa582d5d4bc4", "score": "0.5096194", "text": "func NameContainsFold(v string) predicate.Fileinsert {\n\treturn predicate.Fileinsert(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "3b4fc0347f8cbf8299f75d8df3087061", "score": "0.50936913", "text": "func PayloadValueContainsFold(v string) predicate.Message {\n\treturn predicate.Message(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPayloadValue), v))\n\t})\n}", "title": "" }, { "docid": "9a85742e3a77045f60791acbedf0d327", "score": "0.5085215", "text": "func AlertNameContainsFold(v string) predicate.AlertHistory {\n\treturn predicate.AlertHistory(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAlertName), v))\n\t})\n}", "title": "" }, { "docid": "8349916c20c1c50b9d5010d73c55b2ec", "score": "0.50851554", "text": "func SeriousEventStatsGroupIDContainsFold(v string) predicate.SeriousEventStats {\n\treturn predicate.SeriousEventStats(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldSeriousEventStatsGroupID), v))\n\t})\n}", "title": "" }, { "docid": "62f2f356d0c22869951c020a4ee144ce", "score": "0.5084671", "text": "func UseCaseNameContainsFold(v string) predicate.UseCase {\n\treturn predicate.UseCase(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldUseCaseName), v))\n\t})\n}", "title": "" }, { "docid": "a06d71286a4ac74836672223b44f102b", "score": "0.50747156", "text": "func AddressContainsFold(v string) predicate.KeyStore {\n\treturn predicate.KeyStore(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "013e470d9627a0a257da0f577188881e", "score": "0.5073718", "text": "func OutcomeGroupDescriptionContainsFold(v string) predicate.OutcomeGroup {\n\treturn predicate.OutcomeGroup(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldOutcomeGroupDescription), v))\n\t})\n}", "title": "" }, { "docid": "828c544d580c950bc5da2a709591fff8", "score": "0.5070531", "text": "func DirectionContainsFold(v string) predicate.Message {\n\treturn predicate.Message(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDirection), v))\n\t})\n}", "title": "" }, { "docid": "53e68222404da1e2948bcfe91aab41e9", "score": "0.50615615", "text": "func CustomContainsFold(v string) predicate.CustomType {\n\treturn predicate.CustomType(sql.FieldContainsFold(FieldCustom, v))\n}", "title": "" }, { "docid": "369207c4e8e71e6faed15a574a9a42b5", "score": "0.50609213", "text": "func ParcelcodeContainsFold(v string) predicate.Deposit {\n\treturn predicate.Deposit(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldParcelcode), v))\n\t})\n}", "title": "" }, { "docid": "5f208415e6c8dfb6b474900c0b624edb", "score": "0.50576335", "text": "func NameContainsFold(v string) predicate.Server {\n\treturn predicate.Server(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "e0a642f3d9b8fe337049981a8f5273a4", "score": "0.50574124", "text": "func ConnectorIDContainsFold(v string) predicate.AuthRequest {\n\treturn predicate.AuthRequest(sql.FieldContainsFold(FieldConnectorID, v))\n}", "title": "" }, { "docid": "087d9c1b9e91e1ec00db326306fdaf3e", "score": "0.5048265", "text": "func IconContainsFold(v string) predicate.SubItem {\n\treturn predicate.SubItem(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldIcon), v))\n\t})\n}", "title": "" }, { "docid": "d583efad9df71fff607d64b4b10e4a55", "score": "0.5043955", "text": "func URLContainsFold(v string) predicate.Card {\n\treturn predicate.Card(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldURL), v))\n\t})\n}", "title": "" }, { "docid": "424e8a22b5d334f57a4416a35ee85d03", "score": "0.50438523", "text": "func UseragentContainsFold(v string) predicate.Browser {\n\treturn predicate.Browser(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldUseragent), v))\n\t})\n}", "title": "" }, { "docid": "86ab43dbba8482b0d3050310d5713ee2", "score": "0.504322", "text": "func DescriptionContainsFold(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDescription), v))\n\t})\n}", "title": "" }, { "docid": "6c129c554ebb202c608a214526e425e4", "score": "0.50421584", "text": "func StaffIDContainsFold(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldStaffID), v))\n\t})\n}", "title": "" }, { "docid": "dcd65ac301d64be8afa713b1e041db92", "score": "0.5041521", "text": "func GroupOfAgeAgeContainsFold(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "e64655a836e985716232d9e497c0e4bf", "score": "0.5032388", "text": "func IPListContainsFold(v string) predicate.LoadBalance {\n\treturn predicate.LoadBalance(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldIPList), v))\n\t})\n}", "title": "" }, { "docid": "06ada937b6056027a0eba6c1e4bcbd09", "score": "0.5021664", "text": "func MatchFold(blob, query string) bool {\n\treturn Match(strings.ToLower(blob), strings.ToLower(query))\n}", "title": "" }, { "docid": "037a2a03213ead24f0367ae5e10fe502", "score": "0.50216085", "text": "func AddressContainsFold(v string) predicate.Customer {\n\treturn predicate.Customer(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "cd1181af4894fe0f73c8bb9a2cdd6a87", "score": "0.5017669", "text": "func GenderContainsFold(v string) predicate.Userprofile {\n\treturn predicate.Userprofile(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldGender), v))\n\t})\n}", "title": "" }, { "docid": "3f8f266aecfe6407dd0c7634209ddc4f", "score": "0.50048244", "text": "func BusinessAddressContainsFold(v string) predicate.Userprofile {\n\treturn predicate.Userprofile(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldBusinessAddress), v))\n\t})\n}", "title": "" }, { "docid": "06ba2b637298323cc500cf19e1c1bc0d", "score": "0.50020295", "text": "func NameContainsFold(v string) predicate.Browser {\n\treturn predicate.Browser(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "75565d9b497f4b38007d67e927a74e2e", "score": "0.49995047", "text": "func NameContainsFold(v string) predicate.Bag {\n\treturn predicate.Bag(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "c18113439154d0d7286eec4e05b1eae9", "score": "0.49977207", "text": "func MerchantIDContainsFold(v string) predicate.MerchantTransaction {\n\treturn predicate.MerchantTransaction(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldMerchantID), v))\n\t})\n}", "title": "" }, { "docid": "be2e9b2eb1c497a7187bdea821bbf93b", "score": "0.49973848", "text": "func FamilyNameContainsFold(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldFamilyName), v))\n\t})\n}", "title": "" }, { "docid": "c10b070c9125fcac47f30420874f8bba", "score": "0.49964994", "text": "func MatchFold(source, target string) bool {\n\treturn match(source, target, foldTransformer())\n}", "title": "" }, { "docid": "661e874edbe0e54ba4833ef80b071b96", "score": "0.49960402", "text": "func DescriptionContainsFold(v string) predicate.Server {\n\treturn predicate.Server(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDescription), v))\n\t})\n}", "title": "" }, { "docid": "de7e0da8b2db27ac222e29ae4b7410bd", "score": "0.49958062", "text": "func MagicContainsFold(v string) predicate.Challenge {\n\treturn predicate.Challenge(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldMagic), v))\n\t})\n}", "title": "" }, { "docid": "198aa13fe8efdfc1b124eed1f641e7dc", "score": "0.49955505", "text": "func RedirectURIContainsFold(v string) predicate.AuthRequest {\n\treturn predicate.AuthRequest(sql.FieldContainsFold(FieldRedirectURI, v))\n}", "title": "" }, { "docid": "2af9e748e2c569a07be5ec9167d9c674", "score": "0.4991233", "text": "func IPContainsFold(v string) predicate.Server {\n\treturn predicate.Server(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldIP), v))\n\t})\n}", "title": "" }, { "docid": "b52b878df58dd820de29e31db15c4003", "score": "0.49775648", "text": "func PhoneContainsFold(v string) predicate.Customer {\n\treturn predicate.Customer(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "efd23b96b6b46c8305d25e2081e76dab", "score": "0.4976554", "text": "func ModelContainsFold(v string) predicate.Car {\n\treturn predicate.Car(sql.FieldContainsFold(FieldModel, v))\n}", "title": "" }, { "docid": "7b433a244ee9f6efdd715b7b09fddb1b", "score": "0.49764743", "text": "func DiscordIDContainsFold(v string) predicate.Guild {\n\treturn predicate.Guild(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.ContainsFold(s.C(FieldDiscordID), v))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "3f0dbc2249c81b955009df68931e5c8d", "score": "0.4973445", "text": "func HostContainsFold(v string) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldHost), v))\n\t})\n}", "title": "" }, { "docid": "71ece6215b3da8f0132cfceb7e0d58a9", "score": "0.49669856", "text": "func PaymentChannelContainsFold(v string) predicate.MerchantTransaction {\n\treturn predicate.MerchantTransaction(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPaymentChannel), v))\n\t})\n}", "title": "" }, { "docid": "1ad76081cdb733bfa5a94a46ce6030d5", "score": "0.49601227", "text": "func DeviceCodeContainsFold(v string) predicate.DeviceToken {\n\treturn predicate.DeviceToken(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDeviceCode), v))\n\t})\n}", "title": "" }, { "docid": "a3e0458005177376ce9c2d805a19439e", "score": "0.49581137", "text": "func KYCDateContainsFold(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldKYCDate), v))\n\t})\n}", "title": "" }, { "docid": "27c47ab18a191ecee49583886bc00a1b", "score": "0.4957423", "text": "func UserIDContainsFold(v string) predicate.Challenge {\n\treturn predicate.Challenge(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldUserID), v))\n\t})\n}", "title": "" }, { "docid": "06b65f14d3d03f81f606323328b46322", "score": "0.49435866", "text": "func NameContainsFold(v string) predicate.SubItem {\n\treturn predicate.SubItem(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "b7e6b72dac15ec9575266fbe413e0cac", "score": "0.49329218", "text": "func AgreementOtherDetailsContainsFold(v string) predicate.CertainAgreement {\n\treturn predicate.CertainAgreement(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAgreementOtherDetails), v))\n\t})\n}", "title": "" }, { "docid": "0d3ba743f7b19d8d4c8a424dfcf3b651", "score": "0.49280414", "text": "func LOSTHasSuffix(v string) predicate.Bookreturn {\n\treturn predicate.Bookreturn(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldLOST), v))\n\t})\n}", "title": "" } ]
de3729df42b42251aca3577eac3b164e
writePump writes messages to the client socket as they come in.
[ { "docid": "f9197b92ede0d7960b281e321695e48b", "score": "0.8386181", "text": "func (c *Client) writePump() {\n\tfor msg := range c.send {\n\t\terr := c.socket.WriteJSON(msg)\n\t\tif err != nil {\n\t\t\tc.error(errors.Wrap(err, \"writing message\"))\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "3dab8f9b7b9b646f169b9b2cb3958d68", "score": "0.8363479", "text": "func (c *SocketClient) writePump() {\n\tdefer func() {\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tmsg := <-c.send\n\t\tif err := c.conn.SetWriteDeadline(time.Now().Add(socketWriteWait)); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif err := c.conn.WriteMessage(websocket.TextMessage, msg); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "75aa6872e1eb54df507b3d9fcf4e9a83", "score": "0.81772566", "text": "func (c *Client) writePump() {\n\tdefer func() {\n\t\tc.conn.Close()\n\t}()\n\tc.source = make(chan string, 10)\n\tfor {\n\t\tselect {\n\t\tcase message := <-c.source:\n\t\t\terr := c.conn.WriteMessage(websocket.TextMessage, []byte(message))\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"write error: %s\", err)\n\t\t\t\tclients.Remove(c)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-c.quit:\n\t\t\treturn // terminate the client\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e72042011dfb83f4385a2b7419f0b0a5", "score": "0.8066273", "text": "func (c *Client) writePump() {\n\tm := Message{}\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.socket.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, &m)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := c.write(websocket.TextMessage, message); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, &m); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "778a068d304347f75faad70c64161497", "score": "0.7978283", "text": "func (c *Client) writePump() {\n\tdefer func() {\n\t\tc.conn.Close()\n\t\tc.top.terminate()\n\t}()\n\n\tbuf := make([]byte, 4*1024)\n\tfor {\n\t\tn, err := c.top.stdout.Read(buf)\n//\t\tlog.Printf(\"Read %s\", buf[:n])\n\t\tif n > 0 {\n\t\t\terr := c.conn.WriteMessage(websocket.TextMessage, buf[:n])\n\t\t\tif err != nil {\n\t\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway,\n\t\t\t\t\twebsocket.CloseNoStatusReceived) {\n\t\t\t\t\tlog.Printf(\"Writepump websocket error: %s\", err)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else {\n\t\t\tif err != nil {\n\t\t\t\tif err != io.EOF {\n\t\t\t\t\tlog.Printf(\"Writepump Unexpected error while reading STDOUT from process: %s\", err)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Printf(\"Writepump Process STDOUT closed: %s\", err)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "578f370286c38fc9a117dcd297e398d0", "score": "0.78760284", "text": "func (c *Client) WritePump() {\n\n\tticker := time.NewTicker(pingPeriod)\n\n\tdefer func() {\n\t\tticker.Stop()\n\t\tif c.Connect != nil {\n\t\t\tc.Connect.Close()\n\t\t}\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.Send:\n\n\t\t\tswitch c.ConnType {\n\t\t\tcase SOCKJS:\n\t\t\t\tc.Session.Send(string(message))\n\t\t\tcase WEBSOCK:\n\t\t\t\tif !ok {\n\t\t\t\t\tc.Write(websocket.CloseMessage, []byte{})\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif err := c.Write(websocket.TextMessage, message); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tdefault:\n\n\t\t\t}\n\n\t\tcase <-ticker.C:\n\t\t\tif err := c.Write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0b705b107f8f4066a1e6fc3e5ee7494c", "score": "0.78674555", "text": "func (c *cliClientType) writePump(l *keptnutils.Logger) {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.hub.unregisterCLI <- c\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif wsLogging {\n\t\t\t\tl.Debug(fmt.Sprintf(\"Received message to CLI: %s\", message))\n\t\t\t}\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tl.Debug(\"Cannot write message because hub closed the channel\")\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.conn.WriteControl(websocket.PingMessage, []byte{}, time.Now().Add(writeWait)); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "84011faac9096be1f7b51df659b1bfb1", "score": "0.7698877", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t\tlog.Println(\"Client closed\")\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e84645876d699539e65534f84a2fc2b1", "score": "0.7686404", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5ba6c42b02cf43d75ed3cda9f9205b8a", "score": "0.7658969", "text": "func (s *s) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase <-s.shutdown:\n\t\t\treturn\n\t\tcase message := <-s.send:\n\t\t\tif err := s.write(websocket.TextMessage, message); err != nil {\n\t\t\t\tlog.Println(\"[\"+s.name+\"]\", \"Error during socket write:\", err)\n\t\t\t\ts.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := s.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\tlog.Println(\"[\"+s.name+\"]\", \"Error during ping for socket:\", err)\n\t\t\t\ts.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e086a4a91161001e14d397ba788d60b1", "score": "0.7629353", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3edd75c59c1385fe446af5aa9b20931c", "score": "0.7624353", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3edd75c59c1385fe446af5aa9b20931c", "score": "0.7624353", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1cf3c6dea932015df00e4a0b1dd38676", "score": "0.76193416", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor{\n\t\tif c.stop {\n\t\t\tbreak\n\t\t}\n\t\tselect {\n\t\tcase msg := <-c.send:\n\t\t\tencodedMsg, err := msg.encode()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr = c.write(websocket.TextMessage, encodedMsg)\n\t\t\tif err != nil{\n\t\t\t\tfmt.Println(\"Error while writing text message\",err)\n\t\t\t\treturn\n\t\t\t}\n\t\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\tc.hub.unregister<-c\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "99b1f7d2797e5c615561c800f0be119b", "score": "0.761218", "text": "func (c *connection) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.ws.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tbuff := new(bytes.Buffer)\n\t\t\tif err := json.NewEncoder(buff).Encode(message); err != nil {\n\t\t\t\tlog.Error(err.Error())\n\t\t\t\treturn\n\t\t\t} else if err := c.write(websocket.TextMessage, buff.Bytes()); err != nil {\n\t\t\t\tlog.Error(err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\tlog.Error(\"%#v\", err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "08f8a573fb8329457dc439731362b941", "score": "0.7552284", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(PingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.Conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.Send:\n\t\t\tc.Conn.SetWriteDeadline(time.Now().Add(WriteWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.Conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.Conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.Conn.SetWriteDeadline(time.Now().Add(WriteWait))\n\t\t\tif err := c.Conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "54baf9bd918b7cfa037a996de0ccaa39", "score": "0.75511897", "text": "func (c *Connection) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.ws.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := c.writeMessage(message); err != nil {\n\t\t\t\tlog.Println(\"Error sending message:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\tlog.Println(\"Error sending ping:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5e01470d06c05dd6c0ee8632eb32e870", "score": "0.7549526", "text": "func (c *connection) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.ws.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := c.write(websocket.TextMessage, message); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fcffbfeb4cd84429bed211554043b0b1", "score": "0.75468755", "text": "func (c *client) writePump() {\r\n\tticker := time.NewTicker(pingPeriod)\r\n\tdefer func() {\r\n\t\tticker.Stop()\r\n\t\tc.conn.Close()\r\n\t}()\r\n\tfor {\r\n\t\tselect {\r\n\t\tcase message, ok := <-c.send:\r\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\r\n\t\t\tif !ok {\r\n\t\t\t\t// The hub closed the channel.\r\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\r\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\r\n\t\t\tw.Write(message)\r\n\r\n\t\t\t// Add queued messages to the current websocket message\r\n\t\t\tn := len(c.send)\r\n\t\t\tfor i := 0; i < n; i++ {\r\n\t\t\t\tw.Write(<-c.send)\r\n\t\t\t}\r\n\r\n\t\t\tif err := w.Close(); err != nil {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\tcase <-ticker.C:\r\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\r\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, []byte{}); err != nil {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "20d9333ed5804a77b364037f2306af0f", "score": "0.74952114", "text": "func (s *Subscription) writePump() {\n\tc := s.conn\n\tticker := time.NewTicker(pingPeriod)\n\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := c.write(websocket.TextMessage, message); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1b539c7f1eebf9fe5c8300a511c5b2a8", "score": "0.7471283", "text": "func (c *Client) writePump(ctx context.Context, writeQueue <-chan *writeRequest, disconnectCh <-chan struct{}) error {\n\tfor {\n\t\tselect {\n\t\tcase req := <-writeQueue:\n\t\t\tif err := c.conn.WriteMessage(ctx, req.msg); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"writing message to conn failed\")\n\t\t\t}\n\t\t\tclose(req.doneCh)\n\t\tcase <-disconnectCh:\n\t\t\t// Shutdown requested, stop writing messages and quit. This makes\n\t\t\t// it possible for Run to safely write a shutdown message to conn,\n\t\t\t// without the writePump interfering.\n\t\t\treturn errWritePumpShutdownRequested\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "753bac586a8fd4765b326ba8b08fc6aa", "score": "0.74692184", "text": "func (c *Client) writePump() {\n\n\tpingTicker := time.NewTicker(pingPeriod)\n\n\tdefer func() {\n\t\t// stop the ping ticker\n\t\tpingTicker.Stop()\n\n\t\t// Send a unregister message to the hub\n\t\tc.hub.unregister <- c\n\n\t\t// close the websocket connection\n\t\tc.conn.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\n\t\tcase <-c.hub.shutdownSignal:\n\t\t\treturn\n\n\t\tcase msg, ok := <-c.sendChan:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The Hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := c.conn.WriteJSON(msg); err != nil {\n\t\t\t\tc.hub.logger.Warnf(\"Websocket error: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase <-pingTicker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "40f0b80d8931ec5729aae7cf02a689f8", "score": "0.74311477", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(PING_PERIOD)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase wsMsg, ok := <-c.send:\n\t\t\tlog.Printf(\"message received on user %d:\\n%s\", c.userID, wsMsg.Message)\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(WRITE_WAIT))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tlog.Println(c.userID, \"closing writePump connection\")\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tmessage := fmt.Sprintf(\"User %d: %s\", wsMsg.From, wsMsg.Message)\n\t\t\tif wsMsg.From <= 0 {\n\t\t\t\tmessage = fmt.Sprintf(\"<b>%s</b>\", wsMsg.Message)\n\t\t\t}\n\t\t\tw.Write([]byte(message))\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\t// n := len(c.send)\n\t\t\t// for i := 0; i < n; i++ {\n\t\t\t// \tw.Write(newline)\n\t\t\t// \tw.Write([]byte(<-c.send.Message))\n\t\t\t// }\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(WRITE_WAIT))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b5d481df990e3f3d5f005aae86556a5d", "score": "0.7352619", "text": "func (p *Player) WritePump() {\n\tpong := time.NewTicker(configuration.Server.PingPeriod)\n\tdefer func() {\n\t\tpong.Stop()\n\t\tp.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-p.sendch:\n\t\t\tif !ok {\n\t\t\t\tp.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := p.write(websocket.BinaryMessage, message); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-pong.C:\n\t\t\tif err := p.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1afa1b5198693a500157f538436a2e9a", "score": "0.7318692", "text": "func (c *Client) writePump() {\n\tc.ticker = time.NewTicker(pingPeriod)\n\tdefer c.stop(\"writePump exited\")\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().UTC().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tlogger.Info(\"ws-%s error when setting the write deadline\", c.id)\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := c.conn.WriteJSON(message); err != nil {\n\t\t\t\tlogger.Error(errors.Wrapf(err, \"ws-%s error when writing a message\", c.id))\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase <-c.ticker.C:\n\t\t\tif !c.authenticated && time.Now().Sub(c.started) > authTimeout {\n\t\t\t\tlog.Printf(\"ws-%s not authenticated, disconnecting\", c.id)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tc.conn.SetWriteDeadline(time.Now().UTC().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\tlogger.Error(errors.Wrapf(err, \"ws-%s error when writing ping message\", c.id))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b916869b2b4f249a688f084bc1057f00", "score": "0.73142093", "text": "func (s *subscriber) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tlog.Println(\"[subscriber] writePump exiting\")\n\t\tticker.Stop()\n\t\ts.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-s.send:\n\t\t\ts.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The pub closed the channel.\n\t\t\t\ts.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := s.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(s.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-s.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\ts.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := s.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "af34e020c3261365be88de8822c6e2a5", "score": "0.7305472", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t//w.Write([]byte(\"message\"))\n\t\t\t//fmt.Println(message)\n\t\t\t//在这里调用\n\t\t\tw.Write(message)\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2f44f7ba5b4a5b53cc0599590107a30c", "score": "0.72687805", "text": "func (c *Connection) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.wsConnect.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <- c.send:\n\t\t\tc.wsConnect.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.wsConnect.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.wsConnect.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\t//n := len(c.send)\n\t\t\t//for i := 0; i < n; i++ {\n\t\t\t//\tw.Write(newline)\n\t\t\t//\tw.Write(<-c.send)\n\t\t\t//}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.wsConnect.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.wsConnect.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5a42820e8437c4cc508998ada076644c", "score": "0.7268266", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// the hub closed the channel\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// gets the next available writer\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// add queued chat messages to the current websocket message\n\t\t\t// n := len(c.send)\n\t\t\t// for i := 0; i < n; i++ {\n\t\t\t// \tw.Write(newline)\n\t\t\t// \tw.Write(<-c.send)\n\t\t\t// }\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t// send keep-alive ping signal to the websocket every time\n\t\t// the ticker sends a message on the channel\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\terr := c.conn.WriteMessage(websocket.PingMessage, []byte{})\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8d5f09ea93b2abc227801005a10d2fe6", "score": "0.7186236", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttryWriteMessage(w, message, 0)\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tlog.Debugf(\"[%v] <- ping...\", c.key)\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\tlog.Debugf(\"[%v] <- ping failed\", c.key)\n\t\t\t\tgo func() {\n\t\t\t\t\tfor i := 0; i < 3; i++ {\n\t\t\t\t\t\ttime.Sleep(time.Second)\n\t\t\t\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\t\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\t\t\t\tlog.Debugf(\"[%v] <- ping failed %d times\", c.key, i+1)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}()\n\t\t\t}\n\t\tcase <-c.close:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0d677aef8f7f03335360901f73f5477a", "score": "0.7170426", "text": "func (sub *subscription) writePump() {\n\tconn := sub.conn\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tconn.ws.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-conn.send: // from client\n\t\t\tlog.Printf(\"[DEBUG] writePump called send '%s'\", message)\n\t\t\tconn.ws.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tconn.ws.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := conn.write(websocket.TextMessage, message); err != nil {\n\t\t\t\tlog.Printf(\"[ERROR] %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tlog.Println(\"[DEBUG] writePump called ticker\")\n\t\t\tsub.conn.ws.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := conn.ws.WriteMessage(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0525382a043ed04ae87f1b26986d4b36", "score": "0.71679884", "text": "func (c *ClientConn) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.ws.Close()\n\t\tc.stop <- 1\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tlog.Printf(\"%v c.send not ok\", ok)\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tc.ws.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tw, err := c.ws.NextWriter(websocket.BinaryMessage)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"%v NextWriter\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw.Write(message)\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\tlog.Printf(\"%v w.Close\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\tlog.Printf(\"%v write ping message\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"%v tick\", c.alias)\n\t\t\tif (c.alias != \"\") {\n\t\t\t\t// 判断地址是否还存在,如果不存在则应该停止WS\n\t\t\t\tdevice_map, err := trans_phone_address(c.alias)\n\t\t\t\tif _, ok := phones[device_map]; err != nil || !ok {\n\t\t\t\t\tlog.Printf(\"phone map not exist, clost ws %v\", c.alias)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "55b504cb1b208f194e1b4a58613203d7", "score": "0.67400753", "text": "func (control *ControlConnection) writeConnectionPump(sock *NamedWebSocket) {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tcontrol.removeConnection(sock)\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tcontrol.ws.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tcontrol.ws.WriteMessage(websocket.PingMessage, []byte{})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "15d72cd47d743ab957d02e27de32b61c", "score": "0.6687899", "text": "func (s *Server) outPump() {\n\tlogrus.Debug(\"Dplay output pump started\")\n\tfor {\n\t\tout := <-s.outQueue\n\t\tmsg := out.wr.Bytes()\n\t\tlogrus.Debugf(\"put % #x\", msg)\n\t\ts.listenConn.WriteToUDP(msg, out.addr)\n\t\ts.bufpool.Put(out.wr)\n\t}\n}", "title": "" }, { "docid": "317dc9acda1d801f3e2cba629f729c8e", "score": "0.6425042", "text": "func (s *socket) write(p *Pool) {\n\tfor {\n\t\tselect {\n\t\tcase <-s.wQuit:\n\t\t\ts.done <- struct{}{}\n\t\t\tp.shutdown <- s\n\t\t\treturn\n\t\tcase msg := <-s.p2s:\n\t\t\terr := s.connection.WriteMessage(msg.Type, msg.Payload)\n\t\t\tif err != nil {\n\t\t\t\ts.rQuit <- struct{}{}\n\t\t\t\ts.errors = append(s.errors, err)\n\t\t\t\ts.done <- struct{}{}\n\t\t\t\tp.shutdown <- s\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7b3b2a5dbbd46de8669eb29646d51ed7", "score": "0.6359893", "text": "func (c *IrcClient) pump() {\n\tvar err error\n\tvar sleeper <-chan time.Time\n\tdefer close(c.pumpservice)\n\n\tfor err == nil {\n\t\tselect {\n\t\tcase c.pumpservice <- c.pumpchan:\n\t\t\tmessage := <-c.pumpchan\n\t\t\tif len(message) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif bytes.HasPrefix(message, pong) {\n\t\t\t\tif err = c.writeMessage(message); err != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if sleeper == nil {\n\t\t\t\tsleepTime := c.calcSleepTime(time.Now())\n\t\t\t\tif sleepTime == 0 {\n\t\t\t\t\tif err = c.writeMessage(message); err != nil {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tc.queue.Enqueue(message)\n\t\t\t\t\tsleeper = time.After(sleepTime)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tc.queue.Enqueue(message)\n\t\t\t}\n\t\tcase <-sleeper:\n\t\t\tif err = c.writeMessage(c.queue.Dequeue()); err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif c.queue.length > 0 {\n\t\t\t\tsleepTime := c.calcSleepTime(time.Now())\n\t\t\t\tsleeper = time.After(sleepTime)\n\t\t\t} else {\n\t\t\t\tsleeper = nil\n\t\t\t}\n\t\tcase <-c.killpump:\n\t\t\tLog(fmtErrPumpClosed, c.name, errMsgShutdown)\n\t\t\treturn\n\t\t}\n\t}\n\n\t<-c.killpump\n}", "title": "" }, { "docid": "4a2007313140856f4a6ae150f2e3eb21", "score": "0.6324945", "text": "func (c *PubClient) readPump() {\n\tdefer func() {\n\t\tc.hub.unregisterPub <- c\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tfmt.Println(\"Error:\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\tc.hub.broadcast <- message\n\t}\n}", "title": "" }, { "docid": "476137d6417330a9a06fc2a757195a93", "score": "0.6292281", "text": "func (c *client) write() {\n\tfor {\n\t\ttoWrite := <-c.send\n\n\t\t_ = c.conn.WriteMessage(websocket.BinaryMessage, toWrite)\n\t}\n}", "title": "" }, { "docid": "791885eab2f906c31efecf1198733f8f", "score": "0.62869513", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.Conn.Close()\n\t}()\n\n\tc.Conn.SetReadLimit(maxMessageSize)\n\tc.Conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.Conn.SetPongHandler(func(string) error { c.Conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.Conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\n\t\t// c.Out <- message\n\t\tc.InMess.AddMessage(message)\n\t}\n}", "title": "" }, { "docid": "0440196283062d46c4b0201843833e26", "score": "0.6286076", "text": "func (c *client) write() {\n\tfor {\n\t\ttoWrite := <-c.send\n\t\t_ = c.conn.WriteMessage(websocket.BinaryMessage, toWrite)\n\t}\n}", "title": "" }, { "docid": "a94a1bc85647226adaa3ba0da37e991a", "score": "0.62586105", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.reg.unregister <- c\n\t\tc.conn.Close()\n\t\tc.top.terminate()\n\t}()\n\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway,\n\t\t\t\twebsocket.CloseNoStatusReceived) {\n\t\t\t\tlog.Printf(\"readPump error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tc.top.stdin.Write(message)\n\t}\n}", "title": "" }, { "docid": "fdf2e5c4784d5ca2d2948ac00102ebc8", "score": "0.62472713", "text": "func (c *Client) write() {\n // make sure to close the connection incase the loop exits\n defer func() {\n c.ws.Close()\n }()\n\n for {\n select {\n case message, ok := <-c.send:\n if !ok {\n c.ws.WriteMessage(websocket.CloseMessage, []byte{})\n log.Printf(\"%v\", message)\n return\n }\n log.Printf(\"%v\", message)\n c.ws.WriteMessage(websocket.TextMessage, message)\n }\n }\n}", "title": "" }, { "docid": "ae58356da142844b5b67fbd35919123c", "score": "0.6218434", "text": "func (c *client) write() {\n\t// Get all the messages out of the send channel and send them back through\n\t// the websocket\n\tfor msg := range c.send {\n\t\tif err := c.socket.WriteMessage(websocket.TextMessage, msg); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tc.socket.Close()\n}", "title": "" }, { "docid": "715a2f1a7df9e2a12223f2e971fd2dd1", "score": "0.6204441", "text": "func (c *client) write() {\n\tdefer c.socket.Close()\n\tfor msg := range c.send {\n\t\terr := c.socket.WriteMessage(websocket.TextMessage, msg)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e64219bd7811288f6f3137362bc31327", "score": "0.6189717", "text": "func (c *client) write() {\n\tdefer c.socket.Close()\n\tfor msg := range c.send {\n\t\t//write the message into the specific client web socket.\n\t\terr := c.socket.WriteMessage(websocket.TextMessage, msg)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5c019f57a94d374046d4934b14472ddf", "score": "0.6146201", "text": "func (c *Client) write() {\n\tfor m := range c.send {\n\t\tif err := c.sock.WriteMessage(websocket.TextMessage, m); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d21ab14a139d4828c1b0d957b8d0d94c", "score": "0.6098357", "text": "func (c *Client) write() {\n\tfor {\n\t\tmessage, ok := <-c.send\n\t\tif !ok { // error handling incase, unable to read the message\n\t\t\treturn\n\t\t}\n\t\tc.socket.WriteMessage(websocket.TextMessage, message) // write that message to the client\n\t}\n}", "title": "" }, { "docid": "a1d4e756b9c0bbba9c301166355ebdc1", "score": "0.60520077", "text": "func (c *WebSocketClient) writeMessageLoop(ctx context.Context) {\n\tticker := time.NewTicker(1 * time.Second)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done(): // write loop is closed\n\t\t\tutil.LogInfo(fmt.Sprintf(\"client %d has terminated write loop\", c.userID))\n\t\t\treturn\n\t\tcase p := <-c.writeMessage: // message broker wants to write to client\n\t\t\tc.connMessage.SetReadDeadline(time.Now().Add(2 * time.Second))\n\t\t\tbytes, err := json.Marshal(p)\n\t\t\tif err != nil {\n\t\t\t\tutil.LogErr(\"writeMessageLoop json.Marshall\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\terr = c.connMessage.WriteMessage(websocket.TextMessage, bytes)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase <-ticker.C: // send a ping to the connection if the ticker signals\n\t\t\tc.connMessage.SetWriteDeadline(time.Now().Add(5 * time.Second))\n\t\t\terr := c.connMessage.WriteMessage(websocket.PingMessage, []byte{})\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f3c5ed30e62ced0149099186ddca70e8", "score": "0.60427576", "text": "func (c *client) write() {\n\tfor msg := range c.send {\n\t\tif err := c.socket.WriteJSON(msg); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tc.socket.Close()\n}", "title": "" }, { "docid": "70576e616f9e1bfd0341b7f70978f92c", "score": "0.60217786", "text": "func (c *connection) readPump() {\n\tdefer func() {\n\t\th.unregister <- c\n\t\tc.ws.Close()\n\t}()\n\n\tc.ws.SetReadLimit(maxMessageSize)\n\tc.ws.SetReadDeadline(time.Now().Add(pongWait))\n\tc.ws.SetPongHandler(func(string) error {\n\t\tc.ws.SetReadDeadline(time.Now().Add(pongWait))\n\t\treturn nil\n\t})\n\n\tdatasources := make([]struct {\n\t\tID string `json:\"id\"`\n\t\tName string `json:\"name\"`\n\t}, 0, len(c.server.Datasources))\n\tfor k := range c.server.Datasources {\n\t\tdatasources = append(datasources, struct {\n\t\t\tID string `json:\"id\"`\n\t\t\tName string `json:\"name\"`\n\t\t}{\n\t\t\tID: k,\n\t\t\tName: k,\n\t\t})\n\t}\n\n\t// send initial state\n\tc.send <- &InitialStateMessage{\n\t\tDatasources: datasources,\n\t}\n\n\tfor {\n\t\t_, message, err := c.ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Errorf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tlog.Debug(\"Message\", string(message))\n\n\t\tv := map[string]interface{}{}\n\t\tif err := json.NewDecoder(\n\t\t\tbytes.NewBuffer(message)).Decode(&v); err != nil {\n\t\t\tlog.Error(\"Error decoding message: \", err.Error())\n\n\t\t\tc.send <- &ErrorMessage{\n\t\t\t\tQuery: v[\"query\"].(string),\n\t\t\t\tColor: v[\"color\"].(string),\n\t\t\t\tMessage: err.Error(),\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tgo func() {\n\t\t\tdefer func() {\n\t\t\t\tif err := recover(); err != nil {\n\t\t\t\t\ttrace := make([]byte, 1024)\n\t\t\t\t\tcount := runtime.Stack(trace, true)\n\t\t\t\t\tlog.Error(\"Error: %s\", err)\n\t\t\t\t\tlog.Debug(\"Stack of %d bytes: %s\\n\", count, string(trace))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tt := v[\"type\"].(string)\n\t\t\tswitch t {\n\t\t\tcase ActionTypeItemsRequest:\n\t\t\t\tif err := c.Search(v); err != nil {\n\t\t\t\t\tlog.Error(\"Error occured during search: %s\", err.Error())\n\t\t\t\t\tc.send <- &ErrorMessage{\n\t\t\t\t\t\tQuery: \"\",\n\t\t\t\t\t\tColor: \"\",\n\t\t\t\t\t\tMessage: err.Error(),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase ActionTypeFieldsRequest:\n\t\t\t\tif err := c.DiscoverFields(v); err != nil {\n\t\t\t\t\tlog.Error(\"Error occured during field discovery: %s\", err.Error())\n\t\t\t\t\tc.send <- &ErrorMessage{\n\t\t\t\t\t\tQuery: \"\",\n\t\t\t\t\t\tColor: \"\",\n\t\t\t\t\t\tMessage: err.Error(),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "0634611b58d6e7e29dcae4f8d3498e4c", "score": "0.6008737", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.room.chUnregisterClient <- c\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tc.processMessage(message)\n\t}\n}", "title": "" }, { "docid": "5c61bc3f1edfb4bdb077e7fd1c6aeabe", "score": "0.5999028", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.conn.Close()\n\t}()\n\n\tfor {\n\t\tbody := make(map[string]string)\n\t\terr := c.conn.ReadJSON(&body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"read error: %s\", err)\n\t\t\tclients.Remove(c)\n\t\t\treturn\n\t\t} else {\n\t\t\tlog.Printf(\"message body: %s\", body)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "51c8d5fbca1632ee9e63e206f2e7e7e5", "score": "0.59870714", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.socket.Close()\n\t}()\n\n\tc.socket.SetReadLimit(maxMessageSize)\n\tc.socket.SetReadDeadline(time.Now().Add(pongWait))\n\tc.socket.SetPongHandler(func(string) error {\n\t\tc.socket.SetReadDeadline(time.Now().Add(pongWait))\n\t\treturn nil\n\t})\n\n\tfor {\n\t\tm := Message{}\n\t\terr := c.socket.ReadJSON(&m)\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\n\t\t\tbreak\n\t\t}\n\n\t\tc.rooms[c.roomID].forward <- &m\n\t}\n}", "title": "" }, { "docid": "cc168f6c642a1d895bc6390eb519c945", "score": "0.5985367", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\tc.hub.outbound <- message\n\t}\n}", "title": "" }, { "docid": "fadec8e199b66364b765f912fb7dc2e6", "score": "0.5957305", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\t//message = []byte(\"helloWorld\")\n\t\tc.hub.broadcast <- message\n\t}\n}", "title": "" }, { "docid": "aab57cc2180ba1686466f26ad657dd93", "score": "0.595332", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\tvar p pkg\n\t\terr := c.conn.ReadJSON(&p)\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Errorf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tlog.Infof(\"ws message: %v\", p)\n\n\t\t// _, message, err := c.conn.ReadMessage()\n\t\t// if err != nil {\n\t\t// \tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t// \t\tlog.Errorf(\"error: %v\", err)\n\t\t// \t}\n\t\t// \tbreak\n\t\t// }\n\t\t// message = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\t// json.Unmarshal(message, &p)\n\t\t// log.Infof(\"ws message: %s, %v\", message, p)\n\t\tif p.T == \"getusers\" {\n\t\t\tc.shipUsers()\n\t\t} else if p.T == \"getsites\" {\n\t\t\tc.shipSites()\n\t\t} else if p.T == \"getteams\" {\n\t\t\tc.shipTeams()\n\t\t} else if p.T == \"updateteam\" {\n\t\t\tc.updateTeam(p.D)\n\t\t} else if p.T == \"deleteteam\" {\n\t\t\tc.deleteTeam(p.D)\n\t\t}\n\t\t// c.hub.broadcast <- []byte(p)\n\t}\n}", "title": "" }, { "docid": "3736b471b328874b71982e21bb899b88", "score": "0.59431964", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\tc.hub.broadcast <- message\n\t}\n}", "title": "" }, { "docid": "d3f3699c1ae18a3aae6d50ff077a6ee6", "score": "0.59421617", "text": "func (t *outConn) sendPump(msgC <-chan *outMessage, stream storeStream.BStoreOpenReadStreamInCall) {\n\tdefer t.wg.Done() // drop ref on waitgroup\n\tdefer stream.Done() // close \"out\" stream\n\n\tvar unflushedWrites int // count of writes since the last flush (FIXME: make it \"size\" based?)\n\tflushTicker := time.NewTicker(common.FlushTimeout) // start ticker to flush tchannel stream\n\tdefer flushTicker.Stop()\n\n\tlog := t.log // get \"local\" logger (that already contains extent info)\n\npump:\n\tfor {\n\t\tselect {\n\t\tcase msg, ok := <-msgC: // read from the go-channel\n\n\t\t\tif !ok {\n\t\t\t\tif outConnDebug {\n\t\t\t\t\tlog.Debug(`outConn.sendPump: msgC closed`) // #perfdisable\n\t\t\t\t}\n\t\t\t\tbreak pump\n\t\t\t}\n\n\t\t\t// write out (blocking) to stream\n\t\t\tif err := stream.Write(msg.ReadMessageContent); err != nil {\n\t\t\t\tif outConnDebug {\n\t\t\t\t\tlog.WithField(common.TagErr, err).Debug(`outConn.sendPump: stream.Write error`)\n\t\t\t\t}\n\t\t\t\tbreak pump\n\t\t\t}\n\n\t\t\tt.m3Client.RecordTimer(metrics.OutConnScope, metrics.StorageReadMessageLatency, time.Since(msg.t0))\n\n\t\t\tif outConnDebug {\n\t\t\t\tswitch msg.GetType() { // #perfdisable\n\t\t\t\tcase store.ReadMessageContentType_MESSAGE: // #perfdisable\n\t\t\t\t\tlog.WithFields(bark.Fields{ // #perfdisable\n\t\t\t\t\t\tcommon.TagSeq: msg.GetMessage().GetMessage().GetSequenceNumber(), // #perfdisable\n\t\t\t\t\t\t`addr`: strconv.FormatInt(msg.GetMessage().GetAddress(), 16), // #perfdisable\n\t\t\t\t\t}).Debug(`outConn.sendPump: sent msg`) // #perfdisable\n\t\t\t\tcase store.ReadMessageContentType_SEALED: // #perfdisable\n\t\t\t\t\tlog.WithFields(bark.Fields{ // #perfdisable\n\t\t\t\t\t\t`sealSeqNum`: msg.GetSealed().GetSequenceNumber(), // #perfdisable\n\t\t\t\t\t}).Debug(`outConn.sendPump: sent msg sealed`) // #perfdisable\n\t\t\t\tcase store.ReadMessageContentType_ERROR: // #perfdisable\n\t\t\t\t\tlog.WithFields(bark.Fields{ // #perfdisable\n\t\t\t\t\t\t`error`: msg.GetError().GetMessage(), // #perfdisable\n\t\t\t\t\t}).Debug(`outConn.sendPump: sent msg error`) // #perfdisable\n\t\t\t\t} // #perfdisable\n\t\t\t}\n\n\t\t\tif unflushedWrites++; unflushedWrites >= common.FlushThreshold {\n\n\t\t\t\tif err := stream.Flush(); err != nil {\n\t\t\t\t\tlog.WithField(common.TagErr, err).Error(`outConn.sendPump: <threshold> stream.Flush error`)\n\t\t\t\t\tbreak pump\n\t\t\t\t}\n\n\t\t\t\tif outConnDebug {\n\t\t\t\t\tlog.WithFields(bark.Fields{ // #perfdisable\n\t\t\t\t\t\t`unflushed-writes`: unflushedWrites,\n\t\t\t\t\t}).Debug(`outConn.sendPump: <threshold> flushed ack stream`) // #perfdisable\n\t\t\t\t}\n\n\t\t\t\tunflushedWrites = 0\n\t\t\t}\n\n\t\tcase <-flushTicker.C: // the flush \"ticker\" has fired\n\n\t\t\tif unflushedWrites > 0 {\n\n\t\t\t\tif err := stream.Flush(); err != nil {\n\t\t\t\t\tlog.WithField(common.TagErr, err).Error(`outConn.sendPump: <ticker> stream.Flush error`)\n\t\t\t\t\tbreak pump\n\t\t\t\t}\n\n\t\t\t\tif outConnDebug {\n\t\t\t\t\tlog.WithFields(bark.Fields{ // #perfdisable\n\t\t\t\t\t\t`unflushed-writes`: unflushedWrites,\n\t\t\t\t\t}).Debug(`outConn.sendPump: <ticker> flushed ack stream`) // #perfdisable\n\t\t\t\t}\n\n\t\t\t\tunflushedWrites = 0\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "49d271b38962c7047a1ebd3a0796de75", "score": "0.5884482", "text": "func (c *client) readPump() {\r\n\tdefer func() {\r\n\t\tc.hub.unregister <- c\r\n\t\tc.conn.Close()\r\n\t}()\r\n\tc.conn.SetReadLimit(maxMessageSize)\r\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\r\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\r\n\tfor {\r\n\t\t_, rawMessage, err := c.conn.ReadMessage()\r\n\t\tif err != nil {\r\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\r\n\t\t\t\tlog.Printf(\"err: %v\", err)\r\n\t\t\t}\r\n\t\t\tbreak\r\n\t\t}\r\n\r\n\t\tmessage := newMessage(c.id, ClientMessage, rawMessage)\r\n\t\tc.hub.fromClient <- *message\r\n\t}\r\n}", "title": "" }, { "docid": "bc763182d35df88675fe1210a7f9e05c", "score": "0.5863252", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n // do processing here!\n\n var socketData SocketData\n\t\tjson.Unmarshal([]byte(message), &socketData)\n\t\tvar data []byte\n var broadcast = true\n\t\tswitch socketData.Action {\n\t\t\tcase \"update ui\":\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n broadcast = false\n\t\t\tcase \"set volume\":\n\t\t\t\tSetVolume(int(socketData.Data.(float64)))\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t\tcase \"load playlist\":\n\t\t\t\tLoadPlaylist(socketData.Data.(int))\n\t\t\t\tStartPlayer(-1)\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t\tcase \"play playlist entry\":\n\t\t\t\tvar playlistMedia PlaylistMedia\n\t\t\t\tjson.Unmarshal([]byte(socketData.Data.(string)), &playlistMedia)\n\t\t\t\tPlayMediaFromPlaylist(playlistMedia.MediaID, playlistMedia.PlaylistID)\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t\tcase \"list media\":\n\t\t\t\tif socketData.Data == nil {\n\t\t\t\t\tsocketData.Data = 0\n\t\t\t\t}\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"media list\", Data: GetAllMedia(socketData.Data.(int))})\n broadcast = false\n\t\t\tcase \"play media\":\n\t\t\t\tvar media Media\n\t\t\t\tjson.Unmarshal([]byte(socketData.Data.(string)), &media)\n\t\t\t\tClearQueue()\n\t\t\t\tAddToQueue(media.FileName)\n\t\t\t\tStartPlayer(-1)\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t\tcase \"add to up next\":\n\t\t\t\tvar media Media\n\t\t\t\tjson.Unmarshal([]byte(socketData.Data.(string)), &media)\n\t\t\t\tif currentPlaylist.ID != 0 {\n\t\t\t\t\tClearQueue()\n\t\t\t\t}\n\t\t\t\tAddToQueue(media.FileName)\n\t\t\t\tStartPlayer(-1)\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t\tcase \"start player\":\n\t\t\t\tStartPlayer(-1)\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t\tcase \"next\":\n\t\t\t\tNext()\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t\tcase \"prev\":\n\t\t\t\tPrevious()\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t\tcase \"toggle pause\":\n\t\t\t\tTogglePause()\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n case \"toggle random\":\n ToggleRandom()\n data, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n case \"set repeat\":\n Repeat(int(socketData.Data.(float64)))\n data, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t\tcase \"play queued song\":\n\t\t\t\tpos, _ := strconv.Atoi(socketData.Data.(string))\n\t\t\t\tStartPlayer(pos)\n\t\t\t\tdata, _ = json.Marshal(SocketData{Action: \"update ui\", Data: UpdateUi()})\n\t\t}\n if broadcast {\n c.hub.broadcast <- data\n } else {\n c.send <- data\n }\n\t}\n}", "title": "" }, { "docid": "0c8ff3b54898f910d308aa47733df6bf", "score": "0.58218706", "text": "func (s *subscriber) readPump() {\n\tdefer func() {\n\t\tlog.Println(\"[subscriber] readPump exiting\")\n\t\ts.pub.unsubscribe <- s\n\t\ts.conn.Close()\n\t}()\n\ts.conn.SetReadLimit(maxMessageSize)\n\ts.conn.SetReadDeadline(time.Now().Add(pongWait))\n\ts.conn.SetPongHandler(func(string) error { s.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := s.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\t// s.pub.broadcast <- message\n\t}\n}", "title": "" }, { "docid": "0caf7853e84b85573be11f651dbf14f6", "score": "0.5819312", "text": "func (c *connection) writeLoop() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.ws.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := c.write(websocket.TextMessage, message); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "85203e5811de1f8ec61e97150de8b34a", "score": "0.5776445", "text": "func (client *Client) Write() {\n\t// use range keyword to iterate over values sent through go channel. when no channels being sent for\n\t//block waits\n\tfor msg := range client.send {\n\t\tif err := client.socket.WriteJSON(msg); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tclient.socket.Close()\n}", "title": "" }, { "docid": "9e65d6f7583b1f0e1480567364050a92", "score": "0.5763598", "text": "func (wsc *wsConnection) writeRoutine() {\n\tpingTicker := time.NewTicker(wsc.pingPeriod)\n\tdefer pingTicker.Stop()\n\n\t// https://github.com/gorilla/websocket/issues/97\n\tpongs := make(chan string, 1)\n\twsc.baseConn.SetPingHandler(func(m string) error {\n\t\tselect {\n\t\tcase pongs <- m:\n\t\tdefault:\n\t\t}\n\t\treturn nil\n\t})\n\n\tfor {\n\t\tselect {\n\t\tcase <-wsc.Quit():\n\t\t\treturn\n\t\tcase <-wsc.readRoutineQuit: // error in readRoutine\n\t\t\treturn\n\t\tcase m := <-pongs:\n\t\t\terr := wsc.writeMessageWithDeadline(websocket.PongMessage, []byte(m))\n\t\t\tif err != nil {\n\t\t\t\twsc.Logger.Info(\"Failed to write pong (client may disconnect)\", \"err\", err)\n\t\t\t}\n\t\tcase <-pingTicker.C:\n\t\t\terr := wsc.writeMessageWithDeadline(websocket.PingMessage, []byte{})\n\t\t\tif err != nil {\n\t\t\t\twsc.Logger.Error(\"Failed to write ping\", \"err\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase msg := <-wsc.writeChan:\n\t\t\t// Use json.MarshalIndent instead of Marshal for pretty output.\n\t\t\t// Pretty output not necessary, since most consumers of WS events are\n\t\t\t// automated processes, not humans.\n\t\t\tjsonBytes, err := json.Marshal(msg)\n\t\t\tif err != nil {\n\t\t\t\twsc.Logger.Error(\"Failed to marshal RPCResponse to JSON\", \"err\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err = wsc.writeMessageWithDeadline(websocket.TextMessage, jsonBytes); err != nil {\n\t\t\t\twsc.Logger.Error(\"Failed to write response\", \"err\", err, \"msg\", msg)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "24715cfbba0cf97e572fbb5a1a056074", "score": "0.5755236", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tc.Hub.Unregister <- c\n\t\tc.Conn.Close()\n\t}()\n\tc.Conn.SetReadLimit(MaxMessageSize)\n\tc.Conn.SetReadDeadline(time.Now().Add(PongWait))\n\tc.Conn.SetPongHandler(func(string) error { c.Conn.SetReadDeadline(time.Now().Add(PongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.Conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tklog.Errorf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\tmsgObj := ClientWSMessage{ClientEmail: c.Email, msg: message}\n\t\tc.Hub.Response <- msgObj\n\t}\n}", "title": "" }, { "docid": "a0ad6a6a61b7d9e9ea90aff1a89919b9", "score": "0.57519144", "text": "func (s *s) readPump() {\n\tfor {\n\t\tmt, message, err := s.ws.ReadMessage()\n\t\tif err != nil {\n\t\t\t// This happens anytime a client closes the connection, which can end up with\n\t\t\t// chatty logs, so we aren't logging this error currently. If we did, it would look like:\n\t\t\t// log.Println(\"[\" + s.name + \"]\", \"Error during socket read:\", err)\n\t\t\ts.Close()\n\t\t\ts.shutdown <- true\n\t\t\treturn\n\t\t}\n\n\t\ts.onRead(mt, message)\n\t}\n}", "title": "" }, { "docid": "74b1ae8e3481438775045e51b8fb2133", "score": "0.57501566", "text": "func (c *clientType) readPump(l *keptnutils.Logger) {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tl.Error(fmt.Sprintf(\"Received error while reading: %s\", err.Error()))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif wsLogging {\n\t\t\tl.Debug(fmt.Sprintf(\"Received message from service: %s\", message))\n\t\t}\n\t\tvar data receivedData\n\t\terr = json.Unmarshal(message, &data)\n\t\tif err != nil {\n\t\t\tl.Error(fmt.Sprintf(\"Unmarshaling error in websocket communication: %s\", err.Error()))\n\t\t}\n\t\tbData := broadcastData{channelIDType(data.Shkeptncontext), message}\n\t\tc.hub.broadcast <- &bData\n\t}\n}", "title": "" }, { "docid": "6a4cc14e5c238d4eea4d95730a250d6e", "score": "0.57491267", "text": "func (c *Client) readPump() {\n\n\t//Un-register client once there is nothing to read\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(\n\t\tfunc(string) error { \n\t\t\tc.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\t//Break causes unregistry of client\n\t\t\treturn\n\t\t}\n\t\tm := c.DecodeWSMessage(message)\n\t\tgo m.Execute(false)\n\t}\n}", "title": "" }, { "docid": "2845a71b55f40f5e17f521cad65bbf73", "score": "0.5747623", "text": "func (c *Client) writer() {\n\tdefer func() {\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// adding queued messages\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write([]byte{'\\n'})\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31af43982b3922167fb4af26fdf20c6b", "score": "0.57378787", "text": "func (c *Connection) readPump() {\n\tdefer func() {\n\t\tc.ws.Close()\n\t\tclose(c.receive)\n\t}()\n\tc.ws.SetReadLimit(maxMessageSize)\n\tc.ws.SetReadDeadline(time.Now().Add(pongWait))\n\tc.ws.SetPongHandler(func(string) error { c.ws.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t// read raw message off the socket\n\t\t_, raw, err := c.ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.Println(\"Error reading message off socket\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\t// uncompress LZW\n\t\tuncompressed := LzwDecompress(string(raw))\n\n\t\t// unmarshal JSON\n\t\tvar message Message\n\t\terr = json.Unmarshal(uncompressed, &message)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error unmarshalling JSON\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// process the message\n\t\tif message.Type == \"h\" {\n\t\t\t// respond to heartbeat right away, but still send it to the client as well\n\t\t\tc.send <- &Message{Type: \"h\", Time: MakeTimestamp()}\n\t\t}\n\n\t\tc.receive <- &message\n\t}\n}", "title": "" }, { "docid": "586355dae3dfbe81cf16a6373437c81b", "score": "0.5683451", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tfor _, hub := range c.joinedHubs {\n\t\t\thub.unregister <- c\n\t\t}\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(MAX_MESSAGE_SIZE)\n\tc.conn.SetReadDeadline(time.Now().Add(PONG_WAIT))\n\tc.conn.SetPongHandler(\n\t\tfunc(string) error {\n\t\t\tc.conn.SetReadDeadline(time.Now().Add(PONG_WAIT))\n\t\t\treturn nil\n\t\t})\n\n\tfor {\n\t\tmsg := WebsocketMessage{}\n\t\terr := c.conn.ReadJSON(&msg)\n\t\tlog.Printf(\"msg: %+v\", msg)\n\t\tif websocket.IsCloseError(err, websocket.CloseGoingAway) {\n\t\t\tmsg.Message = fmt.Sprintf(\"User %d left this chat room\", c.userID)\n\t\t\tfor _, hub := range c.joinedHubs {\n\t\t\t\thub.broadcast <- &msg\n\t\t\t}\n\t\t\tbreak\n\n\t\t} else if err != nil {\n\t\t\tlog.Println(\"Error:\", err)\n\t\t\tbreak\n\n\t\t} else {\n\t\t\tmsg.From = c.userID\n\t\t\thub := c.joinedHubs[msg.HubID]\n\t\t\tif hub != nil {\n\t\t\t\thub.broadcast <- &msg\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cc85ee57c51ee592a92c1e69d860047d", "score": "0.5682357", "text": "func (c *Client) readPump() {\n\tvar msg Message\n\tfor {\n\t\tif err := c.socket.ReadJSON(&msg); err != nil {\n\t\t\tc.error(errors.Wrap(err, \"reading message\"))\n\t\t\tbreak\n\t\t}\n\t\tif handler, ok := c.findHandler(msg.Name); ok {\n\t\t\thandler(c, Payload{Raw: msg.Data})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "013faefe14aa55e54d052cdca2e927a3", "score": "0.5666301", "text": "func outPump() error {\n\tlogger.Debug(\"start out read pump\")\n\tdefer logger.Debug(\"exit out read pump\")\n\tfor {\n\t\tselect {\n\t\tcase <-closeC:\n\t\t\treturn nil\n\t\tcase msg := <-outC:\n\t\t\t_, ps, ok := topicPubsubs.Get(msg.Topic)\n\t\t\tif !ok {\n\t\t\t\tlogger.WithField(\"topic\", msg.Topic).Warn(\"unsupported out topic\")\n\t\t\t}\n\t\t\tlogger.WithFields(logger.F{\n\t\t\t\t\"topic\": msg.Topic,\n\t\t\t\t\"payload\": string(msg.Payload),\n\t\t\t}).Debug(\"publish message\")\n\t\t\tif err := ps.Write(msg); err != nil {\n\t\t\t\tlogger.WithError(err).Error(\"error publishing message\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "792e59294e08faadef0b09cdadeb87d1", "score": "0.5616361", "text": "func (s *Server) write(c net.Conn, p *core.Messenger, stopped chan struct{}) {\n\t// This is kinda hacky, but i guess ok for such a thing.\n\tdefer close(stopped)\n\n\tfor msg := range p.ReadResponses() {\n\t\tc.SetWriteDeadline(time.Now().Add(time.Second * 5))\n\t\tif _, err := c.Write([]byte(msg.String() + \"\\n\")); err != nil {\n\t\t\ts.log.WithError(err).Error(\"writing to a connection\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e6a8680b73bab51fce68263b9c17075c", "score": "0.5612999", "text": "func (c *Client) readPump() {\n\tdefer func() {\n\t\tif c.hub != nil {\n\t\t\tc.hub.unregister <- c\n\t\t}\n\t\tc.ws.Close()\n\t}()\n\tc.ws.SetReadLimit(maxMessageSize)\n\tc.ws.SetReadDeadline(time.Now().Add(pongWait))\n\tc.ws.SetPongHandler(func(string) error { c.ws.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, _, err := c.ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3946a226eb3899529cab3b69f7a894dc", "score": "0.56098175", "text": "func (c *ClientConn) readPump() {\n\tdefer func() {\n\t\tc.ws.Close()\n\t\tc.stop <- 1\n\t}()\n\tc.ws.SetReadDeadline(time.Now().Add(pongWait))\n\tc.ws.SetPongHandler(func(string) error {\n\t\tc.ws.SetReadDeadline(time.Now().Add(pongWait)); return nil\n\t})\n\tfor {\n\t\t_, _, err := c.ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tlog.Printf(\"%v c.ws.ReadMessage\", err)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "16c067420e83df89a2201d434ccf9f98", "score": "0.5600078", "text": "func (s *SocketStore) writeMessages(ctx *HandlerContext, message *Message) {\n\tdata := message\n\n\tfmt.Println(ctx.SocketStore.Connections)\n\tfor _, conn := range ctx.SocketStore.Connections {\n\t\tfmt.Println(\"About to send %m\", data)\n\t\tif err := conn.WriteJSON(data); err != nil {\n\t\t\tfmt.Println(\"Error writing message to WebSocket connection.\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b0f68a97823e133bea787c2fb3bdc1c5", "score": "0.5563695", "text": "func HandleMessages() {\n\tfor {\n\t\tmsg := <-broadcast\n\t\tfor client := range clients {\n\t\t\terr := client.WriteJSON(msg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t\tclient.Close()\n\t\t\t\tdelete(clients, client)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "110d2174d712088b190c345ba6ee278e", "score": "0.5561268", "text": "func (c *Connection) readPump(h *hub) {\n\tdefer func() {\n\t\t(*h).unregister <- c\n\t\tc.ws.Close()\n\t}()\n\tc.ws.SetReadLimit(maxMessageSize)\n\tc.ws.SetReadDeadline(time.Now().Add(pongWait))\n\tc.ws.SetPongHandler(func(string) error { c.ws.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\n\tfor {\n\t\t_, message, err := c.ws.ReadMessage()\n\n\t\tif err != nil {\n\t\t\t//h.disconnect(c)\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tprint_binary(message)\n\t\t(*h).broadcast <- message\n\t}\n}", "title": "" }, { "docid": "1fe5a03ebfbd528ed6c6bad66e782af2", "score": "0.5521781", "text": "func (control *ControlConnection) readConnectionPump(sock *NamedWebSocket) {\n\tdefer func() {\n\t\tcontrol.removeConnection(sock)\n\t}()\n\tcontrol.ws.SetReadLimit(maxMessageSize)\n\tcontrol.ws.SetReadDeadline(time.Now().Add(pongWait))\n\tcontrol.ws.SetPongHandler(func(string) error { control.ws.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\topCode, buf, err := control.ws.ReadMessage()\n\t\tif err != nil || opCode != websocket.TextMessage {\n\t\t\tbreak\n\t\t}\n\n\t\tvar message ControlWireMessage\n\t\tif err := json.Unmarshal(buf, &message); err != nil {\n\t\t\tlog.Fatalf(\"%s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch message.Action {\n\t\t// Only read 'messages' (connect and disconnect events are write-only)\n\t\tcase \"message\":\n\n\t\t\tmessageSent := false\n\n\t\t\t// Relay message to control channel that matches target\n\t\t\tfor _, _control := range sock.controllers {\n\t\t\t\tif _control.id == message.Target {\n\t\t\t\t\t_control.send(\"message\", control.id, message.Target, message.Payload)\n\t\t\t\t\tmessageSent = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !messageSent {\n\t\t\t\t// Hunt for target in known proxies\n\t\t\t\tfor _, proxy := range sock.proxies {\n\t\t\t\t\tif proxy.peers[message.Target] {\n\t\t\t\t\t\tproxy.send(\"directmessage\", control.id, message.Target, message.Payload)\n\t\t\t\t\t\tmessageSent = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !messageSent {\n\t\t\t\tfmt.Errorf(\"P2P message target could not be found. Not sent.\")\n\t\t\t}\n\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "60de5ba7dc2cbb1c09b8eb76da4a363d", "score": "0.55040795", "text": "func (srv *ShellServer) ServeWrite(req ble.Request, rsp ble.ResponseWriter) {\n\tdlog.Printf(\"Got a write from %v\\n\", req.Conn().RemoteAddr())\n\n\t// Can't give us commands to execute if you are not subscribed to\n\t// recieve the output of those commands\n\tif !srv.subscribed {\n\t\tdlog.Printf(\"Responding NOT SUBSCRIBED!\\n\")\n\t\trsp.SetStatus(ble.ErrAuthentication)\n\t\treturn\n\t}\n\n\tsrv.inWtrLock.Lock()\n\tsrv.inputWriter.Write(req.Data())\n\tsrv.inputWriter.Flush() // Does not execute command\n\tsrv.inWtrLock.Unlock()\n\n\t// Be quick. This pre-emtively notifies the client to retrieve data\n\t// from the server. This is good because of terminal echo and tab-auto\n\t// complete.\n\tsrv.notifyClient()\n}", "title": "" }, { "docid": "2bce9ed06dd910dd5efc5d0598f74795", "score": "0.54981875", "text": "func handleMessages() {\n\tfor {\n\t\t//Grab the next message from the broadcast channel\n\t\tmsg := <-broadcast\n\t\t//Send it out to every client that is currently connected\n\t\tfor client := range clients {\n\t\t\terr := client.WriteJSON(msg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t\tclient.Close()\n\t\t\t\tdelete(clients, client)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "af1ab0ac061983e228082c4e8a6da60e", "score": "0.5492337", "text": "func (c *Client) writeMessages() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b9131e4579a013f5da7fb74b77ab2e04", "score": "0.5491071", "text": "func (ws *webSocket) readPump() {\n\n\tdefer func() {\n\t\tws.conn.Close()\n\t\tclose(ws.receiver)\n\t\tclose(ws.updates)\n\t\tlog.Println(\"closed ws conn\")\n\t}()\n\n\tws.updates <- ws.receiver\n\n\tfor {\n\t\t_, b, err := ws.conn.ReadMessage() // blocks until message read or error\n\t\tif err != nil {\n\t\t\t// Log an error if this websocket connection did not close properly\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"Closing Error: %s\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tws.receiver <- b\n\t}\n}", "title": "" }, { "docid": "bba48058844c1f89c76e47507a23f2a1", "score": "0.5476965", "text": "func (c *Client) readPump() {\n\t// close this client's connection and remove them from the map once this\n\t// function exits. It runs an infinite look that only breaks when the\n\t// web client unregisters.\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\n\t// infinite loop listening for messages from the web client\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\t// break out of the loop if there is an error reading the message\n\t\t\tbreak\n\t\t}\n\t\tc.hub.broadcast <- message\n\t}\n}", "title": "" }, { "docid": "6a35de478336231554ed9e3b7331f2b4", "score": "0.5405237", "text": "func (p *Player) write(mt int, payload []byte) error {\n\tp.ws.SetWriteDeadline(time.Now().Add(configuration.Server.WriteWait))\n\n\treturn p.ws.WriteMessage(mt, payload)\n}", "title": "" }, { "docid": "cd20eebeddc90c0027f74e05bdd752ef", "score": "0.5403477", "text": "func (c *websocketClient) onWrite() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tc.stopPing()\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\n\t\t// End onRead() goroutine.\n\t\tc.CloseOrIgnore()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase msg := <-c.msgCh:\n\t\t\terr := c.write(websocket.TextMessage, msg)\n\n\t\t\tif err != nil {\n\t\t\t\tc.LogError(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase <-ticker.C:\n\t\t\terr := c.write(websocket.PingMessage, []byte{})\n\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"client[%d] ping timeout: %s\", c.ID, err.Error())\n\t\t\t\tc.LogError(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase <-c.closeCh:\n\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "76e2a23329093757d27d3557fb4e9fc4", "score": "0.53812647", "text": "func (c *Client) listenWrite() {\n\tfor {\n\t\tselect {\n\n\t\t// send message to the client\n\t\tcase msg := <-c.ch:\n\t\t\tlog.Println(\"Send:\", msg)\n\t\t\twebsocket.JSON.Send(c.ws, msg)\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tc.server.Del(c)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bd6abe91c8a81e37442918abde8dc6ae", "score": "0.53772765", "text": "func (u User) Writer() {\n\tdefer func() { fmt.Println(\"client disconnected\") }()\n\tfor {\n\t\tselect {\n\t\tcase p := <-u.Ch:\n\t\t\tif err := websocket.WriteJSON(u.Con, p); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ddaccc1d57336c723c53eb2d120dd96e", "score": "0.537409", "text": "func (c *Client) Run() {\n\tdefer c.socket.Close()\n\tgo c.readPump()\n\tgo c.writePump()\n\t<-c.done\n}", "title": "" }, { "docid": "9304b7818285a839ff776d2a346956ba", "score": "0.5367017", "text": "func (c *ClientConn) write(mt int, payload []byte) error {\n\tc.ws.SetWriteDeadline(time.Now().Add(writeWait))\n\treturn c.ws.WriteMessage(mt, payload)\n}", "title": "" }, { "docid": "a4d723ddf560f51c9ee7dc4abc5b157a", "score": "0.5364649", "text": "func (c *Client) WriteMessage() {\n\tdefer func() {\n\t\tc.Conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.Message:\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tc.Conn.WriteJSON(message)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fd40f513d361bdeae0889983045e7b62", "score": "0.5355872", "text": "func (s Subscription) readPump() {\n\tc := s.conn\n\n\tdefer func() {\n\t\tH.unregister <- s\n\t\tc.conn.Close()\n\t}()\n\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\n\tfor {\n\t\t_, msg, err := c.conn.ReadMessage()\n\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Fatal(\"error: %s\", err.Error())\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tm := Message{msg, s.artboard}\n\t\tH.broadcast <- m\n\t}\n}", "title": "" }, { "docid": "6f7bcd5446ee04e972af59ce90464755", "score": "0.5355214", "text": "func (s *datagramSocketImpl) loopWrite(ch chan<- struct{}) {\n\tdefer close(ch)\n\n\twaitEntry, notifyCh := waiter.NewChannelEntry(waiter.EventOut)\n\ts.wq.EventRegister(&waitEntry)\n\tdefer s.wq.EventUnregister(&waitEntry)\n\n\tbuf := make([]byte, udpTxPreludeSize+maxUDPPayloadSize)\n\ts.sharedState.localEDrainedCond.L.Lock()\n\tdefer s.sharedState.localEDrainedCond.L.Unlock()\n\tfor {\n\t\tv := buf\n\t\tn, err := s.local.Read(v, 0)\n\t\tif err != nil {\n\t\t\tif err, ok := err.(*zx.Error); ok {\n\t\t\t\tif s.handleZxSocketReadError(*err, func(sigs zx.Signals) zx.Signals {\n\t\t\t\t\t// FIDL methods on datagram sockets block until all of the payloads\n\t\t\t\t\t// in the contained zircon socket have been dequeued. When the\n\t\t\t\t\t// socket is readable (aka contains payloads), methods wait on\n\t\t\t\t\t// a condition variable until the next time it might be empty.\n\t\t\t\t\t//\n\t\t\t\t\t// Since this callback is invoked precisely when the socket has\n\t\t\t\t\t// been found to be empty (aka returns ErrShouldWait) wake up\n\t\t\t\t\t// any waiters.\n\t\t\t\t\ts.sharedState.localEDrainedCond.L.Unlock()\n\t\t\t\t\ts.sharedState.localEDrainedCond.Broadcast()\n\t\t\t\t\tsigs, err := zxwait.WaitContext(context.Background(), zx.Handle(s.local), sigs)\n\t\t\t\t\ts.sharedState.localEDrainedCond.L.Lock()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tpanic(err)\n\t\t\t\t\t}\n\t\t\t\t\treturn sigs\n\t\t\t\t}) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpanic(err)\n\t\t}\n\n\t\tv = v[:n]\n\n\t\topts := tcpip.WriteOptions{\n\t\t\tAtomic: true,\n\t\t}\n\n\t\taddr, cmsgs, err := udp_serde.DeserializeSendMsgMeta(v[:udpTxPreludeSize])\n\t\tif err != nil {\n\t\t\t// Ideally, we'd like to close the socket so as to inform the client\n\t\t\t// that they're mishandling the ABI. This is complicated by the fact\n\t\t\t// that the zircon socket can be shared by multiple clients, and we\n\t\t\t// can't tell which client sent the bad payload. Instead, we just\n\t\t\t// log the error and drop the payload on the floor.\n\t\t\t_ = syslog.Errorf(\"error deserializing payload from socket: %s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif errno := validateSendableControlMessages(&cmsgs); errno != 0 {\n\t\t\t// As above, we'd prefer to close the socket but instead just drop\n\t\t\t// the payload on the floor.\n\t\t\t_ = syslog.Errorf(\"error validating control messages (%#v): %s\", cmsgs, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif addr != nil {\n\t\t\topts.To = addr\n\t\t}\n\t\topts.ControlMessages = cmsgs\n\n\t\tv = v[udpTxPreludeSize:]\n\n\t\tfor {\n\t\t\tvar r bytes.Reader\n\t\t\tr.Reset(v)\n\t\t\tlenPrev := len(v)\n\t\t\twritten, err := s.ep.Write(&r, opts)\n\t\t\tif stored := s.sharedState.err.set(err); stored {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif err == nil {\n\t\t\t\tif int(written) != lenPrev {\n\t\t\t\t\tpanic(fmt.Sprintf(\"UDP disallows short writes; saw: %d/%d\", written, lenPrev))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tswitch err.(type) {\n\t\t\t\tcase *tcpip.ErrWouldBlock:\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-notifyCh:\n\t\t\t\t\t\tcontinue\n\t\t\t\t\tcase <-s.endpointWithSocket.closing:\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tif s.handleEndpointWriteError(err, udp.ProtocolNumber) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9c629735388deb2ab3a065a21bc1b8a9", "score": "0.53543895", "text": "func (c *client) startWriteHandler(pingPeriod time.Duration) {\n\tpingTicker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tc.NotifyClose()\n\t\tpingTicker.Stop()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.write:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := writeJSON(c.conn, message); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-pingTicker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := ping(c.conn); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0e04d01bac8a44bbd45bcc39810ce63a", "score": "0.5342996", "text": "func (p *Player) ReadPump() {\n\tdefer func() {\n\t\tp.Close()\n\t}()\n\tfor {\n\t\t_, message, err := p.ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\t//ignore empty messages\n\t\tif len(message) == 0 {\n\t\t\tlogrus.Warn(\"empty message skipped\")\n\t\t\tcontinue\n\t\t}\n\n\t\t//spam\n\t\tif len(message) > 2048 {\n\t\t\tlogrus.Warn(\"player unregistered because of spam\")\n\t\t\tp.Close()\n\t\t}\n\n\t\t//handle packages\n\t\tpack, err := p.packetHandler.OnMessage(message)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"error handling packet: %s\", err)\n\t\t}\n\n\t\t//update tracket according to packet structs\n\t\tp.Tracker.Update(pack)\n\t}\n}", "title": "" }, { "docid": "a0871f28f05e451eeb00d8932c88895f", "score": "0.53293467", "text": "func (c *client) Write(payload []byte) error {\n\t//println(\"Client Write\")\n\tc.writeSignal <- packet{NewData(c.id, 0, payload, nil), nil, MsgData, false, false}\n\ti := <-c.writeToLostConnection\n\tc.writeToLostConnection <- i\n\tif i == 1 {\n\t\treturn errors.New(\"the connection with the server has been lost\")\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "76c72fd76473c76123b0dcd6826ba5c3", "score": "0.52995855", "text": "func (c *Conn) writeLoop(ctx context.Context) error {\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase data := <-c.sendMsg:\n\t\t\terr := c.write(data)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9fcdfa0e0c8b7faf201d0ecc64978f93", "score": "0.52990925", "text": "func (sub subscription) readPump() {\n\tconn := sub.conn\n\tdefer func() {\n\t\thub.unregister <- sub\n\t\tconn.ws.Close()\n\t}()\n\tconn.ws.SetReadLimit(maxMessageSize)\n\tconn.ws.SetReadDeadline(time.Now().Add(pongWait))\n\tconn.ws.SetPongHandler(func(string) error {\n\t\tconn.ws.SetReadDeadline(time.Now().Add(pongWait))\n\t\treturn nil\n\t})\n\tlog.Printf(\"[DEBUG] readPump initiated\")\n\tfor {\n\t\t_, rawMessage, err := conn.ws.ReadMessage()\n\t\tlog.Printf(\"[DEBUG] readPump loop, '%s'\", rawMessage) // \"send\" called\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"[ERROR] %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tm, err := sanitizedMessage(rawMessage)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[WARN] Failed sanitizzation, %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Printf(\"[DEBUG] unmarshaled message struct %v\", m)\n\t\thub.broadcast <- m\n\t}\n}", "title": "" }, { "docid": "17913b2067adb547c096aa526333e9fe", "score": "0.5296376", "text": "func (oc *outc) startWriting() {\n\tticker := time.NewTicker(oc.pingWait)\n\tdefer func() {\n\t\tticker.Stop()\n\t\toc.Close()\n\t\tolog.Debugf(\"[%v] backend writer routine done\", oc.id)\n\t}()\n\t// cleanup existing cache by sending all messages form that first\n\tif !oc.clearCache() {\n\t\treturn\n\t}\n\tfor {\n\t\tselect {\n\t\tcase msg := <-oc.receive:\n\t\t\tif msg == nil || msg.MessageType == common.RemoteConnectionNormalClosure {\n\t\t\t\t// well, client is gone, cleanup upstream connection\n\t\t\t\tolog.Debugf(\"[%v] received control message: %v\", oc.id, msg)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif wrr := oc.con.WriteMessage(msg.MessageType, msg.Data); wrr != nil {\n\t\t\t\toc.notifyFrontend(wrr, \"writing\")\n\t\t\t\toc.cache.add(msg)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tolog.Tracef(\"[%v] client->proxy: %s\", oc.id, msg)\n\t\tcase <-ticker.C:\n\t\t\terr := oc.con.WriteControl(websocket.PingMessage, []byte{}, time.Now().Add(time.Second))\n\t\t\tif err != nil {\n\t\t\t\toc.notifyFrontend(err, \"writing ping\")\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-oc.done:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "edd7ba1b68deee16a97ff73523f2033d", "score": "0.52802205", "text": "func (p *peer) WriteMessages() {\n\tdefer p.Close()\n\n\tvar reader bytes.Reader\n\twriter := bufio.NewWriter(p.conn)\n\tfor { // When this loop exits, p.sendQueueCond.L is unlocked\n\t\tp.sendQueueCond.L.Lock()\n\t\tfor {\n\t\t\tif p.closed.GetValue() {\n\t\t\t\tp.sendQueueCond.L.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(p.sendQueue) > 0 {\n\t\t\t\t// There is a message to send\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Wait until there is a message to send\n\t\t\tp.sendQueueCond.Wait()\n\t\t}\n\t\tmsg := p.sendQueue[0]\n\t\tp.sendQueue = p.sendQueue[1:]\n\t\tp.sendQueueCond.L.Unlock()\n\n\t\tmsgLen := uint32(len(msg.Bytes()))\n\t\tp.net.outboundMsgThrottler.Release(uint64(msgLen), p.nodeID)\n\t\tp.net.log.Verbo(\"sending message to %s%s at %s:\\n%s\", constants.NodeIDPrefix, p.nodeID, p.getIP(), formatting.DumpBytes{Bytes: msg.Bytes()})\n\t\tmsgb := [wrappers.IntLen]byte{}\n\t\tbinary.BigEndian.PutUint32(msgb[:], msgLen)\n\t\tfor _, byteSlice := range [2][]byte{msgb[:], msg.Bytes()} {\n\t\t\treader.Reset(byteSlice)\n\t\t\tif err := p.conn.SetWriteDeadline(p.nextTimeout()); err != nil {\n\t\t\t\tp.net.log.Verbo(\"error setting write deadline to %s%s at %s due to: %s\", constants.NodeIDPrefix, p.nodeID, p.getIP(), err)\n\t\t\t\tmsg.DecRef()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif _, err := io.CopyN(writer, &reader, int64(len((byteSlice)))); err != nil {\n\t\t\t\tp.net.log.Verbo(\"error writing to %s%s at %s due to: %s\", constants.NodeIDPrefix, p.nodeID, p.getIP(), err)\n\t\t\t\tmsg.DecRef()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tp.tickerOnce.Do(p.StartTicker)\n\t\t}\n\t\t// Make sure the peer got the entire message\n\t\tif err := writer.Flush(); err != nil {\n\t\t\tp.net.log.Verbo(\"couldn't flush writer to %s%s at %s: %s\", constants.NodeIDPrefix, p.nodeID, p.getIP(), err)\n\t\t\tmsg.DecRef()\n\t\t\treturn\n\t\t}\n\n\t\tnow := p.net.clock.Time().Unix()\n\t\tatomic.StoreInt64(&p.lastSent, now)\n\t\tatomic.StoreInt64(&p.net.lastMsgSentTime, now)\n\n\t\tmsg.DecRef()\n\t}\n}", "title": "" } ]
5152004fdf89bc4f006bc9c334ab41c9
DeletePod deletes the specified pod and wait until it got terminated
[ { "docid": "55ab5ac1f2e8100482b366ffbace49ce", "score": "0.70184475", "text": "func DeletePod(podName, podLabel, namespace string, timeout, delay int, clients clients.ClientSets) error {\n\n\terr := clients.KubeClient.CoreV1().Pods(namespace).Delete(podName, &v1.DeleteOptions{})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// waiting for the termination of the pod\n\terr = retry.\n\t\tTimes(uint(timeout / delay)).\n\t\tWait(time.Duration(delay) * time.Second).\n\t\tTry(func(attempt uint) error {\n\t\t\tpodSpec, err := clients.KubeClient.CoreV1().Pods(namespace).List(v1.ListOptions{LabelSelector: podLabel})\n\t\t\tif err != nil || len(podSpec.Items) != 0 {\n\t\t\t\treturn errors.Errorf(\"Unable to delete the pod, err: %v\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\treturn err\n}", "title": "" } ]
[ { "docid": "74fdcb64c1e07abcd51db511a1052bce", "score": "0.739036", "text": "func waitForPodDeleted(ctx context.Context, namespace, podName string, clientset *kubernetes.Clientset) (*corev1.Pod, error) {\n\tfor {\n\t\t_, err := clientset.CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{})\n\t\tif err != nil && k8serrors.IsNotFound(err) {\n\t\t\tlog.Infof(\"Pod %s was deleted, moving on\", podName)\n\t\t\treturn &corev1.Pod{}, nil\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, errors.Wrap(ctx.Err(), \"timed out waiting for pod to be deleted\")\n\t\tcase <-time.After(5 * time.Second):\n\t\t}\n\t}\n}", "title": "" }, { "docid": "311ce9d0cd542f26b41d70cc85556422", "score": "0.70609003", "text": "func deleteProbePod(chaosDetails *types.ChaosDetails, clients clients.ClientSets, runID string) error {\n\n\tif err := clients.KubeClient.CoreV1().Pods(chaosDetails.ChaosNamespace).Delete(chaosDetails.ExperimentName+\"-probe-\"+runID, &v1.DeleteOptions{}); err != nil {\n\t\treturn err\n\t}\n\n\t// waiting till the termination of the pod\n\treturn retry.\n\t\tTimes(uint(chaosDetails.Timeout / chaosDetails.Delay)).\n\t\tWait(time.Duration(chaosDetails.Delay) * time.Second).\n\t\tTry(func(attempt uint) error {\n\t\t\tpodSpec, err := clients.KubeClient.CoreV1().Pods(chaosDetails.ChaosNamespace).List(v1.ListOptions{LabelSelector: chaosDetails.ExperimentName + \"-probe-\" + runID})\n\t\t\tif err != nil || len(podSpec.Items) != 0 {\n\t\t\t\treturn errors.Errorf(\"Probe Pod is not deleted yet, err: %v\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n}", "title": "" }, { "docid": "055181d858f8d264dd9b0652a01d5710", "score": "0.70390403", "text": "func WaitForPodDeletion(pod *corev1.Pod, timeout time.Duration) error {\n\tkey := types.NamespacedName{\n\t\tName: pod.Name,\n\t\tNamespace: pod.Namespace,\n\t}\n\treturn wait.PollImmediate(time.Second, timeout, func() (bool, error) {\n\t\tpod := &corev1.Pod{}\n\t\tif err := Client.Get(context.TODO(), key, pod); errors.IsNotFound(err) {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t})\n}", "title": "" }, { "docid": "91a297c230697ca06c332d6d2e296520", "score": "0.7016077", "text": "func (j *PVCTestJig) DeleteAndAwaitPodOrFail(ns string, podName string) {\n\terr := j.KubeClient.CoreV1().Pods(ns).Delete(context.Background(), podName, metav1.DeleteOptions{})\n\tif err != nil {\n\t\tFailf(\"Pod %q Delete API error: %v\", podName, err)\n\t}\n\n\terr = j.waitTimeoutForPodNotFoundInNamespace(podName, ns, DefaultTimeout)\n\tif err != nil {\n\t\tFailf(\"Pod %q is not deleted: %v\", podName, err)\n\t}\n}", "title": "" }, { "docid": "62f178f8c564dcac05b326abb3c08217", "score": "0.6994709", "text": "func handlePodDelete(pod *corev1.Pod, cont *corev1.Container) {\n\tlog.Info(\"Pod is terminating...\")\n\n\tname, err := generateApprovalName(pod, cont)\n\tif err != nil {\n\t\tlog.Error(err, \"cannot generate approval name\")\n\t\treturn\n\t}\n\tif err := internal.UpdateApproval(k8sClient, name, tmaxv1.ResultCanceled, \"\"); err != nil {\n\t\tlog.Error(err, \"cannot update approval\")\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e4d33207f0d8de193bdc35f9a8d232a9", "score": "0.6931983", "text": "func (cm *ChaosManager) deletePod(name string, namespace string, timeout uint64, wg *sync.WaitGroup, podCh chan error) {\n\tselect {\n\tcase <-time.After(time.Duration(timeout) * time.Second):\n\t\tdeletePolicy := metav1.DeletePropagationForeground\n\n\t\tif err := cm.clientset.CoreV1().Pods(namespace).Delete(name, &metav1.DeleteOptions{\n\t\t\tPropagationPolicy: &deletePolicy,\n\t\t}); err != nil {\n\t\t\tlog.WithError(err).WithField(\"podName\", name).WithField(\"namespace\", namespace).Error(\"Encountered error while pod deletion\")\n\t\t}\n\n\t\tlog.WithField(\"podName\", name).WithField(\"namespace\", namespace).Info(\"Removed pod\")\n\n\tcase <-podCh:\n\t\tlog.WithField(\"name\", name).WithField(\"namespace\", namespace).Info(\"Received chaos interrupt, terminating simulation\")\n\t}\n\n\tcm.pmux.Lock()\n\tdefer cm.pmux.Unlock()\n\n\tdelete(cm.podMap, fmt.Sprintf(\"%s-%s\", name, namespace))\n\twg.Done()\n}", "title": "" }, { "docid": "46368834e8e8f226b412dcd869716e17", "score": "0.67868245", "text": "func (v *VicPodDeleter) deletePod(op trace.Operation, vp *vicpod.VicPod, force bool) error {\n\tdefer trace.End(trace.Begin(\"\", op))\n\n\tif vp == nil {\n\t\treturn PodDeleterInvalidPodSpecError\n\t}\n\n\tid := vp.ID\n\tname := vp.Pod.Name\n\trunning := false\n\n\tstopper, err := NewPodStopper(v.client, v.isolationProxy)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Use the force and stop the container first\n\tif force {\n\t\tif err := stopper.Stop(op, id, name); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tstate, err := v.isolationProxy.State(op, id, name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tswitch state {\n\t\tcase \"Error\":\n\t\t\t// force stop if container state is error to make sure container is deletable later\n\t\t\tstopper.Stop(op, id, name)\n\t\tcase \"Starting\":\n\t\t\t// if we are starting let the user know they must use the force\n\t\t\treturn fmt.Errorf(\"The container is starting. To remove use -f\")\n\t\tcase \"Running\":\n\t\t\trunning = true\n\t\t}\n\n\t\thandle, err := v.isolationProxy.Handle(op, id, name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Unbind the container to the scope\n\t\t_, ep, err := v.isolationProxy.UnbindScope(op, handle, name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\top.Infof(\"Scope Unbind returned endpoints %# +v\", ep)\n\t}\n\n\t// Retry remove operation if container is not in running state. If in running state, we only try\n\t// once to prevent retries from degrading performance.\n\tif !running {\n\t\toperation := func() error {\n\t\t\treturn v.isolationProxy.Remove(op, id, true)\n\t\t}\n\t\top.Infof(\"Delete Pod, ID: %s, running: %v\", vp.ID, running)\n\t\treturn retry.Do(operation, vicerrors.IsConflictError)\n\t}\n\n\terr = v.isolationProxy.Remove(op, id, true)\n\top.Infof(\"Delete Pod, ID: %s, running: %v err: %v\", vp.ID, running, err)\n\treturn err\n}", "title": "" }, { "docid": "5b0563cc45c77e85037a0c8e3b4bf84c", "score": "0.67257583", "text": "func (r *runtime) KillPod(pod *api.Pod, runningPod kubecontainer.Pod) error {\n\tvar (\n\t\tpodID string\n\t\tpodFullName string\n\t\tpodName string\n\t\tpodNamespace string\n\t\terr error\n\t)\n\n\tpodName = runningPod.Name\n\tpodNamespace = runningPod.Namespace\n\tif len(podName) == 0 && pod != nil {\n\t\tpodName = pod.Name\n\t\tpodNamespace = pod.Namespace\n\t}\n\tif len(podName) == 0 {\n\t\treturn nil\n\t}\n\n\tpodFullName = kubecontainer.BuildPodFullName(podName, podNamespace)\n\tglog.V(4).Infof(\"Hyper: killing pod %q.\", podFullName)\n\n\tdefer func() {\n\t\t// Teardown pod's network\n\t\terr = r.networkPlugin.TearDownPod(podNamespace, podName, \"\", \"hyper\")\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"Hyper: networkPlugin.TearDownPod failed, error: %v\", err)\n\t\t}\n\n\t\t// Delete pod spec file\n\t\tspecFileName := path.Join(hyperPodSpecDir, podFullName)\n\t\t_, err = os.Stat(specFileName)\n\t\tif err == nil {\n\t\t\te := os.Remove(specFileName)\n\t\t\tif e != nil {\n\t\t\t\tglog.Warningf(\"Hyper: delete spec file for %s failed, error: %v\", runningPod.Name, e)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// preStop hook\n\tfor _, c := range runningPod.Containers {\n\t\tr.containerRefManager.ClearRef(c.ID)\n\n\t\tvar container *api.Container\n\t\tif pod != nil {\n\t\t\tfor i, containerSpec := range pod.Spec.Containers {\n\t\t\t\tif c.Name == containerSpec.Name {\n\t\t\t\t\tcontainer = &pod.Spec.Containers[i]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tgracePeriod := int64(minimumGracePeriodInSeconds)\n\t\tif pod != nil {\n\t\t\tswitch {\n\t\t\tcase pod.DeletionGracePeriodSeconds != nil:\n\t\t\t\tgracePeriod = *pod.DeletionGracePeriodSeconds\n\t\t\tcase pod.Spec.TerminationGracePeriodSeconds != nil:\n\t\t\t\tgracePeriod = *pod.Spec.TerminationGracePeriodSeconds\n\t\t\t}\n\t\t}\n\n\t\tstart := unversioned.Now()\n\t\tif pod != nil && container != nil && container.Lifecycle != nil && container.Lifecycle.PreStop != nil {\n\t\t\tglog.V(4).Infof(\"Running preStop hook for container %q\", container.Name)\n\t\t\tdone := make(chan struct{})\n\t\t\tgo func() {\n\t\t\t\tdefer close(done)\n\t\t\t\tdefer utilruntime.HandleCrash()\n\t\t\t\tif err := r.runner.Run(c.ID, pod, container, container.Lifecycle.PreStop); err != nil {\n\t\t\t\t\tglog.Errorf(\"preStop hook for container %q failed: %v\", container.Name, err)\n\t\t\t\t}\n\t\t\t}()\n\t\t\tselect {\n\t\t\tcase <-time.After(time.Duration(gracePeriod) * time.Second):\n\t\t\t\tglog.V(2).Infof(\"preStop hook for container %q did not complete in %d seconds\", container.Name, gracePeriod)\n\t\t\tcase <-done:\n\t\t\t\tglog.V(4).Infof(\"preStop hook for container %q completed\", container.Name)\n\t\t\t}\n\t\t\tgracePeriod -= int64(unversioned.Now().Sub(start.Time).Seconds())\n\t\t}\n\n\t\t// always give containers a minimal shutdown window to avoid unnecessary SIGKILLs\n\t\tif gracePeriod < minimumGracePeriodInSeconds {\n\t\t\tgracePeriod = minimumGracePeriodInSeconds\n\t\t}\n\t}\n\n\tpodInfos, err := r.hyperClient.ListPods()\n\tif err != nil {\n\t\tglog.Errorf(\"Hyper: ListPods failed, error: %s\", err)\n\t\treturn err\n\t}\n\n\tfor _, podInfo := range podInfos {\n\t\tif podInfo.PodName == podFullName {\n\t\t\tpodID = podInfo.PodID\n\n\t\t\t// Remove log links\n\t\t\tfor _, c := range podInfo.PodInfo.Status.Status {\n\t\t\t\t_, _, _, containerName, _, _, err := r.parseHyperContainerFullName(c.Name)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tsymlinkFile := LogSymlink(r.containerLogsDir, podFullName, containerName, c.ContainerID)\n\t\t\t\terr = os.Remove(symlinkFile)\n\t\t\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\t\t\tglog.Warningf(\"Failed to remove container log symlink %q: %v\", symlinkFile, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbreak\n\t\t}\n\t}\n\n\terr = r.hyperClient.RemovePod(podID)\n\tif err != nil {\n\t\tglog.Errorf(\"Hyper: remove pod %s failed, error: %s\", podID, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eea829b4a0cbfae5355f2e63a75d4363", "score": "0.6701076", "text": "func WaitForPodDeleted(ctx context.Context, client kubernetes.Interface, name, namespace string) error {\n\tif err := WaitForPodState(ctx, client, func(p *corev1.Pod) (bool, error) {\n\t\t// Always return false. We're oly interested in the error which indicates pod deletion or timeout.\n\t\treturn false, nil\n\t}, name, namespace); err != nil {\n\t\tif !apierrs.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "673232c37ebf83ccb0319a7526b68948", "score": "0.66442215", "text": "func DeletePod(pod types.FakePod) {\n\tresp, err := SendHTTPRequest(http.MethodDelete,\n\t\tControllerHubURL+constants.PodResource+\n\t\t\t\"?name=\"+pod.Name+\"&namespace=\"+pod.Namespace+\"&nodename=\"+pod.NodeName,\n\t\tnil)\n\tif err != nil {\n\t\tklog.Errorf(\"Frame HTTP request failed: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tcontents, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tklog.Errorf(\"HTTP Response reading has failed: %v\", err)\n\t}\n\n\tklog.V(4).Infof(\"DeletePod response: %v\", contents)\n}", "title": "" }, { "docid": "a00b22271b4781ed9786b5536c00bd35", "score": "0.65597993", "text": "func (dc *Controller) deletePod(etype controllers.EventType, obj interface{}) {\n\tpod := obj.(*v1.Pod)\n\tdc.enqueueObj(pod)\n\tlog.Printf(\"receive Pod del event, %s %s\", pod.Name, pod.Namespace)\n\treturn\n}", "title": "" }, { "docid": "f6c8f1b158de877d8cbe5b118280bf67", "score": "0.6476077", "text": "func (p *k8sProvider) DeletePod(ctx context.Context, pod *v1.Pod) error {\n\tlog.Println(\"=================DeletePod=================\")\n\tnamespace := pod.ObjectMeta.Namespace\n\tname := pod.ObjectMeta.Name\n\tif name == \"vk\" {\n\t\treturn nil\n\t}\n\tresult := p.QTSk8sClient.Core().Pods(namespace).Delete(name, &metav1.DeleteOptions{})\n\tif result != nil {\n log.Println(result)\n }\n\n\treturn nil\n}", "title": "" }, { "docid": "00b3437f0f11b5e16e9b88ba55da79d8", "score": "0.6454937", "text": "func (c *Client) WaitForPodDeletion(uid types.UID, namespace string, timeout time.Duration) error {\n\tt := func() (interface{}, bool, error) {\n\t\tif err := c.initClient(); err != nil {\n\t\t\treturn nil, true, err\n\t\t}\n\n\t\tp, err := c.GetPodByUID(uid, namespace)\n\t\tif err != nil {\n\t\t\tif err == schederrors.ErrPodsNotFound {\n\t\t\t\treturn nil, false, nil\n\t\t\t}\n\n\t\t\treturn nil, true, err\n\t\t}\n\n\t\tif p != nil {\n\t\t\treturn nil, true, fmt.Errorf(\"pod %s:%s (%s) still present in the system\", namespace, p.Name, uid)\n\t\t}\n\n\t\treturn nil, false, nil\n\t}\n\n\tif _, err := task.DoRetryWithTimeout(t, timeout, 5*time.Second); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "be4a780cb72e02f4897fd29fed7ea4db", "score": "0.6441554", "text": "func (p *Pod) Delete(clientset kubernetes.Interface,\n\tredisClient redisinterfaces.RedisClient,\n\treason string,\n\tconfigYaml *ConfigYAML,\n) error {\n\terr := clientset.CoreV1().Pods(p.Namespace).Delete(p.Name, &metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn errors.NewKubernetesError(\"delete pod error\", err)\n\t}\n\n\t_ = reporters.Report(reportersConstants.EventGruDelete, map[string]interface{}{\n\t\treportersConstants.TagGame: p.Game,\n\t\treportersConstants.TagScheduler: p.Namespace,\n\t\treportersConstants.TagReason: reason,\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "124993ca66bb5524a4673c51fb01636c", "score": "0.6401973", "text": "func (p *BasicECSPod) Delete(ctx context.Context) error {\n\tif err := p.Stop(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"stopping pod\")\n\t}\n\n\tif utility.FromBoolPtr(p.resources.TaskDefinition.Owned) {\n\t\tderegisterDef := ecs.DeregisterTaskDefinitionInput{}\n\t\tderegisterDef.SetTaskDefinition(utility.FromStringPtr(p.resources.TaskDefinition.ID))\n\n\t\tif _, err := p.client.DeregisterTaskDefinition(ctx, &deregisterDef); err != nil {\n\t\t\treturn errors.Wrap(err, \"deregistering task definition\")\n\t\t}\n\t}\n\n\tfor _, secret := range p.resources.Secrets {\n\t\tif utility.FromBoolPtr(secret.Owned) {\n\t\t\tif err := p.vault.DeleteSecret(ctx, utility.FromStringPtr(secret.Name)); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"deleting secret\")\n\t\t\t}\n\t\t}\n\t}\n\n\tp.status = cocoa.StatusDeleted\n\n\treturn nil\n}", "title": "" }, { "docid": "f839dde31470290090f2a2bf088e16ac", "score": "0.63547003", "text": "func DeleteFakePod(ControllerHubURL string, pod types.FakePod) {\n\tresp, err := SendHTTPRequest(http.MethodDelete,\n\t\tControllerHubURL+constants.PodResource+\n\t\t\t\"?name=\"+pod.Name+\"&namespace=\"+pod.Namespace+\"&nodename=\"+pod.NodeName,\n\t\tnil)\n\tif err != nil {\n\t\tutils.Fatalf(\"Frame HTTP request failed: %v\", err)\n\t}\n\n\tif resp != nil {\n\t\tdefer resp.Body.Close()\n\n\t\tcontents, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"HTTP Response reading has failed: %v\", err)\n\t\t}\n\n\t\tif contents != nil {\n\t\t\tutils.Infof(\"DeletePod response: %v\", contents)\n\t\t} else {\n\t\t\tutils.Infof(\"DeletePod response: nil\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fa92b16dafab5e5e96334ff562a11fb4", "score": "0.629296", "text": "func (jgc *JanusGuardController) deletePod(obj interface{}) {\n\tpod, ok := obj.(*corev1.Pod)\n\n\t// When a delete is dropped, the relist will notice a pod in the store not\n\t// in the list, leading to the insertion of a tombstone object which\n\t// contains the deleted key/value. Note that this value might be stale. If\n\t// the pod changed labels the new JanusGuard will not be woken up until\n\t// the periodic resync.\n\tif !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\truntime.HandleError(fmt.Errorf(\"couldn't get object from tombstone %+v\", obj))\n\t\t\treturn\n\t\t}\n\t\tpod, ok = tombstone.Obj.(*corev1.Pod)\n\t\tif !ok {\n\t\t\truntime.HandleError(fmt.Errorf(\"tombstone contained object that is not a pod %#v\", obj))\n\t\t\treturn\n\t\t}\n\t}\n\n\tif jgName, found := pod.Annotations[JanusGuardAnnotationKey]; found {\n\t\tjg, err := jgc.jgLister.JanusGuards(pod.Namespace).Get(jgName)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tjgKey, err := controller.KeyFunc(jg)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tglog.V(4).Infof(\"Annotated pod %s/%s deleted through %v, timestamp %+v: %#v.\",\n\t\t\tpod.Namespace, pod.Name, runtime.GetCaller(), pod.DeletionTimestamp, pod)\n\t\tjgc.expectations.DeletionObserved(jgKey, controller.PodKey(pod))\n\t\tjgc.enqueueJanusGuard(jg)\n\t}\n\n\t// If this pod is a JanusD pod, we need to first destroy the connection to\n\t// the gRPC server run on the daemon. Then remove relevant JanusGuard\n\t// annotations from pods on the same node.\n\tif label, _ := pod.Labels[\"daemon\"]; label == \"janusd\" {\n\t\thostURL, err := jgc.getHostURL(pod)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t// Destroy connections to gRPC server on daemon.\n\t\tjgc.janusdConnections.Delete(hostURL)\n\n\t\tallPods, err := jgc.podLister.List(labels.Everything())\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tfor _, po := range allPods {\n\t\t\tif po.Spec.NodeName != pod.Spec.NodeName {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t//delete(po.Annotations, JanusGuardAnnotationKey)\n\t\t\tupdateAnnotations([]string{JanusGuardAnnotationKey}, nil, po)\n\t\t}\n\t\tglog.V(4).Infof(\"Daemon pod %s/%s deleted through %v, timestamp %+v: %#v.\",\n\t\t\tpod.Namespace, pod.Name, runtime.GetCaller(), pod.DeletionTimestamp, pod)\n\t}\n}", "title": "" }, { "docid": "90fbda2258b1ef5556c205250eb8ccd1", "score": "0.62576395", "text": "func (s *Simulator) deletePod() error {\n\treturn s.kubeClient.CoreV1().Pods(s.namespace).Delete(s.name, &metav1.DeleteOptions{})\n}", "title": "" }, { "docid": "52791b07bcec2a065cf7e8d9f77c4fb8", "score": "0.6214934", "text": "func (t *terraformer) waitForPod(ctx context.Context, logger logr.Logger, pod *corev1.Pod, deadline time.Duration) int32 {\n\t// 'terraform plan' returns exit code 2 if the plan succeeded and there is a diff\n\t// If we can't read the terminated state of the container we simply force that the Terraform\n\t// job gets created.\n\tvar exitCode int32 = 2\n\tctx, cancel := context.WithTimeout(ctx, deadline)\n\tdefer cancel()\n\n\tlogger = logger.WithValues(\"pod\", client.ObjectKeyFromObject(pod))\n\n\tlogger.Info(\"Waiting for Terraformer pod to be completed...\")\n\tif err := retry.Until(ctx, 5*time.Second, func(ctx context.Context) (done bool, err error) {\n\t\terr = t.client.Get(ctx, client.ObjectKeyFromObject(pod), pod)\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tlogger.Info(\"Terraformer pod disappeared unexpectedly, somebody must have manually deleted it\")\n\t\t\treturn retry.Ok()\n\t\t}\n\t\tif err != nil {\n\t\t\tlogger.Error(err, \"Error retrieving pod\")\n\t\t\treturn retry.SevereError(err)\n\t\t}\n\n\t\t// Check whether the Pod has been successful\n\t\tvar (\n\t\t\tphase = pod.Status.Phase\n\t\t\tcontainerStatuses = pod.Status.ContainerStatuses\n\t\t)\n\n\t\tif (phase == corev1.PodSucceeded || phase == corev1.PodFailed) && len(containerStatuses) > 0 {\n\t\t\tif containerStateTerminated := containerStatuses[0].State.Terminated; containerStateTerminated != nil {\n\t\t\t\texitCode = containerStateTerminated.ExitCode\n\t\t\t}\n\t\t\treturn retry.Ok()\n\t\t}\n\n\t\tlogger.Info(\"Waiting for Terraformer pod to be completed, pod hasn't finished yet\", \"phase\", phase, \"len-of-containerstatuses\", len(containerStatuses))\n\t\treturn retry.MinorError(fmt.Errorf(\"pod was not successful: phase=%s, len-of-containerstatuses=%d\", phase, len(containerStatuses)))\n\t}); err != nil {\n\t\texitCode = 1\n\t}\n\n\treturn exitCode\n}", "title": "" }, { "docid": "078068fb2294e8bfa611b2cee01f936b", "score": "0.620279", "text": "func (jm *Controller) deletePod(logger klog.Logger, obj interface{}, final bool) {\n\tpod, ok := obj.(*v1.Pod)\n\tif final {\n\t\trecordFinishedPodWithTrackingFinalizer(pod, nil)\n\t}\n\n\t// When a delete is dropped, the relist will notice a pod in the store not\n\t// in the list, leading to the insertion of a tombstone object which contains\n\t// the deleted key/value. Note that this value might be stale. If the pod\n\t// changed labels the new job will not be woken up till the periodic resync.\n\tif !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"couldn't get object from tombstone %+v\", obj))\n\t\t\treturn\n\t\t}\n\t\tpod, ok = tombstone.Obj.(*v1.Pod)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"tombstone contained object that is not a pod %+v\", obj))\n\t\t\treturn\n\t\t}\n\t}\n\n\tcontrollerRef := metav1.GetControllerOf(pod)\n\thasFinalizer := hasJobTrackingFinalizer(pod)\n\tif controllerRef == nil {\n\t\t// No controller should care about orphans being deleted.\n\t\t// But this pod might have belonged to a Job and the GC removed the reference.\n\t\tif hasFinalizer {\n\t\t\tjm.enqueueOrphanPod(pod)\n\t\t}\n\t\treturn\n\t}\n\tjob := jm.resolveControllerRef(pod.Namespace, controllerRef)\n\tif job == nil || IsJobFinished(job) {\n\t\t// syncJob will not remove this finalizer.\n\t\tif hasFinalizer {\n\t\t\tjm.enqueueOrphanPod(pod)\n\t\t}\n\t\treturn\n\t}\n\tjobKey, err := controller.KeyFunc(job)\n\tif err != nil {\n\t\treturn\n\t}\n\tjm.expectations.DeletionObserved(logger, jobKey)\n\n\t// Consider the finalizer removed if this is the final delete. Otherwise,\n\t// it's an update for the deletion timestamp, then check finalizer.\n\tif final || !hasFinalizer {\n\t\tjm.finalizerExpectations.finalizerRemovalObserved(logger, jobKey, string(pod.UID))\n\t}\n\n\tjm.enqueueSyncJobBatched(logger, job)\n}", "title": "" }, { "docid": "2d5f30664bb54448c49e3ca552a3b40a", "score": "0.6143681", "text": "func deletePod(namespace, podName string, clientset *kubernetes.Clientset) error {\n\tctx := context.TODO()\n\terr := clientset.CoreV1().Pods(namespace).Delete(ctx, podName, metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c876d2b05ab046b7dcf611f82d29957e", "score": "0.6141021", "text": "func (deploymentClient *DeploymentClient) DeletePod(podName string){\n\tlog.Println(\"Deleting Pod \"+podName+\"...\")\n\tpodsClient := deploymentClient.Clientset.CoreV1().Pods(deploymentClient.Namespace)\n\tdeletePolicy := metav1.DeletePropagationForeground\n\terr := podsClient.Delete(podName, &metav1.DeleteOptions{\n\t\tPropagationPolicy: &deletePolicy,\n\t})\n\tif err != nil {\n\t\tlog.Println(\"Delete Pod error: \",err)\n\t}else {\n\t\tlog.Println(\"Deleted Pod : \",podName)\n\t}\n}", "title": "" }, { "docid": "b3c84f295e7f48e47c2903ecc0932d4f", "score": "0.61383533", "text": "func DeletePod(contextName string, namespace string, name string) error {\n\n\tclientset, err := context.GetClientset(contextName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn connector.DeletePod(clientset, namespace, name)\n}", "title": "" }, { "docid": "d63bfa78d00094a877926e4b0654ad75", "score": "0.61209404", "text": "func deletePod(ctx context.Context, namespace string, name string, client *kubernetes.Clientset) error {\n\n\tdelOpts := v1.DeleteOptions{}\n\terr := client.CoreV1().Pods(namespace).Delete(ctx, name, delOpts)\n\tif err != nil {\n\t\treportErr := fmt.Errorf(\"Error deleting pod \" + name + \" in namespace \" + namespace + \" with error \" + error.Error(err))\n\t\treturn reportErr\n\t}\n\tlog.Infoln(\"Pod\", name, \"successfully deleted in namespace:\", namespace)\n\treturn nil\n}", "title": "" }, { "docid": "0c8c40f28ac9f1628613f0de4b61e720", "score": "0.61174375", "text": "func (c *Controller) deletePod(selector map[string]string ,podDeleteLimit int) error {\n\tpodClient := c.kubeClientset.CoreV1().Pods(apiv1.NamespaceDefault)\n\tfor key,val := range selector {\n\t\tpodList, err := c.kubeClientset.CoreV1().Pods(apiv1.NamespaceDefault).List(metav1.ListOptions{LabelSelector:key+\"=\"+val})\n\t\tif err!=nil {\n\t\t\treturn err\n\t\t}\n\t\tcnt :=int(0)\n\t\tif podDeleteLimit==AllPods {\n\t\t\tpodDeleteLimit = len(podList.Items)\n\t\t}\n\t\tfor _,pod := range podList.Items {\n\t\t\tif cnt < podDeleteLimit {\n\t\t\t\t//clear podMapToPodwatch,podStatus\n\t\t\t\tdelete(c.PodMapToPodWatch,pod.GetName())\n\t\t\t\tdelete(c.PodStatus,pod.GetName())\n\t\t\t\terr = podClient.Delete(pod.GetName(),&metav1.DeleteOptions{})\n\t\t\t\tif err!=nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcnt++\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e490480c6c486084570ca83465d78010", "score": "0.60324496", "text": "func waitForPod(ctx context.Context, kubeClient kubernetes.Interface, name string, namespace string) error {\n\tfor i := 0; i < podCreationWaitRetries; i++ {\n\t\t// check for the existence of the resource\n\t\tpod, err := kubeClient.CoreV1().Pods(namespace).Get(ctx, name, meta_v1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get pod %s, err %+v\", name, err)\n\t\t}\n\t\tif pod.Status.Phase != \"Succeeded\" {\n\t\t\tlog.Infof(\"pod %s is curently in %s phase\", name, pod.Status.Phase)\n\t\t\ttime.Sleep(podCreationSleepIntervalSeconds * time.Second)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Infof(\"pod %s have run successfully\", name)\n\t\t// successfully running\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"gave up waiting for pod %s to be available\", name)\n}", "title": "" }, { "docid": "fc7907181f1cc9cc4ea4d97ce4076c99", "score": "0.59829175", "text": "func Delete(input DeleteInput) {\n\tExpect(input.Deleter).NotTo(BeNil(), \"input.Deleter is required for IdentityValidator.Delete\")\n\tExpect(input.IdentityValidator).NotTo(BeNil(), \"input.IdentityValidator is required for IdentityValidator.Delete\")\n\n\tBy(fmt.Sprintf(\"Deleting pod \\\"%s\\\"\", input.IdentityValidator.Name))\n\n\tEventually(func() error {\n\t\treturn input.Deleter.Delete(context.TODO(), input.IdentityValidator)\n\t}, deleteTimeout, deletePolling).Should(Succeed())\n}", "title": "" }, { "docid": "94f004ce260bdd04bc41953616d23fdb", "score": "0.59682244", "text": "func (e *Controller) deletePod(obj interface{}) {\n\tpod := endpointsliceutil.GetPodFromDeleteAction(obj)\n\tif pod != nil {\n\t\te.addPod(pod)\n\t}\n}", "title": "" }, { "docid": "6b42b2c82272157b7e8eb1473c8a6dfb", "score": "0.59615564", "text": "func (dagRun *DAGRun) DeletePod() {\n\tlogs.InfoLogger.Printf(\n\t\t\"Deleting pod %s, in namespace %s\",\n\t\tdagRun.pod.Name,\n\t\tdagRun.pod.Namespace,\n\t)\n\terr := dagRun.podClient().Delete(\n\t\tcontext.TODO(),\n\t\tdagRun.Name,\n\t\tk8sapi.DeleteOptions{},\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "5c0200b3e7e9b74d394e6c3a9f2326a2", "score": "0.59443754", "text": "func (rc *realModel) deletePod(namespace, name string) {\n\trc.lock.Lock()\n\tdefer rc.lock.Unlock()\n\n\tif namespaceInfo, ok := rc.Namespaces[namespace]; ok {\n\t\tif podInfo, ok := namespaceInfo.Pods[name]; ok {\n\t\t\tif nodeInfo, ok := rc.Nodes[podInfo.Hostname]; ok {\n\t\t\t\tdelete(nodeInfo.Pods, getPodKey(namespace, name))\n\t\t\t}\n\t\t\tdelete(namespaceInfo.Pods, name)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f0ae91dfc13c281863dbb386bf80e706", "score": "0.59075385", "text": "func (s *ServiceV1alpha1) DeletePods(ctx context.Context, in *DatahubV1alpha1.DeletePodsRequest) (*status.Status, error) {\n\tscope.Debug(\"Request received from DeletePods grpc function: \" + AlamedaUtils.InterfaceToString(in))\n\n\tvar containerDAO DaoClusterStatus.ContainerOperation = &DaoClusterStatusImpl.Container{\n\t\tInfluxDBConfig: *s.Config.InfluxDB,\n\t}\n\tif err := containerDAO.DeletePods(in.GetPods()); err != nil {\n\t\tscope.Errorf(\"DeletePods failed: %+v\", err)\n\t\treturn &status.Status{\n\t\t\tCode: int32(code.Code_INTERNAL),\n\t\t\tMessage: err.Error(),\n\t\t}, nil\n\t}\n\treturn &status.Status{\n\t\tCode: int32(code.Code_OK),\n\t}, nil\n}", "title": "" }, { "docid": "20682399fd87c411fcee1980d82b417f", "score": "0.58988214", "text": "func TestPortForwardDeletePod(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"skipping integration test\")\n\t}\n\tif ShouldRunGCPOnlyTests() {\n\t\tt.Skip(\"skipping test that is not gcp only\")\n\t}\n\n\tns, _, deleteNs := SetupNamespace(t)\n\tdefer deleteNs()\n\n\trpcAddr := randomPort()\n\tenv := []string{fmt.Sprintf(\"TEST_NS=%s\", ns.Name)}\n\tcmd := skaffold.Dev(\"--port-forward\", \"--rpc-port\", rpcAddr, \"-v=info\").InDir(\"examples/microservices\").InNs(ns.Name).WithEnv(env)\n\tstop := cmd.RunBackground(t)\n\tdefer stop()\n\n\tclient, shutdown := setupRPCClient(t, rpcAddr)\n\tdefer shutdown()\n\n\t// create a grpc connection. Increase number of reties for helm.\n\tstream, err := readEventAPIStream(client, t, 20)\n\tif stream == nil {\n\t\tt.Fatalf(\"error retrieving event log: %v\\n\", err)\n\t}\n\n\t// read entries from the log\n\tentries := make(chan *proto.LogEntry)\n\tgo func() {\n\t\tfor {\n\t\t\tentry, _ := stream.Recv()\n\t\t\tif entry != nil {\n\t\t\t\tentries <- entry\n\t\t\t}\n\t\t}\n\t}()\n\n\tlocalPort := getLocalPortFromPortForwardEvent(t, entries, \"leeroy-app\", \"service\", ns.Name)\n\tassertResponseFromPort(t, localPort, constants.LeeroyAppResponse)\n\n\t// now, delete all pods in this namespace.\n\tlogrus.Infof(\"Deleting all pods in namespace %s\", ns.Name)\n\tkubectlCLI := getKubectlCLI(t, ns.Name)\n\tkillPodsCmd := kubectlCLI.Command(context.Background(),\n\t\t\"delete\",\n\t\t\"pods\", \"--all\",\n\t\t\"-n\", ns.Name,\n\t)\n\n\tif output, err := killPodsCmd.CombinedOutput(); err != nil {\n\t\tt.Fatalf(\"error deleting all pods: %v \\n %s\", err, string(output))\n\t}\n\t// port forwarding should come up again on the same port\n\tassertResponseFromPort(t, localPort, constants.LeeroyAppResponse)\n}", "title": "" }, { "docid": "11ee9143cb21d6eb283d6b48f2ce0773", "score": "0.5883784", "text": "func (npMgr *NetworkPolicyManager) DeletePod(podObj *corev1.Pod) error {\n\tnpMgr.Lock()\n\tdefer npMgr.Unlock()\n\n\tif !isValidPod(podObj) {\n\t\treturn nil\n\t}\n\n\tvar err error\n\n\tpodNs := podObj.ObjectMeta.Namespace\n\tpodName := podObj.ObjectMeta.Name\n\tpodNodeName := podObj.Spec.NodeName\n\tpodLabels := podObj.ObjectMeta.Labels\n\tpodIP := podObj.Status.PodIP\n\tlog.Printf(\"POD DELETING: [%s/%s/%s%+v%s]\", podNs, podName, podNodeName, podLabels, podIP)\n\n\t// Delete pod from ipset\n\tipsMgr := npMgr.nsMap[util.KubeAllNamespacesFlag].ipsMgr\n\t// Delete the pod from its namespace's ipset.\n\tif err = ipsMgr.DeleteFromSet(podNs, podIP); err != nil {\n\t\tlog.Errorf(\"Error: failed to delete pod from namespace ipset.\")\n\t\treturn err\n\t}\n\t// Delete the pod from its label's ipset.\n\tfor podLabelKey, podLabelVal := range podLabels {\n\t\t//Ignore pod-template-hash label.\n\t\tif strings.Contains(podLabelKey, \"pod-template-hash\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tlabelKey := util.KubeAllNamespacesFlag + \"-\" + podLabelKey + \":\" + podLabelVal\n\t\tif err = ipsMgr.DeleteFromSet(labelKey, podIP); err != nil {\n\t\t\tlog.Errorf(\"Error: failed to delete pod from label ipset.\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "af4f9cf04cb82ccc66dc1d65aea0ccb3", "score": "0.5883559", "text": "func podKillCmd(c *cli.Context) error {\n\tif err := checkMutuallyExclusiveFlags(c); err != nil {\n\t\treturn err\n\t}\n\n\truntime, err := libpodruntime.GetRuntime(c)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not get runtime\")\n\t}\n\tdefer runtime.Shutdown(false)\n\n\tvar killSignal uint = uint(syscall.SIGTERM)\n\n\tif c.String(\"signal\") != \"\" {\n\t\t// Check if the signalString provided by the user is valid\n\t\t// Invalid signals will return err\n\t\tsysSignal, err := signal.ParseSignal(c.String(\"signal\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tkillSignal = uint(sysSignal)\n\t}\n\n\t// getPodsFromContext returns an error when a requested pod\n\t// isn't found. The only fatal error scenerio is when there are no pods\n\t// in which case the following loop will be skipped.\n\tpods, lastError := getPodsFromContext(c, runtime)\n\n\tfor _, pod := range pods {\n\t\tctr_errs, err := pod.Kill(killSignal)\n\t\tif ctr_errs != nil {\n\t\t\tfor ctr, err := range ctr_errs {\n\t\t\t\tif lastError != nil {\n\t\t\t\t\tlogrus.Errorf(\"%q\", lastError)\n\t\t\t\t}\n\t\t\t\tlastError = errors.Wrapf(err, \"unable to kill container %q in pod %q\", ctr, pod.ID())\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\tif lastError != nil {\n\t\t\t\tlogrus.Errorf(\"%q\", lastError)\n\t\t\t}\n\t\t\tlastError = errors.Wrapf(err, \"unable to kill pod %q\", pod.ID())\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Println(pod.ID())\n\t}\n\treturn lastError\n}", "title": "" }, { "docid": "2f8d2da52687f9247c2ad86de4831e03", "score": "0.5848979", "text": "func (ext *Checker) deletePod(podName string) error {\n\text.log(\"Deleting pod with name\", podName)\n\tpodClient := ext.KubeClient.CoreV1().Pods(ext.Namespace)\n\tgracePeriodSeconds := int64(1)\n\tdeletionPolicy := metav1.DeletePropagationForeground\n\terr := podClient.Delete(podName, &metav1.DeleteOptions{\n\t\tGracePeriodSeconds: &gracePeriodSeconds,\n\t\tPropagationPolicy: &deletionPolicy,\n\t})\n\tif err != nil && !(k8sErrors.IsNotFound(err) || strings.Contains(err.Error(), \"not found\")) {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5462b18176db41c74580800a05c8732c", "score": "0.5842104", "text": "func (m *ReconcilePod) podDelete(ctx context.Context, namespacedName client.ObjectKey) (reconcile.Result, error) {\n\tprePodENI := &v1beta1.PodENI{}\n\terr := m.client.Get(ctx, namespacedName, prePodENI)\n\tif err != nil {\n\t\tif k8sErr.IsNotFound(err) {\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t}\n\t// already deleting\n\tif prePodENI.Status.Phase == v1beta1.ENIPhaseDeleting || !prePodENI.DeletionTimestamp.IsZero() {\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\thaveFixedIP := false\n\tfor _, alloc := range prePodENI.Spec.Allocations {\n\t\tif alloc.AllocationType.Type == v1beta1.IPAllocTypeFixed {\n\t\t\thaveFixedIP = true\n\t\t}\n\t}\n\tif haveFixedIP {\n\t\t// for fixed ip , update podENI status to v1beta1.ENIPhaseDetaching\n\t\tif prePodENI.Status.Phase == v1beta1.ENIPhaseDetaching {\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\tprePodENICopy := prePodENI.DeepCopy()\n\t\tprePodENICopy.Status.Phase = v1beta1.ENIPhaseDetaching\n\t\t_, err = common.UpdatePodENIStatus(ctx, m.client, prePodENICopy)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// for non fixed ip, update status to v1beta1.ENIPhaseDeleting\n\tupdate := prePodENI.DeepCopy()\n\tupdate.Status.Phase = v1beta1.ENIPhaseDeleting\n\t_, err = common.UpdatePodENIStatus(ctx, m.client, update)\n\n\treturn reconcile.Result{}, err\n}", "title": "" }, { "docid": "323c4be8869ae51eef6660de07c4d3d3", "score": "0.58391505", "text": "func (jm *Controller) deleteJobPods(ctx context.Context, job *batch.Job, jobKey string, pods []*v1.Pod) (int32, error) {\n\terrCh := make(chan error, len(pods))\n\tsuccessfulDeletes := int32(len(pods))\n\tlogger := klog.FromContext(ctx)\n\n\tfailDelete := func(pod *v1.Pod, err error) {\n\t\t// Decrement the expected number of deletes because the informer won't observe this deletion\n\t\tjm.expectations.DeletionObserved(logger, jobKey)\n\t\tif !apierrors.IsNotFound(err) {\n\t\t\tlogger.V(2).Info(\"Failed to delete Pod\", \"job\", klog.KObj(job), \"pod\", klog.KObj(pod), \"err\", err)\n\t\t\tatomic.AddInt32(&successfulDeletes, -1)\n\t\t\terrCh <- err\n\t\t\tutilruntime.HandleError(err)\n\t\t}\n\t}\n\n\twg := sync.WaitGroup{}\n\twg.Add(len(pods))\n\tfor i := range pods {\n\t\tgo func(pod *v1.Pod) {\n\t\t\tdefer wg.Done()\n\t\t\tif patch := removeTrackingFinalizerPatch(pod); patch != nil {\n\t\t\t\tif err := jm.podControl.PatchPod(ctx, pod.Namespace, pod.Name, patch); err != nil {\n\t\t\t\t\tfailDelete(pod, fmt.Errorf(\"removing completion finalizer: %w\", err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := jm.podControl.DeletePod(ctx, job.Namespace, pod.Name, job); err != nil {\n\t\t\t\tfailDelete(pod, err)\n\t\t\t}\n\t\t}(pods[i])\n\t}\n\twg.Wait()\n\treturn successfulDeletes, errorFromChannel(errCh)\n}", "title": "" }, { "docid": "b98db0d31f23eab32cd0928d68b532b5", "score": "0.5828317", "text": "func TestPodDeletionDoesntEnqueueRecreateDeployment(t *testing.T) {\n\tlogger, ctx := ktesting.NewTestContext(t)\n\n\tf := newFixture(t)\n\n\tfoo := newDeployment(\"foo\", 1, nil, nil, nil, map[string]string{\"foo\": \"bar\"})\n\tfoo.Spec.Strategy.Type = apps.RecreateDeploymentStrategyType\n\trs1 := newReplicaSet(foo, \"foo-1\", 1)\n\trs2 := newReplicaSet(foo, \"foo-1\", 1)\n\tpod1 := generatePodFromRS(rs1)\n\tpod2 := generatePodFromRS(rs2)\n\n\tf.dLister = append(f.dLister, foo)\n\t// Let's pretend this is a different pod. The gist is that the pod lister needs to\n\t// return a non-empty list.\n\tf.podLister = append(f.podLister, pod1, pod2)\n\n\tc, _, err := f.newController(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating Deployment controller: %v\", err)\n\t}\n\tenqueued := false\n\tc.enqueueDeployment = func(d *apps.Deployment) {\n\t\tif d.Name == \"foo\" {\n\t\t\tenqueued = true\n\t\t}\n\t}\n\n\tc.deletePod(logger, pod1)\n\n\tif enqueued {\n\t\tt.Errorf(\"expected deployment %q not to be queued after pod deletion\", foo.Name)\n\t}\n}", "title": "" }, { "docid": "a8414ab40cca98bfaad60049c4d8f7ba", "score": "0.58263546", "text": "func waitPod(kubeconfig string, pod *v1.Pod) {\n\tclientset, _, err := getKubeClient(kubeconfig)\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot get clientset: %v\", err)\n\t}\n\n\tstop := newStopChan()\n\n\twatchlist := cache.NewListWatchFromClient(clientset.CoreV1().RESTClient(), \"pods\", pod.Namespace, fields.Everything())\n\t_, controller := cache.NewInformer(watchlist, &v1.Pod{}, time.Second*1, cache.ResourceEventHandlerFuncs{\n\t\tUpdateFunc: func(o, n interface{}) {\n\t\t\tnewPod := n.(*v1.Pod)\n\n\t\t\t// not the pod we created\n\t\t\tif newPod.Name != pod.Name {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// if the pod is running, stop watching and continue with the cmd execution\n\t\t\tif newPod.Status.Phase == v1.PodRunning {\n\t\t\t\tstop.closeOnce()\n\t\t\t\treturn\n\t\t\t}\n\t\t},\n\t})\n\n\tcontroller.Run(stop.c)\n}", "title": "" }, { "docid": "0168be3c02f80273a826fa741f16c703", "score": "0.581915", "text": "func TestPodDeletionEnqueuesRecreateDeployment(t *testing.T) {\n\tlogger, ctx := ktesting.NewTestContext(t)\n\n\tf := newFixture(t)\n\n\tfoo := newDeployment(\"foo\", 1, nil, nil, nil, map[string]string{\"foo\": \"bar\"})\n\tfoo.Spec.Strategy.Type = apps.RecreateDeploymentStrategyType\n\trs := newReplicaSet(foo, \"foo-1\", 1)\n\tpod := generatePodFromRS(rs)\n\n\tf.dLister = append(f.dLister, foo)\n\tf.rsLister = append(f.rsLister, rs)\n\tf.objects = append(f.objects, foo, rs)\n\n\tc, _, err := f.newController(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating Deployment controller: %v\", err)\n\t}\n\tenqueued := false\n\tc.enqueueDeployment = func(d *apps.Deployment) {\n\t\tif d.Name == \"foo\" {\n\t\t\tenqueued = true\n\t\t}\n\t}\n\n\tc.deletePod(logger, pod)\n\n\tif !enqueued {\n\t\tt.Errorf(\"expected deployment %q to be queued after pod deletion\", foo.Name)\n\t}\n}", "title": "" }, { "docid": "74388c54627808a1284ae973732cdc33", "score": "0.58150876", "text": "func (rcc *CassandraClusterReconciler) ForceDeletePod(pod *v1.Pod) error {\n\terr := rcc.Client.Delete(context.TODO(), pod, client.GracePeriodSeconds(0))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete Pod: %cc\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7acf50a72bf5d6d56593a37d03ecff35", "score": "0.5806981", "text": "func (p *CCIProvider) DeletePod(ctx context.Context, pod *v1.Pod) error {\n\t// Create the deletePod request url\n\tpodName := pod.Namespace + \"-\" + pod.Name\n\turi := p.apiEndpoint + \"/api/v1/namespaces/\" + p.project + \"/pods/\" + podName\n\t// build the request\n\tr, err := http.NewRequest(\"DELETE\", uri, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = p.signRequest(r); err != nil {\n\t\treturn fmt.Errorf(\"Sign the request failed: %v\", err)\n\t}\n\tresp, err := p.client.HTTPClient.Do(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn errorFromResponse(resp)\n}", "title": "" }, { "docid": "04ea54f282cdd8b0ce5862b3e630f6fb", "score": "0.57823586", "text": "func (deploymentClient *DeploymentClient) DeletePodWithLabel(targetLabels map[string]string){\n\tlog.Println(\"Deleting Pods ...\")\n\tpods,err:=deploymentClient.GetPodListWithLabels(targetLabels)\n\tif err != nil {\n\t\tlog.Println(\"Cannot delete pods\")\n\t\treturn\n\t}\n\tfor _, p := range pods {\n\t\tdeploymentClient.DeletePod(p.Name)\n\t}\n\tlog.Println(\"Deleted Pods.\")\n}", "title": "" }, { "docid": "2181caafd606f5411512ff2ce31490bd", "score": "0.5782263", "text": "func (p *PodmanV0Provider) DeletePod(ctx context.Context, pod *v1.Pod) (err error) {\n\tlog.G(ctx).Infof(\"receive DeletePod %s\", pod.Namespace, pod.Name)\n\treturn p.c.Delete(ctx, pod)\n}", "title": "" }, { "docid": "6683917a6ba4dc4f75b9a4dc5b171c09", "score": "0.5781802", "text": "func (client *Client) DeletePod(project, namespace, pod string) error {\n\treturn client.RestAPI.Delete(rest.Rq{\n\t\tURL: rest.URL{\n\t\t\tPath: podPath,\n\t\t\tParams: rest.P{\n\t\t\t\t\"pod\": pod,\n\t\t\t\t\"namespace\": namespace,\n\t\t\t\t\"project\": project,\n\t\t\t},\n\t\t},\n\t})\n}", "title": "" }, { "docid": "9a567b71c507624b8fed6f6acd0b2786", "score": "0.5776062", "text": "func CheckPodDeletion(EdgedEndPoint, UID string) {\n\tgomega.Eventually(func() bool {\n\t\tvar IsExist = false\n\t\tpods, _ := GetPods(EdgedEndPoint)\n\t\tif len(pods.Items) > 0 {\n\t\t\tfor index := range pods.Items {\n\t\t\t\tpod := &pods.Items[index]\n\t\t\t\tcommon.Infof(\"PodName: %s PodStatus: %s\", pod.Name, pod.Status.Phase)\n\t\t\t\tif pod.Name == UID {\n\t\t\t\t\tIsExist = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn IsExist\n\t}, \"30s\", \"4s\").Should(gomega.Equal(false), \"Delete Application deployment is Unsuccessful, Pod has not come to Running State\")\n}", "title": "" }, { "docid": "f23ad62f325b17d29704033cbe07ff8b", "score": "0.5773824", "text": "func (p *PodOption) DeletePod(namespace string, name string) error {\n\tpod := &corev1.Pod{}\n\tif err := p.client.Get(context.TODO(), types.NamespacedName{\n\t\tName: name,\n\t\tNamespace: namespace,\n\t}, pod); err != nil {\n\t\treturn err\n\t}\n\treturn p.client.Delete(context.TODO(), pod)\n}", "title": "" }, { "docid": "5b0f76317ed5c1318d822e2635abaef1", "score": "0.5768582", "text": "func cleanupCurlClientPod(f *framework.Framework, podname string) {\n\tframework.Logf(\"Cleaning up the http test client pod %s\", podname)\n\tif err := f.ClientSet.CoreV1().Pods(\"default\").Delete(podname, nil); err != nil {\n\t\tframework.Logf(\"unable to cleanup http test client pod %v: %v\", podname, err)\n\t}\n}", "title": "" }, { "docid": "4b050468bc232a629bcd09d642e80ea0", "score": "0.5736984", "text": "func (rcc *CassandraClusterReconciler) DeletePod(pod *v1.Pod) error {\n\terr := rcc.Client.Delete(context.TODO(), pod)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete Pod: %cc\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f64f808615e95db656442e622cb79bc1", "score": "0.57358855", "text": "func (k *Kubectl) Delete(namespace string, yamlFilePath string) error {\n\tcmd := exec.Command(\"kubectl\", \"--namespace\", namespace, \"delete\", \"-f\", yamlFilePath)\n\tvar stderr bytes.Buffer\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, stderr.String())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25dc7aeaea71f7c1da5e13d94c77012a", "score": "0.57021034", "text": "func ExampleClient_delete() {\n\t// Using a typed object.\n\tpod := &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: \"namespace\",\n\t\t\tName: \"name\",\n\t\t},\n\t}\n\t// c is a created client.\n\t_ = c.Delete(context.Background(), pod)\n\n\t// Using a unstructured object.\n\tu := &unstructured.Unstructured{}\n\tu.SetName(\"name\")\n\tu.SetNamespace(\"namespace\")\n\tu.SetGroupVersionKind(schema.GroupVersionKind{\n\t\tGroup: \"apps\",\n\t\tKind: \"Deployment\",\n\t\tVersion: \"v1\",\n\t})\n\t_ = c.Delete(context.Background(), u)\n}", "title": "" }, { "docid": "7d6514b7548355bbaaed2321a22c0f5f", "score": "0.56744695", "text": "func (p *Provisioner) createCleanupPod(pOpts *HelperPodOptions) (err error) {\n\t//func (p *Provisioner) createCleanupPod(cmdsForPath []string, name, path, node string) (err error) {\n\tif pOpts.name == \"\" || pOpts.path == \"\" || pOpts.nodeName == \"\" {\n\t\treturn fmt.Errorf(\"invalid empty name or path or node\")\n\t}\n\n\t// Initialize HostPath builder and validate that\n\t// non-root directories are not passed for delete\n\t// Extract the base path and the volume unique path.\n\tparentDir, volumeDir, vErr := hostpath.NewBuilder().WithPath(pOpts.path).\n\t\tWithCheckf(hostpath.IsNonRoot(), \"path should not be a root directory: path %v\", pOpts.path).\n\t\tExtractSubPath()\n\tif vErr != nil {\n\t\treturn vErr\n\t}\n\n\tconObj, _ := mContainer.Builder().\n\t\tWithName(\"local-path-cleanup\").\n\t\tWithImage(p.helperImage).\n\t\tWithCommand(append(pOpts.cmdsForPath, filepath.Join(\"/data/\", volumeDir))).\n\t\tWithVolumeMounts([]v1.VolumeMount{\n\t\t\t{\n\t\t\t\tName: \"data\",\n\t\t\t\tReadOnly: false,\n\t\t\t\tMountPath: \"/data/\",\n\t\t\t},\n\t\t}).\n\t\tBuild()\n\tcontainers := []v1.Container{conObj}\n\n\tvolObj, _ := mVolume.NewBuilder().\n\t\tWithName(\"data\").\n\t\tWithHostDirectory(parentDir).\n\t\tBuild()\n\tvolumes := []v1.Volume{*volObj}\n\n\thelperPod, _ := mPod.NewBuilder().\n\t\tWithName(\"cleanup-\" + pOpts.name).\n\t\tWithRestartPolicy(v1.RestartPolicyNever).\n\t\tWithNodeName(pOpts.nodeName).\n\t\tWithContainers(containers).\n\t\tWithVolumes(volumes).\n\t\tBuild()\n\n\t//Launch the cleanup pod.\n\tpod, err := p.kubeClient.CoreV1().Pods(p.namespace).Create(helperPod)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\te := p.kubeClient.CoreV1().Pods(p.namespace).Delete(pod.Name, &metav1.DeleteOptions{})\n\t\tif e != nil {\n\t\t\tglog.Errorf(\"unable to delete the helper pod: %v\", e)\n\t\t}\n\t}()\n\n\t//Wait for the cleanup pod to complete it job and exit\n\tcompleted := false\n\tfor i := 0; i < CmdTimeoutCounts; i++ {\n\t\tif pod, err := p.kubeClient.CoreV1().Pods(p.namespace).Get(pod.Name, metav1.GetOptions{}); err != nil {\n\t\t\treturn err\n\t\t} else if pod.Status.Phase == v1.PodSucceeded {\n\t\t\tcompleted = true\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\tif !completed {\n\t\treturn fmt.Errorf(\"create process timeout after %v seconds\", CmdTimeoutCounts)\n\t}\n\n\tglog.Infof(\"Volume %v has been cleaned on %v:%v\", pOpts.name, pOpts.nodeName, pOpts.path)\n\treturn nil\n}", "title": "" }, { "docid": "f1bf658dbef6dc087bbbd0d671566c8a", "score": "0.567381", "text": "func (m *MockDockerClient) DelPod(podID pod.ID) {\n\tpodContainer, exists := m.podByID[podID]\n\tif exists {\n\t\tdelete(m.podByID, podID)\n\t\tdelete(m.podByContainer, podContainer.containerID)\n\t}\n}", "title": "" }, { "docid": "d3f7828e653eedf574605b01e60afe51", "score": "0.5654365", "text": "func TestHandle_orphanedPod(t *testing.T) {\n\tdeleted := kutil.NewStringSet()\n\tcontroller := &DeployerPodController{\n\t\tdeploymentClient: &deploymentClientImpl{\n\t\t\tupdateDeploymentFunc: func(namespace string, deployment *kapi.ReplicationController) (*kapi.ReplicationController, error) {\n\t\t\t\tt.Fatalf(\"Unexpected deployment update\")\n\t\t\t\treturn nil, nil\n\t\t\t},\n\t\t\tgetDeploymentFunc: func(namespace, name string) (*kapi.ReplicationController, error) {\n\t\t\t\treturn nil, kerrors.NewNotFound(\"ReplicationController\", name)\n\t\t\t},\n\t\t},\n\t\tdeployerPodsFor: func(namespace, name string) (*kapi.PodList, error) {\n\t\t\tmkpod := func(suffix string) kapi.Pod {\n\t\t\t\tdeployment, _ := deployutil.MakeDeployment(deploytest.OkDeploymentConfig(1), kapi.Codec)\n\t\t\t\tp := okPod(deployment)\n\t\t\t\tp.Name = p.Name + suffix\n\t\t\t\treturn *p\n\t\t\t}\n\t\t\treturn &kapi.PodList{\n\t\t\t\tItems: []kapi.Pod{\n\t\t\t\t\tmkpod(\"\"),\n\t\t\t\t\tmkpod(\"-prehook\"),\n\t\t\t\t\tmkpod(\"-posthook\"),\n\t\t\t\t},\n\t\t\t}, nil\n\t\t},\n\t\tdeletePod: func(namespace, name string) error {\n\t\t\tdeleted.Insert(name)\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tdeployment, _ := deployutil.MakeDeployment(deploytest.OkDeploymentConfig(1), kapi.Codec)\n\terr := controller.Handle(runningPod(deployment))\n\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\n\tdeployerName := deployutil.DeployerPodNameForDeployment(deployment.Name)\n\tif !deleted.HasAll(deployerName, deployerName+\"-prehook\", deployerName+\"-posthook\") {\n\t\tt.Fatalf(\"unexpected deleted names: %v\", deleted.List())\n\t}\n}", "title": "" }, { "docid": "3bea84472f264c821ca0dbb4b46acb98", "score": "0.5636198", "text": "func (c *KubernetesPod) Stop() (err error) {\n\tlog.Infof(\"deleting the pod: %v\", c.name)\n\treturn deletePod(c.clientset, c.namespace, c.name)\n}", "title": "" }, { "docid": "315cc2cf4b2ee2cc3efdc7f918dfb76f", "score": "0.56294864", "text": "func runDelete(cmd *cobra.Command, args []string) {\n\tif len(args) > 0 {\n\t\texit.UsageT(\"usage: minikube delete\")\n\t}\n\tprofile := viper.GetString(pkg_config.MachineProfile)\n\tapi, err := machine.NewAPIClient()\n\tif err != nil {\n\t\texit.WithError(\"Error getting client\", err)\n\t}\n\tdefer api.Close()\n\n\tcc, err := pkg_config.Load()\n\tif err != nil && !os.IsNotExist(err) {\n\t\tout.ErrT(out.Sad, \"Error loading profile config: {{.error}}\", out.V{\"name\": profile})\n\t}\n\n\t// In the case of \"none\", we want to uninstall Kubernetes as there is no VM to delete\n\tif err == nil && cc.MachineConfig.VMDriver == constants.DriverNone {\n\t\tuninstallKubernetes(api, cc.KubernetesConfig, viper.GetString(cmdcfg.Bootstrapper))\n\t}\n\n\tif err = cluster.DeleteHost(api); err != nil {\n\t\tswitch err := errors.Cause(err).(type) {\n\t\tcase mcnerror.ErrHostDoesNotExist:\n\t\t\tout.T(out.Meh, `\"{{.name}}\" cluster does not exist`, out.V{\"name\": profile})\n\t\tdefault:\n\t\t\texit.WithError(\"Failed to delete cluster\", err)\n\t\t}\n\t}\n\n\tif err := cmdUtil.KillMountProcess(); err != nil {\n\t\tout.FatalT(\"Failed to kill mount process: {{.error}}\", out.V{\"error\": err})\n\t}\n\n\tif err := os.RemoveAll(constants.GetProfilePath(viper.GetString(pkg_config.MachineProfile))); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tout.T(out.Meh, `\"{{.profile_name}}\" profile does not exist`, out.V{\"profile_name\": profile})\n\t\t\tos.Exit(0)\n\t\t}\n\t\texit.WithError(\"Failed to remove profile\", err)\n\t}\n\tout.T(out.Crushed, `The \"{{.cluster_name}}\" cluster has been deleted.`, out.V{\"cluster_name\": profile})\n\n\tmachineName := pkg_config.GetMachineName()\n\tif err := pkgutil.DeleteKubeConfigContext(constants.KubeconfigPath, machineName); err != nil {\n\t\texit.WithError(\"update config\", err)\n\t}\n}", "title": "" }, { "docid": "4492fbe14c3aa1949d8fc26a3ced106b", "score": "0.5627357", "text": "func waitForPod(client kubernetes.Interface, name string) (*v1.Pod, error) {\n\tvar resultPod *v1.Pod\n\tvar err error\n\tstopCh := make(chan struct{})\n\n\tgo func() {\n\t\tselect {\n\t\tcase <-time.After(time.Minute * 5):\n\t\t\terr = errors.New(\"timing out waiting for pod state\")\n\t\t\tclose(stopCh)\n\t\tcase <-stopCh:\n\t\t}\n\t}()\n\n\twatchlist := cache.NewListWatchFromClient(client.CoreV1().RESTClient(),\n\t\t\"pods\", namespace, fields.Everything())\n\t_, controller := cache.NewInformer(watchlist, &v1.Pod{}, time.Second*1,\n\t\tcache.ResourceEventHandlerFuncs{\n\t\t\tUpdateFunc: func(o, n interface{}) {\n\t\t\t\tpod := n.(*v1.Pod)\n\t\t\t\tif name != pod.Name {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif pod.Status.Phase == v1.PodFailed || pod.Status.Phase == v1.PodSucceeded {\n\t\t\t\t\terr = errors.New(\"pod status is Failed or in Succeeded status (terminated)\")\n\t\t\t\t\tclose(stopCh)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif pod.Status.Phase == v1.PodRunning {\n\t\t\t\t\tresultPod = pod\n\t\t\t\t\tclose(stopCh)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\n\tcontroller.Run(stopCh)\n\treturn resultPod, err\n}", "title": "" }, { "docid": "4543854ad4a3c71cbbd62a9fbc207708", "score": "0.5621995", "text": "func DeletePod(ns string, podName string) error {\n\t_, err := exec.Command(\"kubectl\", \"delete\", \"pod\", \"-n\", ns, podName).Output()\n\tif err != nil {\n\t\tlogf.Log.Error(err, \"Failed to delete operator pod \", \"PodName\", podName, \"Namespace\", ns)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b58c3d8f7fc88ec33d25f1850805e60", "score": "0.56202173", "text": "func (invoker *CNSIPAMInvoker) Delete(address *net.IPNet, nwCfg *cni.NetworkConfig, options map[string]interface{}) error {\r\n\r\n\t// Parse Pod arguments.\r\n\tpodInfo := cns.KubernetesPodInfo{PodName: invoker.podName, PodNamespace: invoker.podNamespace}\r\n\r\n\torchestratorContext, err := json.Marshal(podInfo)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn invoker.cnsClient.ReleaseIPAddress(orchestratorContext)\r\n}", "title": "" }, { "docid": "3048e85a06b80c71ab0040c32096e6ad", "score": "0.56064117", "text": "func (gr *podRestarter) restart(pod *core.Pod) error {\n\tpreconditions := meta.Preconditions{UID: &pod.UID}\n\tdeleteOptions := meta.DeleteOptions{Preconditions: &preconditions}\n\terr := gr.kubeCli.CoreV1().Pods(pod.Namespace).Delete(pod.Name, &deleteOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bb281e24367ae89e4de6b6c2ac316439", "score": "0.5604927", "text": "func (invoker *CNSIPAMInvoker) Delete(address net.IPNet, nwCfg *cni.NetworkConfig, options map[string]interface{}) error {\r\n\r\n\t// Parse Pod arguments.\r\n\tpodInfo := cns.KubernetesPodInfo{PodName: invoker.podName, PodNamespace: invoker.podNamespace}\r\n\r\n\torchestratorContext, err := json.Marshal(podInfo)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn invoker.cnsClient.ReleaseIPAddress(orchestratorContext)\r\n}", "title": "" }, { "docid": "a762256529e010f23b0f27d144f6b1be", "score": "0.56000453", "text": "func (rc *realModel) deletePodContainer(namespace, podName, containerName string) {\n\trc.lock.Lock()\n\tdefer rc.lock.Unlock()\n\n\t// Delete pod container from the belonging pod in the target namespace\n\tif namespaceInfo, ok := rc.Namespaces[namespace]; ok {\n\t\tif podInfo, ok := namespaceInfo.Pods[podName]; ok {\n\t\t\tdelete(podInfo.Containers, containerName)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "265133e886b7248990b68ec341680233", "score": "0.5593574", "text": "func (ctrl *ElasticQuotaController) podDeleted(obj interface{}) {\n\t_, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n\tif err != nil {\n\t\truntime.HandleError(err)\n\t\treturn\n\t}\n\tctrl.podAdded(obj)\n}", "title": "" }, { "docid": "c4aaff78981217d219d4b75481dc5c89", "score": "0.55924964", "text": "func PurgePod(kubeClient kubernetes.Interface, namespace string, podName string, gracePeriodSeconds int64, propagationPolicy metav1.DeletionPropagation) error {\n\tlogf(Verbose, \"Deleting pod %s in namespace %s\", podName, namespace)\n\treturn kubeClient.CoreV1().Pods(namespace).Delete(\n\t\tcontext.TODO(),\n\t\tpodName,\n\t\tmetav1.DeleteOptions{\n\t\t\tGracePeriodSeconds: &gracePeriodSeconds,\n\t\t\tPropagationPolicy: &propagationPolicy,\n\t\t})\n}", "title": "" }, { "docid": "934083f8990518e7d2a13d7bec7de685", "score": "0.55918676", "text": "func (p *BrowserProvider) DeletePod(ctx context.Context, pod *v1.Pod) error {\n\tctx, span := trace.StartSpan(ctx, \"browser.DeletePod\")\n\tdefer span.End()\n\tlog.G(ctx).Infof(\"Deleting pod %v\", pod.Name)\n\n\tdelete(p.pods, getPodName(pod))\n\n\treturn nil\n}", "title": "" }, { "docid": "8c99bdbf05c149dee4101b899ecca6aa", "score": "0.5581191", "text": "func (p *Provisioner) createCleanupPod(pOpts *HelperPodOptions) error {\n\t//err := pOpts.validate()\n\tif err := pOpts.validate(); err != nil {\n\t\treturn err\n\t}\n\n\t// Initialize HostPath builder and validate that\n\t// volume directory is not directly under root.\n\t// Extract the base path and the volume unique path.\n\tparentDir, volumeDir, vErr := hostpath.NewBuilder().WithPath(pOpts.path).\n\t\tWithCheckf(hostpath.IsNonRoot(), \"volume directory {%v} should not be under root directory\", pOpts.path).\n\t\tExtractSubPath()\n\tif vErr != nil {\n\t\treturn vErr\n\t}\n\n\tconObj, _ := container.NewBuilder().\n\t\tWithName(\"local-path-cleanup\").\n\t\tWithImage(p.helperImage).\n\t\tWithCommand(append(pOpts.cmdsForPath, filepath.Join(\"/data/\", volumeDir))).\n\t\tWithVolumeMounts([]corev1.VolumeMount{\n\t\t\t{\n\t\t\t\tName: \"data\",\n\t\t\t\tReadOnly: false,\n\t\t\t\tMountPath: \"/data/\",\n\t\t\t},\n\t\t}).\n\t\tBuild()\n\t//containers := []v1.Container{conObj}\n\n\tvolObj, _ := volume.NewBuilder().\n\t\tWithName(\"data\").\n\t\tWithHostDirectory(parentDir).\n\t\tBuild()\n\t//volumes := []v1.Volume{*volObj}\n\n\thelperPod, _ := pod.NewBuilder().\n\t\tWithName(\"cleanup-\" + pOpts.name).\n\t\tWithRestartPolicy(corev1.RestartPolicyNever).\n\t\tWithNodeName(pOpts.nodeName).\n\t\tWithContainer(conObj).\n\t\tWithVolume(*volObj).\n\t\tBuild()\n\n\t//Launch the cleanup pod.\n\thPod, err := p.kubeClient.CoreV1().Pods(p.namespace).Create(helperPod)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\te := p.kubeClient.CoreV1().Pods(p.namespace).Delete(hPod.Name, &metav1.DeleteOptions{})\n\t\tif e != nil {\n\t\t\tglog.Errorf(\"unable to delete the helper pod: %v\", e)\n\t\t}\n\t}()\n\n\t//Wait for the cleanup pod to complete it job and exit\n\tcompleted := false\n\tfor i := 0; i < CmdTimeoutCounts; i++ {\n\t\tcheckPod, err := p.kubeClient.CoreV1().Pods(p.namespace).Get(hPod.Name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else if checkPod.Status.Phase == corev1.PodSucceeded {\n\t\t\tcompleted = true\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\tif !completed {\n\t\treturn errors.Errorf(\"create process timeout after %v seconds\", CmdTimeoutCounts)\n\t}\n\n\tglog.Infof(\"Volume %v has been cleaned on %v:%v\", pOpts.name, pOpts.nodeName, pOpts.path)\n\treturn nil\n}", "title": "" }, { "docid": "138d1a613c7ff7ac984d3de23281dfb0", "score": "0.55765927", "text": "func (k *Kubectl) Delete(namespace string, yamlFilePath string) error {\n\tcmd := exec.Command(\"kubectl\", \"--namespace\", namespace, \"delete\", \"-f\", yamlFilePath)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, string(out))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e96b097701e51724924c4a0169e5ca4", "score": "0.5565953", "text": "func (k *KubeClient) DeletePod(podName string) error {\n\tvar oneSecond int64 = 1\n\treturn k.Clientset.Pods(k.namespace).Delete(podName, &metav1.DeleteOptions{GracePeriodSeconds: &oneSecond})\n}", "title": "" }, { "docid": "ccd2e745f18b4510a6dffec1192b29cc", "score": "0.55645096", "text": "func (ext *Checker) waitForDeletedEvent(eventsIn <-chan watch.Event, sawRemovalChan chan struct{}, stoppedChan chan struct{}) {\n\n\text.wg.Add(1)\n\tdefer ext.wg.Done()\n\n\t// restart the watcher repeatedly forever until we are told to shutdown\n\text.log(\"starting pod shutdown watcher\")\n\n\t// watch events for a removal\n\tfor e := range eventsIn {\n\t\text.log(\"got a result when watching for pod to remove\")\n\t\tswitch e.Type {\n\t\tcase watch.Modified: // this section is entirely informational\n\t\t\text.log(\"checker pod shutdown monitor saw a modified event.\")\n\t\t\tp, ok := e.Object.(*apiv1.Pod)\n\t\t\tif !ok {\n\t\t\t\text.log(\"checker pod shutdown monitor saw a modified event and the object was not a pod. skipped.\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\text.log(\"checker pod shutdown monitor saw a modified event. the pod changed to \", p.Status.Phase)\n\t\t\treturn\n\t\tcase watch.Deleted:\n\t\t\text.log(\"checker pod shutdown monitor saw a deleted event. notifying that pod has shutdown\")\n\t\t\tsawRemovalChan <- struct{}{}\n\t\t\treturn\n\t\tcase watch.Error:\n\t\t\text.log(\"khcheck monitor saw an error event\")\n\t\t\te, ok := e.Object.(*metav1.Status)\n\t\t\tif ok {\n\t\t\t\text.log(\"pod removal monitor had an error when watching for pod changes:\", e.Reason)\n\t\t\t}\n\t\tdefault:\n\t\t\text.log(\"pod removal monitor saw an irrelevant event type and ignored it:\", e.Type)\n\t\t}\n\t}\n\n\t// if the watch ends for any reason, we notify the listeners that our watch has ended\n\text.log(\"pod removal monitor ended unexpectedly\")\n\tstoppedChan <- struct{}{}\n\n}", "title": "" }, { "docid": "9a7dbb36c5865a7f84e541d44bab14cb", "score": "0.55333304", "text": "func runDelete(_ *cobra.Command, args []string) {\n\tif len(args) > 0 {\n\t\texit.Message(reason.Usage, \"Usage: minikube delete\")\n\t}\n\tout.SetJSON(outputFormat == \"json\")\n\tregister.Reg.SetStep(register.Deleting)\n\tdownload.CleanUpOlderPreloads()\n\tvalidProfiles, invalidProfiles, err := config.ListProfiles()\n\tif err != nil {\n\t\tklog.Warningf(\"'error loading profiles in minikube home %q: %v\", localpath.MiniPath(), err)\n\t}\n\tprofilesToDelete := validProfiles\n\tprofilesToDelete = append(profilesToDelete, invalidProfiles...)\n\t// in the case user has more than 1 profile and runs --purge\n\t// to prevent abandoned VMs/containers, force user to run with delete --all\n\tif purge && len(profilesToDelete) > 1 && !deleteAll {\n\t\tout.ErrT(style.Notice, \"Multiple minikube profiles were found - \")\n\t\tfor _, p := range profilesToDelete {\n\t\t\tout.Styled(style.Notice, \" - {{.profile}}\", out.V{\"profile\": p.Name})\n\t\t}\n\t\texit.Message(reason.Usage, \"Usage: minikube delete --all --purge\")\n\t}\n\tdelCtx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\n\tdefer cancel()\n\n\tif deleteAll {\n\t\tdeleteContainersAndVolumes(delCtx, oci.Docker)\n\t\tdeleteContainersAndVolumes(delCtx, oci.Podman)\n\n\t\terrs := DeleteProfiles(profilesToDelete)\n\t\tregister.Reg.SetStep(register.Done)\n\n\t\tif len(errs) > 0 {\n\t\t\tHandleDeletionErrors(errs)\n\t\t} else {\n\t\t\tout.Step(style.DeletingHost, \"Successfully deleted all profiles\")\n\t\t}\n\t} else {\n\t\tif len(args) > 0 {\n\t\t\texit.Message(reason.Usage, \"usage: minikube delete\")\n\t\t}\n\n\t\tcname := ClusterFlagValue()\n\t\tprofile, err := config.LoadProfile(cname)\n\t\torphan := false\n\n\t\tif err != nil {\n\t\t\tout.ErrT(style.Meh, `\"{{.name}}\" profile does not exist, trying anyways.`, out.V{\"name\": cname})\n\t\t\torphan = true\n\t\t}\n\n\t\terrs := DeleteProfiles([]*config.Profile{profile})\n\t\tregister.Reg.SetStep(register.Done)\n\n\t\tif len(errs) > 0 {\n\t\t\tHandleDeletionErrors(errs)\n\t\t}\n\n\t\tif orphan {\n\t\t\tdelete.PossibleLeftOvers(delCtx, cname, driver.Docker)\n\t\t\tdelete.PossibleLeftOvers(delCtx, cname, driver.Podman)\n\t\t}\n\t}\n\n\t// If the purge flag is set, go ahead and delete the .minikube directory.\n\tif purge {\n\t\tpurgeMinikubeDirectory()\n\n\t\tdockerImageNames, err := kicbaseImages(delCtx, oci.Docker)\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"error fetching docker images: %v\", err)\n\t\t}\n\t\tpodmanImageNames, err := kicbaseImages(delCtx, oci.Podman)\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"error fetching podman images: %v\", err)\n\t\t}\n\t\tprintDeleteImageInfo(dockerImageNames, podmanImageNames)\n\t}\n}", "title": "" }, { "docid": "2536bbce009370d4cd33d57d5c11e950", "score": "0.55192083", "text": "func DeletePods(clientset *kubernetes.Clientset) {\n\tfor x, _ := range podMap {\n\t\tfmt.Println(\"Deleting pod\", x)\n\t\tclientset.CoreV1().Pods(\"default\").Delete(x, &v1.DeleteOptions{})\n\t}\n\n}", "title": "" }, { "docid": "bcaf052daeb783cfd77933283c8165f3", "score": "0.54873824", "text": "func (r *Reconciler) EvictPod(namespace, name string) error {\n\tif err := r.ipCheck(); err != nil {\n\t\t// ignore, non-fatal\n\t\tglog.Errorf(\"Error running pre-eviction IP pool check [%+v]\", err)\n\t}\n\tglog.Infof(\"Deleting pod %s/%s\", namespace, name)\n\t// TODO - is just killing the pods the best path forward?\n\terr := r.clientset.CoreV1().Pods(namespace).Delete(name, &meta_v1.DeleteOptions{})\n\tif err != nil && !api_errors.IsNotFound(err) {\n\t\treturn errors.Wrapf(err, \"Error deleting pod %q from namespace %q\", name, namespace)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f1a4b4837e4293a1c04fc0590ec8aed3", "score": "0.5483113", "text": "func handleKeycloakPodDeletion(dc *oappsv1.DeploymentConfig) error {\n\tcfg, err := config.GetConfig()\n\tif err != nil {\n\t\tlog.Error(err, \"unable to get k8s config\")\n\t\treturn err\n\t}\n\n\t// Initialize deployment config client.\n\tdcClient, err := oappsv1client.NewForConfig(cfg)\n\tif err != nil {\n\t\tlog.Error(err, fmt.Sprintf(\"unable to create apps client for Deployment config %s in namespace %s\",\n\t\t\tdc.Name, dc.Namespace))\n\t\treturn err\n\t}\n\n\tlog.Info(\"Set the Realm Creation status annoation to false\")\n\texistingDC, err := dcClient.DeploymentConfigs(dc.Namespace).Get(context.TODO(), defaultKeycloakIdentifier, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texistingDC.Annotations[\"argocd.argoproj.io/realm-created\"] = \"false\"\n\t_, err = dcClient.DeploymentConfigs(dc.Namespace).Update(context.TODO(), existingDC, metav1.UpdateOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "247d3d9174e1e42ef40a427b1b870656", "score": "0.5412236", "text": "func waitForPodRunning(ctx context.Context, namespace, podName string, clientset *kubernetes.Clientset) (*corev1.Pod, error) {\n\tfor {\n\t\tpod, err := clientset.CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{})\n\t\tpodReady := true\n\t\tif err == nil {\n\t\t\tfor _, condition := range pod.Status.Conditions {\n\t\t\t\tif condition.Status == corev1.ConditionFalse {\n\t\t\t\t\tpodReady = false\n\t\t\t\t}\n\t\t\t}\n\t\t\tif podReady == true {\n\t\t\t\treturn pod, nil\n\t\t\t}\n\t\t}\n\t\tif err != nil && k8serrors.IsNotFound(err) {\n\t\t\tlog.Infof(\"Pod %s not found in %s namespace, maybe was part of the old replicaset, since we updated the deployment/statefullsets, moving on\", podName, namespace)\n\t\t\treturn &corev1.Pod{}, nil\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, errors.Wrap(ctx.Err(), \"timed out waiting for pod to become ready\")\n\t\tcase <-time.After(5 * time.Second):\n\t\t}\n\t}\n}", "title": "" }, { "docid": "37041a51786798f21ba873b319f9dd38", "score": "0.53829664", "text": "func (s *SQLiteState) RemovePod(pod *Pod) (defErr error) {\n\tif !s.valid {\n\t\treturn define.ErrDBClosed\n\t}\n\n\tif !pod.valid {\n\t\treturn define.ErrPodRemoved\n\t}\n\n\ttx, err := s.conn.Begin()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"beginning pod %s removal transaction: %w\", pod.ID(), err)\n\t}\n\tdefer func() {\n\t\tif defErr != nil {\n\t\t\tif err := tx.Rollback(); err != nil {\n\t\t\t\tlogrus.Errorf(\"Rolling back transaction to remove pod %s: %v\", pod.ID(), err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tvar check int\n\trow := tx.QueryRow(\"SELECT 1 FROM ContainerConfig WHERE PodID=? AND ID!=?;\", pod.ID(), pod.state.InfraContainerID)\n\tif err := row.Scan(&check); err != nil {\n\t\tif !errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn fmt.Errorf(\"checking if pod %s has containers in database: %w\", pod.ID(), err)\n\t\t}\n\t} else if check != 0 {\n\t\treturn fmt.Errorf(\"pod %s is not empty: %w\", pod.ID(), define.ErrCtrExists)\n\t}\n\n\tcheckResult := func(result sql.Result) error {\n\t\trows, err := result.RowsAffected()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"retrieving pod %s delete rows affected: %w\", pod.ID(), err)\n\t\t}\n\t\tif rows == 0 {\n\t\t\tpod.valid = false\n\t\t\treturn define.ErrNoSuchPod\n\t\t}\n\t\treturn nil\n\t}\n\n\tresult, err := tx.Exec(\"DELETE FROM IDNamespace WHERE ID=?;\", pod.ID())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"removing pod %s id from database: %w\", pod.ID(), err)\n\t}\n\tif err := checkResult(result); err != nil {\n\t\treturn err\n\t}\n\n\tresult, err = tx.Exec(\"DELETE FROM PodConfig WHERE ID=?;\", pod.ID())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"removing pod %s config from database: %w\", pod.ID(), err)\n\t}\n\tif err := checkResult(result); err != nil {\n\t\treturn err\n\t}\n\n\tresult, err = tx.Exec(\"DELETE FROM PodState WHERE ID=?;\", pod.ID())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"removing pod %s state from database: %w\", pod.ID(), err)\n\t}\n\tif err := checkResult(result); err != nil {\n\t\treturn err\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\treturn fmt.Errorf(\"committing pod %s removal transaction: %w\", pod.ID(), err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e0712e0c2ee5204fb4ae09a807221f17", "score": "0.5378342", "text": "func Delete(name, templateOutputPath string) error {\n\tcmd := exec.Command(\"kubectl\", \"delete\", \"-f\", path.Join(templateOutputPath, name+\"-deployment.yaml\"), \"--now\", \"--ignore-not-found\")\n\tutil.PrintCommand(cmd)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed to delete %v from the Kubernetes cluster: %s\", name, out)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "340586dc3d58151e8eea47d6b7ad7caa", "score": "0.5375721", "text": "func (service *Service) WaitForDelete(timeout time.Duration) error {\n\tcond := conditions{\n\t\tprogress: \"delete in progress\",\n\t\tcompleted: \"delete succeeded\",\n\t}\n\treturn service.waitForCondition(cond, timeout)\n}", "title": "" }, { "docid": "32846a7deeb848c90df82c0f755c2c1a", "score": "0.5369413", "text": "func (v *VicPodDeleter) DeletePod(op trace.Operation, pod *v1.Pod) error {\n\tif pod == nil {\n\t\treturn PodDeleterInvalidPodSpecError\n\t}\n\tdefer trace.End(trace.Begin(pod.Name, op))\n\n\t// Get pod from cache\n\tvp, err := v.podCache.Get(op, \"\", pod.Name)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Stop pod if not already stopped\n\n\t// Transform kube container config to docker create config\n\terr = v.deletePod(op, vp, true)\n\tif err != nil {\n\t\top.Errorf(\"PodDeleter failed to delete pod: %s\", err.Error())\n\t\treturn err\n\t}\n\n\top.Infof(\"PodDeleter deleting from cache, name: %s, ID: %s\", pod.Name, vp.ID)\n\tv.podCache.Delete(op, \"\", pod.Name)\n\n\treturn nil\n}", "title": "" }, { "docid": "23488a40e665342dcad020789d277cce", "score": "0.5367099", "text": "func (oc *Controller) handlePeerPodSelectorDelete(gp *gressPolicy, obj interface{}) {\n\tpod := obj.(*kapi.Pod)\n\tif err := gp.deletePeerPod(pod); err != nil {\n\t\tklog.Errorf(err.Error())\n\t}\n}", "title": "" }, { "docid": "a87ce7cacbfe297ebe35189fed4a2a99", "score": "0.53639394", "text": "func PodKill(client *kubernetes.Clientset, podName string, namespace string, gracePeriod int64) error {\n\t// TODO: refactor function to receive context on exported function in next breaking change.\n\tctx := context.TODO()\n\n\t// Setup a pod watching client for our current KH pod\n\tpodClient := client.CoreV1().Pods(namespace)\n\n\t// Check for and return any errors, otherwise pod was killed successfully\n\terr := podClient.Delete(ctx, podName, metav1.DeleteOptions{GracePeriodSeconds: &gracePeriod})\n\tif err != nil && (k8sErrors.IsNotFound(err) || strings.Contains(err.Error(), \"not found\")) {\n\t\tlog.Warnln(\"Pod\", podName, \"not found not found in namespace\", namespace+\":\", err.Error())\n\t\treturn err\n\t}\n\tlog.Infoln(\"Pod\", podName, \"was killed successfully.\")\n\treturn nil\n}", "title": "" }, { "docid": "90775915ef4075ef2c5965d34e960295", "score": "0.53610843", "text": "func testPDPod(diskNames []string, targetNode types.NodeName, readOnly bool, numContainers int) *v1.Pod {\n\t// escape if not a supported provider\n\tif !(framework.TestContext.Provider == \"gce\" || framework.TestContext.Provider == \"gke\" ||\n\t\tframework.TestContext.Provider == \"aws\") {\n\t\tframework.Failf(fmt.Sprintf(\"func `testPDPod` only supports gce, gke, and aws providers, not %v\", framework.TestContext.Provider))\n\t}\n\n\tcontainers := make([]v1.Container, numContainers)\n\tfor i := range containers {\n\t\tcontainers[i].Name = \"mycontainer\"\n\t\tif numContainers > 1 {\n\t\t\tcontainers[i].Name = fmt.Sprintf(\"mycontainer%v\", i+1)\n\t\t}\n\t\tcontainers[i].Image = e2epod.GetTestImage(imageutils.BusyBox)\n\t\tcontainers[i].Command = []string{\"sleep\", \"6000\"}\n\t\tcontainers[i].VolumeMounts = make([]v1.VolumeMount, len(diskNames))\n\t\tfor k := range diskNames {\n\t\t\tcontainers[i].VolumeMounts[k].Name = fmt.Sprintf(\"testpd%v\", k+1)\n\t\t\tcontainers[i].VolumeMounts[k].MountPath = fmt.Sprintf(\"/testpd%v\", k+1)\n\t\t}\n\t\tcontainers[i].Resources.Limits = v1.ResourceList{}\n\t\tcontainers[i].Resources.Limits[v1.ResourceCPU] = *resource.NewQuantity(int64(0), resource.DecimalSI)\n\t}\n\n\tpod := &v1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"pd-test-\" + string(uuid.NewUUID()),\n\t\t},\n\t\tSpec: v1.PodSpec{\n\t\t\tContainers: containers,\n\t\t\tNodeName: string(targetNode),\n\t\t},\n\t}\n\n\tpod.Spec.Volumes = make([]v1.Volume, len(diskNames))\n\tfor k, diskName := range diskNames {\n\t\tpod.Spec.Volumes[k].Name = fmt.Sprintf(\"testpd%v\", k+1)\n\t\tif framework.TestContext.Provider == \"aws\" {\n\t\t\tpod.Spec.Volumes[k].VolumeSource = v1.VolumeSource{\n\t\t\t\tAWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{\n\t\t\t\t\tVolumeID: diskName,\n\t\t\t\t\tFSType: \"ext4\",\n\t\t\t\t\tReadOnly: readOnly,\n\t\t\t\t},\n\t\t\t}\n\t\t} else { // \"gce\" or \"gke\"\n\t\t\tpod.Spec.Volumes[k].VolumeSource = v1.VolumeSource{\n\t\t\t\tGCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{\n\t\t\t\t\tPDName: diskName,\n\t\t\t\t\tFSType: e2epv.GetDefaultFSType(),\n\t\t\t\t\tReadOnly: readOnly,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\treturn pod\n}", "title": "" }, { "docid": "335e55c79c25f14794c8a0251c6d7466", "score": "0.53582877", "text": "func (_m *Operator) DeletePod(namespace string, name string) error {\n\tret := _m.Called(namespace, name)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, string) error); ok {\n\t\tr0 = rf(namespace, name)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "2842c68d26777ffa70e18baecafbcc47", "score": "0.53569657", "text": "func (k Epinio) Delete(ctx context.Context, c *kubernetes.Cluster, ui *termui.UI) error {\n\tui.Note().KeeplineUnder(1).Msg(\"Removing Epinio...\")\n\n\texistsAndOwned, err := c.NamespaceExistsAndOwned(ctx, EpinioDeploymentID)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to check if namespace '%s' is owned or not\", EpinioDeploymentID)\n\t}\n\tif !existsAndOwned {\n\t\tui.Exclamation().Msg(\"Skipping Epinio because namespace either doesn't exist or not owned by Epinio\")\n\t\treturn nil\n\t}\n\n\t// We are taking a shortcut here. When we applied the file we had to replace\n\t// ##current_epinio_version## with the correct version. No need to do any parsing when\n\t// deleting though.\n\tif out, err := helpers.KubectlDeleteEmbeddedYaml(epinioServerYaml, true); err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"Deleting %s failed:\\n%s\", epinioServerYaml, out))\n\t}\n\n\tif out, err := helpers.KubectlDeleteEmbeddedYaml(epinioRolesYAML, true); err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"Deleting %s failed:\\n%s\", epinioRolesYAML, out))\n\t}\n\n\t// (yyy) Note: We ignore deletion errors due to a mising\n\t// Middleware CRD. That indicates that a traefik v1 controller\n\t// was used, and the object was not applied. See also (xxx).\n\n\tif out, err := helpers.KubectlDeleteEmbeddedYaml(epinioBasicAuthYaml, true); err != nil {\n\t\tif !strings.Contains(out, `no matches for kind \"Middleware\"`) {\n\t\t\treturn errors.Wrap(err, fmt.Sprintf(\"Deleting %s failed:\\n%s\", epinioServerYaml, out))\n\t\t}\n\t}\n\n\tmessage := \"Deleting Epinio namespace \" + EpinioDeploymentID\n\t_, err = helpers.WaitForCommandCompletion(ui, message,\n\t\tfunc() (string, error) {\n\t\t\treturn \"\", c.DeleteNamespace(ctx, EpinioDeploymentID)\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed deleting namespace %s\", EpinioDeploymentID)\n\t}\n\n\terr = c.WaitForNamespaceMissing(ctx, ui, EpinioDeploymentID, k.Timeout)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to delete namespace\")\n\t}\n\n\tui.Success().Msg(\"Epinio removed\")\n\n\treturn nil\n}", "title": "" }, { "docid": "12a2639da576b352f42ad03e586b4781", "score": "0.53543276", "text": "func (s *machineScope) deleteUnevictedPods() (int, error) {\n\tnode, err := s.getNode()\n\tif err != nil {\n\t\t// do not return error if node object not found, treat it as unreachable\n\t\tif apimachineryerrors.IsNotFound(err) {\n\t\t\treturn 0, nil\n\t\t}\n\t\treturn 0, err\n\t}\n\tif nodeReachable(node) {\n\t\treturn 0, fmt.Errorf(\"node is in operational state, won't proceed with pods deletion\")\n\t}\n\n\tterminatingPods, err := getPodList(s.Context, s.apiReader, node, []podPredicate{isTerminating})\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tgracePeriodSeconds := int64(0)\n\tdeleteOptions := &runtimeclient.DeleteOptions{\n\t\tGracePeriodSeconds: &gracePeriodSeconds,\n\t}\n\tdeletedPods := 0\n\tvar deleteErrList []error\n\tfor _, pod := range terminatingPods.Items {\n\t\terr := s.client.Delete(s.Context, &pod, deleteOptions)\n\t\tif err != nil {\n\t\t\tdeleteErrList = append(deleteErrList, err)\n\t\t} else {\n\t\t\tdeletedPods += 1\n\t\t}\n\t}\n\tif len(deleteErrList) > 0 {\n\t\treturn deletedPods, apimachineryutilerrors.NewAggregate(deleteErrList)\n\t}\n\treturn deletedPods, nil\n}", "title": "" }, { "docid": "09942559742222da17b3123ecc8b7b0a", "score": "0.53475094", "text": "func (p *PodRunner) Run(ctx context.Context, fn func(context.Context, *v1.Pod) (map[string]interface{}, error)) (map[string]interface{}, error) {\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\tif p.cli == nil || p.podOptions == nil {\n\t\treturn nil, errors.New(\"Pod Runner not initialized\")\n\t}\n\tpod, err := CreatePod(ctx, p.cli, p.podOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed to create pod\")\n\t}\n\tctx = field.Context(ctx, consts.PodNameKey, pod.Name)\n\tctx = field.Context(ctx, consts.ContainerNameKey, pod.Spec.Containers[0].Name)\n\tgo func() {\n\t\t<-ctx.Done()\n\t\terr := DeletePod(context.Background(), p.cli, pod)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Failed to delete pod \", err.Error())\n\t\t}\n\t}()\n\treturn fn(ctx, pod)\n}", "title": "" }, { "docid": "5072a76ec3887800e58ffb0e98b5f64b", "score": "0.5330845", "text": "func (m *MockPodStateWaiter) ListenUntilPodDeleted(stopChannel <-chan struct{}, pod *v1.Pod) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"ListenUntilPodDeleted\", stopChannel, pod)\n\treturn\n}", "title": "" }, { "docid": "ed2c86dd411dd972f6430e6c72c32cd2", "score": "0.53180444", "text": "func (p *PodController) DeletePod(pod *corev1.Pod) error {\n\treturn p.client.Delete(context.TODO(), pod)\n}", "title": "" }, { "docid": "91999b6e45601406c4cf25178ac55a0a", "score": "0.5301798", "text": "func (m *MockInterface) DeletePodForcefully(arg0, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeletePodForcefully\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "260ead55b079517cf93ce7e1b461412a", "score": "0.5285762", "text": "func Delete(ctx context.Context, cluster *kubernetes.Cluster, appRef models.AppRef) error {\n\tclient, err := cluster.ClientApp()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// delete application resource, will cascade and delete deployment,\n\t// ingress, service and certificate, environment variables, bindings\n\terr = client.Namespace(appRef.Org).Delete(ctx, appRef.Name, metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// delete pipelineruns in tekton-staging namespace\n\terr = Unstage(ctx, cluster, appRef, \"\")\n\tif err != nil && !apierrors.IsNotFound(err) {\n\t\treturn err\n\t}\n\n\t// delete staging PVC (the one that stores \"source\" and \"cache\" tekton workspaces)\n\terr = DeleteStagePVC(ctx, cluster, appRef)\n\tif err != nil && !apierrors.IsNotFound(err) {\n\t\treturn err\n\t}\n\n\terr = cluster.WaitForPodBySelectorMissing(ctx, nil,\n\t\tappRef.Org,\n\t\tfmt.Sprintf(\"app.kubernetes.io/name=%s\", appRef.Name),\n\t\tduration.ToDeployment())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8b9d8fc20e15037d121e7b6e71165a11", "score": "0.52842855", "text": "func (launcher *Launcher) Run() (errors []error) {\n\tvar (\n\t\tdeleteTridentEphemeral = false\n\t\tdeploymentExists = false\n\t\tdeploymentCreated = false\n\t\terr error\n\t\tlauncherErr error\n\t\tpv *v1.PersistentVolume\n\t\tpvExists = false\n\t\tpvcExists = false\n\t\tpvcCreated = false\n\t\tpvc *v1.PersistentVolumeClaim\n\t\tpvCreated = false\n\t\ttridentEphemeralCreated = false\n\t\ttridentEphemeralPod *v1.Pod\n\t\ttridentPod *v1.Pod\n\t\tvolConfig *storage.VolumeConfig\n\t\tvolumeCreated = false\n\t)\n\n\terrors = make([]error, 0)\n\n\tdefer func() {\n\t\t// Cleanup after success (err == nil)\n\t\tif launcherErr == nil && tridentEphemeralCreated {\n\t\t\t// Delete pod trident-ephemeral\n\t\t\tif errCleanup := stopTridentEphemeralPod(launcher.kubeClient); errCleanup != nil {\n\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\"error\": errCleanup,\n\t\t\t\t\t\"pod\": tridentEphemeralPodName,\n\t\t\t\t}).Error(\"Launcher failed to delete the pod, so it needs \" +\n\t\t\t\t\t\"to be manually deleted!\")\n\t\t\t\terrors = append(errors,\n\t\t\t\t\tfmt.Errorf(\"launcher failed to delete pod %s: %s; manual deletion is required\",\n\t\t\t\t\t\ttridentEphemeralPodName, errCleanup))\n\t\t\t} else {\n\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\"pod\": tridentEphemeralPodName,\n\t\t\t\t}).Info(\"Launcher successfully deleted the pod during cleanup.\")\n\t\t\t}\n\t\t} else if launcherErr != nil {\n\t\t\tlog.Error(launcherErr)\n\t\t\terrors = append(errors, launcherErr)\n\n\t\t\t// Cleanup after failure (err != nil)\n\t\t\tvar gracePeriod int64\n\t\t\toptions := &metav1.DeleteOptions{\n\t\t\t\tGracePeriodSeconds: &gracePeriod,\n\t\t\t}\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"error\": err,\n\t\t\t\t\"pvcCreated\": pvcCreated,\n\t\t\t\t\"pvCreated\": pvCreated,\n\t\t\t\t\"volumeCreated\": volumeCreated,\n\t\t\t\t\"deploymentCreated\": deploymentCreated,\n\t\t\t\t\"tridentEphemeralCreated\": tridentEphemeralCreated,\n\t\t\t}).Debug(\"Launcher is starting the cleanup after failure.\")\n\t\t\tif pvcCreated && !deploymentCreated {\n\t\t\t\t// Delete the PVC\n\t\t\t\tif errCleanup := launcher.kubeClient.DeletePVC(*tridentPVCName, options); errCleanup != nil {\n\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\"error\": errCleanup,\n\t\t\t\t\t\t\"pvc\": *tridentPVCName,\n\t\t\t\t\t}).Error(\"Launcher failed to delete the PVC during cleanup. \" +\n\t\t\t\t\t\t\"Manual deletion is required!\")\n\t\t\t\t\terrors = append(errors,\n\t\t\t\t\t\tfmt.Errorf(\"launcher failed to delete PVC %s during cleanup: %s; \"+\n\t\t\t\t\t\t\t\"manual deletion is required\", *tridentPVCName, errCleanup))\n\t\t\t\t} else {\n\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\"pvc\": *tridentPVCName,\n\t\t\t\t\t}).Info(\"Launcher successfully deleted the PVC during cleanup.\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tif pvCreated && !deploymentCreated {\n\t\t\t\t// Delete the PV\n\t\t\t\tif errCleanup := launcher.kubeClient.DeletePV(*tridentPVName, options); errCleanup != nil {\n\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\"error\": errCleanup,\n\t\t\t\t\t\t\"pv\": *tridentPVName,\n\t\t\t\t\t}).Error(\"Launcher failed to delete the PV during cleanup! \" +\n\t\t\t\t\t\t\"Manual deletion is required!\")\n\t\t\t\t\terrors = append(errors,\n\t\t\t\t\t\tfmt.Errorf(\"launcher failed to delete PV %s during cleanup: %s; \"+\n\t\t\t\t\t\t\t\"manual deletion is required\", *tridentPVName, errCleanup))\n\t\t\t\t} else {\n\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\"pv\": *tridentPVName,\n\t\t\t\t\t}).Info(\"Launcher successfully deleted the PV during cleanup.\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tif volumeCreated && !deploymentCreated {\n\t\t\t\t// Delete the volume\n\t\t\t\tif errCleanup := deleteVolume(launcher.tridentEphemeralClient, *tridentVolumeName); errCleanup != nil {\n\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\"error\": errCleanup,\n\t\t\t\t\t\t\"volume\": *tridentVolumeName,\n\t\t\t\t\t}).Error(\"Launcher failed to delete the volume during cleanup. \"+\n\t\t\t\t\t\t\"Manual deletion is required! \"+\n\t\t\t\t\t\t\"Run 'kubectl logs %s' for more information.\",\n\t\t\t\t\t\ttridentEphemeralPodName)\n\t\t\t\t\terrors = append(errors,\n\t\t\t\t\t\tfmt.Errorf(\"launcher failed to delete volume %s during cleanup: %s; \"+\n\t\t\t\t\t\t\t\"manual deletion is required; run 'kubectl logs %s' for more information\",\n\t\t\t\t\t\t\t*tridentVolumeName, errCleanup, tridentEphemeralPodName))\n\t\t\t\t\tdeleteTridentEphemeral = false\n\t\t\t\t} else {\n\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\"volume\": *tridentVolumeName,\n\t\t\t\t\t}).Info(\"Launcher successfully deleted the volume during cleanup.\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tif tridentEphemeralCreated && (deploymentCreated || deleteTridentEphemeral) {\n\t\t\t\t//TODO: Capture the logs for pod trident-ephemeral\n\t\t\t\t/* kubectl logs trident-ephemeral --v=8\n\t\t\t\t * https://kubernetes.io/docs/api-reference/v1/operations/\n\t\t\t\t * https://kubernetes.io/docs/admin/authorization/\n\t\t\t\t */\n\t\t\t\t// Delete pod trident-ephemeral\n\t\t\t\tif errCleanup := stopTridentEphemeralPod(launcher.kubeClient); errCleanup != nil {\n\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\"error\": errCleanup,\n\t\t\t\t\t\t\"pod\": tridentEphemeralPodName,\n\t\t\t\t\t}).Error(\"Launcher failed to delete the pod. \" +\n\t\t\t\t\t\t\"Manual deletion is required!\")\n\t\t\t\t\terrors = append(errors,\n\t\t\t\t\t\tfmt.Errorf(\"launcher failed to delete pod %s: %s; manual deletion is required\",\n\t\t\t\t\t\t\ttridentEphemeralPodName, errCleanup))\n\t\t\t\t} else {\n\t\t\t\t\tlog.Infof(\"Launcher successfully deleted pod %s during cleanup.\",\n\t\t\t\t\t\ttridentEphemeralPodName)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Check for an existing Trident deployment\n\tif deploymentExists, err = launcher.kubeClient.CheckDeploymentExists(launcher.tridentDeployment.Name); deploymentExists {\n\t\tlauncherErr = fmt.Errorf(\"launcher detected a preexisting deployment called %s, so it will quit\",\n\t\t\tlauncher.tridentDeployment.Name)\n\t\treturn\n\t} else if err != nil {\n\t\tlauncherErr = fmt.Errorf(\"launcher couldn't establish the presence of deployment %s: %s; please check your\"+\n\t\t\t\" service account setup\", launcher.tridentDeployment.Name, err)\n\t\treturn\n\t}\n\n\t// Check for an existing PVC for Trident\n\tif pvcExists, err = launcher.kubeClient.CheckPVCExists(*tridentPVCName); pvcExists {\n\t\tvar (\n\t\t\toptions metav1.GetOptions\n\t\t\tphase v1.PersistentVolumeClaimPhase\n\t\t)\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"pvc\": *tridentPVCName,\n\t\t}).Info(\"Launcher detected a preexisting PVC. It assumes \" +\n\t\t\t\"this PVC was created for the Trident deployment.\")\n\t\tphase, err = launcher.kubeClient.GetPVCPhase(*tridentPVCName, options)\n\t\tif err != nil {\n\t\t\tlauncherErr = fmt.Errorf(\"launcher couldn't detect the phase for PVC %s: %s\", *tridentPVCName, err)\n\t\t\treturn\n\t\t}\n\t\tswitch phase {\n\t\tcase v1.ClaimPending:\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"pvc\": *tridentPVCName,\n\t\t\t}).Info(\"Launcher detected that the PVC is still pending; \" +\n\t\t\t\t\"proceeding with the creation of the corresponding PV.\")\n\t\tcase v1.ClaimBound:\n\t\t\tpvExists = true\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"pvc\": *tridentPVCName,\n\t\t\t}).Info(\"Launcher detected that the PVC is bound; proceeding \" +\n\t\t\t\t\"with the creation of the Trident deployment.\")\n\t\tcase v1.ClaimLost:\n\t\t\tlauncherErr = fmt.Errorf(\"please delete the preexisting PVC %s and try again\", *tridentPVCName)\n\t\t\treturn\n\t\t}\n\t} else if err != nil {\n\t\tlauncherErr = fmt.Errorf(\"launcher couldn't establish the presence of PVC %s: %s\", *tridentPVCName, err)\n\t\treturn\n\t}\n\n\tif !pvExists {\n\t\t// Start ephemeral Trident\n\t\tif tridentEphemeralPod, err = createTridentEphemeralPod(launcher.kubeClient); err != nil {\n\t\t\tlauncherErr = fmt.Errorf(\"launcher failed to launch pod %s: %s\",\n\t\t\t\ttridentEphemeralPodName, err)\n\t\t\treturn\n\t\t}\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"pod\": tridentEphemeralPodName,\n\t\t}).Info(\"Launcher created the pod.\")\n\t\ttridentEphemeralCreated = true\n\n\t\t// Wait for the pod to run\n\t\tif tridentEphemeralPod, err = launcher.kubeClient.GetRunningPod(\n\t\t\ttridentEphemeralPod, k8sTimeout,\n\t\t\ttridentEphemeralLabels); err != nil {\n\t\t\tlauncherErr = err\n\t\t\treturn\n\t\t}\n\n\t\t// Create Trident client\n\t\tif tridentEphemeralPod.Status.PodIP == \"\" {\n\t\t\tlauncherErr = fmt.Errorf(\"pod %s doesn't have an IP address\",\n\t\t\t\ttridentEphemeralPod.Name)\n\t\t\treturn\n\t\t}\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"pod\": tridentEphemeralPod.Name,\n\t\t\t\"ipAddress\": tridentEphemeralPod.Status.PodIP,\n\t\t}).Infof(\"Launcher detected the IP address for the pod.\")\n\t\tlauncher.tridentEphemeralClient.Configure(tridentEphemeralPod.Status.PodIP,\n\t\t\ttridentDefaultPort, *tridentTimeout)\n\n\t\t// Check the pod is functional\n\t\tif err = checkTridentAPI(launcher.tridentEphemeralClient, tridentEphemeralPod.Name); err != nil {\n\t\t\tlauncherErr = fmt.Errorf(\n\t\t\t\t\"launcher failed to bring up a functional pod: %s \"+\n\t\t\t\t\t\"try 'kubectl logs %s' to diagnose the problem\",\n\t\t\t\terr, tridentEphemeralPod.Name)\n\t\t\treturn\n\t\t}\n\n\t\t// Provision the volume\n\t\tif err = provisionVolume(launcher.tridentEphemeralClient); err != nil {\n\t\t\tlauncherErr = fmt.Errorf(\"launcher failed to add volume %s: %s\",\n\t\t\t\t*tridentVolumeName, err.Error())\n\t\t\treturn\n\t\t}\n\t\tvolumeCreated = true\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"volume\": *tridentVolumeName,\n\t\t\t\"volumeSize\": fmt.Sprintf(\"%d%s\", *tridentVolumeSize, \"GB\"),\n\t\t}).Info(\"Launcher successfully created the volume.\")\n\t\tdeleteTridentEphemeral = true\n\t}\n\n\tif !pvcExists {\n\t\t// Create the PVC\n\t\tif pvc, err = createPVC(launcher.kubeClient, *tridentPVCName); err != nil {\n\t\t\tlauncherErr = fmt.Errorf(\"launcher failed in creating PVC %s: %s\", *tridentPVCName, err)\n\t\t\treturn\n\t\t}\n\t\tpvcCreated = true\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"pvc\": *tridentPVCName,\n\t\t}).Info(\"Launcher successfully created the PVC.\")\n\t} else {\n\t\t// Retrieve the preexisting PVC\n\t\tvar options metav1.GetOptions\n\t\tif pvc, err = launcher.kubeClient.GetPVC(*tridentPVCName, options); err != nil {\n\t\t\tlauncherErr = fmt.Errorf(\"launcher failed in getting PVC %s: %s\",\n\t\t\t\t*tridentPVCName, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// At this point, we should have created the volume and the PVC for the\n\t// stateful Trident pod.\n\tif !pvExists {\n\t\t// Create the pre-bound PV\n\t\t// Get the volume information\n\t\tvar volumeExternal *storage.VolumeExternal\n\t\tif volumeExternal, err = getVolume(launcher.tridentEphemeralClient, *tridentVolumeName); err != nil {\n\t\t\tlauncherErr = err\n\t\t\treturn\n\t\t}\n\t\tvolConfig = volumeExternal.Config\n\t\tif pv, err = createPV(launcher.kubeClient, *tridentPVName, volumeExternal, pvc); err != nil {\n\t\t\tlauncherErr = fmt.Errorf(\"launcher failed in creating PV %s: %s. \"+\n\t\t\t\t\"Either use -pv_name in launcher-pod.yaml to create a volume \"+\n\t\t\t\t\"and a PV with a different name, or delete PV %s so that \"+\n\t\t\t\t\"launcher can create a new PV with the same name. \"+\n\t\t\t\t\"(The new PV will reuse the volume represented by the old \"+\n\t\t\t\t\"PV unless the volume is manually deleted from the storage \"+\n\t\t\t\t\"backend.)\",\n\t\t\t\t*tridentPVName, err, *tridentPVName)\n\t\t\treturn\n\t\t}\n\t\tpvCreated = true\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"pv\": pv.Name,\n\t\t\t\"volume\": volConfig.InternalName,\n\t\t}).Info(\"Launcher successfully created the PV for the volume.\")\n\n\t\t// Wait for the Trident PVC and PV to bind\n\t\tif pvc, err = launcher.kubeClient.GetBoundPVC(pvc,\n\t\t\tpv, k8sTimeout, tridentLabels); err != nil {\n\t\t\tlauncherErr = err\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Start the stateful Trident\n\tif launcher.tridentDeployment, err = launcher.kubeClient.CreateDeployment(launcher.tridentDeployment); err != nil {\n\t\tlauncherErr = fmt.Errorf(\"launcher failed in creating deployment %s: %s\",\n\t\t\tlauncher.tridentDeployment.Name, err)\n\t\treturn\n\t}\n\tdeploymentCreated = true\n\n\t// Get the stateful Trident pod\n\tif tridentPod, err = launcher.kubeClient.GetPodByLabels(\n\t\tk8sclient.CreateListOptions(k8sTimeout,\n\t\t\ttridentLabels, launcher.tridentDeployment.ResourceVersion)); err != nil {\n\t\tlauncherErr = err\n\t\treturn\n\t}\n\tlog.WithFields(log.Fields{\n\t\t\"pod\": tridentPod.Name,\n\t\t\"podPhase\": tridentPod.Status.Phase,\n\t\t\"deployment\": launcher.tridentDeployment.Name,\n\t}).Info(\"Launcher successfully retrieved information about the deployment.\")\n\n\t// Wait for a running Pod\n\tif tridentPod.Status.Phase != v1.PodRunning {\n\t\tif tridentPod, err = launcher.kubeClient.GetRunningPod(\n\t\t\ttridentPod, k8sTimeout, tridentLabels); err != nil {\n\t\t\tlauncherErr = fmt.Errorf(\"%s; try 'kubectl describe pod %s' for more information\",\n\t\t\t\terr, tridentPod.Name)\n\t\t\treturn\n\t\t} else {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"pod\": tridentPod.Name,\n\t\t\t\t\"podPhase\": tridentPod.Status.Phase,\n\t\t\t\t\"deployment\": launcher.tridentDeployment.Name,\n\t\t\t}).Info(\"Launcher successfully retrieved information about the deployment.\")\n\t\t}\n\t}\n\n\t// Create the client for the stateful pod\n\tif tridentPod.Status.PodIP == \"\" {\n\t\tlauncherErr = fmt.Errorf(\"pod %s doesn't have an IP address\",\n\t\t\ttridentPod.Name)\n\t\treturn\n\t}\n\tlog.WithFields(log.Fields{\n\t\t\"pod\": tridentPod.Name,\n\t\t\"ipAddress\": tridentPod.Status.PodIP,\n\t}).Infof(\"Launcher detected the IP address for the pod.\")\n\tlauncher.tridentClient = launcher.tridentClient.Configure(tridentPod.Status.PodIP,\n\t\ttridentDefaultPort, *tridentTimeout)\n\n\t// Check the pod is functional\n\tif err = checkTridentAPI(launcher.tridentClient, tridentPod.Name); err != nil {\n\t\tlog.Warnf(\"%s Perhaps Trident is bootstrapping a lot of state. \"+\n\t\t\t\"Try 'kubectl logs %s -c %s' to see if Trident has bootstrapped successfully.\",\n\t\t\terr, tridentPod.Name, tridentContainerName)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7460022b27425d7de9f3b18b4ce17f72", "score": "0.5283914", "text": "func RecordPodDeleted() {\n\tstats.Record(context.Background(), mPodsDeleted.M(int64(1)))\n}", "title": "" }, { "docid": "1feec077e1ca3421497bafe169d3ed3b", "score": "0.5276013", "text": "func deleteFile(f *framework.Framework, pod *v1.Pod, fpath string) {\n\tginkgo.By(fmt.Sprintf(\"deleting test file %s...\", fpath))\n\tstdout, stderr, err := e2evolume.PodExec(f, pod, fmt.Sprintf(\"rm -f %s\", fpath))\n\tif err != nil {\n\t\t// keep going, the test dir will be deleted when the volume is unmounted\n\t\tframework.Logf(\"unable to delete test file %s: %v\\nerror ignored, continuing test\\nstdout: %s\\nstderr: %s\", fpath, err, stdout, stderr)\n\t}\n}", "title": "" }, { "docid": "0841e978577876e767401bc2274e82bd", "score": "0.5272901", "text": "func (c *Client) DeletePod(name string, ns string, force bool) error {\n\tif err := c.initClient(); err != nil {\n\t\treturn err\n\t}\n\n\tdeleteOptions := metav1.DeleteOptions{}\n\tif force {\n\t\tgracePeriodSec := int64(0)\n\t\tdeleteOptions.GracePeriodSeconds = &gracePeriodSec\n\t}\n\n\treturn c.kubernetes.CoreV1().Pods(ns).Delete(context.TODO(), name, deleteOptions)\n}", "title": "" }, { "docid": "a01c9fa83ffffc1bb97725e70f8beb51", "score": "0.5272548", "text": "func (k *kubeClient) DeleteOrEvictPodsSimple(nodeName string) error {\n\tpods, err := k.GetPodsByNodes(nodeName)\n\tif err != nil {\n\t\tlogrus.Infof(\"get pods of node %s failed \", nodeName)\n\t\treturn err\n\t}\n\tpolicyGroupVersion, err := k.SupportEviction()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif policyGroupVersion == \"\" {\n\t\treturn fmt.Errorf(\"the server can not support eviction subresource\")\n\t}\n\tfor _, v := range pods {\n\t\tk.evictPod(v, policyGroupVersion)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39bd846d9ea5bc032005826e8f595436", "score": "0.52675694", "text": "func (h *CephInstaller) GetCleanupPod(node, removalDir string) string {\n\treturn `apiVersion: batch/v1\nkind: Job\nmetadata:\n name: rook-cleanup-` + uuid.Must(uuid.NewRandom()).String() + `\nspec:\n template:\n spec:\n restartPolicy: Never\n containers:\n - name: rook-cleaner\n image: rook/ceph:` + LocalBuildTag + `\n securityContext:\n privileged: true\n volumeMounts:\n - name: cleaner\n mountPath: /scrub\n command:\n - \"sh\"\n - \"-c\"\n - \"rm -rf /scrub/*\"\n nodeSelector:\n kubernetes.io/hostname: ` + node + `\n volumes:\n - name: cleaner\n hostPath:\n path: ` + removalDir\n}", "title": "" }, { "docid": "31739bea86ba1e0db793fad5f6f52e36", "score": "0.5267128", "text": "func DeletePods(ns string, podNames ...string) error {\n\tdeletePolicy := metav1.DeletePropagationForeground\n\tfor _, pName := range podNames {\n\t\terr := kubecli.CoreV1().Pods(ns).Delete(pName, &metav1.DeleteOptions{\n\t\t\tPropagationPolicy: &deletePolicy,\n\t\t})\n\t\tif err != nil && !apierrors.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t\tlog.Infof(`Pod \"%s\" deleted`, pName)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19a8820d4e45b33f44e81e15651e1a68", "score": "0.5262686", "text": "func TestResiliencePod(t *testing.T) {\n\tlongOrSkip(t)\n\tc := client.MustNewInCluster()\n\tkubecli := mustNewKubeClient(t)\n\tns := getNamespace(t)\n\n\t//fmt.Printf(\"There are %d pods in the cluster\\n\", len(pods.Items))\n\n\t// Prepare deployment config\n\tdepl := newDeployment(\"test-pod-resilience\" + uniuri.NewLen(4))\n\tdepl.Spec.Mode = api.NewMode(api.DeploymentModeCluster)\n\tdepl.Spec.SetDefaults(depl.GetName()) // this must be last\n\n\t// Create deployment\n\tapiObject, err := c.DatabaseV1alpha().ArangoDeployments(ns).Create(depl)\n\tif err != nil {\n\t\tt.Fatalf(\"Create deployment failed: %v\", err)\n\t}\n\n\t// Wait for deployment to be ready\n\tif _, err = waitUntilDeployment(c, depl.GetName(), ns, deploymentIsReady()); err != nil {\n\t\tt.Fatalf(\"Deployment not running in time: %v\", err)\n\t}\n\n\t// Create a database client\n\tctx := context.Background()\n\tclient := mustNewArangodDatabaseClient(ctx, kubecli, apiObject, t)\n\n\t// Wait for cluster to be completely ready\n\tif err := waitUntilClusterHealth(client, func(h driver.ClusterHealth) error {\n\t\treturn clusterHealthEqualsSpec(h, apiObject.Spec)\n\t}); err != nil {\n\t\tt.Fatalf(\"Cluster not running in expected health in time: %v\", err)\n\t}\n\n\t// Fetch latest status so we know all member details\n\tapiObject, err = c.DatabaseV1alpha().ArangoDeployments(ns).Get(depl.GetName(), metav1.GetOptions{})\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to get deployment: %v\", err)\n\t}\n\n\t// Delete one pod after the other\n\tapiObject.ForeachServerGroup(func(group api.ServerGroup, spec api.ServerGroupSpec, status *api.MemberStatusList) error {\n\t\tfor _, m := range *status {\n\t\t\t// Get current pod so we can compare UID later\n\t\t\toriginalPod, err := kubecli.CoreV1().Pods(ns).Get(m.PodName, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Failed to get pod %s: %v\", m.PodName, err)\n\t\t\t}\n\t\t\tif err := kubecli.CoreV1().Pods(ns).Delete(m.PodName, &metav1.DeleteOptions{}); err != nil {\n\t\t\t\tt.Fatalf(\"Failed to delete pod %s: %v\", m.PodName, err)\n\t\t\t}\n\t\t\t// Wait for pod to return with different UID\n\t\t\top := func() error {\n\t\t\t\tpod, err := kubecli.CoreV1().Pods(ns).Get(m.PodName, metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn maskAny(err)\n\t\t\t\t}\n\t\t\t\tif pod.GetUID() == originalPod.GetUID() {\n\t\t\t\t\treturn fmt.Errorf(\"Still original pod\")\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif err := retry.Retry(op, time.Minute); err != nil {\n\t\t\t\tt.Fatalf(\"Pod did not restart: %v\", err)\n\t\t\t}\n\t\t\t// Wait for cluster to be completely ready\n\t\t\tif err := waitUntilClusterHealth(client, func(h driver.ClusterHealth) error {\n\t\t\t\treturn clusterHealthEqualsSpec(h, apiObject.Spec)\n\t\t\t}); err != nil {\n\t\t\t\tt.Fatalf(\"Cluster not running in expected health in time: %v\", err)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}, &apiObject.Status)\n\n\t// Cleanup\n\tremoveDeployment(c, depl.GetName(), ns)\n}", "title": "" }, { "docid": "57cd416e9a17f4665f84fa200bea62d6", "score": "0.52583605", "text": "func (kl *Kubelet) HandlePodCleanups() error {\n\tallPods, mirrorPods := kl.podManager.GetPodsAndMirrorPods()\n\t// Pod phase progresses monotonically. Once a pod has reached a final state,\n\t// it should never leave regardless of the restart policy. The statuses\n\t// of such pods should not be changed, and there is no need to sync them.\n\t// TODO: the logic here does not handle two cases:\n\t// 1. If the containers were removed immediately after they died, kubelet\n\t// may fail to generate correct statuses, let alone filtering correctly.\n\t// 2. If kubelet restarted before writing the terminated status for a pod\n\t// to the apiserver, it could still restart the terminated pod (even\n\t// though the pod was not considered terminated by the apiserver).\n\t// These two conditions could be alleviated by checkpointing kubelet.\n\tactivePods := kl.filterOutTerminatedPods(allPods)\n\n\tdesiredPods := make(map[types.UID]empty)\n\tfor _, pod := range activePods {\n\t\tdesiredPods[pod.UID] = empty{}\n\t}\n\t// Stop the workers for no-longer existing pods.\n\t// TODO: is here the best place to forget pod workers?\n\tkl.podWorkers.ForgetNonExistingPodWorkers(desiredPods)\n\tkl.probeManager.CleanupPods(activePods)\n\n\trunningPods, err := kl.runtimeCache.GetPods()\n\tif err != nil {\n\t\tglog.Errorf(\"Error listing containers: %#v\", err)\n\t\treturn err\n\t}\n\tfor _, pod := range runningPods {\n\t\tif _, found := desiredPods[pod.ID]; !found {\n\t\t\tkl.podKillingCh <- &kubecontainer.PodPair{nil, pod}\n\t\t}\n\t}\n\n\tkl.removeOrphanedPodStatuses(allPods, mirrorPods)\n\t// Note that we just killed the unwanted pods. This may not have reflected\n\t// in the cache. We need to bypass the cache to get the latest set of\n\t// running pods to clean up the volumes.\n\t// TODO: Evaluate the performance impact of bypassing the runtime cache.\n\trunningPods, err = kl.containerRuntime.GetPods(false)\n\tif err != nil {\n\t\tglog.Errorf(\"Error listing containers: %#v\", err)\n\t\treturn err\n\t}\n\n\t// Remove any orphaned volumes.\n\t// Note that we pass all pods (including terminated pods) to the function,\n\t// so that we don't remove volumes associated with terminated but not yet\n\t// deleted pods.\n\terr = kl.cleanupOrphanedVolumes(allPods, runningPods)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed cleaning up orphaned volumes: %v\", err)\n\t\treturn err\n\t}\n\n\t// Remove any orphaned pod directories.\n\t// Note that we pass all pods (including terminated pods) to the function,\n\t// so that we don't remove directories associated with terminated but not yet\n\t// deleted pods.\n\terr = kl.cleanupOrphanedPodDirs(allPods, runningPods)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed cleaning up orphaned pod directories: %v\", err)\n\t\treturn err\n\t}\n\n\t// Remove any orphaned mirror pods.\n\tkl.podManager.DeleteOrphanedMirrorPods()\n\n\t// Clear out any old bandwidth rules\n\tif err = kl.cleanupBandwidthLimits(allPods); err != nil {\n\t\treturn err\n\t}\n\n\tkl.backOff.GC()\n\treturn err\n}", "title": "" }, { "docid": "6bc72f97eeb23d287b9675b024d74d55", "score": "0.5257195", "text": "func TestHandle_orphanedPod(t *testing.T) {\n\tcontroller := &DeployerPodController{\n\t\tdeploymentClient: &deploymentClientImpl{\n\t\t\tupdateDeploymentFunc: func(namespace string, deployment *kapi.ReplicationController) (*kapi.ReplicationController, error) {\n\t\t\t\tt.Fatalf(\"Unexpected deployment update\")\n\t\t\t\treturn nil, nil\n\t\t\t},\n\t\t\tgetDeploymentFunc: func(namespace, name string) (*kapi.ReplicationController, error) {\n\t\t\t\treturn nil, kerrors.NewNotFound(\"ReplicationController\", name)\n\t\t\t},\n\t\t},\n\t}\n\n\terr := controller.Handle(runningPod())\n\n\tif err == nil {\n\t\tt.Fatalf(\"expected an error\")\n\t}\n}", "title": "" }, { "docid": "41f736589699f3f5c10c114bb1ca6ba1", "score": "0.52558476", "text": "func deleteResourceAndWait(namespace, name, resourceType string,\n\tdeleteAction func(*metav1.DeleteOptions) error,\n\tgetAction func() error) error {\n\n\tvar gracePeriod int64\n\tpropagation := metav1.DeletePropagationForeground\n\toptions := &metav1.DeleteOptions{GracePeriodSeconds: &gracePeriod, PropagationPolicy: &propagation}\n\n\t// Delete the resource if it exists\n\terr := deleteAction(options)\n\tif err != nil {\n\t\tif !errors.IsNotFound(err) {\n\t\t\treturn fmt.Errorf(\"failed to delete %s. %+v\", name, err)\n\t\t}\n\t\treturn nil\n\t}\n\tlogger.Infof(\"Removed %s %s\", resourceType, name)\n\n\t// wait for the resource to be deleted\n\tsleepTime := 2 * time.Second\n\tfor i := 0; i < 30; i++ {\n\t\t// check for the existence of the resource\n\t\terr = getAction()\n\t\tif err != nil {\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\tlogger.Infof(\"confirmed %s does not exist\", name)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"failed to get %s. %+v\", name, err)\n\t\t}\n\n\t\tlogger.Infof(\"%s still found. waiting...\", name)\n\t\ttime.Sleep(sleepTime)\n\t}\n\n\treturn fmt.Errorf(\"gave up waiting for %s pods to be terminated\", name)\n}", "title": "" } ]
3a1132ac354b273ad5e2719f60486e00
Helper to build multiparams dictionary
[ { "docid": "39b30863be8453229ade03c430a42f10", "score": "0.50759745", "text": "func (e *expressionAttributes) paramsHelper(params []Params) {\n\tif len(params) == 0 {\n\t\treturn\n\t}\n\toutput := make([]Param, 0, len(params))\n\tfor _, p := range params {\n\t\toutput = append(output, p.AsParams()...)\n\t}\n\te.assignParams(output)\n}", "title": "" } ]
[ { "docid": "318914a9402485d5908dfa084fdf88ee", "score": "0.66935664", "text": "func buildBindParams(bindParams *ServiceParams) map[string]interface{} {\n\tparams := map[string]interface{}{}\n\n\tfor k, v := range bindParams.Properties {\n\t\tparams[k] = v[\"value\"]\n\t}\n\n\treturn params\n}", "title": "" }, { "docid": "ab90af8c77652905c58d7890ca6c8253", "score": "0.5964396", "text": "func (c *client) newParamMap(key string, value interface{}) map[string]string {\n\tret := make(map[string]string, len(c.params)+1)\n\tfor key, value := range c.params {\n\t\tret[key] = value\n\t}\n\tswitch value.(type) {\n\tcase string:\n\t\tret[key] = value.(string)\n\tdefault:\n\t\tjsonVal, _ := json.Marshal(value)\n\t\tret[key] = string(jsonVal)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "54fb38419d2e2cd6dd02dc741df47afa", "score": "0.5884025", "text": "func (b *builder) parameters(kv ...string) *v1.ConfigMap {\n\tb.parametersCounter++\n\tdata := map[string]string{}\n\tfor i := 0; i < len(kv); i += 2 {\n\t\tdata[kv[i]] = kv[i+1]\n\t}\n\tif len(data) == 0 {\n\t\tdata = b.parametersEnv()\n\t}\n\treturn &v1.ConfigMap{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: b.f.Namespace.Name,\n\t\t\tName: b.parametersName(),\n\t\t},\n\t\tData: data,\n\t}\n}", "title": "" }, { "docid": "2e76c5a0161e1bddf1693c1696a37b53", "score": "0.5838702", "text": "func groupConfigParams(params map[string]string, prefix string, checker func(string) bool) map[string]map[string]string {\n\tresultMap := make(map[string]map[string]string)\n\tfor k, v := range params {\n\t\tname, ok := getConfigParamName(k, prefix, checker)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tattribute := getConfigParamAttribute(k)\n\n\t\tm, ok := resultMap[name]\n\t\tif !ok {\n\t\t\tm = make(map[string]string)\n\t\t\tresultMap[name] = m\n\t\t}\n\t\tm[attribute] = v\n\t}\n\treturn resultMap\n}", "title": "" }, { "docid": "91a67edfdd2065108306445dc4466acf", "score": "0.5659876", "text": "func (s *ComposeService) parameters(dnsSearch, cName string, extLabels map[string]string) []*Parameter {\n\tvar (\n\t\tm1 = make(map[string]string) // key-value params\n\t\tm2 = make(map[string][]string) // key-list params\n\t)\n\n\tif v := s.ContainerName; v != \"\" {\n\t\tm1[\"name\"] = v\n\t}\n\tif v := s.CgroupParent; v != \"\" {\n\t\tm1[\"cgroup-parent\"] = v\n\t}\n\tif v := s.Hostname; v != \"\" {\n\t\tm1[\"hostname\"] = v\n\t}\n\tif v := s.Ipc; v != \"\" {\n\t\tm1[\"ipc\"] = v\n\t}\n\tif v := s.MacAddress; v != \"\" {\n\t\tm1[\"mac-address\"] = v\n\t}\n\tif v := s.Pid; v != \"\" {\n\t\tm1[\"pid\"] = v\n\t}\n\tif v := s.StopSignal; v != \"\" {\n\t\tm1[\"stop-signal\"] = v\n\t}\n\tif v := s.Restart; v != \"\" {\n\t\tm1[\"restart\"] = v\n\t}\n\tif v := s.User; v != \"\" {\n\t\tm1[\"user\"] = v\n\t}\n\tif v := s.WorkingDir; v != \"\" {\n\t\tm1[\"workdir\"] = v\n\t}\n\tm1[\"read-only\"] = fmt.Sprintf(\"%t\", s.ReadOnly)\n\tm1[\"tty\"] = fmt.Sprintf(\"%t\", s.Tty)\n\t// entrypoint\n\tvar e string\n\tfor _, v := range s.Entrypoint {\n\t\te += \" \" + v\n\t}\n\tif e != \"\" {\n\t\tm1[\"entrypoint\"] = e\n\t}\n\t// log driver\n\tif v := s.Logging; v != nil {\n\t\tif d := v.Driver; d != \"\" {\n\t\t\tm1[\"log-driver\"] = d\n\t\t}\n\t}\n\n\t// m2\n\tfset := func(k string, vs []string) {\n\t\tm2[k] = append(m2[k], vs...)\n\t}\n\t// log-opt\n\tif v := s.Logging; v != nil {\n\t\topts := make([]string, 0, 0)\n\t\tfor key, val := range v.Options {\n\t\t\topts = append(opts, key+\"=\"+val)\n\t\t}\n\t\tif len(opts) > 0 {\n\t\t\tfset(\"log-opt\", opts)\n\t\t}\n\t}\n\tif v := s.CapAdd; len(v) > 0 {\n\t\tfset(\"cap-add\", v)\n\t}\n\tif v := s.CapDrop; len(v) > 0 {\n\t\tfset(\"cap-drop\", v)\n\t}\n\tif v := s.Devices; len(v) > 0 {\n\t\tfset(\"device\", v)\n\t}\n\tif v := s.Dns; len(v) > 0 {\n\t\tfset(\"dns\", v)\n\t}\n\tfset(\"dns-search\", append([]string{dnsSearch}, s.DnsSearch...))\n\n\t// env\n\tif v := s.Environment; len(v) > 0 {\n\t\tenvs := make([]string, 0, len(v))\n\t\tfor key, val := range v {\n\t\t\tenvs = append(envs, fmt.Sprintf(\"%s=%s\", key, val))\n\t\t}\n\t\tfset(\"env\", envs)\n\t}\n\t// add-host\n\tif v := s.ExtraHosts; len(v) > 0 {\n\t\thosts := make([]string, 0, len(v))\n\t\tfor key, val := range v {\n\t\t\thosts = append(hosts, fmt.Sprintf(\"%s:%s\", key, val))\n\t\t}\n\t\tfset(\"add-host\", hosts)\n\t}\n\t// expose\n\tif v := s.Expose; len(v) > 0 {\n\t\tfset(\"expose\", v)\n\t}\n\tif v := s.SecurityOpt; len(v) > 0 {\n\t\tfset(\"security-opt\", v)\n\t}\n\t// tmpfs\n\tif v := s.Tmpfs; len(v) > 0 {\n\t\tfset(\"tmpfs\", v)\n\t}\n\t// labels\n\tlbs := []string{\"SWAN_COMPOSE_NAME=\" + cName}\n\tfor key, val := range s.Labels {\n\t\tlbs = append(lbs, fmt.Sprintf(\"%s=%s\", key, val))\n\t}\n\tfor key, val := range extLabels {\n\t\tlbs = append(lbs, fmt.Sprintf(\"%s=%s\", key, val))\n\t}\n\tfset(\"label\", lbs)\n\t// volumes\n\tif v := s.Volumes; len(v) > 0 {\n\t\tfset(\"volume\", v)\n\t}\n\t// ulimits\n\tif v := s.Ulimits; len(v) > 0 {\n\t\tvs := make([]string, 0, len(v))\n\t\tfor key, val := range v {\n\t\t\tvs = append(vs, fmt.Sprintf(\"%s=%d:%d\", key, val.Soft, val.Hard))\n\t\t}\n\t\tfset(\"ulimit\", vs)\n\t}\n\t// final\n\tret := make([]*Parameter, 0, 0)\n\tfor k, v := range m1 {\n\t\tret = append(ret, &Parameter{k, v})\n\t}\n\tfor k, vs := range m2 {\n\t\tfor _, v := range vs {\n\t\t\tret = append(ret, &Parameter{k, v})\n\t\t}\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "ba055234469b4ff0871f45493a4ff551", "score": "0.56242704", "text": "func extract_params(f interface{},id *int) Params_struct {\n\n\tvar input_obj Params_struct\t\n\tm := f.(map[string]interface{})\n\tfor _, v := range m {\n\t switch vv := v.(type) {\n\t\tcase string: //for method. No need here to extract\n\t\t\tbreak\n\t\tcase int:break\t \n\t case []interface{}: //for Params field, key, relation,value\n\n\t\t\tif len(vv) >= 2 {\n\t\t\t\tinput_obj.Key = vv[0].(string)\n\t\t\t\tinput_obj.Rel = vv[1].(string)\n\t\t\t\tif len(vv) == 3 {\n\t\t\t\t\tinput_obj.Value = vv[2]\n\t\t\t\t}\n\t\t\t\t// if len(vv)==4{\n\t\t\t\t// \tinput_obj.Permission=vv[3]\n\t\t\t\t// }\n\t\t\t}\n\n\t default: //for ID\n\t \t\n\t }\n\t}\n\t return input_obj\n}", "title": "" }, { "docid": "d13c634501ab4efa176ee700ea617449", "score": "0.5618479", "text": "func (lup *ListUploadParam) GenParams() map[string]interface{} {\n\tparams := map[string]interface{}{\n\t\t\"prefix\": lup.Prefix,\n\t\t\"delimiter\": lup.Delimiter,\n\t\t\"encoding-type\": lup.EncodingType,\n\t\t\"max-uploads\": lup.MaxUploads,\n\t\t\"key-marker\": lup.KeyMarker,\n\t\t\"upload-id-marker\": lup.UploadIDMarker,\n\t}\n\n\tfor k, v := range params {\n\t\tif v == \"\" {\n\t\t\tdelete(params, k)\n\t\t}\n\n\t\tif v == 0 {\n\t\t\tdelete(params, k)\n\t\t}\n\t}\n\tparams[\"uploads\"] = \"\"\n\n\treturn params\n\n}", "title": "" }, { "docid": "013135eef7de5e8448bf089b48520b5a", "score": "0.56036997", "text": "func NewParams(key string) Params {\n\tret := Params{}\n\tparts := strings.Split(key, \",\")\n\tparts = parts[1 : len(parts)-1]\n\tfor _, s := range parts {\n\t\tpair := strings.Split(s, \"=\")\n\t\tret[pair[0]] = pair[1]\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "4fac849be3e21507fa63fd727fc3cc58", "score": "0.5576541", "text": "func (o *PhoneOptions) getParameters() (params map[string]string, err error) {\n\tparams = make(map[string]string)\n\tif o.Phone == \"\" {\n\t\treturn params, errors.New(\"to perform a search for a business by phone number, the phone property must be specified\")\n\t}\n\tparams[\"phone\"] = o.Phone\n\n\tif o.CC != \"\" {\n\t\tparams[\"cc\"] = o.CC\n\t}\n\n\tif o.Category != \"\" {\n\t\tparams[\"category\"] = o.Category\n\t}\n\n\treturn params, nil\n}", "title": "" }, { "docid": "4db294936d760bf50fe78ea21bec271d", "score": "0.55734086", "text": "func toMap(params []interface{}) map[string]interface{} {\n\tpar := make(map[string]interface{})\n\tif len(params) == 0 {\n\t\treturn par\n\t}\n\tif len(params)%2 != 0 {\n\t\tpanic(\"toMap: len(params) % 2 != 0\")\n\t}\n\tfor i := 0; i < len(params)/2; i++ {\n\t\tkey, ok := params[2*i].(string)\n\t\tif !ok {\n\t\t\tpanic(\"toMap: string expected\")\n\t\t}\n\t\tpar[key] = params[2*i+1]\n\t}\n\treturn par\n}", "title": "" }, { "docid": "04e7e26955ff526dfde06214ec7f9813", "score": "0.54958624", "text": "func (this *request) FormParams() map[string][]string {\n\tparams := make(map[string][]string)\n\tfor key, values := range this.queryParams {\n\t\tparams[key] = values[:]\n\t}\n\treturn params\n}", "title": "" }, { "docid": "a3d8f73cb31fc7abfd8d585f10f3a0db", "score": "0.5444143", "text": "func CreateParameters(src map[string]interface{}) Parameters {\n\tdst := make(map[string]interface{})\n\tfor k, v := range src {\n\t\tdst[k] = v\n\t}\n\treturn dst\n}", "title": "" }, { "docid": "5c48d6627838aeb3657c7e8d0291ebe8", "score": "0.5422453", "text": "func getParams(genericParams map[string]interface{}) (map[string]string, error) {\n\tparams := map[string]string{}\n\tfor key, value := range genericParams {\n\t\tstrVal, isString := value.(string)\n\t\tif !isString {\n\t\t\treturn nil, fmt.Errorf(\"expected string, saw %v for '%s'\", value, key)\n\t\t}\n\t\tparams[key] = strVal\n\t}\n\treturn params, nil\n}", "title": "" }, { "docid": "6dd3682b33c48bf02396e03ec6fe07fa", "score": "0.5421561", "text": "func QueryParams(m map[string][]string) *Query {\n\tp := new(Query)\n\tp.Sort = make([]string, 0, 2)\n\tp.Queries = make(Keymaps, 0, 2)\n\tp.Filters = make(Keymaps, 0, 2)\n\n\tfor key, params := range m {\n\t\tln := len(params[0])\n\t\tswitch key {\n\t\tcase \"sort\":\n\t\t\tidx := 0\n\t\t\tfor i := 0; i < ln; i++ {\n\t\t\t\tif params[0][i] == ',' || i == ln-1 {\n\t\t\t\t\tvar w string\n\t\t\t\t\tif i == ln-1 {\n\t\t\t\t\t\tw = params[0][idx:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tw = params[0][idx:i]\n\t\t\t\t\t}\n\t\t\t\t\tp.Sort = append(p.Sort, w)\n\t\t\t\t\tidx = i + 1\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"start\":\n\t\t\tts, err := time.Parse(\"1/2/2006\", params[0])\n\t\t\tif err == nil {\n\t\t\t\tp.Start = &ts\n\t\t\t}\n\t\tcase \"end\":\n\t\t\tts, err := time.Parse(\"1/2/2006\", params[0])\n\t\t\tif err == nil {\n\t\t\t\tp.End = &ts\n\t\t\t}\n\t\tcase \"include\":\n\t\t\tp.Include = params[0]\n\t\tcase \"limit\":\n\t\t\tp.Limit = strToInt(params[0])\n\t\tcase \"offset\":\n\t\t\tp.Offset = strToInt(params[0])\n\t\tcase \"format\":\n\t\t\tp.Format = params[0]\n\t\tdefault:\n\t\t\t// filtering\n\t\t\tif strings.HasPrefix(key, \"filter[\") {\n\t\t\t\tval := strings.TrimSuffix(strings.TrimPrefix(key, \"filter[\"), \"]\")\n\t\t\t\tp.Filters = append(p.Filters, Keymap{val, params[0]})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// search queries\n\t\t\tif strings.HasPrefix(key, \"query[\") {\n\t\t\t\tval := strings.TrimSuffix(strings.TrimPrefix(key, \"query[\"), \"]\")\n\t\t\t\tp.Queries = append(p.Queries, Keymap{val, params[0]})\n\t\t\t}\n\t\t}\n\t}\n\treturn p\n}", "title": "" }, { "docid": "ba20a774dd961a6c1e3833d5ea64139b", "score": "0.537177", "text": "func (this *request) QueryParams() map[string][]string {\n\tparams := make(map[string][]string)\n\tfor key, values := range this.queryParams {\n\t\tparams[key] = values[:]\n\t}\n\treturn params\n}", "title": "" }, { "docid": "ab0509742011323c06d5bf7ad82316ec", "score": "0.53689337", "text": "func addParams(u *url.URL, ps map[string][]string) {\n\tparams := url.Values{}\n\tfor k, v := range ps {\n\t\tparams.Add(k, strings.Join(v, \", \"))\n\t}\n\tu.RawQuery = params.Encode()\n}", "title": "" }, { "docid": "de145d3b963e996fa413d5847eb840d6", "score": "0.5361056", "text": "func BuildParams(requestPath string, params map[string]string) string {\n\turlParams := url.Values{}\n\tfor k := range params {\n\t\turlParams.Add(k, params[k])\n\t}\n\treturn requestPath + \"?\" + urlParams.Encode()\n}", "title": "" }, { "docid": "3b679e85bdafd5e94357ba6b7737ae85", "score": "0.52931076", "text": "func (sp *Scope) Params() (map[string]interface{}, error) {\n\tglobalparams := viper.GetStringMap(\"global\")\n\tlocalparams := viper.GetStringMap(sp.scopename)\n\tscope := make(map[string]interface{})\n\tscope = MergeMaps(scope, globalparams)\n\tscope = MergeMaps(scope, localparams)\n\tlog.Printf(\"global params from config:%s\\n\", globalparams)\n\tlog.Printf(\"local params from config:%s\\n\", localparams)\n\tlog.Printf(\"actual params from config:%s\\n\", scope)\n\tsp.parameters = scope\n\treturn scope, nil\n}", "title": "" }, { "docid": "addbbf44ca1a4a56e9602ebfda63e010", "score": "0.5270466", "text": "func addByNameParams(ps *param.PSet) error {\n\tps.AddGroup(paramGroupName, \"test parameters.\")\n\n\tps.Add(\"param1\", psetter.Int64{Value: &int64Val1},\n\t\t\"help text for param1\",\n\t\tparam.GroupName(paramGroupName),\n\t\tparam.AltNames(\"param1-alt1\"),\n\t\tparam.Attrs(param.CommandLineOnly),\n\t)\n\n\tps.Add(\"param2\", psetter.Int64{Value: &int64Val2},\n\t\t\"help text for param2.\\nWith an embedded new line and a lot of\"+\n\t\t\t\" text to demonstrate the behaviour when text is wrapped\"+\n\t\t\t\" across multiple lines\",\n\t\tparam.GroupName(paramGroupName),\n\t\tparam.AltNames(\"param2-alt2\"),\n\t\tparam.Attrs(param.MustBeSet),\n\t)\n\n\tps.Add(\"param3\", psetter.Float64{Value: &float64Val3},\n\t\t\"help...\",\n\t\tparam.GroupName(paramGroupName),\n\t\tparam.AltNames(\"p3\"),\n\t\tparam.Attrs(param.DontShowInStdUsage),\n\t)\n\n\tps.Add(\"param4\", psetter.Bool{Value: &boolVal4},\n\t\t\"help...\",\n\t\tparam.GroupName(paramGroupName),\n\t\tparam.Attrs(param.SetOnlyOnce),\n\t)\n\n\tps.Add(\"param5\", psetter.Enum{\n\t\tAllowedVals: psetter.AllowedVals{\n\t\t\t\"v1\": \"a value\",\n\t\t\t\"v2\": \"another value\",\n\t\t},\n\t\tValue: &str5,\n\t},\n\t\t\"help...\",\n\t\tparam.GroupName(paramGroupName),\n\t)\n\n\tps.Add(\"param6\", psetter.Enum{\n\t\tAllowedVals: psetter.AllowedVals{\n\t\t\t\"v1\": \"a value\",\n\t\t\t\"v2\": \"another value\",\n\t\t},\n\t\tValue: &str6,\n\t},\n\t\t\"help...\",\n\t\tparam.GroupName(paramGroupName),\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "9f7d8c676e3d1945ae320a03e0a41053", "score": "0.52500325", "text": "func buildUrlParams(conn *connector.HttpConnector, msg *message.Message) string {\n\tparams := strings.Split(conn.QueryParams(), \",\")\n\tvar bf bytes.Buffer\n\tfor _, param := range params {\n\t\tbf.WriteString(\"&\")\n\t\tbf.WriteString(param)\n\t\tbf.WriteString(\"=\")\n\t\tbf.WriteString(msg.Params[param])\n\t}\n\turl := conn.Url()\n\tif strings.ContainsAny(url, \"?\") {\n\t\treturn url + bf.String()\n\t} else {\n\t\treturn url + \"?\" + bf.String()[1:]\n\t}\n}", "title": "" }, { "docid": "0771d053512ebd1c069b98e1c170736e", "score": "0.5220444", "text": "func MakeSeriesParams(varLabel, varFmt string, varVals []float64, styles []string) []map[string]string {\n\tret := make([]map[string]string, len(varVals))\n\tfor i, val := range varVals {\n\t\tlabel := fmt.Sprintf(\"$%v=\"+varFmt+\"$\", varLabel, val)\n\t\tsp := make(map[string]string)\n\t\tsp[\"label\"] = label\n\t\tif i < len(styles) {\n\t\t\tsp[\"style\"] = styles[i]\n\t\t} else {\n\t\t\tsp[\"style\"] = styles[0]\n\t\t}\n\t\tret[i] = sp\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "c5b63afe87dfa0296877dac7007dce59", "score": "0.52065444", "text": "func (o *SearchOptions) getParameters() (params map[string]string, err error) {\r\n\r\n\t// ensure only one loc option provider is being used\r\n\tlocOptionsCnt := 0\r\n\tif o.LocationOptions != nil {\r\n\t\tlocOptionsCnt++\r\n\t}\r\n\tif o.CoordinateOptions != nil {\r\n\t\tlocOptionsCnt++\r\n\t}\r\n\tif o.BoundOptions != nil {\r\n\t\tlocOptionsCnt++\r\n\t}\r\n\r\n\tif locOptionsCnt == 0 {\r\n\t\treturn params, errors.New(\"a single location search options type (Location, Coordinate, Bound) must be used\")\r\n\t}\r\n\tif locOptionsCnt > 1 {\r\n\t\treturn params, errors.New(\"only a single location search options type (Location, Coordinate, Bound) can be used at a time\")\r\n\t}\r\n\r\n\t// create an empty map of options\r\n\tparams = make(map[string]string)\r\n\r\n\t// reflect over the properties in o, adding parameters to the global map\r\n\tval := reflect.ValueOf(o).Elem()\r\n\tfor i := 0; i < val.NumField(); i++ {\r\n\t\tif !val.Field(i).IsNil() {\r\n\t\t\to := val.Field(i).Interface().(OptionProvider)\r\n\t\t\tfieldParams, err := o.getParameters()\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn params, err\r\n\t\t\t}\r\n\t\t\tfor k, v := range fieldParams {\r\n\t\t\t\tparams[k] = v\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn params, nil\r\n}", "title": "" }, { "docid": "9cf31d249301ed4c0bc676cb5816bd9f", "score": "0.51889783", "text": "func (d *Dao) All(ctx context.Context) (m map[string][]*param.Param, err error) {\n\trows, err := d.get.Query(ctx)\n\tif err != nil {\n\t\tlog.Error(\"d.get error(%v)\", err)\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tm = map[string][]*param.Param{}\n\tvar _key = \"param_%d\"\n\tfor rows.Next() {\n\t\tp := &param.Param{}\n\t\tif err = rows.Scan(&p.Name, &p.Value, &p.Plat, &p.Build, &p.Condition); err != nil {\n\t\t\tlog.Error(\"row.Scan error(%v)\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tp.Change()\n\t\tkey := fmt.Sprintf(_key, p.Plat)\n\t\tm[key] = append(m[key], p)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d5b957e9b6b7a4ee3a74138e0392f3a9", "score": "0.5171169", "text": "func (f paramFiller) paramsStructList(value []interface{}, shape *Shape) string {\n\tout := f.typeName(shape) + \"{\\n\"\n\tfor _, v := range value {\n\t\tout += fmt.Sprintf(\"%s,\\n\", f.paramsStructAny(v, shape.MemberRef.Shape))\n\t}\n\tout += \"}\"\n\treturn out\n}", "title": "" }, { "docid": "ea2765f2dc1387da4a4686eb93b3bd00", "score": "0.51616395", "text": "func parsetag(v string) (string, map[string]string, []string) {\n\tvs := map[string]string{}\n\trs := []string{}\n\tnm := \"\"\n\n\tfor i, s := range strings.Split(v, \",\") {\n\t\tif i == 0 {\n\t\t\tnm = s\n\t\t\tcontinue\n\t\t}\n\t\tsp := strings.Split(s, \"=\")\n\t\tif c := len(sp); c == 1 {\n\t\t\trs = append(rs, nm)\n\t\t} else if c == 2 {\n\t\t\tvs[sp[0]] = sp[1]\n\t\t}\n\t}\n\treturn nm, vs, rs\n}", "title": "" }, { "docid": "1cc10fe9d4e5e34e0f83d905f134c08b", "score": "0.51340634", "text": "func (u UploadPicMaterialRequest) MultipartParams() map[string]io.Reader {\n\treturn map[string]io.Reader{\n\t\t\"material_file\": u.MaterialFile,\n\t}\n}", "title": "" }, { "docid": "c0d7074b95a8b6e9d56938c59d05c688", "score": "0.5121509", "text": "func Params(query map[string]any) Option {\n\treturn func(o *Options) {\n\t\tfor k, v := range query {\n\t\t\to.Params[k] = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ff9c6a62c1126cdecc41def9bc127ebe", "score": "0.5113367", "text": "func multiParamFunc(a, b int, c string) {\n\tfmt.Printf(\n\t\t\"Param 1: %d\\nParam 2: %d\\nParam 3: %s\", a, b, c)\n}", "title": "" }, { "docid": "cec72005930f1ef8036204b2da2da773", "score": "0.5112062", "text": "func toParams(u *core.Project) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"project_id\": u.ID,\n\t\t\"project_name\": u.Name,\n\t\t\"project_language\": u.Language,\n\t\t\"project_data_base\": u.DataBase,\n\t\t\"project_orm\": u.Orm,\n\t\t\"project_description\": u.Description,\n\t\t\"project_name_space\": u.NameSpace,\n\t\t\"project_created\": u.Created,\n\t\t\"project_updated\": u.Updated,\n\t}\n}", "title": "" }, { "docid": "2ec98e0d92f876733117c02f86204c7b", "score": "0.50963145", "text": "func BuildOrderParams(params map[string]string) string {\n\tvar keys []string\n\tfor k := range params {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\turlParams := url.Values{}\n\tfor k := range params {\n\t\turlParams.Add(k, params[k])\n\t}\n\treturn urlParams.Encode()\n}", "title": "" }, { "docid": "85bdf071e5c97fe4cc093244a836e5cf", "score": "0.50855327", "text": "func addSplitValsToMapParams(splitVals []string, info *Info, mapParams *MapParams) *MapParams {\n\tfor ii := 0; ii < len(splitVals); ii++ {\n\t\tif len(info.Params)-1 >= ii {\n\t\t\tif strings.HasPrefix(splitVals[ii], \"[\") {\n\t\t\t\tlookupSplits := funcLookupSplit(strings.TrimRight(strings.TrimLeft(splitVals[ii], \"[\"), \"]\"))\n\t\t\t\tfor _, v := range lookupSplits {\n\t\t\t\t\tmapParams.Add(info.Params[ii].Field, v)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmapParams.Add(info.Params[ii].Field, splitVals[ii])\n\t\t\t}\n\t\t}\n\t}\n\treturn mapParams\n}", "title": "" }, { "docid": "bca546faa91b2d1aebcd90365d469df6", "score": "0.5084388", "text": "func getStringParameters(buildings []etlpipeline.DBBuilding) [][]string {\n\tstringParams := [][]string{}\n\n\t//initialize the slices as empty slices\n\tgeomSources := []string{}\n\tfeatureCodes := []string{}\n\tlastStatusTypes := []string{}\n\n\t//add each value for that field to its respective array\n\tfor _, building := range buildings {\n\t\tgeomSources = append(geomSources, building.GeomSource)\n\t\tfeatureCodes = append(featureCodes, building.FeatCode)\n\t\tlastStatusTypes = append(lastStatusTypes, building.Lststatype)\n\t}\n\n\t//add the individual arrays to a 2d array for easy access\n\tstringParams = append(stringParams, geomSources, featureCodes, lastStatusTypes)\n\n\treturn stringParams\n}", "title": "" }, { "docid": "12892ed76b4799cbd654eccf896f669a", "score": "0.507506", "text": "func setParams(blockNumber string, verbose bool) []interface{} {\n\tparams := make([]interface{}, 2)\n\tparams[0] = blockNumber\n\tparams[1] = verbose\n\treturn params\n}", "title": "" }, { "docid": "dcd39aa3857fa0bbabcb1d106afdf6e6", "score": "0.5068864", "text": "func NewParams(serviceName string, config *config.Config, dc *dynamicconfig.Collection) (Params, error) {\n\tserviceConfig, err := config.GetServiceConfig(serviceName)\n\tif err != nil {\n\t\treturn Params{}, err\n\t}\n\n\tlistenIP, err := getListenIP(serviceConfig.RPC)\n\tif err != nil {\n\t\treturn Params{}, fmt.Errorf(\"get listen IP: %v\", err)\n\t}\n\n\tinboundTLS, err := serviceConfig.RPC.TLS.ToTLSConfig()\n\tif err != nil {\n\t\treturn Params{}, fmt.Errorf(\"inbound TLS config: %v\", err)\n\t}\n\toutboundTLS := map[string]*tls.Config{}\n\tfor _, outboundServiceName := range service.List {\n\t\toutboundServiceConfig, err := config.GetServiceConfig(outboundServiceName)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\toutboundTLS[outboundServiceName], err = outboundServiceConfig.RPC.TLS.ToTLSConfig()\n\t\tif err != nil {\n\t\t\treturn Params{}, fmt.Errorf(\"outbound %s TLS config: %v\", outboundServiceName, err)\n\t\t}\n\t}\n\n\tenableGRPCOutbound := dc.GetBoolProperty(dynamicconfig.EnableGRPCOutbound)()\n\n\tpublicClientOutbound, err := newPublicClientOutbound(config)\n\tif err != nil {\n\t\treturn Params{}, fmt.Errorf(\"public client outbound: %v\", err)\n\t}\n\n\tforwardingRules, err := getForwardingRules(dc)\n\tif err != nil {\n\t\treturn Params{}, err\n\t}\n\tif len(forwardingRules) == 0 {\n\t\t// not set, load from static config\n\t\tforwardingRules = config.HeaderForwardingRules\n\t}\n\tvar http *httpParams\n\n\tif serviceConfig.RPC.HTTP != nil {\n\t\tif serviceConfig.RPC.HTTP.Port <= 0 {\n\t\t\treturn Params{}, errors.New(\"HTTP port is not set\")\n\t\t}\n\t\tprocedureMap := map[string]struct{}{}\n\n\t\tfor _, v := range serviceConfig.RPC.HTTP.Procedures {\n\t\t\tprocedureMap[v] = struct{}{}\n\t\t}\n\n\t\thttp = &httpParams{\n\t\t\tAddress: net.JoinHostPort(listenIP.String(), strconv.Itoa(int(serviceConfig.RPC.HTTP.Port))),\n\t\t\tProcedures: procedureMap,\n\t\t}\n\n\t\tif serviceConfig.RPC.HTTP.TLS.Enabled {\n\t\t\thttptls, err := serviceConfig.RPC.HTTP.TLS.ToTLSConfig()\n\t\t\tif err != nil {\n\t\t\t\treturn Params{}, fmt.Errorf(\"creating TLS config for HTTP: %w\", err)\n\t\t\t}\n\n\t\t\thttp.TLS = httptls\n\t\t\thttp.Mode = serviceConfig.RPC.HTTP.TLSMode\n\t\t}\n\t}\n\n\treturn Params{\n\t\tServiceName: serviceName,\n\t\tHTTP: http,\n\t\tTChannelAddress: net.JoinHostPort(listenIP.String(), strconv.Itoa(int(serviceConfig.RPC.Port))),\n\t\tGRPCAddress: net.JoinHostPort(listenIP.String(), strconv.Itoa(int(serviceConfig.RPC.GRPCPort))),\n\t\tGRPCMaxMsgSize: serviceConfig.RPC.GRPCMaxMsgSize,\n\t\tOutboundsBuilder: CombineOutbounds(\n\t\t\tNewDirectOutbound(service.History, enableGRPCOutbound, outboundTLS[service.History]),\n\t\t\tNewDirectOutbound(service.Matching, enableGRPCOutbound, outboundTLS[service.Matching]),\n\t\t\tpublicClientOutbound,\n\t\t),\n\t\tInboundTLS: inboundTLS,\n\t\tOutboundTLS: outboundTLS,\n\t\tInboundMiddleware: yarpc.InboundMiddleware{\n\t\t\t// order matters: ForwardPartitionConfigMiddleware must be applied after ClientPartitionConfigMiddleware\n\t\t\tUnary: yarpc.UnaryInboundMiddleware(&InboundMetricsMiddleware{}, &ClientPartitionConfigMiddleware{}, &ForwardPartitionConfigMiddleware{}),\n\t\t},\n\t\tOutboundMiddleware: yarpc.OutboundMiddleware{\n\t\t\tUnary: yarpc.UnaryOutboundMiddleware(&HeaderForwardingMiddleware{\n\t\t\t\tRules: forwardingRules,\n\t\t\t}, &ForwardPartitionConfigMiddleware{}),\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "8bc3a530c4158ce53d7103175b200e66", "score": "0.5067014", "text": "func (apiSession *ApiSessionClass) UrlParams() map[string]string {\n\tvalues := make(map[string]string, 10)\n\n\tq := apiSession.request.URL.Query()\n\tif q != nil {\n\t\tfor k, v := range q {\n\t\t\tvalues[k] = strings.Join(v, \",\")\n\t\t}\n\t}\n\n\treturn values\n}", "title": "" }, { "docid": "1fd4eb8524cf50726733eca2b10e9c3a", "score": "0.50606054", "text": "func createParamString(params map[string]string) string {\n\tb := new(bytes.Buffer)\n\tfor key, value := range params {\n\t\tfmt.Fprintf(b, \"%s=%s&\", key, value)\n\t}\n\treturn strings.TrimSuffix(b.String(), \"&\")\n}", "title": "" }, { "docid": "4f6480c74b0534a36e2c9033a4b1b707", "score": "0.5046275", "text": "func (g *Generator) ParseParameters(i interface{}) (string, []ParamObj) {\n\tv := reflect.ValueOf(i)\n\n\tif v.Kind() == reflect.Ptr {\n\t\tv = v.Elem()\n\t}\n\n\t// Parameters are only parsed from struct.\n\tif v.Kind() != reflect.Struct {\n\t\treturn \"\", nil\n\t}\n\n\tt := v.Type()\n\n\tif mappedTo, ok := g.getMappedType(t); ok {\n\t\treturn g.ParseParameters(mappedTo)\n\t}\n\n\trequestTypeName := refl.GoType(v.Type())\n\tname := t.Name()\n\tnumField := t.NumField()\n\tparams := make([]ParamObj, 0, numField)\n\n\tfilesFound := map[string]bool{}\n\n\tfor i := 0; i < numField; i++ {\n\t\tfield := t.Field(i)\n\t\t// we can't access the value of un-exportable fields\n\t\tif field.PkgPath != \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif field.Anonymous && field.Tag.Get(\"in\") != \"body\" {\n\t\t\tanonValue := reflect.New(field.Type).Interface()\n\t\t\t_, anonParams := g.ParseParameters(anonValue)\n\t\t\tparams = append(params, anonParams...)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tvar (\n\t\t\tnameTag string\n\t\t\tin string\n\t\t)\n\n\t\tif tagIn := field.Tag.Get(\"in\"); tagIn != \"\" {\n\t\t\tif tagName := field.Tag.Get(\"name\"); tagName != \"\" {\n\t\t\t\tnameTag = tagName\n\t\t\t\tin = tagIn\n\t\t\t}\n\t\t}\n\n\t\tif in == \"\" {\n\t\t\tfor _, tag := range []string{\"path\", \"query\", \"header\", \"formData\", \"cookie\", \"file\"} {\n\t\t\t\ttagValue := field.Tag.Get(tag)\n\t\t\t\tif tagValue != \"\" && tagValue != \"-\" {\n\t\t\t\t\tnameTag = tagValue\n\t\t\t\t\tin = tag\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif in == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif in == \"file\" {\n\t\t\tin = \"formData\"\n\t\t}\n\n\t\tparamName := strings.Split(nameTag, \",\")[0]\n\t\tparam := ParamObj{}\n\n\t\tif def, ok := swaggerData(reflect.Zero(field.Type).Interface()); ok {\n\t\t\tparam = def.Param()\n\t\t} else {\n\t\t\tvar schemaObj SchemaObj\n\t\t\tfieldTypeName := refl.GoType(field.Type)\n\t\t\tif fieldTypeName == \"*mime/multipart.FileHeader\" {\n\t\t\t\tschemaObj.Type = \"file\"\n\t\t\t} else {\n\t\t\t\tif mappedTo, ok := g.getMappedType(field.Type); ok {\n\t\t\t\t\tif def, ok := swaggerData(mappedTo); ok {\n\t\t\t\t\t\tschemaObj = def.Schema()\n\t\t\t\t\t\tif schemaObj.TypeName != \"\" {\n\t\t\t\t\t\t\tname = schemaObj.TypeName\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tschemaObj = g.genSchemaForType(reflect.TypeOf(mappedTo), \"\")\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tschemaObj = g.genSchemaForType(field.Type, \"\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif schemaObj.Type == \"\" {\n\t\t\t\tpanic(\"unsupported field \" + field.Name + \" of type \" + string(fieldTypeName) + \" in request of type \" + string(requestTypeName))\n\t\t\t}\n\n\t\t\tparam.CommonFields = schemaObj.CommonFields\n\n\t\t\tif schemaObj.Type == \"array\" && schemaObj.Items != nil {\n\t\t\t\tif schemaObj.Items.Ref != \"\" {\n\t\t\t\t\tfieldType := refl.DeepIndirect(field.Type)\n\t\t\t\t\tif fieldType.Kind() == reflect.Slice || fieldType.Kind() == reflect.Array {\n\t\t\t\t\t\tg.ParseDefinition(reflect.Zero(field.Type.Elem()).Interface())\n\n\t\t\t\t\t\tif def, ok := g.getDefinition(field.Type.Elem()); ok {\n\t\t\t\t\t\t\tschemaObj.Items = &def\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif schemaObj.Items.Ref != \"\" || schemaObj.Items.Type == \"array\" || schemaObj.Items.Type == \"object\" {\n\t\t\t\t\tpanic(\"unsupported array of struct or nested array in parameter: \" + fieldTypeName)\n\t\t\t\t}\n\n\t\t\t\tparam.Items = &ParamItemObj{}\n\t\t\t\tparam.Items.CommonFields = schemaObj.Items.CommonFields\n\t\t\t\tparam.Items.Title = \"\"\n\t\t\t\tparam.Items.Description = \"\"\n\t\t\t\tparam.CollectionFormat = \"multi\" // default for now\n\t\t\t}\n\t\t}\n\n\t\tif g.reflectGoTypes {\n\t\t\tparam.AddExtendedField(\"x-go-name\", field.Name)\n\t\t\tparam.AddExtendedField(\"x-go-type\", refl.GoType(field.Type))\n\t\t}\n\n\t\tparam.Name = paramName\n\n\t\tparam.Enum.LoadFromField(field)\n\t\treadSharedTags(field.Tag, &param.CommonFields)\n\t\treadStringTag(field.Tag, \"collectionFormat\", &param.CollectionFormat)\n\n\t\tif in == \"path\" { // always true for path\n\t\t\tparam.Required = true\n\t\t} else if in != \"body\" { // always unset for body\n\t\t\t// not required by default for others\n\t\t\treadBoolTag(field.Tag, \"required\", &param.Required)\n\t\t}\n\n\t\tparam.In = in\n\t\tif param.Type == \"file\" {\n\t\t\tif filesFound[param.Name] {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tfilesFound[param.Name] = true\n\t\t\t}\n\t\t}\n\n\t\tparams = append(params, param)\n\t}\n\n\treturn name, params\n}", "title": "" }, { "docid": "e0dc192d2eb94b63011775c3045a0a9c", "score": "0.50449926", "text": "func (f paramFiller) paramsStructMap(value map[string]interface{}, shape *Shape) string {\n\tout := f.typeName(shape) + \"{\\n\"\n\tkeys := util.SortedKeys(value)\n\tfor _, k := range keys {\n\t\tv := value[k]\n\t\tout += fmt.Sprintf(\"%q: %s,\\n\", k, f.paramsStructAny(v, shape.ValueRef.Shape))\n\t}\n\tout += \"}\"\n\treturn out\n}", "title": "" }, { "docid": "af32e2846972aa56998ec1a82095df3b", "score": "0.50393975", "text": "func ParseParams(params []string) (map[string]string, error) {\n\tparsedParams := make(map[string]string)\n\tfor _, p := range params {\n\t\tr := strings.SplitN(p, \"=\", 2)\n\t\tif len(r) != 2 {\n\t\t\treturn nil, errors.New(invalidParam + p)\n\t\t}\n\t\tparsedParams[r[0]] = r[1]\n\t}\n\treturn parsedParams, nil\n}", "title": "" }, { "docid": "9bddb9e17fcf417fa1524528a1e18abd", "score": "0.5034885", "text": "func parserParams(fields []*ast.Field) (params []*param) {\n\tfor _, field := range fields {\n\t\tp := &param{}\n\t\tp.V = parseType(field.Type)\n\t\tif field.Names == nil {\n\t\t\tparams = append(params, p)\n\t\t}\n\t\tfor _, name := range field.Names {\n\t\t\tsp := &param{}\n\t\t\tsp.K = name.Name\n\t\t\tsp.V = p.V\n\t\t\tsp.P = p.P\n\t\t\tparams = append(params, sp)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c1db33c6501fee5aca209d4db598c634", "score": "0.5033165", "text": "func getNumberParameters(buildings []etlpipeline.DBBuilding) [][]float64 {\n\tnumberParams := [][]float64{}\n\n\t//initialize the slices as empty slices\n\theights := []float64{}\n\tshapeLengths := []float64{}\n\tshapeAreas := []float64{}\n\tgroundElevations := []float64{}\n\tconstructYears := []float64{}\n\n\t//add each value for that field to its respective array\n\tfor _, building := range buildings {\n\t\theights = append(heights, building.HeightRoof)\n\t\tshapeLengths = append(shapeLengths, building.ShapeLen)\n\t\tshapeAreas = append(shapeAreas, building.ShapeArea)\n\t\tgroundElevations = append(groundElevations, building.GroundElev)\n\t\tconstructYears = append(constructYears, building.ConstructYear)\n\t}\n\n\t//add the individual arrays to a 2d array for easy access\n\tnumberParams = append(numberParams, heights, shapeLengths, shapeAreas, groundElevations, constructYears)\n\n\treturn numberParams\n}", "title": "" }, { "docid": "2863b494d95d377b4acd5fb34c5cf8d3", "score": "0.502939", "text": "func (p ParamSet) AddParamsFromKey(key string) {\n\tparts := strings.Split(key, \",\")\n\tparts = parts[1 : len(parts)-1]\n\tfor _, s := range parts {\n\t\tpair := strings.Split(s, \"=\")\n\t\tparams := p[pair[0]]\n\t\tif !util.In(pair[1], params) {\n\t\t\tp[pair[0]] = append(params, pair[1])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "59159598f825fa69314b81cf47497ee2", "score": "0.5019128", "text": "func CreateParamList(funcv reflect.Value, params []interface{}) ([]reflect.Value, error) {\n\tfunct := funcv.Type()\n\tnumParams := funct.NumIn()\n\tif len(params) != numParams {\n\t\treturn nil, errors.New(\"wrong number of parameters\")\n\t}\n\tresults := make([]reflect.Value, numParams)\n\tfor i := 0; i < numParams; i++ {\n\t\tparamType := funct.In(i)\n\t\tparamValue := reflect.New(paramType)\n\t\tparam := paramValue.Interface()\n\t\tconfig := mapstructure.DecoderConfig{\n\t\t\tDecodeHook: DecodeBytesAsString,\n\t\t\tResult: param,\n\t\t}\n\t\tdecoder, err := mapstructure.NewDecoder(&config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = decoder.Decode(params[i])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresults[i] = paramValue.Elem()\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "4c27e93d9a9f5e2e4661a288e17fc5eb", "score": "0.501585", "text": "func getPathParamMap(c *gin.Context) map[string]string {\n\tpm := make(map[string]string)\n\tfor _, p := range c.Params {\n\t\tpm[p.Key] = p.Value\n\t}\n\treturn pm\n}", "title": "" }, { "docid": "1f0dd3c21c19024a2fcb7ef9dcc7ee73", "score": "0.5015321", "text": "func (r *request) parseParams() {\n\ttext := r.rawParams\n\tr.rawParams = nil\n\tfor len(text) > 0 {\n\t\tkeyLen, n := readSize(text)\n\t\tif n == 0 {\n\t\t\treturn\n\t\t}\n\t\ttext = text[n:]\n\t\tvalLen, n := readSize(text)\n\t\tif n == 0 {\n\t\t\treturn\n\t\t}\n\t\ttext = text[n:]\n\t\tif int(keyLen)+int(valLen) > len(text) {\n\t\t\treturn\n\t\t}\n\t\tkey := readString(text, keyLen)\n\t\ttext = text[keyLen:]\n\t\tval := readString(text, valLen)\n\t\ttext = text[valLen:]\n\t\tr.params[key] = val\n\t}\n}", "title": "" }, { "docid": "97632953d1536da60c9840faafbd265f", "score": "0.49951285", "text": "func parseFieldParameters(str string) (params fieldParameters) {\n\tfor _, part := range strings.Split(str, \",\") {\n\t\tswitch {\n\t\tcase part == \"optional\":\n\t\t\tparams.optional = true\n\t\tcase part == \"sizeExt\":\n\t\t\tparams.sizeExtensible = true\n\t\tcase part == \"valueExt\":\n\t\t\tparams.valueExtensible = true\n\t\tcase strings.HasPrefix(part, \"sizeLB:\"):\n\t\t\ti, err := strconv.ParseInt(part[7:], 10, 64)\n\t\t\tif err == nil {\n\t\t\t\tparams.sizeLowerBound = new(int64)\n\t\t\t\t*params.sizeLowerBound = i\n\t\t\t}\n\t\tcase strings.HasPrefix(part, \"sizeUB:\"):\n\t\t\ti, err := strconv.ParseInt(part[7:], 10, 64)\n\t\t\tif err == nil {\n\t\t\t\tparams.sizeUpperBound = new(int64)\n\t\t\t\t*params.sizeUpperBound = i\n\t\t\t}\n\t\tcase strings.HasPrefix(part, \"valueLB:\"):\n\t\t\ti, err := strconv.ParseInt(part[8:], 10, 64)\n\t\t\tif err == nil {\n\t\t\t\tparams.valueLowerBound = new(int64)\n\t\t\t\t*params.valueLowerBound = i\n\t\t\t}\n\t\tcase strings.HasPrefix(part, \"valueUB:\"):\n\t\t\ti, err := strconv.ParseInt(part[8:], 10, 64)\n\t\t\tif err == nil {\n\t\t\t\tparams.valueUpperBound = new(int64)\n\t\t\t\t*params.valueUpperBound = i\n\t\t\t}\n\t\tcase strings.HasPrefix(part, \"default:\"):\n\t\t\ti, err := strconv.ParseInt(part[8:], 10, 64)\n\t\t\tif err == nil {\n\t\t\t\tparams.defaultValue = new(int64)\n\t\t\t\t*params.defaultValue = i\n\t\t\t}\n\t\tcase part == \"openType\":\n\t\t\tparams.openType = true\n\t\tcase strings.HasPrefix(part, \"referenceFieldName:\"):\n\t\t\tparams.referenceFieldName = part[19:]\n\t\tcase strings.HasPrefix(part, \"referenceFieldValue:\"):\n\t\t\ti, err := strconv.ParseInt(part[20:], 10, 64)\n\t\t\tif err == nil {\n\t\t\t\tparams.referenceFieldValue = new(int64)\n\t\t\t\t*params.referenceFieldValue = i\n\t\t\t}\n\t\t}\n\t}\n\treturn params\n}", "title": "" }, { "docid": "535abd77eaab4d97bc6441b4320e5251", "score": "0.49920842", "text": "func (c Client) ParamValues(param string) []string {\n resp, err := http.Get(c.BaseURL + \"/get_param_values/\" +\n \"?key=\" + c.Key +\n \"&param=\" + param)\n if err != nil {\n log.Fatal(err)\n }\n var data map[string][]string\n decoder := json.NewDecoder(resp.Body)\n err = decoder.Decode(&data)\n if err != nil {\n log.Fatal(err)\n }\n return data[param]\n}", "title": "" }, { "docid": "daf5ebff36b4e4938dc9370c81f259bc", "score": "0.49763203", "text": "func ParseParams(r *http.Request) map[string]string {\n\tr.ParseForm()\n\n\tret := make(map[string]string)\n\n\tfor k, v := range r.Form {\n\t\tif v != nil && len(v) > 0 {\n\t\t\tret[k] = v[0]\n\t\t} else {\n\t\t\tfmt.Printf(\"Warning: No parameter found for key '%v'\\n\", k)\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "80c949627ba47f8db9365dc2ab287d61", "score": "0.49714783", "text": "func genParamArgs(params []ParameterDefinition) string {\n\tif len(params) == 0 {\n\t\treturn \"\"\n\t}\n\tparts := make([]string, len(params))\n\tfor i, p := range params {\n\t\tparamName := p.GoVariableName()\n\t\tparts[i] = fmt.Sprintf(\"%s %s\", paramName, p.TypeDef())\n\t}\n\treturn \", \" + strings.Join(parts, \", \")\n}", "title": "" }, { "docid": "fc6ccebe2a6d730847b290f36174c2c6", "score": "0.49694973", "text": "func parseInput(input interface{}) map[string]interface{} {\n\ts := reflect.ValueOf(input)\n\tparams := make(map[string]interface{})\n\n\tfor i := 0; i < s.NumField(); i++ {\n\t\tcurr := s.Field(i).Interface()\n\t\ttag := fieldTag(reflect.TypeOf(input).FieldByIndex([]int{i}))\n\t\tif !isEmpty(curr) {\n\t\t\tparams[tag] = curr\n\t\t}\n\t}\n\treturn params\n}", "title": "" }, { "docid": "498783f41df3f129deec2a8dd689db46", "score": "0.49635872", "text": "func collectParameters(oauth1 OAuth1, r *gohttp.Request) map[string][]string {\n\t// Create two copies of the request body\n\t// Since r.Body is io.ReadCloser the body is empty after reading.\n\t// Need to replace r.Body after r.ParseForm() dumps the body contents\n\tbuf, _ := ioutil.ReadAll(r.Body)\n\toriginalBody := ioutil.NopCloser(bytes.NewBuffer(buf))\n\tcopyBody := ioutil.NopCloser(bytes.NewBuffer(buf))\n\tr.Body = originalBody\n\n\tparamMap := make(map[string][]string, 0)\n\t// get query and body params and URL encode keys and\n\t// values sort values after encoding\n\tr.ParseForm()\n\tfor paramKey, paramValues := range r.Form {\n\t\tencodedKey := encodeURI(paramKey)\n\t\tparamMap[encodedKey] = paramValues\n\n\t\t// Keys with multiple values require the values\n\t\t// to be sorted post-percent encoding\n\t\tfor valueIndex, value := range paramMap[encodedKey] {\n\t\t\tencodedValue := encodeURI(value)\n\t\t\tparamMap[encodedKey][valueIndex] = encodedValue\n\t\t}\n\t\tsort.Strings(paramMap[encodedKey])\n\t}\n\tr.Body = copyBody\n\n\t// these keys are already URL safe and don't need sorted(1 value)\n\tparamMap[oauthConsumerKey] = []string{encodeURI(oauth1.ConsumerKey)}\n\tparamMap[oauthNonce] = []string{encodeURI(oauth1.Nonce)}\n\tparamMap[oauthSignatureMethod] = []string{encodeURI(oauth1.SignatureMethod)}\n\tparamMap[oauthTimestamp] = []string{encodeURI(oauth1.TimeStamp)}\n\tparamMap[oauthToken] = []string{encodeURI(oauth1.Token)}\n\tparamMap[oauthVersion] = []string{encodeURI(oauth1.Version)}\n\n\treturn paramMap\n}", "title": "" }, { "docid": "b15facfed4aa53ed45de7f99e53e24d9", "score": "0.49614146", "text": "func (this *MagicDictionary) BuildDict(dict []string) {\n \n}", "title": "" }, { "docid": "d85313a5687a003a88a8266416d3fe9f", "score": "0.4959949", "text": "func fillInInfoParams(params map[string]string) {\n\tparams[\"BuildVersion\"] = BuildVersion\n\tparams[\"BuildTime\"] = BuildTime\n\tparams[\"BuildBranch\"] = BuildBranch\n\tparams[\"BuildCommit\"] = BuildCommit\n\tparams[\"UtilsVersion\"] = UtilsVersion\n}", "title": "" }, { "docid": "c582c53d7ada9871b29ea5e56ce0f740", "score": "0.49393246", "text": "func genParamNames(params []ParameterDefinition) string {\n\tif len(params) == 0 {\n\t\treturn \"\"\n\t}\n\tparts := make([]string, len(params))\n\tfor i, p := range params {\n\t\tparts[i] = p.GoVariableName()\n\t}\n\treturn \", \" + strings.Join(parts, \", \")\n}", "title": "" }, { "docid": "c018c91f532adda90736890c52c8092f", "score": "0.49380198", "text": "func buildArgs(prefix []string, argm map[string]string) []string {\n\tvar args []string\n\targs = append(args, prefix...)\n\tfor k, v := range argm {\n\t\tif v == \"\" {\n\t\t\targs = append(args, fmt.Sprintf(\"--%s\", k))\n\t\t\tcontinue\n\t\t}\n\n\t\targs = append(args, fmt.Sprintf(\"--%s=%s\", k, v))\n\t}\n\treturn args\n}", "title": "" }, { "docid": "ed8c81aa31c54b115254edf9972c9a7a", "score": "0.49356043", "text": "func generateParamDataValueMap(paramStringMap map[string][]string,\n\tparamNameMap map[string]string,\n\tparamTypeMap map[string]bindings.BindingType, paramsType ParamsType) (map[string]data.DataValue, []error) {\n\n\tparamValueMap := map[string]data.DataValue{}\n\n\tfor annotationName, valuelist := range paramStringMap {\n\n\t\t_, found := paramNameMap[annotationName]\n\t\tif !found {\n\t\t\t// The query name is not annotated, skip\n\t\t\tcontinue\n\n\t\t}\n\t\tname, ptype, errIn := findParamNameType(annotationName,\n\t\t\tparamNameMap,\n\t\t\tparamTypeMap)\n\n\t\tif errIn == nil {\n\t\t\tparamValueMap[name], errIn = convertRequestParamToDataValue(annotationName, valuelist, ptype, paramsType)\n\t\t}\n\t\tif errIn != nil {\n\t\t\treturn nil, errIn\n\t\t}\n\t}\n\treturn paramValueMap, nil\n}", "title": "" }, { "docid": "b9c5e0ad54c15000d2f3ef1a2f723370", "score": "0.4917843", "text": "func GetParameterMap(raw []string) (map[string]string, error) {\n\tvar errs []string\n\tparameters := make(map[string]string)\n\n\tfor _, a := range raw {\n\t\tkey, value, err := parseParameter(a)\n\t\tif err != nil {\n\t\t\terrs = append(errs, *err)\n\t\t\tcontinue\n\t\t}\n\t\tparameters[key] = value\n\t}\n\n\tif errs != nil {\n\t\treturn nil, errors.New(strings.Join(errs, \", \"))\n\t}\n\n\treturn parameters, nil\n}", "title": "" }, { "docid": "2a88fd5b8c70d78498a28137ef07a5d7", "score": "0.49163413", "text": "func doParams(params map[string]string) doOption {\n\tparamsCopy := make(map[string]string, len(params))\n\tfor k, v := range params {\n\t\tparamsCopy[k] = v\n\t}\n\treturn func(d *doSettings) {\n\t\td.params = paramsCopy\n\t}\n}", "title": "" }, { "docid": "3dfb7177a9ab7f3e1de74ceda09d3682", "score": "0.4910569", "text": "func (p Params) Add(b ...Params) {\n\tfor _, oneMap := range b {\n\t\tfor k, v := range oneMap {\n\t\t\tp[k] = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "da04e8525d59d3cdb928057e01557ab8", "score": "0.4910193", "text": "func (p *Params) calcValues() Values {\n\tnumParams := len(p.Query) + len(p.Form) + len(p.Path)\n\n\t// If there were no params, return an empty map.\n\tif numParams == 0 {\n\t\treturn make(Values, 0)\n\t}\n\n\t// Copy everything into the same map.\n\tvalues := make(Values, numParams)\n\tfor k, v := range p.Query {\n\t\tvalues.Append(k, splitValues(v, \",\")...)\n\t}\n\tfor k, v := range p.Form {\n\t\tvalues.Append(k, v...)\n\t}\n\tfor k, v := range p.Path {\n\t\tvalues.Append(k, splitValues(v, \",\")...)\n\t}\n\treturn values\n}", "title": "" }, { "docid": "20886aa351d192b508a7dea827475b79", "score": "0.49047342", "text": "func (s *server) extractURLParams(master, slave string) map[string]string {\n\tvar res = map[string]string{}\n\tmasterArr := strings.Split(master, \"/\")\n\tslaveArr := strings.Split(slave, \"/\")\n\tfor i, str := range masterArr {\n\t\tif strings.Contains(str, \":\") {\n\t\t\t// to compare if be mistake in arr\n\t\t\t// FIXME : may cause error on master or slave size difference\n\t\t\tres[strings.ReplaceAll(str, \":\", \"\")] = slaveArr[i]\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "6816de842fcb0f8b1f2cd8d1cff62fb7", "score": "0.48935917", "text": "func (o BoundOptions) getParameters() (params map[string]string, err error) {\n\treturn map[string]string{\n\t\t\"bounds\": fmt.Sprintf(\"%v,%v|%v,%v\",\n\t\t\to.SwLatitude,\n\t\t\to.SwLongitude,\n\t\t\to.NeLatitude,\n\t\t\to.NeLongitude,\n\t\t),\n\t}, nil\n}", "title": "" }, { "docid": "1ebe6a067844a6ad632257c330cabc41", "score": "0.4882992", "text": "func (req *BasicRequest) Params() map[string]string {\n\treturn req.params\n}", "title": "" }, { "docid": "eb7ad2c3f6004fb263b8c01ac0e751dc", "score": "0.48702335", "text": "func GenSwitchkeysRescalingParams(Q, P []uint64) (params []uint64) {\n\n\tparams = make([]uint64, len(Q))\n\n\tPBig := ring.NewUint(1)\n\tfor _, pj := range P {\n\t\tPBig.Mul(PBig, ring.NewUint(pj))\n\t}\n\n\ttmp := ring.NewUint(0)\n\n\tfor i := 0; i < len(Q); i++ {\n\n\t\tparams[i] = tmp.Mod(PBig, ring.NewUint(Q[i])).Uint64()\n\t\tparams[i] = ring.ModExp(params[i], int(Q[i]-2), Q[i])\n\t\tparams[i] = ring.MForm(params[i], Q[i], ring.BRedParams(Q[i]))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6587e1ecc845ec413220125f4042ee29", "score": "0.48658177", "text": "func parseReqParameters(req *plugin.CodeGeneratorRequest) {\n\tif req.Parameter != nil {\n\t\tfor _, p := range strings.Split(req.GetParameter(), \",\") {\n\t\t\tspec := strings.SplitN(p, \"=\", 2)\n\t\t\tif len(spec) == 1 {\n\t\t\t\tif err := flag.CommandLine.Set(spec[0], \"\"); err != nil {\n\t\t\t\t\tlog.Fatalf(\"Cannot set flag %s\", p)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tname, value := spec[0], spec[1]\n\t\t\tif err := flag.CommandLine.Set(name, value); err != nil {\n\t\t\t\tlog.Fatalf(\"Cannot set flag %s\", p)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7f064d6909822a40488dbf250e02682d", "score": "0.48604026", "text": "func (g *Generator) LoadParams() {\n\tfor _, v := range strings.Split(g.Request.GetParameter(), \",\") {\n\t\tif i := strings.Index(v, \"=\"); i < 0 {\n\t\t\tg.Params[v] = \"true\"\n\t\t} else {\n\t\t\tg.Params[v[0:i]] = v[i+1:]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f9a771ed976ced42c2b10538291fcb00", "score": "0.4838827", "text": "func parseParams(inputParams string) (out ArgonParams, err error) {\n\t// expected format: m=65536,t=2,p=4\n\tpart := strings.Split(inputParams, \",\")\n\n\tmem, err := strconv.Atoi(strings.TrimPrefix(part[0], \"m=\"))\n\tif err != nil {\n\t\treturn out, ErrParseMemory\n\t}\n\ttimeCost, err := strconv.Atoi(strings.TrimPrefix(part[1], \"t=\"))\n\tif err != nil {\n\t\treturn out, ErrParseTime\n\t}\n\tparallelism, err := strconv.Atoi(strings.TrimPrefix(part[2], \"p=\"))\n\tif err != nil {\n\t\treturn out, ErrParseParallelism\n\t}\n\tout.Memory = uint32(mem)\n\tout.Time = uint32(timeCost)\n\tout.Parallelism = uint8(parallelism)\n\n\treturn out, err\n}", "title": "" }, { "docid": "da6b4df011903d2f767d4f8581e5e513", "score": "0.4835513", "text": "func (cmd Command) Params() [][]ParamInfo {\n\tparams := make([][]ParamInfo, len(cmd.v))\n\tfor index, runnable := range cmd.v {\n\t\telem := runnable.Elem()\n\t\tfor i := 0; i < elem.NumField(); i++ {\n\t\t\tfieldType := elem.Type().Field(i)\n\t\t\tparams[index] = append(params[index], ParamInfo{\n\t\t\t\tName: name(fieldType),\n\t\t\t\tValue: reflect.New(elem.Field(i).Type()).Elem().Interface(),\n\t\t\t\tOptional: optional(fieldType),\n\t\t\t\tSuffix: suffix(fieldType),\n\t\t\t})\n\t\t}\n\t}\n\treturn params\n}", "title": "" }, { "docid": "f2cc497d10acd68278f3c7f251b69e7e", "score": "0.4831836", "text": "func addParams(lhs, rhs url.Values) url.Values {\n\tfor key := range rhs {\n\t\tif lhs.Get(key) != \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tlhs.Set(key, rhs.Get(key))\n\t}\n\treturn lhs\n}", "title": "" }, { "docid": "eda620043d6c101c777e2538f1e15dfa", "score": "0.483096", "text": "func (rps *RequestParams) Parse(params map[string][]string) error {\r\n\tfor name, rp := range *rps {\r\n\t\tp, ok := params[name]\r\n\t\tif !ok && !rp.Optional {\r\n\t\t\treturn fmt.Errorf(\"Не задан обязательный параметр запроса '%s'\", name)\r\n\t\t}\r\n\r\n\t\tif !ok {\r\n\t\t\trp.Value.Type = Nil\r\n\t\t\t(*rps)[name] = rp\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\trp.Value.Type = rp.Type\r\n\t\terr := rp.Value.Parse(p[0])\r\n\t\t(*rps)[name] = rp\r\n\t\tif err != nil {\r\n\t\t\terr = fmt.Errorf(\"Значение параметра '%s' не удается распознать (%v)\", name, err)\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "9eb1ba439845803ee2b6bfedabac8a31", "score": "0.48297906", "text": "func BuildAPIV1Params(requestPath string, params map[string]string, config Config) string {\n\tparams[\"api_key\"] = config.ApiKey\n\tsortParams := BuildOrderParams(params)\n\tpreMd5Params := sortParams + \"&secret_key=\" + config.SecretKey\n\tmd5Sign := Md5Signer(preMd5Params)\n\trequestParams := sortParams + \"&sign=\" + strings.ToUpper(md5Sign)\n\treturn requestPath + \"?\" + requestParams\n}", "title": "" }, { "docid": "089d2d6e09964e9099f97dad472181b9", "score": "0.48243994", "text": "func buildParameters(columns int, rows int) string {\n\tvar parametersSQL string\n\tqs := \"(\"\n\tfor i := 0; i < columns; i++ {\n\t\tif i > 0 {\n\t\t\tqs += \",\"\n\t\t}\n\t\tqs += \"?\"\n\t}\n\tqs += \")\"\n\t// append as many (?,?) parts as there are objects to insert\n\tfor i := 0; i < rows; i++ {\n\t\tif i > 0 {\n\t\t\tparametersSQL += \",\"\n\t\t}\n\t\tparametersSQL += qs\n\t}\n\treturn parametersSQL\n}", "title": "" }, { "docid": "a42b0eb9db917960aa58d4aab8fedc29", "score": "0.48143598", "text": "func (s *Session) commonParams() (url.Values, error) {\n\tdtsg, err := s.fetchDTSG()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treqParams := url.Values{}\n\treqParams.Add(\"__a\", \"1\")\n\treqParams.Add(\"__af\", \"o\")\n\treqParams.Add(\"__be\", \"-1\")\n\treqParams.Add(\"__pc\", \"EXP1:messengerdotcom_pkg\")\n\treqParams.Add(\"__req\", \"14\")\n\treqParams.Add(\"__rev\", \"2643465\")\n\treqParams.Add(\"__srp_t\", \"1477432416\")\n\treqParams.Add(\"__user\", s.userID)\n\treqParams.Add(\"client\", \"mercury\")\n\treqParams.Add(\"fb_dtsg\", dtsg)\n\n\treturn reqParams, nil\n}", "title": "" }, { "docid": "a2da248356223503456a2a6d96b085bd", "score": "0.48134378", "text": "func (q *query) params() func(url.Values) {\n\treturn func(v url.Values) {\n\t\tif q.fromID != nil {\n\t\t\tparam(\"fromId\", *q.fromID)(v)\n\t\t}\n\n\t\tif q.startTime != nil {\n\t\t\tparam(\"startTime\", q.startTime.UnixNano()/1000000)(v)\n\t\t}\n\n\t\tif q.endTime != nil {\n\t\t\tparam(\"endTime\", q.endTime.UnixNano()/1000000)(v)\n\t\t}\n\n\t\tif q.limit != nil {\n\t\t\tparam(\"limit\", *q.limit)(v)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31d0ff6b44f84b5c1929ceeb23f54477", "score": "0.4808219", "text": "func buildQueryString(params map[string]interface{}) string {\n\tqueryString := \"\"\n\n\t// Create a sorted list of the query parameter field names...\n\tkeys := func() []string {\n\t\tkeys := []string{}\n\t\tfor key, _ := range params {\n\t\t\tkeys = append(keys, key)\n\t\t}\n\t\tsort.Strings(keys)\n\t\treturn keys\n\t}()\n\n\t// Build the query string.\n\tfor _, key := range keys {\n\t\tif queryString != \"\" {\n\t\t\tqueryString = fmt.Sprintf(\"%s&\", queryString)\n\t\t}\n\t\tqueryString = fmt.Sprintf(\"%s%s=%v\", queryString, key, params[key])\n\t}\n\n\treturn queryString\n}", "title": "" }, { "docid": "26673636c4805e13ae14ef52a6390580", "score": "0.48021454", "text": "func (u UploadPicMaterialRequest) Params() map[string]string {\n\treturn map[string]string{\n\t\t\"material_type\": strconv.Itoa(u.MaterialType),\n\t}\n}", "title": "" }, { "docid": "f96d20f2984f338fc4e11e54617c255d", "score": "0.47999105", "text": "func cmdParams(params ...proto.Message) []interface{} {\n\tif len(params) == 0 {\n\t\treturn []interface{}{}\n\t}\n\tm := &jsonpb.Marshaler{\n\t\tOrigName: true,\n\t}\n\tjsparams := make([]interface{}, len(params))\n\tfor i, p := range params {\n\t\tjsparams[i] = &jsProtoMessage{\n\t\t\tMessage: p,\n\t\t\tm: m,\n\t\t}\n\t}\n\treturn jsparams\n}", "title": "" }, { "docid": "e81ff35aede591e81175e72d3581130e", "score": "0.47868654", "text": "func (q Parameters) validate(p Definitions) (Parameters, error) {\n\tout := make(map[string]string, len(q.m))\n\n\tfor k, v := range q.m {\n\t\tparamType, ok := p.m[k]\n\t\tif !ok {\n\t\t\treturn q, fmt.Errorf(\"Parameters contains key %q that is not defined in the Stmt's Parameters\", k)\n\t\t}\n\t\tswitch paramType.Type {\n\t\tcase types.Bool:\n\t\t\tb, ok := v.(bool)\n\t\t\tif !ok {\n\t\t\t\treturn q, fmt.Errorf(\"Parameters[%s](bool) = %T, which is not a bool\", k, v)\n\t\t\t}\n\t\t\tif b {\n\t\t\t\tout[k] = \"bool(true)\"\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tout[k] = \"bool(false)\"\n\t\tcase types.DateTime:\n\t\t\tt, ok := v.(time.Time)\n\t\t\tif !ok {\n\t\t\t\treturn q, fmt.Errorf(\"Parameters[%s](datetime) = %T, which is not a time.Time\", k, v)\n\t\t\t}\n\t\t\tout[k] = fmt.Sprintf(\"datetime(%s)\", t.Format(time.RFC3339Nano))\n\t\tcase types.Dynamic:\n\t\t\tb, err := json.Marshal(v)\n\t\t\tif err != nil {\n\t\t\t\treturn q, fmt.Errorf(\"Parameters[%s](dynamic), %T could not be marshalled into JSON, err: %s\", k, v, err)\n\t\t\t}\n\t\t\tout[k] = fmt.Sprintf(\"dynamic(%s)\", string(b))\n\t\tcase types.GUID:\n\t\t\tu, ok := v.(uuid.UUID)\n\t\t\tif !ok {\n\t\t\t\treturn q, fmt.Errorf(\"Parameters[%s](guid) = %T, which is not a uuid.UUID\", k, v)\n\t\t\t}\n\t\t\tout[k] = fmt.Sprintf(\"guid(%s)\", u.String())\n\t\tcase types.Int:\n\t\t\ti, ok := v.(int32)\n\t\t\tif !ok {\n\t\t\t\treturn q, fmt.Errorf(\"Parameters[%s](int) = %T, which is not an int32\", k, v)\n\t\t\t}\n\t\t\tout[k] = fmt.Sprintf(\"int(%d)\", i)\n\t\tcase types.Long:\n\t\t\ti, ok := v.(int64)\n\t\t\tif !ok {\n\t\t\t\treturn q, fmt.Errorf(\"Parameters[%s](long) = %T, which is not an int64\", k, v)\n\t\t\t}\n\t\t\tout[k] = fmt.Sprintf(\"long(%d)\", i)\n\t\tcase types.Real:\n\t\t\ti, ok := v.(float64)\n\t\t\tif !ok {\n\t\t\t\treturn q, fmt.Errorf(\"Parameters[%s](real) = %T, which is not a float64\", k, v)\n\t\t\t}\n\t\t\tout[k] = fmt.Sprintf(\"real(%f)\", i)\n\t\tcase types.String:\n\t\t\ts, ok := v.(string)\n\t\t\tif !ok {\n\t\t\t\treturn q, fmt.Errorf(\"Parameters[%s](string) = %T, which is not a string\", k, v)\n\t\t\t}\n\t\t\tout[k] = fmt.Sprint(s)\n\t\tcase types.Timespan:\n\t\t\td, ok := v.(time.Duration)\n\t\t\tif !ok {\n\t\t\t\treturn q, fmt.Errorf(\"parameters[%s](timespan) = %T, which is not a time.Duration\", k, v)\n\t\t\t}\n\t\t\tout[k] = fmt.Sprintf(\"timespan(%s)\", value.Timespan{Value: d, Valid: true}.Marshal())\n\t\tcase types.Decimal:\n\t\t\tvar sval string\n\t\t\tswitch v := v.(type) {\n\t\t\tcase string:\n\t\t\t\tsval = v\n\t\t\tcase *big.Float:\n\t\t\t\tsval = v.String()\n\t\t\tcase *big.Int:\n\t\t\t\tsval = v.String()\n\t\t\tdefault:\n\t\t\t\treturn q, fmt.Errorf(\"Parameters[%s](decimal) = %T, which is not a string or *big.Float\", k, v)\n\t\t\t}\n\t\t\tout[k] = fmt.Sprintf(\"decimal(%s)\", sval)\n\t\t}\n\t}\n\tq.outM = out\n\treturn q, nil\n}", "title": "" }, { "docid": "279b472680e0a786f5e5d97c9157f391", "score": "0.47839412", "text": "func (tr *ConsumerGroup) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "title": "" }, { "docid": "528191b270cf3d95fa589960e610a45c", "score": "0.47661614", "text": "func MarshalParams(p Params) ([]byte, error) {\n\tswitch p := p.(type) {\n\tcase *bb1params:\n\t\tret := make([]byte, 0, headerSize+marshaledBB1ParamsSize)\n\t\t// g and gHat are the generators, do not need to be marshaled.\n\t\tfor _, field := range [][]byte{\n\t\t\twriteHeader(typeBB1Params),\n\t\t\tp.g1.Marshal(),\n\t\t\tp.h.Marshal(),\n\t\t\tp.g1Hat.Marshal(),\n\t\t\tp.hHat.Marshal(),\n\t\t\tp.v.Marshal(),\n\t\t} {\n\t\t\tret = append(ret, field...)\n\t\t}\n\t\treturn ret, nil\n\tcase *bb2params:\n\t\tret := make([]byte, 0, headerSize+marshaledBB2ParamsSize)\n\t\tfor _, field := range [][]byte{\n\t\t\twriteHeader(typeBB2Params),\n\t\t\tp.X.Marshal(),\n\t\t\tp.Y.Marshal(),\n\t\t\tp.v.Marshal(),\n\t\t} {\n\t\t\tret = append(ret, field...)\n\t\t}\n\t\treturn ret, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"MarshalParams for %T for implemented yet\", p)\n\t}\n}", "title": "" }, { "docid": "342c0d077be9c845d63047384267f17c", "score": "0.47596106", "text": "func (r *Request) ParseParams() {\n\tr.parseParamsOnce.Do(func() {\n\t\tif r.Request.Form == nil || r.Request.MultipartForm == nil {\n\t\t\tr.Request.ParseMultipartForm(32 << 20)\n\t\t}\n\n\t\tfor n, vs := range r.Request.Form {\n\t\t\tpvs := make([]*RequestParamValue, 0, len(vs))\n\t\t\tfor _, v := range vs {\n\t\t\t\tpvs = append(pvs, &RequestParamValue{\n\t\t\t\t\ti: v,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif r.Params[n] == nil {\n\t\t\t\tr.Params[n] = &RequestParam{\n\t\t\t\t\tName: n,\n\t\t\t\t\tValues: pvs,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tr.Params[n].Values = append(\n\t\t\t\t\tr.Params[n].Values,\n\t\t\t\t\tpvs...,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tif r.Request.MultipartForm != nil {\n\t\t\tfor n, vs := range r.Request.MultipartForm.Value {\n\t\t\t\tpvs := make([]*RequestParamValue, 0, len(vs))\n\t\t\t\tfor _, v := range vs {\n\t\t\t\t\tpvs = append(pvs, &RequestParamValue{\n\t\t\t\t\t\ti: v,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tif r.Params[n] == nil {\n\t\t\t\t\tr.Params[n] = &RequestParam{\n\t\t\t\t\t\tName: n,\n\t\t\t\t\t\tValues: pvs,\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tr.Params[n].Values = append(\n\t\t\t\t\t\tr.Params[n].Values,\n\t\t\t\t\t\tpvs...,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor n, vs := range r.Request.MultipartForm.File {\n\t\t\t\tpvs := make([]*RequestParamValue, 0, len(vs))\n\t\t\t\tfor _, v := range vs {\n\t\t\t\t\tpvs = append(pvs, &RequestParamValue{\n\t\t\t\t\t\ti: v,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tif r.Params[n] == nil {\n\t\t\t\t\tr.Params[n] = &RequestParam{\n\t\t\t\t\t\tName: n,\n\t\t\t\t\t\tValues: pvs,\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tr.Params[n].Values = append(\n\t\t\t\t\t\tr.Params[n].Values,\n\t\t\t\t\t\tpvs...,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "5ae97ae6b9d340d167b54b62c7c9eea5", "score": "0.4758628", "text": "func getParametersFromSsmParameterStore(s ISsmParameterService, parametersToFetch []string) (map[string]SsmParameterInfo, error) {\n\n\toutputMap := make(map[string]SsmParameterInfo)\n\n\tvar totalParams = len(parametersToFetch)\n\tvar startPos = 0\n\tfor totalParams > 0 {\n\n\t\tvar paramsBatch []string\n\n\t\tvar count = 0\n\t\tfor i := startPos; i < len(parametersToFetch) && count < maxParametersRetrievedFromSsm; i++ {\n\t\t\tparamsBatch = append(paramsBatch, parametersToFetch[i])\n\n\t\t\ttotalParams--\n\t\t\tcount++\n\t\t\tstartPos++\n\t\t}\n\n\t\tresults, err := s.callGetParameters(paramsBatch)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor name, value := range results {\n\t\t\toutputMap[name] = value\n\t\t}\n\t}\n\n\treturn outputMap, nil\n}", "title": "" }, { "docid": "f8a06d3541c12e8f0b4d8faa77fa02d0", "score": "0.47559234", "text": "func (params *Params) ParamSetPairs() paramstypes.ParamSetPairs {\n\treturn paramstypes.ParamSetPairs{\n\t\tparamstypes.NewParamSetPair(NicknameLenParamsKey, &params.NicknameParams, ValidateNicknameParams),\n\t\tparamstypes.NewParamSetPair(DTagLenParamsKey, &params.DTagParams, ValidateDTagParams),\n\t\tparamstypes.NewParamSetPair(MaxBioLenParamsKey, &params.MaxBioLength, ValidateBioParams),\n\t}\n}", "title": "" }, { "docid": "52b7ae45cfd483241ba8719c2e375b3d", "score": "0.47527432", "text": "func (ck *HttpCheck) PutParams() map[string]string {\n\tm := map[string]string{\n\t\t\"name\": ck.Name,\n\t\t\"host\": ck.Hostname,\n\t\t\"resolution\": strconv.Itoa(ck.Resolution),\n\t\t\"paused\": strconv.FormatBool(ck.Paused),\n\t\t\"notifyagainevery\": strconv.Itoa(ck.NotifyAgainEvery),\n\t\t\"notifywhenbackup\": strconv.FormatBool(ck.NotifyWhenBackup),\n\t\t\"url\": ck.Url,\n\t\t\"encryption\": strconv.FormatBool(ck.Encryption),\n\t\t\"postdata\": ck.PostData,\n\t\t\"integrationids\": intListToCDString(ck.IntegrationIds),\n\t\t\"tags\": ck.Tags,\n\t\t\"probe_filters\": ck.ProbeFilters,\n\t\t\"userids\": intListToCDString(ck.UserIds),\n\t\t\"teamids\": intListToCDString(ck.TeamIds),\n\t}\n\n\t// Ignore zero values\n\tif ck.Port != 0 {\n\t\tm[\"port\"] = strconv.Itoa(ck.Port)\n\t}\n\n\tif ck.SendNotificationWhenDown != 0 {\n\t\tm[\"sendnotificationwhendown\"] = strconv.Itoa(ck.SendNotificationWhenDown)\n\t}\n\n\tif ck.ResponseTimeThreshold != 0 {\n\t\tm[\"responsetime_threshold\"] = strconv.Itoa(ck.ResponseTimeThreshold)\n\t}\n\n\tif ck.VerifyCertificate != nil {\n\t\tm[\"verify_certificate\"] = strconv.FormatBool(*ck.VerifyCertificate)\n\t}\n\n\tif ck.SSLDownDaysBefore != nil {\n\t\tm[\"ssl_down_days_before\"] = strconv.Itoa(*ck.SSLDownDaysBefore)\n\t}\n\n\t// ShouldContain and ShouldNotContain are mutually exclusive.\n\t// But we must define one so they can be emptied if required.\n\tif ck.ShouldContain != \"\" {\n\t\tm[\"shouldcontain\"] = ck.ShouldContain\n\t} else {\n\t\tm[\"shouldnotcontain\"] = ck.ShouldNotContain\n\t}\n\n\t// Convert auth\n\tif ck.Username != \"\" {\n\t\tm[\"auth\"] = fmt.Sprintf(\"%s:%s\", ck.Username, ck.Password)\n\t}\n\n\t// Convert headers\n\tvar headers []string\n\tfor k := range ck.RequestHeaders {\n\t\theaders = append(headers, k)\n\t}\n\tsort.Strings(headers)\n\tfor i, k := range headers {\n\t\tm[fmt.Sprintf(\"requestheader%d\", i)] = fmt.Sprintf(\"%s:%s\", k, ck.RequestHeaders[k])\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "598a802f4105e2ff4c5e8b5a2a645b96", "score": "0.47481024", "text": "func getParamSummaries(cluster []kmeans.Clusterable) map[string][]ValueWeight {\n\t// For each cluster member increment each parameters count.\n\t// map[key] map[value] count\n\tcounts := map[string]map[string]int{}\n\tclusterSize := float64(len(cluster))\n\t// First figure out what parameters and values appear in the cluster.\n\tfor _, o := range cluster {\n\t\tkey := o.(*ctrace2.ClusterableTrace).Key\n\t\tif key == ctrace2.CENTROID_KEY {\n\t\t\tcontinue\n\t\t}\n\t\tparams, err := query.ParseKey(key)\n\t\tif err != nil {\n\t\t\tsklog.Errorf(\"Invalid key found in Cluster: %s\", err)\n\t\t\tcontinue\n\t\t}\n\t\tfor k, v := range params {\n\t\t\tif v == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif _, ok := counts[k]; !ok {\n\t\t\t\tcounts[k] = map[string]int{}\n\t\t\t}\n\t\t\tcounts[k][v] += 1\n\t\t}\n\t}\n\t// Now calculate the weights for each parameter value. The weight of each\n\t// value is proportional to the number of times it appears on an observation\n\t// versus all other values for the same parameter.\n\tret := map[string][]ValueWeight{}\n\tfor key, count := range counts {\n\t\tweights := []ValueWeight{}\n\t\tfor value, weight := range count {\n\t\t\tweights = append(weights, ValueWeight{\n\t\t\t\tValue: value,\n\t\t\t\tWeight: int(14*float64(weight)/clusterSize) + 12,\n\t\t\t})\n\t\t}\n\t\tsort.Sort(ValueWeightSortable(weights))\n\t\tret[key] = weights\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "9c88d38e22b0df953641503b647d5ebb", "score": "0.4746598", "text": "func makeRPCArgs() (rpcArgs types.JsonRpcArgs, rpcParams types.JeedomRPCParams) {\n\tvar args types.JsonRpcArgs\n\tvar params types.JeedomRPCParams\n\targs.Jsonrpc = \"2.0\"\n\targs.ID = \"0\"\n\tparams.Apikey = config.Conf.JeedomConfig.APIKey\n\t//args.Params.Apikey = config.Conf.JeedomConfig.APIKey\n\n\treturn args, params\n}", "title": "" }, { "docid": "6265a120043b4deb0044ae32a26f7969", "score": "0.47438085", "text": "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "d8486fc450fc10884ae457cabb94545f", "score": "0.47395158", "text": "func (self *_SymbolRef) buildArgsFromParameters(\n\tctx context.Context, scope types.Scope) *ordereddict.Dict {\n\n\t// Not a function call - pass the scope as it is.\n\tif !self.Called {\n\t\treturn ordereddict.NewDict()\n\t}\n\n\tself.mu.Lock()\n\tparameters := self.Parameters\n\tself.mu.Unlock()\n\n\treturn buildArgsFromParameters(ctx, scope, parameters)\n}", "title": "" }, { "docid": "f16b253f16ab65043d03941b1985c26d", "score": "0.47296664", "text": "func PathParams(url string, urlTmpl string) (map[string]string, error) {\n\trv := map[string]string{}\n\tpmp := BuildParamMap(urlTmpl)\n\n\texpectedLen := len(strings.Split(strings.TrimRight(urlTmpl, \"/\"), \"/\"))\n\trecievedLen := len(strings.Split(strings.TrimRight(url, \"/\"), \"/\"))\n\tif expectedLen != recievedLen {\n\t\treturn nil, fmt.Errorf(\"expecting a path containing %d parts, provided path contains %d parts\", expectedLen, recievedLen)\n\t}\n\n\tparts := strings.Split(url, \"/\")\n\tfor k, v := range pmp {\n\t\trv[k] = parts[v]\n\t}\n\n\treturn rv, nil\n}", "title": "" }, { "docid": "e4af71fe345914bc1db78ff187d4fc46", "score": "0.47289065", "text": "func (p Pagination) toParams() map[string]string {\n\tparams := map[string]string{}\n\tif p.Limit > 0 {\n\t\tparams[\"limit\"] = strconv.Itoa(p.Limit)\n\t}\n\tif p.Offset > 0 {\n\t\tparams[\"offset\"] = strconv.Itoa(p.Offset)\n\t}\n\n\tif p.IncludeTotal {\n\t\tparams[\"include_total\"] = strconv.FormatBool(p.IncludeTotal)\n\t}\n\treturn params\n}", "title": "" }, { "docid": "57f0d289d41256c07946923a153d509d", "score": "0.4727076", "text": "func encodeParamseters(p Parameters) string {\n\tstr := \"\"\n\tfor k, v := range p {\n\t\tif v == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tstr = fmt.Sprintf(defaultFormat, str, k, v)\n\t}\n\n\treturn strings.TrimRight(str, defaultAnd)\n}", "title": "" }, { "docid": "49d778897ce918262fee8a1101d511f1", "score": "0.4724508", "text": "func GetBaseURIParameters(config CONFIGURATION) map[string]interface{} {\r\n kvpMap := map[string]interface{}{\r\n \"cluster_vip\": config.ClusterVip(),\r\n }\r\n return kvpMap;\r\n}", "title": "" }, { "docid": "e102e9d8aff167f981b5670caa61be1a", "score": "0.47204766", "text": "func generateAttrListForCopyObject(attributes *map[string]string) string {\n\tattributesList := make([]string, 0, len(*attributes))\n\tfor k, v := range *attributes {\n\t\tattributesList = append(attributesList, k+\":\"+v)\n\t}\n\tattributesParam := strings.Join(attributesList, \",\")\n\treturn attributesParam\n}", "title": "" }, { "docid": "58b6ef9c548bc41eb463f8e759ffdfd9", "score": "0.47181362", "text": "func (this validatorImpl) Params() map[string]interface{} {\n\treturn this.params\n}", "title": "" }, { "docid": "018f0bd2bdf06393070b6670ed6b0ee7", "score": "0.47179198", "text": "func encodeParams(params map[string]string) string {\n\n\tvalues := url.Values{}\n\n\tfor k, v := range params {\n\t\tif v != \"\" {\n\t\t\tvalues.Set(k, v)\n\t\t}\n\t}\n\n\treturn values.Encode()\n}", "title": "" }, { "docid": "4abb6ff86c615e2ec53e973cba73d424", "score": "0.4711077", "text": "func (p *Parser) setParams(fn *oop.Function, tokens *[]obj.Token) {\n\tbraceCount := 0\n\tinfo := paramSetInfo{\n\t\tparamName: true,\n\t\ttokens: tokens,\n\t\tfn: fn,\n\t}\n\tfor ; info.i < len(*tokens); info.i++ {\n\t\tinfo.token = (*tokens)[info.i]\n\t\tif info.token.Type == fract.Brace {\n\t\t\tswitch info.token.Val {\n\t\t\tcase \"{\", \"[\", \"(\":\n\t\t\t\tbraceCount++\n\t\t\tdefault:\n\t\t\t\tbraceCount--\n\t\t\t}\n\t\t}\n\t\tif braceCount > 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif info.paramName {\n\t\t\tdefineParam(&info)\n\t\t\tcontinue\n\t\t}\n\t\tinfo.paramName = true\n\t\t// Default value definition?\n\t\tif info.token.Val == \"=\" {\n\t\t\tp.defineDefaultParamValue(&info)\n\t\t\tcontinue\n\t\t}\n\t\tif info.param.DefaultVal.Data == nil && info.defaultDef {\n\t\t\tfract.IPanic(info.token, obj.SyntaxPanic,\n\t\t\t\t\"All parameters after a given parameter with a default value must take a default value!\")\n\t\t} else if info.token.Type != fract.Comma {\n\t\t\tfract.IPanic(info.token, obj.SyntaxPanic, \"Comma is not found!\")\n\t\t}\n\t}\n\tif info.param.DefaultVal.Data == nil && info.defaultDef {\n\t\tfract.IPanic((*tokens)[len(*tokens)-1], obj.SyntaxPanic,\n\t\t\t\"All parameters after a given parameter with a default value must take a default value!\")\n\t}\n}", "title": "" }, { "docid": "1d2545b074824a4a5b2c0a927beb2ab1", "score": "0.47083464", "text": "func NewParameters(initialLength ...int) Parameters {\n\ti := 0\n\tif len(initialLength) > 0 {\n\t\ti = initialLength[0]\n\t}\n\treturn &parameters{\n\t\tkeys: make([]string, 0, i),\n\t\tvalues: make([][]string, 0, i),\n\t}\n}", "title": "" }, { "docid": "85b778be81b895ce180f081c2a228fb5", "score": "0.47057107", "text": "func getpdtmParams() string {\n\tparams := &url.Values{}\n\tparams.Add(\"os\", runtime.GOOS)\n\tparams.Add(\"arch\", runtime.GOARCH)\n\tparams.Add(\"go_version\", runtime.Version())\n\tparams.Add(\"v\", config.Version)\n\treturn params.Encode()\n}", "title": "" }, { "docid": "878e96c5a32e156cc085b1a411295f8e", "score": "0.470081", "text": "func (G *global_data) SetParams(params map[string]string) *global_data {\n\tif G.Req.Params == nil {\n\t\tG.Req.Params = make(map[string]string)\n\t}\n\tfor key, value := range params {\n\t\tG.Req.Params[key] = value\n\t}\n\treturn G\n}", "title": "" }, { "docid": "536694dc3a6120ddcdf57bf0312a5aca", "score": "0.46959388", "text": "func (c *Ctx) AllParams() map[string]string {\n\tparams := make(map[string]string, len(c.route.Params))\n\tfor _, param := range c.route.Params {\n\t\tparams[param] = c.Params(param)\n\t}\n\n\treturn params\n}", "title": "" } ]
620fedb2bdddfb1a26cc6c79aa145687
/ Checks to see if a session is still valid. A session is valid if it has been used in less than the maximum expiry date;
[ { "docid": "4b65482a4d527621a9533def1c7283e5", "score": "0.5496274", "text": "func (s *SessionStorage) CheckSessions() {\n\tfmt.Printf(\"Starting session check...\\n\")\n\tfor {\n\t\tlenght := len(*s)\n\n\t\tfor i := 0; i < lenght; i++ {\n\t\t\tdif := time.Now().Unix() - (*s)[i].lastUsed\n\t\t\tif dif >= MAX_LIFE {\n\t\t\t\ts.RemoveSession((*s)[i].User)\n\t\t\t\tlenght--;\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(24 * time.Second)\n\t}\n}", "title": "" } ]
[ { "docid": "e9c60a9c2f6a5550a50884b054effa69", "score": "0.7476957", "text": "func (s *Session) Valid() bool {\n\n\tif time.Now().Sub(s.Expires) > 0 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "51b40b48086f6a4ad8adab4ca3fd90c2", "score": "0.73841953", "text": "func (s Session) Valid() bool {\n\treturn time.Now().Before(s.Expires)\n}", "title": "" }, { "docid": "3724288e5201e6308cf3d05a4c243e75", "score": "0.72007215", "text": "func (s *session) isValid() bool {\n\tif s.cookie != nil && time.Now().Before(s.expires) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "228519e57d105309d4d71f44ec7d15f0", "score": "0.7106777", "text": "func (s *Session) Expired() bool {\n\ts.RLock()\n\tdefer s.RUnlock()\n\treturn s.referenceID != \"\" && time.Since(s.lastAccess) >= SessionIDGracePeriod ||\n\t\ttime.Since(s.lastAccess) >= SessionExpiry &&\n\t\t\ttime.Since(s.created) >= SessionIDExpiry+SessionIDGracePeriod\n}", "title": "" }, { "docid": "467c14d5961e4353297c346a3efbe7d8", "score": "0.70071995", "text": "func validateSession(sessionID string) bool {\n\tif sessionID == \"\" {\n\t\treturn false\n\t}\n\tfor i, s := range sessions {\n\t\tif time.Now().After(s.ExpirationDate) { // remove sessions that have expired\n\t\t\tsessions = append(sessions[:i], sessions[i+1:]...)\n\t\t}\n\t\tif sessionID == s.SessionID {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b28d241fb74e626a2411cabe3838ec1e", "score": "0.6907406", "text": "func needExpiry(ctx context.Context, session *statepb.LoginSession) bool {\n\treturn session.State == loginsessionspb.LoginSession_PENDING &&\n\t\tclock.Now(ctx).After(session.Expiry.AsTime())\n}", "title": "" }, { "docid": "4d9cb8a52e0fc941dc95fec1f3fef2a3", "score": "0.6788748", "text": "func isExpired(validity time.Time) bool {\r\n\tvar timeDiff time.Duration\r\n\tcurrentDate := time.Now()\r\n\ttimeDiff = validity.Sub(currentDate)\r\n\tminsDiff := int(timeDiff.Minutes())\r\n\tif minsDiff > 1 {\r\n\t\treturn false\r\n\t}\r\n\treturn true\r\n}", "title": "" }, { "docid": "90489104ec79a5cde1b1a3529dbf4e1c", "score": "0.67688733", "text": "func (s *session) isValid() bool {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.valid\n}", "title": "" }, { "docid": "d968d076073352c78a1a2aec0c6120ad", "score": "0.6735638", "text": "func (self *LockWrapper) isSessionValid() bool {\n log.WithFields(log.Fields{\n \"session\": self.session.ID,\n }).Debug(\"validating session\")\n \n // validate session; returns nil if session is invalid\n session, _, err := self.consul.Session().Info(self.session.ID, nil)\n\n if err != nil {\n log.Fatalf(\"unable to retrieve session: %v\", err)\n }\n \n isValid := session != nil\n \n log.WithFields(log.Fields{\n \"session\": self.session.ID,\n }).Debugf(\"session is valid? %t\", isValid)\n \n return isValid\n}", "title": "" }, { "docid": "5b17b6a3ea880b3f681b563758d5ddb5", "score": "0.6675912", "text": "func TestLoginSystem_SessionIsValid_SessionTimedOut(t *testing.T) {\n\ttestee := LoginSystem{}\n\ttestee.currentSessions = make(map[string]inMemorySession)\n\n\ttoken := \"1234567899+op\"\n\t// Set last update of session to 12 minutes ago.\n\ttimestamp := time.Now().Add(time.Duration(-12) * time.Minute)\n\ttestee.currentSessions[token] = inMemorySession{userId: 1, userMail: \"testUser@test.de\",\n\t\tsessionToken: \"1234567899+op\", sessionTimestamp: timestamp}\n\n\tvalid, _, _, _, err := testee.SessionIsValid(token)\n\tassert.False(t, valid, \"Session should be invalid\")\n\tassert.Nil(t, err)\n}", "title": "" }, { "docid": "990c8260110d5e8af8df4b10dc36aff4", "score": "0.666656", "text": "func (session *Session) IsExpired() bool {\n\treturn dateutil.IsDateExpiredFromNow(session.ExpireTime)\n}", "title": "" }, { "docid": "c3a7e06ab5080048a28334115d75abad", "score": "0.6630445", "text": "func (sess *Session) IsExpired() bool {\n\treturn sess.expiry.Before(time.Now())\n}", "title": "" }, { "docid": "842b60f1918bb8a1f15e0e830ccee4ff", "score": "0.65796924", "text": "func (s *Session) IsExpired() bool {\n\tif !s.hasTicket || s.ticket == nil {\n\t\treturn true\n\t}\n\treturn s.ticket.ExpireTimestampMs < getTimestamp(time.Now())\n}", "title": "" }, { "docid": "df41b3ee3764a7664dbe08b6ce6ced3e", "score": "0.65563464", "text": "func IsSessionTooFresh(err error) bool {\n\treturn errors.Is(err, typedErrChecker{t: ErrSessionTooFresh})\n}", "title": "" }, { "docid": "aae4103e2c07e113438c316c38f5588d", "score": "0.6504101", "text": "func (s *Session) IsExpired() (expired bool) {\n\texpired = !(s != nil && time.Now().Before(s.Expires))\n\treturn\n}", "title": "" }, { "docid": "548b94b1ed825535f99b8b8f86e4fd36", "score": "0.6496575", "text": "func (u *Session) Expired() bool {\n\treturn time.Now().After(u.Expires)\n}", "title": "" }, { "docid": "29c8c592b2e3ba07231ec75dfa1dcc27", "score": "0.64291954", "text": "func (s *SessionState) IsExpired() bool {\n\tif s.ExpiresOn != nil && !s.ExpiresOn.IsZero() && s.ExpiresOn.Before(time.Now()) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e207de16a58006a8ad554b0b43e6f1c8", "score": "0.63362914", "text": "func Expire(w http.ResponseWriter, r *http.Request) bool {\r\n\tvar currentSession sessdetail\r\n\t//get sessionID\r\n\tcookie, _ := r.Cookie(envvar.CookieName())\r\n\tcurrentSession = Sess[cookie.Value] //get session detail\r\n\r\n\t//check expire/timeout\r\n\tif time.Since(currentSession.StartTime) > (timeoutMins * time.Minute) {\r\n\t\tlogger.Warning.Println(\"session expire : \" + currentSession.UserID)\r\n\r\n\t\t//clear session & cookie\r\n\t\tDelete(r)\r\n\t\treturn true\r\n\t}\r\n\treturn false\r\n}", "title": "" }, { "docid": "a0c72ad1b09d90705df403469bfba96f", "score": "0.6332502", "text": "func checkSession(sessionKey string) bool {\n\n\tfmt.Println(\"Checking Session...\")\n\n\tsession, err := mgo.Dial(\"localhost\")\n\tcheck(err)\n\tdefer session.Close()\n\n\tsession.SetMode(mgo.Monotonic, true)\n\tc := session.DB(\"test\").C(\"Sessions\")\n\n\tresult := sessionInfo{}\n\t_ = c.Find(bson.M{\"sessionkey\": sessionKey}).One(&result)\n\n\tif result.SessionKey != \"\" {\n\t\tfmt.Println(\"Session key exists.\")\n\t\telapsed := time.Since(result.LastSeen)\n\t\tif elapsed.Minutes() > sessionTimeout {\n\t\t\tfmt.Println(\"Session Inactive.\")\n\t\t\treturn false\n\t\t}\n\t\tfmt.Println(\"Session Active.\")\n\t\t//There was a session key, and it hasn't expired yet.\n\t\treturn true\n\n\t}\n\treturn false\n}", "title": "" }, { "docid": "08964f7f99dc126f4cf43741b45acb29", "score": "0.62018573", "text": "func IsValidSessionKey(username string, key string) bool {\n\tquery, err := db.Query(\"SELECT sessionkey, logintime FROM usersSession WHERE username = ?;\", username)\n\tcheckErr(\"Db query error in IsValidSessionKey()\", err)\n\t\n\tdeleteSession := false\n\tvalidSession := false\n\n\tvar sessionKey string\n\tvar loginTime time.Time\n\n\tfor query.Next() {\n\t\terr = query.Scan(&sessionKey, &loginTime)\n\t\tcheckErr(\"Query scan error IsValidSessionKey()\", err)\n\n\t\t// Allow a vaild session to be 6 hours long\n\t\t// There can be multiple sessions for the same user, therefore this loop will go\n\t\t// through the retrieved results from the database to check if the session key from\n\t\t// cookie is valid\n\t\tif time.Since(loginTime).Hours() <= 6 && key == sessionKey {\n\t\t\tvalidSession = true\n\t\t} else if key == sessionKey { // Session expired\n\t\t\tdeleteSession = true\n\t\t}\n\t}\n\n\tquery.Close()\n\n\tif deleteSession {\n\t\tDeleteSessionKey(sessionKey)\n\t}\n\n\treturn validSession\n}", "title": "" }, { "docid": "fa74a262bff0090b229141dd2ee9fbe4", "score": "0.6201659", "text": "func (p *sessionPool) isValid() bool {\n\tif p == nil {\n\t\treturn false\n\t}\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\treturn p.valid\n}", "title": "" }, { "docid": "d83fbfb379a570e3d1e6a216d0ce5726", "score": "0.6187452", "text": "func isExpired(ts int) bool {\n\n\tif time.Unix(int64(ts), 0).Add(options.AppSettings.RevocationCacheTTL).Before(time.Now()) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0c3745fe0078d13846d9e131235d864b", "score": "0.6147379", "text": "func (c *Channel) checkExpired() bool {\n\tttl := 30 // minutes\n\tsecs := time.Now().Unix()\n\n\treturn secs - c.StreamUrlCreatedAt > int64(ttl * 60)\n}", "title": "" }, { "docid": "bb9419b3b9f9ea1529c7eb6232646d37", "score": "0.61399883", "text": "func sessionIsAlive(r *http.Request) bool {\n\ts, ok := SessionGetValue(r, \"id\")\n\tif s < 1 || ok == false {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8d0db7f536441d09c12c42a717fe6bf3", "score": "0.611402", "text": "func TestLoginSystem_SessionIsValid_IsInValid(t *testing.T) {\n\ttestee := LoginSystem{}\n\ttestee.currentSessions = make(map[string]inMemorySession)\n\n\ttoken := \"1234567899+op\"\n\ttestee.currentSessions[token] = inMemorySession{userId: 1, userMail: \"testUser@test.de\",\n\t\tsessionToken: \"1234567899+op\", sessionTimestamp: time.Now()}\n\n\tvalid, _, _, _, err := testee.SessionIsValid(\"5698456\")\n\tassert.False(t, valid, \"Session should be invalid\")\n\tassert.Nil(t, err)\n}", "title": "" }, { "docid": "91712864add3b385e4cf18c5fe38597e", "score": "0.60557884", "text": "func hasExpired(expTime time.Time) bool {\n\tif time.Now().After(expTime) {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "81a7c072d9d12d33a4e62f7f4f03bae4", "score": "0.60480314", "text": "func (c *Controller) ttlExpired(wf *wfv1.Workflow) bool {\n\texpiresIn, ok := c.expiresIn(wf)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn expiresIn <= 0\n}", "title": "" }, { "docid": "8f8910e453fbdb8a9fabf3858f04716b", "score": "0.6035174", "text": "func checkIntervalExpired() bool {\n\n\tdms3libs.LogDebug(filepath.Base(dms3libs.GetFunctionName()))\n\n\tif time.Since(checkIntervalTimestamp).Seconds() >= float64(ServerConfig.Server.CheckInterval) {\n\t\tcheckIntervalTimestamp = time.Now()\n\t\treturn true\n\t}\n\n\treturn false\n\n}", "title": "" }, { "docid": "f3bf9423a428384f859175d414b91de0", "score": "0.6030384", "text": "func (at AccessToken) IsExpired() bool {\n\tnow := time.Now().UTC()\n\texpirationTime := time.Unix(at.Expires, 0)\n\tfmt.Println(expirationTime)\n\n\treturn expirationTime.Before(now)\n}", "title": "" }, { "docid": "932209d05f84fb4942301cf66fcd4f2c", "score": "0.6016306", "text": "func isExpired(expTime int64, logger *zap.SugaredLogger, execId string) (bool, error) {\n\ttm := time.Unix(expTime, 0)\n\tremainder := tm.Sub(time.Now())\n\tif remainder > 0 {\n\t\tlogger.Debugf(\"[%s] Token received is not expired\", execId)\n\t\treturn true, nil\n\t}\n\tlogger.Debugf(\"[%s] Token received is expired. Token expiry time is %s, while the system time is %s\",\n\t\texecId, tm, time.Now())\n\n\treturn false, nil\n}", "title": "" }, { "docid": "6a772d3559f24b1b45a6a7a9bfc3f4e3", "score": "0.5996757", "text": "func isValidSession(r *http.Request, app *data.App) (*data.Session, bool) {\n\t// get the session from the cookie\n\tcookie, err := r.Cookie(cookieName)\n\tif err != nil {\n\t\tlog.Info(\"Cannot find cookie from the request object\")\n\t\treturn nil, false\n\t}\n\n\t// find the session object by the uuid from the cookie\n\ts := &data.Session{Uuid: cookie.Value}\n\terr = app.FindSessionByUuid(s)\n\tif err != nil {\n\t\t// there was a problem in finding the session, hence invalid session\n\t\t// Log the error and return accordingly\n\t\tlog.Warn(\"Cannot find session by uuid:\", cookie.Value)\n\t\treturn nil, false\n\t} else {\n\t\treturn s, true\n\t}\n}", "title": "" }, { "docid": "eb80111eb01b00437ed246d7d6cbdd5d", "score": "0.59930956", "text": "func TestLoginSystem_SessionIsValid_IsValid(t *testing.T) {\n\ttestee := LoginSystem{}\n\ttestee.currentSessions = make(map[string]inMemorySession)\n\n\ttoken := \"1234567899+op\"\n\ttestee.currentSessions[token] = inMemorySession{userId: 1, userMail: \"testUser@test.de\",\n\t\tsessionToken: token, sessionTimestamp: time.Now()}\n\n\tvalid, _, _, _, err := testee.SessionIsValid(token)\n\tassert.True(t, valid, \"User should have a session for this test\")\n\tassert.Nil(t, err)\n}", "title": "" }, { "docid": "f301131a52e830286c92def5e6f38390", "score": "0.5992389", "text": "func updateExpiry(ctx context.Context, session *statepb.LoginSession) {\n\tif needExpiry(ctx, session) {\n\t\tsession.State = loginsessionspb.LoginSession_EXPIRED\n\t\tsession.Completed = timestamppb.New(clock.Now(ctx))\n\t}\n}", "title": "" }, { "docid": "3f616ec71c41b9e308a76e0fbe1baaa7", "score": "0.5973913", "text": "func (s *Standup) IsExpired(now time.Time) bool {\n\treturn s.Expires.Format(\"2006-01-02\") != getNextDaily(now.In(timezone)).Format(\"2006-01-02\")\n}", "title": "" }, { "docid": "f17ecd31c17bc1ecec5bf09219219c8c", "score": "0.59733135", "text": "func (payload *Payload) Valid() error {\n\tif time.Now().After(payload.ExpiredAt) {\n\t\treturn ErrExpiredToken\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5769c4cd3a4389c011baa277a09b7353", "score": "0.59637296", "text": "func ExampleLoginSystem_SessionIsValid() {\n\tloginSystem := LoginSystem{}\n\tloginSystem.currentSessions = make(map[string]inMemorySession)\n\n\ttoken := \"1234567899+op\"\n\tloginSystem.currentSessions[token] = inMemorySession{userId: 1, userMail: \"max.mustermann@mail.com\",\n\t\tuserRole: 1, sessionToken: token, sessionTimestamp: time.Now()}\n\n\tvalid, userId, userName, userRole, _ := loginSystem.SessionIsValid(token)\n\tfmt.Println(valid)\n\tfmt.Println(userId)\n\tfmt.Println(userName)\n\tfmt.Println(userRole)\n\t// Output:\n\t// true\n\t// 1\n\t// max.mustermann@mail.com\n\t// 1\n\n}", "title": "" }, { "docid": "baa382ac8fc23fb2aaf913dc7a13ac13", "score": "0.5958137", "text": "func (_PLCRVotingContract *PLCRVotingContractSession) IsExpired(_terminationDate *big.Int) (bool, error) {\n\treturn _PLCRVotingContract.Contract.IsExpired(&_PLCRVotingContract.CallOpts, _terminationDate)\n}", "title": "" }, { "docid": "7939df97ab451aff012eea12335e371d", "score": "0.592758", "text": "func refreshTokenIfTooCloseToExpiryTime(w http.ResponseWriter, claims *Claims) (bool, int) {\n\tvar timeLeft = time.Unix(claims.ExpiresAt, 0).Sub(time.Now())\n\texpireInseconds := int(timeLeft.Seconds())\n\tif expireInseconds > 30 { // or timeLeft > 30*time.Second\n\t\treturn false, expireInseconds\n\t}\n\treturn generateToken(w, claims), expireInseconds\n}", "title": "" }, { "docid": "afa7d6105cde9d6324ea37b78ec2f144", "score": "0.5922488", "text": "func GoodSession(r *http.Request) bool {\n\tstore, err := pgstore.NewPGStore(os.Getenv(\"PGURL\"), key)\n\tcheck(err)\n\tdefer store.Close()\n\n\tsession, err := store.Get(r, \"scheduler-session\")\n\tcheck(err)\n\n\t// Check if user is authenticated\n\tif auth, ok := session.Values[\"authenticated\"].(bool); !ok || !auth {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "df21406aa606c0b3ce9da4e1146cc3a4", "score": "0.591092", "text": "func (evpool *Pool) isExpired(height int64, time time.Time) bool {\n\tvar (\n\t\tparams = evpool.State().ConsensusParams.Evidence\n\t\tageDuration = evpool.State().LastBlockTime.Sub(time)\n\t\tageNumBlocks = evpool.State().LastBlockHeight - height\n\t)\n\treturn ageNumBlocks > params.MaxAgeNumBlocks &&\n\t\tageDuration > params.MaxAgeDuration\n}", "title": "" }, { "docid": "9a6d492d73f3e79d69d2a1597b66c5ad", "score": "0.58984286", "text": "func validSession (request *http.Request) (bool) {\n\tcookie, _ := request.Cookie(\"username\")\n\tif (cookie == nil) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "e880ee1d72db468985a6a58edc4cd464", "score": "0.588603", "text": "func (p *sessionPool) remove(s *session, isExpire bool) bool {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tif isExpire && (p.numOpened <= p.MinOpened || s.getIdleList() == nil) {\n\t\t// Don't expire session if the session is not in idle list (in use), or if number of open sessions is going below p.MinOpened.\n\t\treturn false\n\t}\n\tol := s.setIdleList(nil)\n\t// If the session is in the idlelist, remove it.\n\tif ol != nil {\n\t\t// Remove from whichever list it is in.\n\t\tp.idleList.Remove(ol)\n\t\tp.idleWriteList.Remove(ol)\n\t}\n\tif s.invalidate() {\n\t\t// Decrease the number of opened sessions.\n\t\tp.numOpened--\n\t\trecordStat(context.Background(), OpenSessionCount, int64(p.numOpened))\n\t\t// Broadcast that a session has been destroyed.\n\t\tclose(p.mayGetSession)\n\t\tp.mayGetSession = make(chan struct{})\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0614087c3acb379dede20286b6a48f2f", "score": "0.58734685", "text": "func checkSubtokenExpiration(t *internal.Subtoken, now int64) error {\n\tcreationTime := t.GetCreationTime()\n\tif creationTime <= 0 {\n\t\treturn fmt.Errorf(\"invalid 'creation_time' field: %d\", creationTime)\n\t}\n\tdur := int64(t.GetValidityDuration())\n\tif dur <= 0 {\n\t\treturn fmt.Errorf(\"invalid validity_duration: %d\", dur)\n\t}\n\tif creationTime >= now+allowedClockDriftSec {\n\t\treturn fmt.Errorf(\"token is not active yet (created at %d)\", creationTime)\n\t}\n\tif creationTime+dur < now {\n\t\treturn fmt.Errorf(\"token has expired %d sec ago\", now-(creationTime+dur))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9a2a8c05a8cb0bbee24bff7d2628e5b9", "score": "0.5854849", "text": "func validCookieExpires(t time.Time) bool {\n\t// IETF RFC 6265 Section 5.1.1.5, the year must not be less than 1601\n\treturn t.Year() >= 1601\n}", "title": "" }, { "docid": "1824f65cb9a914e2a9f9fd953ade60c9", "score": "0.5849302", "text": "func (s *session) Expiration() hlc.Timestamp { return s.exp }", "title": "" }, { "docid": "7a3fbf98f51dfa9a217a6fbb61d9e556", "score": "0.58487684", "text": "func (token *Token) IsExpire() bool {\n\tduration := time.Now().Sub(token.generateTime)\n\ttimes := duration.Minutes()\n\tif times >= 30 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "fabcc78488ffef2aa381114655f01d71", "score": "0.5835148", "text": "func (a *Auth) IsExpired() bool {\n\treturn a.Expire <= time.Now().Add(4*time.Hour).Unix() // 提前4小时过期,for renew auth\n}", "title": "" }, { "docid": "8fa214179eaa64799a8a6110886dbd36", "score": "0.5829817", "text": "func (e ExpiresVal) isExpired() bool {\n\tif e.Expires == 0 {\n\t\treturn false\n\t}\n\treturn e.ExpiresAt.Before(time.Now())\n}", "title": "" }, { "docid": "e41b0eb260da9e4d9b1df05a6f03b0ee", "score": "0.5819929", "text": "func (c *credential) isExpired() bool {\n\treturn time.Now().UTC().After(c.expiresAt.UTC())\n}", "title": "" }, { "docid": "831a332882bda6453d6cd4d64543ce1e", "score": "0.5816328", "text": "func (s *Service) ExpireSession(ctx context.Context, key string) error {\n\treturn nil\n}", "title": "" }, { "docid": "69d4c3a710558164d61917a83b75d065", "score": "0.5803286", "text": "func (_PLCRVotingContract *PLCRVotingContractCallerSession) IsExpired(_terminationDate *big.Int) (bool, error) {\n\treturn _PLCRVotingContract.Contract.IsExpired(&_PLCRVotingContract.CallOpts, _terminationDate)\n}", "title": "" }, { "docid": "83d9c33dc78bdac764cd47a1dc59ea6d", "score": "0.579243", "text": "func checkSubtokenExpiration(t *messages.Subtoken, now int64) error {\n\tif t.CreationTime <= 0 {\n\t\treturn fmt.Errorf(\"invalid 'creation_time' field: %d\", t.CreationTime)\n\t}\n\tdur := int64(t.ValidityDuration)\n\tif dur <= 0 {\n\t\treturn fmt.Errorf(\"invalid validity_duration: %d\", dur)\n\t}\n\tif t.CreationTime >= now+allowedClockDriftSec {\n\t\treturn fmt.Errorf(\"token is not active yet (created at %d)\", t.CreationTime)\n\t}\n\tif t.CreationTime+dur < now {\n\t\treturn fmt.Errorf(\"token has expired %d sec ago\", now-(t.CreationTime+dur))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "308118d321a1b486d792d47fa0d14a04", "score": "0.57841104", "text": "func (c RegisteredClaims) IsExpired(now time.Time) bool {\n\texpireAt := c.Exp.Time()\n\n\tif expireAt.IsZero() {\n\t\treturn false\n\t}\n\n\treturn expireAt.Before(now)\n}", "title": "" }, { "docid": "8c73eb1bc93cf43151b0a6775a2d579c", "score": "0.57840157", "text": "func (s *session) invalidate() bool {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tov := s.valid\n\ts.valid = false\n\treturn ov\n}", "title": "" }, { "docid": "baada732db1eda6457f9bb22f6b2ca94", "score": "0.5773738", "text": "func (m *item) expired() bool {\n\tif m.ttl == cm.INFINITY {\n\t\treturn false\n\t}\n\treturn time.Now().Sub(m.created) > m.ttl\n}", "title": "" }, { "docid": "0f76145d0021ab32fba9591c3c3d73f7", "score": "0.5770518", "text": "func (t *Token) Expired() bool {\n\treturn time.Now().Unix() >= (t.IssuedAt + TokenTimeout)\n}", "title": "" }, { "docid": "363f558605e13dfe66fdb72c5981259e", "score": "0.57615286", "text": "func (t *Tx) IsExpired(ct int64) bool {\n\tif t.Expiration <= ct {\n\t\treturn true\n\t}\n\tif ct-t.Time > MaxExpiration {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "eda2320d624bc80015b110c85ebb0f1b", "score": "0.57509714", "text": "func (p *AuthenticateClient) ValidateSessionState(s *sessions.SessionState) bool {\n\t// we validate the user's access token is valid\n\tparams := url.Values{}\n\tparams.Add(\"shared_secret\", p.SharedKey)\n\treq, err := p.newRequest(\"GET\", fmt.Sprintf(\"%s?%s\", p.ValidateURL.String(), params.Encode()), nil)\n\tif err != nil {\n\t\tlog.Error().Err(err).Str(\"user\", s.Email).Msg(\"proxy/authenticator.ValidateSessionState : error validating session state\")\n\t\treturn false\n\t}\n\treq.Header.Set(\"X-Client-Secret\", p.SharedKey)\n\treq.Header.Set(\"X-Access-Token\", s.AccessToken)\n\treq.Header.Set(\"X-Id-Token\", s.IDToken)\n\n\tresp, err := defaultHTTPClient.Do(req)\n\tif err != nil {\n\t\tlog.Error().Err(err).Str(\"user\", s.Email).Msg(\"proxy/authenticator.ValidateSessionState : error making request to validate access token\")\n\t\treturn false\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\t// When we detect that the auth provider is not explicitly denying\n\t\t// authentication, and is merely unavailable, we validate and continue\n\t\t// as normal during the \"grace period\"\n\t\tif isProviderUnavailable(resp.StatusCode) && p.withinGracePeriod(s) {\n\t\t\ts.ValidDeadline = extendDeadline(p.SessionValidTTL)\n\t\t\treturn true\n\t\t}\n\t\tlog.Info().Str(\"user\", s.Email).Int(\"status-code\", resp.StatusCode).Msg(\"proxy/authenticator.ValidateSessionState : could not validate user access token\")\n\n\t\treturn false\n\t}\n\n\ts.ValidDeadline = extendDeadline(p.SessionValidTTL)\n\ts.GracePeriodStart = time.Time{}\n\n\tlog.Info().Str(\"user\", s.Email).Msg(\"proxy/authenticator.ValidateSessionState : validated session\")\n\n\treturn true\n}", "title": "" }, { "docid": "42f2cf8dda762e662c4d10e3344e748b", "score": "0.57489616", "text": "func (t Token) IsExpired() bool {\n\treturn time.Now().Add(expirationTimeBufferDuration).After(t.Expiration)\n}", "title": "" }, { "docid": "6ad6c4ac51c1c52a543eef52d731b7ae", "score": "0.5747432", "text": "func (c *UserTokenClaims) Expired() bool {\n\td, ok := c.claims[\"exp\"]\n\tif !ok {\n\t\treturn true\n\t}\n\tnow := time.Now()\n\tds, _ := d.(string)\n\tdt, _ := strconv.Atoi(ds)\n\tt := time.Unix(int64(dt), 0)\n\treturn now.Equal(t) || now.After(t)\n}", "title": "" }, { "docid": "6ceb862ea71c8f430c6d06784ca3f0de", "score": "0.57191294", "text": "func (k *Kex) IsExpired() bool {\n\treturn time.Now().UTC().After(k.time.UTC().Add(\n\t\ttime.Duration(KexExpirySeconds) * time.Second))\n}", "title": "" }, { "docid": "1feb8e0bbd0dc9d64226dbffb52c9090", "score": "0.5715519", "text": "func (ev expireValue) isExpire(nowSec int64) bool {\n\tif ev.Expire == -1 {\n\t\treturn false\n\t}\n\treturn nowSec >= ev.Expire\n}", "title": "" }, { "docid": "0dedaed09531be59d8b2119aff2f01ee", "score": "0.5689001", "text": "func (module *AuthModuleCert) isCertExpirationValid(clientCert *x509.Certificate) bool {\n\tnow := time.Now()\n\treturn now.Before(clientCert.NotAfter) && now.After(clientCert.NotBefore)\n}", "title": "" }, { "docid": "0017c29a3e6879e93b6c58df3b31e800", "score": "0.5686486", "text": "func (e *element) IsExpired(now time.Time) bool {\n\treturn now.After(e.expiration)\n}", "title": "" }, { "docid": "3d88044706b89ad750895c8fd9f03b03", "score": "0.5683369", "text": "func (at *AccessToken) IsExpired() bool {\n\tnow := time.Now().UTC()\n\texpirationTime := time.Unix(at.Expires, 0)\n\treturn expirationTime.Before(now)\n}", "title": "" }, { "docid": "718ffaf989be042ebe56a921f010d7fe", "score": "0.56726986", "text": "func (this *awsCredentials) expired() bool {\n\tif this.Expiration.IsZero() {\n\t\t// Credentials with no expiration can't expire\n\t\treturn false\n\t}\n\texpireTime := this.Expiration.Add(-4 * time.Minute)\n\n\t// if t - 4 mins is before now, true\n\tif expireTime.Before(time.Now()) {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "56c9151bf27fe8828eecbc440cf422d7", "score": "0.5667996", "text": "func (c *ChessGame) Expired() bool {\n\tif c.Status == \"new\" && c.CreatedAt.Time.Before(time.Now().Add(time.Second*-15)) {\n\t\tif c.WhiteConn != nil && GS.connections[c.WhiteConn] {\n\t\t\tc.WhiteConn.SendGameExpired()\n\t\t}\n\t\tif c.BlackConn != nil && GS.connections[c.BlackConn] {\n\t\t\tc.BlackConn.SendGameExpired()\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d97f8899e40c37e72bf63c41c637ccd3", "score": "0.56678504", "text": "func IsExpired(targetDate time.Time, timeAdded time.Duration) bool {\n\treturn time.Since(targetDate.Add(timeAdded)) > 0\n}", "title": "" }, { "docid": "79fb1cae4a8f0a978039408bb673c1f8", "score": "0.5667563", "text": "func validAtTime(token, key, userID string, now time.Time) bool {\n // Decode the token.\n data, err := base64.URLEncoding.DecodeString(token)\n if err != nil {\n return false\n }\n\n // Extract the issue time of the token.\n sep := bytes.LastIndex(data, []byte{':'})\n if sep < 0 {\n return false\n }\n nanos, err := strconv.ParseInt(string(data[sep+1:]), 10, 64)\n if err != nil {\n return false\n }\n issueTime := time.Unix(0, nanos)\n\n // Check that the token is not expired.\n if now.Sub(issueTime) >= timeout {\n return false\n }\n\n // Check that the token is not from the future.\n // Allow 1 minute grace period in case the token is being verified on a\n // machine whose clock is behind the machine that issued the token.\n if issueTime.After(now.Add(1 * time.Minute)) {\n return false\n }\n\n // Check that the token matches the expected value.\n expected := generateAtTime(key, userID, issueTime)\n return token == expected\n}", "title": "" }, { "docid": "b454ce1e07b72d4d3968e79060deb56d", "score": "0.5666819", "text": "func validateExpiration(rt Runtime, activation, expiration abi.ChainEpoch, sealProof abi.RegisteredSealProof) {\n\t// Expiration must be after activation. Check this explicitly to avoid an underflow below.\n\tif expiration <= activation {\n\t\trt.Abortf(exitcode.ErrIllegalArgument, \"sector expiration %v must be after activation (%v)\", expiration, activation)\n\t}\n\t// expiration cannot be less than minimum after activation\n\tif expiration-activation < MinSectorExpiration {\n\t\trt.Abortf(exitcode.ErrIllegalArgument, \"invalid expiration %d, total sector lifetime (%d) must exceed %d after activation %d\",\n\t\t\texpiration, expiration-activation, MinSectorExpiration, activation)\n\t}\n\n\t// expiration cannot exceed MaxSectorExpirationExtension from now\n\tif expiration > rt.CurrEpoch()+MaxSectorExpirationExtension {\n\t\trt.Abortf(exitcode.ErrIllegalArgument, \"invalid expiration %d, cannot be more than %d past current epoch %d\",\n\t\t\texpiration, MaxSectorExpirationExtension, rt.CurrEpoch())\n\t}\n\n\t// total sector lifetime cannot exceed SectorMaximumLifetime for the sector's seal proof\n\tmaxLifetime, err := builtin.SealProofSectorMaximumLifetime(sealProof)\n\tbuiltin.RequireNoErr(rt, err, exitcode.ErrIllegalArgument, \"unrecognized seal proof type %d\", sealProof)\n\tif expiration-activation > maxLifetime {\n\t\trt.Abortf(exitcode.ErrIllegalArgument, \"invalid expiration %d, total sector lifetime (%d) cannot exceed %d after activation %d\",\n\t\t\texpiration, expiration-activation, maxLifetime, activation)\n\t}\n}", "title": "" }, { "docid": "983f0ff879ce2494cf9d39aa44c418ce", "score": "0.56565684", "text": "func (r *Reservation) Expired() bool {\n\treturn r.tomb.Err() != tomb.ErrStillAlive\n}", "title": "" }, { "docid": "bf1a070955cd8fca82f3ae3977aa298f", "score": "0.56519586", "text": "func (dao *sessionDao) deleteSessionByMaxLifeTime(maxLifeTime int64) (int64, error) {\n\tsqlStr := fmt.Sprintf(\"DELETE FROM %s WHERE last_active<=?\", dao.tableName)\n\tlastTime := time.Now().Unix() - maxLifeTime\n\treturn dao.execute(sqlStr, lastTime)\n}", "title": "" }, { "docid": "2f1c33c711edaba277089a962643854b", "score": "0.56471175", "text": "func (e *Expiry) IsExpired() bool {\n\tcurTime := e.CurrentTime\n\tif curTime == nil {\n\t\tcurTime = time.Now\n\t}\n\treturn e.expiration.Before(curTime())\n}", "title": "" }, { "docid": "63ed5fd8428929204e3c901f569918ba", "score": "0.5627414", "text": "func (ima *InMemoryAPIKeyAccess) IsValid(apiKey string) derrors.Error {\n\tima.Lock()\n\tdefer ima.Unlock()\n\texpire, exists := ima.token[apiKey]\n\tif exists {\n\t\tif expire >= time.Now().Unix() {\n\t\t\treturn nil\n\t\t} else {\n\t\t\t// Expire the token\n\t\t\tdelete(ima.token, apiKey)\n\t\t}\n\t}\n\treturn derrors.NewUnauthenticatedError(\"invalid token\")\n}", "title": "" }, { "docid": "5b6cc911c610a2ce603efaf9da81589e", "score": "0.56208336", "text": "func (a *defragmentator) expired() bool {\n\treturn time.Now().After(a.deadline)\n}", "title": "" }, { "docid": "1073fedb7e660f0f1303101439733dda", "score": "0.56149185", "text": "func (cd *CacheDir) IsValid(maxDuration time.Duration, key ...CacheKey) bool {\n\tts := cd.GetInvalid(key...)\n\n\tswitch {\n\tcase ts.IsZero():\n\t\treturn true\n\tcase time.Now().Sub(ts) > maxDuration:\n\t\tcd.UnsetInvalid(key...)\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "02edba5aaa00f6de091266037ffa9b91", "score": "0.5612574", "text": "func (t Token) Expired() bool {\n\treturn time.Now().After(t.AuthExpiration)\n}", "title": "" }, { "docid": "cf6c20fa0ccc811a2c5ed66efc3e9c97", "score": "0.56122774", "text": "func (p *Permissions) Expired(ttl time.Duration, now time.Time) bool {\n\treturn !now.Before(p.UpdatedAt.Add(ttl))\n}", "title": "" }, { "docid": "7be360c9a4ee788f050bd378a5371d8e", "score": "0.56088656", "text": "func (a *AuthCredentials) HasExpiration() bool {\n\treturn !a.expiry.IsZero()\n}", "title": "" }, { "docid": "bb633bc93734eb9f1b47d7fc2cbe9880", "score": "0.56070817", "text": "func (e *Engine) IsExpired(key string) bool {\n\titem, err := e.client.Get(expirePrefix + key)\n\tif err != nil {\n\t\treturn true\n\t}\n\n\texpiresInt, err := strconv.Atoi(string(item.Value))\n\tif err != nil {\n\t\treturn true\n\t}\n\n\tif time.Now().Unix() > int64(expiresInt) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "517530b33b5e2ca3936f8ad57f40fb51", "score": "0.56030524", "text": "func (wr WorkerRegistration) IsExpired() bool {\n\treturn time.Now().After(wr.ExpiresAt)\n}", "title": "" }, { "docid": "22bdea7dcb14f506c24c8028e0da2d1c", "score": "0.5593932", "text": "func (cfg *Config) IsExpired() bool {\n\treturn false\n}", "title": "" }, { "docid": "03214a4a2b1d9de44206463f8b6d7aae", "score": "0.5591468", "text": "func (s *sessionCache) expire() {\n\tvar key p2pcrypto.PublicKey\n\tfor k, v := range s.sessions {\n\t\tif key == nil || v.ts.Before(s.sessions[key].ts) {\n\t\t\tkey = k\n\t\t}\n\t}\n\tdelete(s.sessions, key)\n}", "title": "" }, { "docid": "06ba64630e8efbb1c1cc73abe551c269", "score": "0.55891025", "text": "func certificateIsExpiring(cert *x509.Certificate, currentTime time.Time) bool {\n\treturn cert.NotAfter.Sub(currentTime) < kubeletCertValidityLimit\n}", "title": "" }, { "docid": "73dc4767190e0c26a4dd79bdff95350f", "score": "0.5587988", "text": "func (c *Conversation) Expired() bool {\n\tc.RLock()\n\tdefer c.RUnlock()\n\treturn c.expiration.Before(time.Now())\n}", "title": "" }, { "docid": "5efc0ada8393d421aee1c96a3266684f", "score": "0.558514", "text": "func (license *License) isLicenseExpired() (bool, time.Time, error) {\n\tttl, err := license.getTTLTime() //convert string to time\n\tif err != nil {\n\t\treturn true, time.Time{}, err\n\t}\n\ttimeDiff := time.Now().Sub(ttl)\n\n\tif timeDiff < 0 { //if positive ttl is in the past\n\t\treturn false, ttl, nil //license not expired\n\t}\n\t//time.Time{} returns ZeroTime, which is nil time\n\treturn true, time.Time{}, nil //license is expired\n\n}", "title": "" }, { "docid": "376ae1c9730568b56186b63955c6e003", "score": "0.55693245", "text": "func (b *ProviderBasis) IsExpired() bool {\n\tif b.CurrentTime == nil {\n\t\tb.CurrentTime = time.Now\n\t}\n\treturn !b.AlwaysValid && !b.CurrentTime().Before(b.expiration)\n}", "title": "" }, { "docid": "9e97711b914e8d1a74eb9615ba62a843", "score": "0.55673647", "text": "func (c *HMACStrategy) Valid(token string) bool {\n\texpiry, err := c.GetExpirationTime(token)\n\tif err != nil {\n\t\treturn false\n\t}\n\tisExpired := time.Now().UTC().After(expiry)\n\n\t// Returning Expiry Status of Token\n\treturn !isExpired\n\n}", "title": "" }, { "docid": "e2d0bad0f60fa62f7283ca4d2b0942e9", "score": "0.5565127", "text": "func (te *timeoutEntry) expired() bool {\n\treturn te.timestamp.Before(time.Now().Add(-time.Duration(500) * time.Millisecond))\n}", "title": "" }, { "docid": "2e54f32285b64078dbe1684a0c1ec0f0", "score": "0.5564859", "text": "func (s *Session) IsActive() bool {\n\ts.mutex.RLock()\n\tactive := s.active\n\twhen := s.when\n\ts.mutex.RUnlock()\n\n\treturn active && !when.Before(time.Now().Add(-(SessionAutorefreshInterval + SessionExpirationGrace)))\n}", "title": "" }, { "docid": "101bcf86ac0b77681a3946cec9ac75f5", "score": "0.55637306", "text": "func (s *SessionTokenProvider) validateSessionDuration(d time.Duration) int64 {\n\ti := int64(d.Seconds())\n\n\tif d < SessionTokenMinDuration {\n\t\ts.debug(\"Session token duration too short\")\n\t\ti = int64(SessionTokenMinDuration.Seconds())\n\t}\n\n\tif d > SessionTokenMaxDuration {\n\t\ts.debug(\"Session token duration too long\")\n\t\ti = int64(SessionTokenMaxDuration.Seconds())\n\t}\n\n\treturn i\n}", "title": "" }, { "docid": "69349c813761005bd30b51087c8179ab", "score": "0.55629027", "text": "func (c Claims) Validate(now time.Time, expLeeway, nbfLeeway time.Duration) error {\n\tif exp, ok := c.Expiration(); ok {\n\t\tif now.After(exp.Add(expLeeway)) {\n\t\t\treturn ErrTokenIsExpired\n\t\t}\n\t}\n\n\tif nbf, ok := c.NotBefore(); ok {\n\t\tif !now.After(nbf.Add(-nbfLeeway)) {\n\t\t\treturn ErrTokenNotYetValid\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ccfa97eef9cbc141967aa5cef95f81e", "score": "0.5554081", "text": "func (item *Item) expired() bool {\n\tif item.ttl <= 0 {\n\t\treturn false\n\t}\n\treturn item.expireAt.Before(time.Now())\n}", "title": "" }, { "docid": "0fa8837bf2a24e3509df512157ace2bf", "score": "0.5550859", "text": "func (m *Map) IsExpired(c Cid) bool {\n\tv, found := m.Get(c)\n\tif !found {\n\t\treturn false\n\t}\n\treturn v.Expir != 0 && v.Expir <= uint64(time.Now().Unix())\n}", "title": "" }, { "docid": "297c67ef44646e396a936d8c66856899", "score": "0.55248547", "text": "func (m Membership) IsExpired() bool {\n\t// If membership does not exist, it is treated as expired.\n\tif m.IsZero() {\n\t\treturn true\n\t}\n\n\t// If expire date is before now, AND auto renew is false,\n\t// we treat this one as actually expired.\n\t// If ExpireDate is passed, but auto renew is true, we still\n\t// treat this one as not expired.\n\treturn m.ExpireDate.Before(time.Now().Truncate(24*time.Hour)) && !m.AutoRenewal\n}", "title": "" }, { "docid": "3f08e20a1c8d79c31168ee6dc0cbb854", "score": "0.55194044", "text": "func (a *Allocation) Expired(now time.Time) bool {\n\tif a == nil || a.Job == nil {\n\t\treturn false\n\t}\n\n\t// If alloc is not Unknown it cannot be expired.\n\tif a.ClientStatus != AllocClientStatusUnknown {\n\t\treturn false\n\t}\n\n\tlastUnknown := a.LastUnknown()\n\tif lastUnknown.IsZero() {\n\t\treturn false\n\t}\n\n\ttg := a.Job.LookupTaskGroup(a.TaskGroup)\n\tif tg == nil {\n\t\treturn false\n\t}\n\n\tif tg.MaxClientDisconnect == nil {\n\t\treturn false\n\t}\n\n\texpiry := lastUnknown.Add(*tg.MaxClientDisconnect)\n\treturn now.UTC().After(expiry) || now.UTC().Equal(expiry)\n}", "title": "" }, { "docid": "bffc05959994e0cb0ee14792dc28cad2", "score": "0.5516855", "text": "func Validate(uname string, challengeToken string) (bool, error) {\n\tseshData, err := query.SessionToken(uname)\n\tif err != nil {\n\t\treturn false, errors.New(\"Can't retrieve session info for \" + uname)\n\t}\n\n\tif seshData.Token == challengeToken {\n\t\tif time.Now().After(seshData.ExpirationTime) {\n\t\t\treturn false, errors.New(\"Expired token\")\n\t\t}\n\t\treturn true, nil\n\t}\n\treturn false, errors.New(\"Bad token\")\n}", "title": "" }, { "docid": "cd3c5fc8c4657a3a6e41583abd43162c", "score": "0.550235", "text": "func (config *Config) IsExpired() bool {\n\treturn false\n}", "title": "" }, { "docid": "284cf84a97055ee13a1e3b7c2feff7d1", "score": "0.54975414", "text": "func (e *ZerodropEntry) IsExpired() bool {\n\treturn e.AccessExpire && (e.AccessCount >= e.AccessExpireCount)\n}", "title": "" }, { "docid": "97c2b326bc01c2c89ab62e79ed4f9a05", "score": "0.5482668", "text": "func (l Lease) IsExpired() bool {\n\treturn l.GetExpiresAt().Before(time.Now())\n}", "title": "" } ]
d921e2ddcff2f9b3f8dd737405e49578
ExitCond_block is called when production cond_block is exited.
[ { "docid": "f6db4b958c6a83582e25aa8e4eb99c0d", "score": "0.8491443", "text": "func (s *BaseSyslParserListener) ExitCond_block(ctx *Cond_blockContext) {}", "title": "" } ]
[ { "docid": "75885c499bc552ae76a96ad40efe3080", "score": "0.704641", "text": "func (s *BasePlSqlParserListener) ExitCondition(ctx *ConditionContext) {}", "title": "" }, { "docid": "1edfbdf5e7e79ac4df1429f939bc8c3d", "score": "0.6907632", "text": "func (s *BasemumpsListener) ExitCondition(ctx *ConditionContext) {}", "title": "" }, { "docid": "63c537ce09dfcb1c1b9b9c4aa55f755c", "score": "0.67883635", "text": "func (s *BaseConcertoListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "049a4d408526009948412199c4d1a0d7", "score": "0.6780609", "text": "func (s *BaseBundListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "78e9ca16f2a1e273b2a2ef8abd9ebd96", "score": "0.672518", "text": "func (s *BasePlSqlParserListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "b4ac624b6097dec4a1a052894046adf8", "score": "0.6626891", "text": "func (s *BaseCymbolListener) ExitBlock(ctx *BlockContext) {}", "title": "" }, { "docid": "5a8aa707e2a85112b55d1c6e28c77100", "score": "0.6590011", "text": "func (s *BasemumpsListener) ExitPostcondition(ctx *PostconditionContext) {}", "title": "" }, { "docid": "63050e29a3edb78f50de2362a11df4f7", "score": "0.6589671", "text": "func (s *BasevhdlListener) ExitCondition(ctx *ConditionContext) {}", "title": "" }, { "docid": "4d7adad39cd875c3f40b4e48ab7f4230", "score": "0.65893227", "text": "func (s *BaseSyslParserListener) EnterCond_block(ctx *Cond_blockContext) {}", "title": "" }, { "docid": "29f57d76e04c9df62f6d3be3d0fc2d93", "score": "0.6540222", "text": "func (s *BaseSyslParserListener) ExitElse_block_stmt(ctx *Else_block_stmtContext) {}", "title": "" }, { "docid": "b7b9a1c44bbf879282027dbeb3f3239b", "score": "0.65390664", "text": "func (s *BasevhdlListener) ExitCondition_clause(ctx *Condition_clauseContext) {}", "title": "" }, { "docid": "b066675623daf4a90d01a637a319e29e", "score": "0.65336496", "text": "func (s *BaseSyslParserListener) ExitExpr_block(ctx *Expr_blockContext) {}", "title": "" }, { "docid": "34d4248e2fd442c47942df4004841588", "score": "0.6523008", "text": "func (s *BasePCREListener) ExitConditional(ctx *ConditionalContext) {}", "title": "" }, { "docid": "0e2209500d5d7147710efb823014767d", "score": "0.64921194", "text": "func (s *BaseTdatListener) ExitConditionExpr(ctx *ConditionExprContext) {}", "title": "" }, { "docid": "43088f1e82258e74de7b670bb7ceb6f6", "score": "0.64063454", "text": "func (s *BaseBundListener) ExitLogicblock_term(ctx *Logicblock_termContext) {}", "title": "" }, { "docid": "9b703bf9c6d17fdd54408367cdf07113", "score": "0.6367663", "text": "func (s *BasevhdlListener) ExitBlock_statement(ctx *Block_statementContext) {}", "title": "" }, { "docid": "77366a577d81fe0aa0585ea8fb20d529", "score": "0.6353645", "text": "func (s *BasePlSqlParserListener) ExitTrigger_block(ctx *Trigger_blockContext) {}", "title": "" }, { "docid": "4c4b12f8be1a06104d0e4887628acbf7", "score": "0.6298152", "text": "func (s *BasePlSqlParserListener) ExitCompound_trigger_block(ctx *Compound_trigger_blockContext) {}", "title": "" }, { "docid": "b10de81a0a1e9574671bfc8873f684a6", "score": "0.62336123", "text": "func (s *BaseGraffleParserListener) ExitBlock_end(ctx *Block_endContext) {}", "title": "" }, { "docid": "477b0fbfd1cc6729b23f0b2dd074448d", "score": "0.6192057", "text": "func (s *BasevhdlListener) ExitBlock_statement_part(ctx *Block_statement_partContext) {}", "title": "" }, { "docid": "e684fe326ec76a74174afb00b0bce911", "score": "0.61664575", "text": "func (s *BasejossListener) ExitConditional(ctx *ConditionalContext) {}", "title": "" }, { "docid": "7055cb0f4aa01661ea63eac72e2b2b31", "score": "0.6046497", "text": "func (s *BasePlSqlParserListener) ExitIf_statement(ctx *If_statementContext) {}", "title": "" }, { "docid": "6a10b887d6a9aa504db8ab7adf510668", "score": "0.6006014", "text": "func (s *BasevhdlListener) ExitConditional_signal_assignment(ctx *Conditional_signal_assignmentContext) {\n}", "title": "" }, { "docid": "87b65e997459052dd8c86418ba517b0a", "score": "0.59672546", "text": "func (s *BaseGraffleParserListener) ExitFunctions_block(ctx *Functions_blockContext) {}", "title": "" }, { "docid": "fb3674a1da5e5bdd44cfff49260fae7c", "score": "0.592834", "text": "func (s *BasevhdlListener) ExitBlock_specification(ctx *Block_specificationContext) {}", "title": "" }, { "docid": "642e9d94dcea722150cb2c1b9c41523b", "score": "0.5922249", "text": "func (s *BaseGShellListener) ExitCloseBlock(ctx *CloseBlockContext) {}", "title": "" }, { "docid": "f90adf4682695cc772b2682acc7371ce", "score": "0.5892623", "text": "func (g gate) exit() {\n\tselect { // do not block\n\tcase <-g:\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "ad1d13226537b6c6bddce834839790ae", "score": "0.5865512", "text": "func (s *BasePlSqlParserListener) ExitCase_else_part(ctx *Case_else_partContext) {}", "title": "" }, { "docid": "666241ba4f491e5939cd6b63b17fddc1", "score": "0.58628213", "text": "func (s *BasemumpsListener) EnterPostcondition(ctx *PostconditionContext) {}", "title": "" }, { "docid": "5627dc9880d2841a5820f4ba194ef003", "score": "0.5851256", "text": "func (s *BasePlSqlParserListener) ExitQuery_block(ctx *Query_blockContext) {}", "title": "" }, { "docid": "a3121a12a53ded28ade7a39738ceb91f", "score": "0.5780122", "text": "func (s *BaseSyslParserListener) ExitIf_stmt(ctx *If_stmtContext) {}", "title": "" }, { "docid": "c72aab346e38adcd2e5e686effc9f9a2", "score": "0.57442814", "text": "func (s *BasevhdlListener) ExitBreak_statement(ctx *Break_statementContext) {}", "title": "" }, { "docid": "b81ff142bc0291c39cabc963710157aa", "score": "0.574303", "text": "func (s *BasecluListener) ExitRoutine_body(ctx *Routine_bodyContext) {}", "title": "" }, { "docid": "13411457d3b1911583889eda85908af4", "score": "0.57287836", "text": "func (s *BasePlSqlParserListener) ExitConditional_insert_clause(ctx *Conditional_insert_clauseContext) {\n}", "title": "" }, { "docid": "4e5de5018c887aa65dccbf13ca48fec6", "score": "0.57089216", "text": "func (s *BaseGShellListener) ExitCommandBlock(ctx *CommandBlockContext) {}", "title": "" }, { "docid": "0d38d3199207b05a8ed24a220f1bba3e", "score": "0.5703694", "text": "func (s *BasevhdlListener) ExitBlock_configuration(ctx *Block_configurationContext) {}", "title": "" }, { "docid": "2ecc3d41585b304832dfa6fcc30fc6c0", "score": "0.56978476", "text": "func (s *BasePlSqlParserListener) ExitControlfile_clauses(ctx *Controlfile_clausesContext) {}", "title": "" }, { "docid": "1d54f4ac7ec359abaf01cf14379d2eec", "score": "0.56854993", "text": "func (s *BasevhdlListener) ExitExit_statement(ctx *Exit_statementContext) {}", "title": "" }, { "docid": "f59a87f49564d711a3222cb652b8baf9", "score": "0.5667775", "text": "func (s *BasePlSqlParserListener) ExitRoutine_clause(ctx *Routine_clauseContext) {}", "title": "" }, { "docid": "9b0b504abd443a800394adf47f5d8192", "score": "0.56603914", "text": "func (s *BasevhdlListener) ExitIf_statement(ctx *If_statementContext) {}", "title": "" }, { "docid": "2c0108454c6f84b3bd6e32fa910076cf", "score": "0.56596786", "text": "func (s *BasevhdlListener) ExitConcurrent_break_statement(ctx *Concurrent_break_statementContext) {}", "title": "" }, { "docid": "c1a861d93608bde740023892ccd7ca05", "score": "0.5646491", "text": "func (s *BaseBundListener) ExitMatchblock_term(ctx *Matchblock_termContext) {}", "title": "" }, { "docid": "c340918400547f73e635e981278f70ec", "score": "0.5638035", "text": "func (s *BaseAspidaListener) ExitIfStatement(ctx *IfStatementContext) {}", "title": "" }, { "docid": "da23b300e1a8fb81ef52b15fc023adac", "score": "0.56364393", "text": "func (s *BasePlSqlParserListener) ExitRecords_per_block_clause(ctx *Records_per_block_clauseContext) {\n}", "title": "" }, { "docid": "bbb351908a8916db164c4b19786cff1f", "score": "0.56334156", "text": "func (s *BasePlSqlParserListener) ExitLogical_expression(ctx *Logical_expressionContext) {}", "title": "" }, { "docid": "dfab88c4adce2eb8adc0c5786a0b366c", "score": "0.5631295", "text": "func (s *BasePlSqlParserListener) ExitBuild_clause(ctx *Build_clauseContext) {}", "title": "" }, { "docid": "6e034bc4ba004b313adda3306bcc852f", "score": "0.5614434", "text": "func (s *BasePlSqlParserListener) ExitStandby_database_clauses(ctx *Standby_database_clausesContext) {\n}", "title": "" }, { "docid": "90cb9d8529d04ebebeff612f33e07510", "score": "0.56120324", "text": "func (s *BasevhdlListener) ExitBlock_declarative_part(ctx *Block_declarative_partContext) {}", "title": "" }, { "docid": "d8c87a09dbd2d7437c49e4627dcc3121", "score": "0.56078047", "text": "func (s *BaseSyslParserListener) ExitElse_stmt(ctx *Else_stmtContext) {}", "title": "" }, { "docid": "ca28c19d3721e5dac5ca76e1b940484c", "score": "0.5589239", "text": "func (s *BasevhdlListener) ExitBlock_header(ctx *Block_headerContext) {}", "title": "" }, { "docid": "a3f4e7d5cdc43e78ee859d3f81fa008a", "score": "0.55699354", "text": "func (s *BaseGraffleParserListener) ExitLogical_expr(ctx *Logical_exprContext) {}", "title": "" }, { "docid": "754f93dcf67a370365b2bed0b9427663", "score": "0.556512", "text": "func (s *BasePlSqlParserListener) ExitTrigger_when_clause(ctx *Trigger_when_clauseContext) {}", "title": "" }, { "docid": "4bb690b02125848478e235b201552312", "score": "0.55650896", "text": "func (s *BaseMySqlParserListener) ExitLogicalExpression(ctx *LogicalExpressionContext) {}", "title": "" }, { "docid": "72247c1f0aea37ecfbfbcf5490e52116", "score": "0.55606896", "text": "func (s *BasemumpsListener) EnterCondition(ctx *ConditionContext) {}", "title": "" }, { "docid": "13f55fd8255d31f102c5325d2eed8747", "score": "0.5559124", "text": "func TestExit(t *testing.T) {\n\tdefer func() {\n\t\tt.Log(\"defer ....\")\n\t}()\n\tt.Log(\"processing...\")\n\tos.Exit(-1)\n}", "title": "" }, { "docid": "04d04395855d5b792ad227d786a0d289", "score": "0.55584705", "text": "func (s *BasebrainfuckListener) ExitStatement(ctx *StatementContext) {}", "title": "" }, { "docid": "18bf5e6754c741b4f75662be5e952532", "score": "0.5554703", "text": "func (s *BasecluListener) ExitWhen_handler(ctx *When_handlerContext) {}", "title": "" }, { "docid": "97cb5d7ee3717d4475cc4bf04be9dfee", "score": "0.5552108", "text": "func (s *BasePlSqlParserListener) ExitRecovery_clauses(ctx *Recovery_clausesContext) {}", "title": "" }, { "docid": "285141bca8a88fcdf617bf180bab1dbb", "score": "0.55451894", "text": "func (s *BasePlSqlParserListener) ExitLoop_statement(ctx *Loop_statementContext) {}", "title": "" }, { "docid": "0cd5cfb9ec9382532dcfb1eeac1cc084", "score": "0.5540677", "text": "func (s *BasePlSqlParserListener) ExitInline_constraint(ctx *Inline_constraintContext) {}", "title": "" }, { "docid": "cbb9f70000f88d8ed02e5b61c91bdf65", "score": "0.5539508", "text": "func (s *BaseCobol85PreprocessorListener) ExitCopyStatement(ctx *CopyStatementContext) {}", "title": "" }, { "docid": "347aba80a9cd327e84fbb7e93854f65d", "score": "0.5534033", "text": "func (l *Lexer) exitBlockComment() {\n\tl.commentLevel--\n\tif l.commentLevel <= 0 {\n\t\tl.State = StateInitial\n\t}\n}", "title": "" }, { "docid": "b78b2fa2f497ed6be944cc1ac390c1bd", "score": "0.5532435", "text": "func (s *BasePlSqlParserListener) ExitCase_statement(ctx *Case_statementContext) {}", "title": "" }, { "docid": "3994f3aa6df68e518ebffc636e8ef3b8", "score": "0.5532065", "text": "func (s *BasevhdlListener) ExitConditional_waveforms(ctx *Conditional_waveformsContext) {}", "title": "" }, { "docid": "68aa1b93d60cf766966401de8eea07c5", "score": "0.55261415", "text": "func (s *BasevhdlListener) ExitBlock_declarative_item(ctx *Block_declarative_itemContext) {}", "title": "" }, { "docid": "0cd28d652fbf9278d9424c44ff1cc318", "score": "0.55169815", "text": "func (s *BaselimboListener) ExitStatements_(ctx *Statements_Context) {}", "title": "" }, { "docid": "82f3f4d3d01c37c91186d535b93d28cd", "score": "0.551228", "text": "func (s *BaseConcertoListener) ExitPackageClause(ctx *PackageClauseContext) {}", "title": "" }, { "docid": "4147c69864212060c986fca835db5083", "score": "0.5508653", "text": "func (s *BasePlSqlParserListener) ExitElse_part(ctx *Else_partContext) {}", "title": "" }, { "docid": "2ab87bdf0e1e0f486347e1bed8961d9c", "score": "0.5498054", "text": "func (s *BasevhdlListener) ExitBreak_selector_clause(ctx *Break_selector_clauseContext) {}", "title": "" }, { "docid": "93cb36fd5af22a967d415fe89a5db0db", "score": "0.54848176", "text": "func (s *BaseCobol85PreprocessorListener) ExitSkipStatement(ctx *SkipStatementContext) {}", "title": "" }, { "docid": "77d7e3d3ffc4b9087c8dcc21239372fc", "score": "0.5482516", "text": "func (s *BasePlSqlParserListener) ExitStop_standby_clause(ctx *Stop_standby_clauseContext) {}", "title": "" }, { "docid": "65e3174d5e56f1560533ed0cfd1b2178", "score": "0.5480568", "text": "func (s *BasevhdlListener) ExitCase_statement(ctx *Case_statementContext) {}", "title": "" }, { "docid": "24bbe53041ff6990c4d28dcc4caac5ad", "score": "0.5479969", "text": "func (s *BasevhdlListener) ExitWait_statement(ctx *Wait_statementContext) {}", "title": "" }, { "docid": "0b409364a7c4c53347325e63e5c92461", "score": "0.5475372", "text": "func (s *BasePlSqlParserListener) ExitConstraint_clauses(ctx *Constraint_clausesContext) {}", "title": "" }, { "docid": "1503dbffad58118ec4e4e67e87ec9dc2", "score": "0.54748476", "text": "func (s *BasePlSqlParserListener) ExitValidation_clauses(ctx *Validation_clausesContext) {}", "title": "" }, { "docid": "e7ff9eaf982fe20ccf1d4a3ee40d82f3", "score": "0.5472094", "text": "func (s *BaseCobol85PreprocessorListener) ExitExecCicsStatement(ctx *ExecCicsStatementContext) {}", "title": "" }, { "docid": "bfca38485a5f567eeed0e292c198d665", "score": "0.54703325", "text": "func (s *BaseGShellListener) ExitOpenBlock(ctx *OpenBlockContext) {}", "title": "" }, { "docid": "191e696575e01dfdb6aac2193e38e381", "score": "0.546922", "text": "func (s *BasePlSqlParserListener) ExitRaise_statement(ctx *Raise_statementContext) {}", "title": "" }, { "docid": "7dae1b079fbfaaf1f764be202c1a0bb1", "score": "0.54678935", "text": "func (s *BasePlSqlParserListener) ExitCompound_expression(ctx *Compound_expressionContext) {}", "title": "" }, { "docid": "f9f0c103d5741b8048580f961e08739c", "score": "0.54662186", "text": "func (s *BasevhdlListener) ExitCase_statement_alternative(ctx *Case_statement_alternativeContext) {}", "title": "" }, { "docid": "ea9745d09d770f73a053f4c547ce31c5", "score": "0.5462003", "text": "func (s *BasevhdlListener) EnterExit_statement(ctx *Exit_statementContext) {}", "title": "" }, { "docid": "90ce4a4635c79459e19d69dcddc4c94c", "score": "0.54613066", "text": "func (s *BasevhdlListener) ExitLoop_statement(ctx *Loop_statementContext) {}", "title": "" }, { "docid": "c08fdfaebe959d6f8ec2eb108cce98e9", "score": "0.5460874", "text": "func (s *BasecluListener) ExitStatement(ctx *StatementContext) {}", "title": "" }, { "docid": "a4644431eb5873bde154baf62a01ef4a", "score": "0.5460796", "text": "func (s *BasePlSqlParserListener) ExitCheck_constraint(ctx *Check_constraintContext) {}", "title": "" }, { "docid": "369f9ac97bb32ab57fcc255572167ff0", "score": "0.5460301", "text": "func (s *BaseloopListener) ExitStatement(ctx *StatementContext) {}", "title": "" }, { "docid": "c33d4fddd11fb04c5f5c5a986f1478d9", "score": "0.54585063", "text": "func (s *BaseSyslParserListener) ExitExpr_if_else(ctx *Expr_if_elseContext) {}", "title": "" }, { "docid": "e195304c50e5d8a594c26ff61e73deb1", "score": "0.54561263", "text": "func (s *BaseloopListener) ExitLoopstmt(ctx *LoopstmtContext) {}", "title": "" }, { "docid": "5d2fd5fba2bdb8996af1856645f18e33", "score": "0.54557383", "text": "func (s *BasePlSqlParserListener) ExitCycle_clause(ctx *Cycle_clauseContext) {}", "title": "" }, { "docid": "a881a6910c5c309feedc8f42d944e587", "score": "0.5454034", "text": "func (s *BasevhdlListener) ExitContext_clause(ctx *Context_clauseContext) {}", "title": "" }, { "docid": "0b00ccac76e75a82719418e71bff1013", "score": "0.54505044", "text": "func (s *BaseSyslParserListener) ExitIf_else(ctx *If_elseContext) {}", "title": "" }, { "docid": "1d8c0bcadbe43b8c29ecd4407a426a5c", "score": "0.5449269", "text": "func (s *BasecluListener) ExitExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "803e46c84c54628b0755ed23dd69b6e4", "score": "0.54431176", "text": "func (s *BasePlSqlParserListener) ExitConditional_insert_else_part(ctx *Conditional_insert_else_partContext) {\n}", "title": "" }, { "docid": "8c674e820e43597aa6e7eaaf4276016a", "score": "0.54430676", "text": "func (s *BasePlSqlParserListener) ExitAnonymous_block(ctx *Anonymous_blockContext) {}", "title": "" }, { "docid": "70b99263c71b477f33fe16c2b721f3c1", "score": "0.5442435", "text": "func (s *BasePlSqlParserListener) ExitExit_statement(ctx *Exit_statementContext) {}", "title": "" }, { "docid": "48d271ccdf85fb007b2ba7a814cbf353", "score": "0.5439865", "text": "func (s *BaseSyslParserListener) ExitBinexpr(ctx *BinexprContext) {}", "title": "" }, { "docid": "c93e26a281942006dbaee611982d0b06", "score": "0.5416814", "text": "func (s *BaserpnListener) ExitExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "7831fd0161f475107049e195e9e9fc00", "score": "0.54111826", "text": "func (s *BaseMySqlParserListener) ExitLockClause(ctx *LockClauseContext) {}", "title": "" }, { "docid": "1360c66ea238e6f4617fb6d17355b879", "score": "0.54073185", "text": "func (s *BasevhdlListener) ExitReturn_statement(ctx *Return_statementContext) {}", "title": "" }, { "docid": "22909fec8fa42e6ffeffd59b8bcc97cf", "score": "0.5400915", "text": "func (s *BasemumpsListener) ExitBreak_(ctx *Break_Context) {}", "title": "" }, { "docid": "78277d6cf71e355bb2cf80ff8dcf017f", "score": "0.5400506", "text": "func (s *BasevhdlListener) ExitPackage_body(ctx *Package_bodyContext) {}", "title": "" } ]
1484e256ebedf64a8c44ec3075eddd2c
QueryHeartbeat queries the heartbeat edge of a Agent.
[ { "docid": "b373aad8eeae3aa046e4ed1bba9c7e6d", "score": "0.8221616", "text": "func (c *AgentClient) QueryHeartbeat(a *Agent) *HeartbeatQuery {\n\tquery := &HeartbeatQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(agent.Table, agent.FieldID, id),\n\t\t\tsqlgraph.To(heartbeat.Table, heartbeat.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, true, agent.HeartbeatTable, agent.HeartbeatColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" } ]
[ { "docid": "5a700bcb67ba34333677f0a9eb48c793", "score": "0.6603959", "text": "func (c *HeartbeatClient) QueryAgent(h *Heartbeat) *AgentQuery {\n\tquery := &AgentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := h.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(heartbeat.Table, heartbeat.FieldID, id),\n\t\t\tsqlgraph.To(agent.Table, agent.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, false, heartbeat.AgentTable, heartbeat.AgentColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(h.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "b13489a9263a44606da6504339ac1a94", "score": "0.61292315", "text": "func (c *HeartbeatClient) Query() *HeartbeatQuery {\n\treturn &HeartbeatQuery{config: c.config}\n}", "title": "" }, { "docid": "d072b1656d10eef8658b3c0836ede2e6", "score": "0.58888936", "text": "func (s *GatewayService) Heartbeat(ctx context.Context, request *gatewayv1.HeartbeatRequest) (*gatewayv1.HeartbeatResponse, error) {\n\terr := s.heartbeatsSource.Emit(heartbeats.DeviceIDHeartbeat_Source_Message{\n\t\tKey: strconv.Itoa(int(request.DeviceId)),\n\t\tValue: &deviceId.Heartbeat{\n\t\t\tTime: request.Time,\n\t\t\tIsHealthy: request.IsHealthy,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to emit device heartbeat\")\n\t}\n\n\treturn &gatewayv1.HeartbeatResponse{}, nil\n}", "title": "" }, { "docid": "6fa2d16679c650d084039758adebbbc3", "score": "0.5758113", "text": "func BroadcastHeartbeat(filter func(p *peer.Peer) bool) {\n\tsnapshotInfo := tangle.GetSnapshotInfo()\n\tif snapshotInfo == nil {\n\t\treturn\n\t}\n\n\tconnected, synced := manager.ConnectedAndSyncedPeerCount()\n\theartbeatMsg, _ := sting.NewHeartbeatMessage(tangle.GetSolidMilestoneIndex(), snapshotInfo.PruningIndex, tangle.GetLatestMilestoneIndex(), connected, synced)\n\n\tmanager.ForAllConnected(func(p *peer.Peer) bool {\n\t\tif !p.Protocol.Supports(sting.FeatureSet) {\n\t\t\treturn true\n\t\t}\n\n\t\tif filter != nil && !filter(p) {\n\t\t\treturn true\n\t\t}\n\n\t\tp.EnqueueForSending(heartbeatMsg)\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "8da11467fb3743b37d6ddc1294832405", "score": "0.56675243", "text": "func (_Heritable *HeritableTransactor) Heartbeat(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Heritable.contract.Transact(opts, \"heartbeat\")\n}", "title": "" }, { "docid": "0f3ef97ae6aeca7debabe8ae64dce0c3", "score": "0.56503546", "text": "func (m *MockDispatcher) Heartbeat(context.Context, *api.HeartbeatRequest) (*api.HeartbeatResponse, error) {\n\treturn &api.HeartbeatResponse{Period: time.Second * 5}, nil\n}", "title": "" }, { "docid": "0f3ef97ae6aeca7debabe8ae64dce0c3", "score": "0.56503546", "text": "func (m *MockDispatcher) Heartbeat(context.Context, *api.HeartbeatRequest) (*api.HeartbeatResponse, error) {\n\treturn &api.HeartbeatResponse{Period: time.Second * 5}, nil\n}", "title": "" }, { "docid": "a66965b471c5cec63b8be554417947dc", "score": "0.56335294", "text": "func (mdwrk *Mdwrk) SetHeartbeat(heartbeat time.Duration) {\n\tmdwrk.heartbeat = heartbeat\n}", "title": "" }, { "docid": "92949ea57912ed97ab84b04b7d76428d", "score": "0.5553276", "text": "func (c *Client) Heartbeat(ctx context.Context) (*Heartbeat, *Response, error) {\n\t// Include the current time in the heartbeat, and include the operating\n\t// systems timezone.\n\theartbeat := &Heartbeat{SentAt: time.Now().Format(time.RFC3339Nano)}\n\n\treq, err := c.newRequest(ctx, \"POST\", \"heartbeat\", &heartbeat)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresp, err := c.doRequest(req, heartbeat)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn heartbeat, resp, err\n}", "title": "" }, { "docid": "e17a9b1874cc60f7ba923adc9493d49c", "score": "0.55505246", "text": "func (c *Coordinator) Heartbeat(request *HeartbeatRequest, response *HeartbeatResponse) error {\n\tmsg := heartbeatMsg{response, make(chan struct{})}\n\tc.heartbeatCh <- msg\n\t<-msg.ok\n\treturn nil\n}", "title": "" }, { "docid": "abcdbec10b8966f0c2ae9f13c46e9861", "score": "0.5529011", "text": "func (c *Client) Heartbeat() (NemRequestResult, error) {\n\ttimeout := time.Duration(10 * time.Second)\n\tclient := http.Client{\n\t\tTimeout: timeout,\n\t}\n\tc.URL.Path = \"/heartbeat\"\n\treq, err := c.buildReq(nil, nil, http.MethodGet)\n\tif err != nil {\n\t\treturn NemRequestResult{}, err\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn NemRequestResult{}, err\n\t}\n\tdefer resp.Body.Close()\n\tbyteArray, err := ioutil.ReadAll(resp.Body)\n\n\tif resp.StatusCode != 200 {\n\t\terr := errors.New(string(byteArray))\n\t\treturn NemRequestResult{}, err\n\t}\n\n\tvar data NemRequestResult\n\tif err := json.Unmarshal(byteArray, &data); err != nil {\n\t\treturn NemRequestResult{}, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "3d7539a54de1d6342a3410fb21915e00", "score": "0.5519176", "text": "func (_Heritable *HeritableSession) Heartbeat() (*types.Transaction, error) {\n\treturn _Heritable.Contract.Heartbeat(&_Heritable.TransactOpts)\n}", "title": "" }, { "docid": "f85cfe0fa52e79a98fc776dfb9b7451e", "score": "0.55164766", "text": "func (_Heritable *HeritableTransactorSession) Heartbeat() (*types.Transaction, error) {\n\treturn _Heritable.Contract.Heartbeat(&_Heritable.TransactOpts)\n}", "title": "" }, { "docid": "a54ba044426b8da339d4d8e225455944", "score": "0.55150276", "text": "func UpdateHeartbeat() error {\n\tlog.Info(\"Updating Heartbeat\")\n\tctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)\n\tdefer cancel()\n\n\tif err := db.PingContext(ctx); err != nil {\n\t\treturn err\n\t}\n\ttsql := `\n\t\tUPDATE device_test\n\t\tSET current_heartbeat = GETDATE();\n\t`\n\tstmt, err := db.Prepare(tsql)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\n\t_, err = stmt.ExecContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "20126b61afc17b8757b9b0d105744336", "score": "0.5510409", "text": "func (b *Broadcaster) BroadcastHeartbeat(filter func(proto *Protocol) bool) {\n\tsnapshotInfo := b.storage.SnapshotInfo()\n\tif snapshotInfo == nil {\n\t\treturn\n\t}\n\n\tsyncState := b.syncManager.SyncState()\n\tconnectedCount := b.peeringManager.ConnectedCount()\n\n\t// TODO: overflow not handled for synced/connected\n\tsyncedCount := b.service.SynchronizedCount(syncState.ConfirmedMilestoneIndex)\n\n\theartbeatMsg, err := newHeartbeatMessage(syncState.ConfirmedMilestoneIndex, snapshotInfo.PruningIndex(), syncState.LatestMilestoneIndex, byte(connectedCount), byte(syncedCount))\n\tif err != nil {\n\t\treturn\n\t}\n\n\tb.service.ForEach(func(proto *Protocol) bool {\n\t\tif filter != nil && !filter(proto) {\n\t\t\treturn true\n\t\t}\n\t\tproto.Enqueue(heartbeatMsg)\n\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "3e1708b8a3a2cbf38571921f3a9d548d", "score": "0.54951346", "text": "func (c *InstructionClient) QueryBeacon(i *Instruction) *BeaconQuery {\n\tquery := &BeaconQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := i.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(instruction.Table, instruction.FieldID, id),\n\t\t\tsqlgraph.To(beacon.Table, beacon.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, instruction.BeaconTable, instruction.BeaconColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(i.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "14287aaf599f99dc8eca7fdc57a21722", "score": "0.53738534", "text": "func (_m *Channel) Heartbeat(requestID string, msg *rpc.WorkerHeartbeat) {\n\t_m.Called(requestID, msg)\n}", "title": "" }, { "docid": "081a78a8623969824d45e5626c301a97", "score": "0.5353522", "text": "func (c *HeartbeatClient) Get(ctx context.Context, id int) (*Heartbeat, error) {\n\treturn c.Query().Where(heartbeat.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "a07f56ea788d5a4184034ce1c32da7bc", "score": "0.5318726", "text": "func (p *DubboRsp) IsHeartbeat() bool {\n\treturn p.mEvent\n}", "title": "" }, { "docid": "06ef4e42efb323fe7a59981bdeaf7fcc", "score": "0.53067595", "text": "func (_Heritable *HeritableSession) HeartbeatTimeout() (*big.Int, error) {\n\treturn _Heritable.Contract.HeartbeatTimeout(&_Heritable.CallOpts)\n}", "title": "" }, { "docid": "c27f0e0d371d3d6ab092c59fb1e46c67", "score": "0.53050065", "text": "func (br *Broadcast) GetHeartbeat() (*BroadcastHeartbeat, error) {\n\tbr.mu.RLock()\n\tif br.BroadcastStatus == \"stopped\" {\n\t\treturn nil, ErrMediaDeleted\n\t}\n\tbr.mu.RUnlock()\n\n\tbody, _, err := br.insta.sendRequest(\n\t\t&reqOptions{\n\t\t\tEndpoint: fmt.Sprintf(urlLiveHeartbeat, br.ID),\n\t\t\tIsPost: true,\n\t\t\tQuery: map[string]string{\n\t\t\t\t\"_uuid\": br.insta.uuid,\n\t\t\t\t\"live_with_eligibility\": \"2\", // What is this?\n\t\t\t},\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc := &BroadcastHeartbeat{}\n\terr = json.Unmarshal(body, c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbr.mu.RLock()\n\tbr.BroadcastStatus = c.BroadcastStatus\n\tbr.mu.RUnlock()\n\n\treturn c, nil\n}", "title": "" }, { "docid": "35a728e56ac42c9416a6b27081065ffe", "score": "0.5257977", "text": "func (t *HTTPTransport) Heartbeat(uri *url.URL, term, commitIndex, leaderID uint64) (uint64, error) {\n\t// Construct URL.\n\tu := *uri\n\tu.Path = path.Join(u.Path, \"raft/heartbeat\")\n\n\t// Set URL parameters.\n\tv := &url.Values{}\n\tv.Set(\"term\", strconv.FormatUint(term, 10))\n\tv.Set(\"commitIndex\", strconv.FormatUint(commitIndex, 10))\n\tv.Set(\"leaderID\", strconv.FormatUint(leaderID, 10))\n\tu.RawQuery = v.Encode()\n\n\t// Send HTTP request.\n\tresp, err := http.Get(u.String())\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t_ = resp.Body.Close()\n\n\t// Parse returned index.\n\tnewIndexString := resp.Header.Get(\"X-Raft-Index\")\n\tnewIndex, err := strconv.ParseUint(newIndexString, 10, 64)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"invalid index: %q\", newIndexString)\n\t}\n\n\t// Parse returned error.\n\tif s := resp.Header.Get(\"X-Raft-Error\"); s != \"\" {\n\t\treturn newIndex, errors.New(s)\n\t}\n\n\treturn newIndex, nil\n}", "title": "" }, { "docid": "7bd374638903e365fdbf397c80d33bc7", "score": "0.51825875", "text": "func ListenHeartbeat() {\n\tfmt.Println(\"start\")\n\tqueue := rabbitmq.New()\n\tdefer queue.Close()\n\t//queue.BindExchange(\"heart-beat-exchange\")\n\n\t//go clearExpiredAddr()\n\n\tfmt.Println(\"ea\")\n\tmsgList := queue.Receive(\"heart-beat-queue\")\n\tfmt.Printf(\"%T\\n\", msgList)\n\tfor msg := range msgList {\n\t\tfmt.Println(\"for\")\n\t\taddr, err := strconv.Unquote(string(msg.Body))\n\t\tfmt.Println(addr, err)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tmutex.Lock()\n\t\taddrList[addr] = time.Now()\n\t\tmutex.Unlock()\n\t}\n}", "title": "" }, { "docid": "4d7edb05a3431c04c6aa6ef022934210", "score": "0.5171094", "text": "func (_Heritable *HeritableCallerSession) HeartbeatTimeout() (*big.Int, error) {\n\treturn _Heritable.Contract.HeartbeatTimeout(&_Heritable.CallOpts)\n}", "title": "" }, { "docid": "de75ad8be2dcedfa4c2af024c15f9d3d", "score": "0.5155071", "text": "func (s *state) fanoutHeartbeat(req *RaftMessageRequest) {\n\t// A heartbeat message is expanded into a heartbeat for each group\n\t// that the remote node is a part of.\n\tfromID := roachpb.NodeID(req.Message.From)\n\tgroupCount := 0\n\tfollowerCount := 0\n\tif originNode, ok := s.nodes[fromID]; ok {\n\t\tfor groupID := range originNode.groupIDs {\n\t\t\tgroupCount++\n\t\t\t// If we don't think that the sending node is leading that group, don't\n\t\t\t// propagate.\n\t\t\tif s.groups[groupID].leader.NodeID != fromID || fromID == s.nodeID {\n\t\t\t\tif log.V(8) {\n\t\t\t\t\tlog.Infof(\"node %s: not fanning out heartbeat to %s, msg is from %s and leader is %s\",\n\t\t\t\t\t\ts.nodeID, groupID, fromID, s.groups[groupID].leader)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfromRepID, err := s.Storage.ReplicaIDForStore(groupID, req.FromReplica.StoreID)\n\t\t\tif err != nil {\n\t\t\t\tif log.V(3) {\n\t\t\t\t\tlog.Infof(\"node %s: not fanning out heartbeat to %s, could not find replica id for sending store %s\",\n\t\t\t\t\t\ts.nodeID, groupID, req.FromReplica.StoreID)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttoRepID, err := s.Storage.ReplicaIDForStore(groupID, req.ToReplica.StoreID)\n\t\t\tif err != nil {\n\t\t\t\tif log.V(3) {\n\t\t\t\t\tlog.Infof(\"node %s: not fanning out heartbeat to %s, could not find replica id for receiving store %s\",\n\t\t\t\t\t\ts.nodeID, groupID, req.ToReplica.StoreID)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfollowerCount++\n\n\t\t\tgroupMsg := raftpb.Message{\n\t\t\t\tType: raftpb.MsgHeartbeat,\n\t\t\t\tTo: uint64(toRepID),\n\t\t\t\tFrom: uint64(fromRepID),\n\t\t\t}\n\n\t\t\tif err := s.multiNode.Step(context.Background(), uint64(groupID), groupMsg); err != nil {\n\t\t\t\tif log.V(4) {\n\t\t\t\t\tlog.Infof(\"node %v: coalesced heartbeat step to group %v failed for message %s\", s.nodeID, groupID,\n\t\t\t\t\t\traft.DescribeMessage(req.Message, s.EntryFormatter))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// We must respond whether we forwarded the heartbeat to any groups\n\t// or not. When a leader considers a follower to be down, it doesn't\n\t// begin recovery until the follower has successfully responded to a\n\t// heartbeat. If we get a heartbeat from a node we don't know, it\n\t// must think we are a follower of some group, so we need to respond\n\t// so it can activate the recovery process.\n\ts.sendMessage(nil,\n\t\traftpb.Message{\n\t\t\tFrom: uint64(s.nodeID),\n\t\t\tTo: req.Message.From,\n\t\t\tType: raftpb.MsgHeartbeatResp,\n\t\t})\n\tif log.V(7) {\n\t\tlog.Infof(\"node %v: received coalesced heartbeat from node %v; \"+\n\t\t\t\"fanned out to %d followers in %d overlapping groups\",\n\t\t\ts.nodeID, fromID, followerCount, groupCount)\n\t}\n}", "title": "" }, { "docid": "c922261ca9a56bf9422242b6a42287ac", "score": "0.5148442", "text": "func (t *Server) Heartbeat(args *heartbeat.Args, reply *heartbeat.Reply) error {\n\treply.OK = true\n\tlog.Println(\"Received Heartbeat. Sending OK.\")\n\treturn nil\n}", "title": "" }, { "docid": "97d25cd1d6409b49e92bbc4d8ea4a316", "score": "0.5125615", "text": "func (c *BeaconClient) Query() *BeaconQuery {\n\treturn &BeaconQuery{config: c.config}\n}", "title": "" }, { "docid": "d22eed1be8fecd1859f6937d3696deda", "score": "0.5091587", "text": "func heartbeat(introducer bool) {\n\tfor {\n\t\tif len(memberMap) == 1 && !introducer {\n\t\t\tlog.Printf(\"[ORPHANED]: [SELFPID=%d] attempting to reconnect with introducer to find new peers.\", selfPID)\n\t\t\tjoinNetwork()\n\t\t}\n\t\tif !introducer {\n\t\t\t// Check for Leader liveness\n\t\t\tcheckLeaderLiveness()\n\t\t}\n\t\tspec.CollectGarbage(\n\t\t\tselfPID,\n\t\t\tm,\n\t\t\t&memberMap,\n\t\t\t&suspicionMap,\n\t\t\t&fingerTable,\n\t\t)\n\t\tspec.RefreshMemberMap(selfIP, selfPID, &memberMap, introducer)\n\t\tmessage := fmt.Sprintf(\n\t\t\t\"%d%s%s%s%d\",\n\t\t\tspec.HEARTBEAT, delimiter,\n\t\t\tspec.EncodeMemberMap(&memberMap), delimiter,\n\t\t\tselfPID,\n\t\t)\n\t\tspec.Disseminate(\n\t\t\tmessage,\n\t\t\tm,\n\t\t\tselfPID,\n\t\t\t&fingerTable,\n\t\t\t&memberMap,\n\t\t\tsendMessage,\n\t\t\tfalse,\n\t\t)\n\t\ttime.Sleep(time.Second * heartbeatInterval)\n\t}\n}", "title": "" }, { "docid": "c7b103896e1c30cd796ea6ac5ac3c34b", "score": "0.5090386", "text": "func (_Heritable *HeritableCaller) HeartbeatTimeout(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Heritable.contract.Call(opts, out, \"heartbeatTimeout\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "eada6538a5e929cf7adb7c8c31d58ef5", "score": "0.5084353", "text": "func WorkflowHeartbeat() error {\n\n\turl := endpoints.workflowHeartbeat\n\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"workflow heartbeat failed %s: %v\", resp.Status, err)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"workflow heartbeat returned a bad status code: %s\", resp.Status)\n\t}\n\tdefer resp.Body.Close()\n\n\treturn err\n}", "title": "" }, { "docid": "4734d2d8f82487b5db14f9f6445b7c5d", "score": "0.5080297", "text": "func (j *Job) Heartbeat() (bool, error) {\n return Bool(j.cli.Do(\"heartbeat\", 0, j.Jid, j.Worker, timestamp(), marshal(j.Data)))\n}", "title": "" }, { "docid": "c97a2d87e8731a0b5d0869e47bb70fee", "score": "0.50750667", "text": "func TestNodeHeartbeat(t *testing.T) {\n\ttx, cleanup := libtesting.NewTestClusterTx(t, 1, 1)\n\tdefer cleanup()\n\n\t_, err := tx.NodeAdd(\"buzz\", \"1.2.3.4:666\", 1, 1)\n\tif err != nil {\n\t\tt.Errorf(\"expected err to be nil: %v\", err)\n\t}\n\n\terr = tx.NodeHeartbeat(\"1.2.3.4:666\", time.Now().Add(-time.Minute))\n\tif err != nil {\n\t\tt.Errorf(\"expected err to be nil: %v\", err)\n\t}\n\n\tnodes, err := tx.Nodes()\n\tif err != nil {\n\t\tt.Errorf(\"expected err to be nil: %v\", err)\n\t}\n\tif expected, actual := 2, len(nodes); expected != actual {\n\t\tt.Errorf(\"expected: %v, actual: %v\", expected, actual)\n\t}\n\n\tclock := clock.New()\n\tnode := nodes[1]\n\tif expected, actual := true, node.IsOffline(clock, 20*time.Second); expected != actual {\n\t\tt.Errorf(\"expected: %v, actual: %v\", expected, actual)\n\t}\n}", "title": "" }, { "docid": "a56904197e12072477dfd2683a2c0a46", "score": "0.5060864", "text": "func (c *Conn) Healthcheck() {\n\tgo func() {\n\t\t// receive heartbeat\n\t\tdefer c.Close()\n\tloop:\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase _, ok := <-c.Heartbeat:\n\t\t\t\tif !ok {\n\t\t\t\t\tbreak loop\n\t\t\t\t}\n\t\t\t\tif c.OnHeartbeatReceived != nil {\n\t\t\t\t\tc.OnHeartbeatReceived()\n\t\t\t\t}\n\n\t\t\tcase <-time.After(HeartbeatTimeOut):\n\t\t\t\t// didn't receive the heartbeat after a certain duration, call the callback function when expired.\n\t\t\t\tif c.OnHeartbeatExpired != nil {\n\t\t\t\t\tc.OnHeartbeatExpired()\n\t\t\t\t}\n\n\t\t\t\tbreak loop\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "229daba02fa737d7e3eee3309f598085", "score": "0.5053522", "text": "func NewHeartbeatRequest() *HeartbeatRequest {\n\trequest := new(HeartbeatRequest)\n\trequest.ProxyRequest = base.NewProxyRequest()\n\trequest.Type = messages.HeartbeatRequest\n\trequest.SetReplyType(messages.HeartbeatReply)\n\n\treturn request\n}", "title": "" }, { "docid": "7517f88aad513322d500cdbd1195bf1e", "score": "0.50460654", "text": "func (service *GrpcServer) Heartbeat(ctx context.Context, in *pb.HeartbeatRequest) (*pb.HeartbeatResponse, error) {\n\tlog.Printf(\"[gRPC] -- Processing heartbeat for app %s\", in.AppID)\n\tif nodeID := in.GetNodeID(); nodeID != 0 {\n\t\t// TODO do we need to lock Heartbeats, since the prune goroutine is deleting from it?\n\t\tif time.Now().Before(Heartbeats[int(nodeID)].Add(HeartbeatPeriodicity)) {\n\t\t\tlog.Printf(\"[gRPC] -- App %s already has a valid node ID... Extending ID lifetime...\", in.AppID)\n\t\t\tHeartbeats[int(nodeID)] = time.Now()\n\t\t\treturn &pb.HeartbeatResponse{AppID: in.AppID, NodeID: nodeID}, nil\n\t\t}\n\t\tlog.Printf(\"[gRPC] -- App %s has expired node ID %d\", in.AppID, nodeID)\n\t}\n\n\t// TODO if you don't create more than 1024, there should always be an available nodeID,\n\t// however, we should probably return an error if there are no available nodes,\n\t// instead of letting the client hang\n\t// https://stackoverflow.com/questions/3398490/checking-if-a-channel-has-a-ready-to-read-value-using-go\n\t// TODO check if channel has ready-to-read value, otherwise return error\n\tnodeID := <-AvailableNodeIds\n\tlog.Printf(\"[gRPC] -- Granting node ID %d to app %s\", nodeID, in.AppID)\n\tHeartbeats[nodeID] = time.Now()\n\treturn &pb.HeartbeatResponse{AppID: in.AppID, NodeID: int32(nodeID)}, nil\n}", "title": "" }, { "docid": "f45932f7a78f54e86c199ad39805030a", "score": "0.5045576", "text": "func (N *KVNode) Heartbeat(txid int, out *bool) error {\n\tif txid != 0 {\n\t\tN.updateHeartbeat(txid)\n\t}\n\t*out = true\n\treturn nil\n}", "title": "" }, { "docid": "e4f4e359c9577321b28f40b7e87db2ef", "score": "0.50403666", "text": "func (r *raft) tickHeartbeat() {\n\tr.heartbeatElapsed++\n\tr.electionElapsed++\n\n\tif r.electionElapsed >= r.electionTimeout {\n\t\tr.electionElapsed = 0\n\t\tif r.checkQuorum {\n\t\t\tr.Step(pb.Message{From: r.id, Type: pb.MsgCheckQuorum})\n\t\t}\n\t\t// If current leader cannot transfer leadership in electionTimeout, it becomes leader again.\n\t\tif r.state == StateLeader && r.leadTransferee != None {\n\t\t\tr.abortLeaderTransfer()\n\t\t}\n\t}\n\n\tif r.state != StateLeader {\n\t\treturn\n\t}\n\n\tif r.heartbeatElapsed >= r.heartbeatTimeout {\n\t\tr.heartbeatElapsed = 0\n\t\tr.Step(pb.Message{From: r.id, Type: pb.MsgBeat})\n\t}\n}", "title": "" }, { "docid": "d011507737890e3279adfe8e8c1a27c1", "score": "0.50261164", "text": "func (s *Server) Heartbeat(nodeID string, _ *bool) (_ error) {\n\ts.nodes.heartbeat(nodeID)\n\treturn\n}", "title": "" }, { "docid": "096ad685ee64400ec5a004bdbfb7fa83", "score": "0.50235", "text": "func Heartbeat(registery, addr string, duration time.Duration) {\n\tif duration == 0 {\n\t\tduration = defaultTimeout - time.Duration(1)*time.Minute\n\t}\n\n\tvar err error\n\terr = sendHeartbeat(registery, addr)\n\tgo func() {\n\t\tt := time.NewTicker(duration)\n\t\tfor err == nil {\n\t\t\t<-t.C\n\t\t\terr = sendHeartbeat(registery, addr)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "b0c1eb0c3d559396b69971832a11e587", "score": "0.5018205", "text": "func HeartBeat(server string) (err error) {\n\tvar (\n\t\tresp *http.Response\n\t\treq *http.Request\n\t\tbr *module.BusinessResponse\n\t\tbody []byte\n\t\tstatus module.ClusteredComponentStatuses\n\t)\n\tstatus, err = GetComponentStatus()\n\tif err != nil {\n\t\treturn\n\t}\n\tbody, err = json.Marshal(status)\n\tif err != nil {\n\t\treturn\n\t}\n\treq = ConstructHttpPostReq(global.G_config.Master, global.HEART_BEART_URI, string(body))\n\tresp, err = http.DefaultClient.Do(req)\n\tif(err != nil){\n\t\terr = errors.New(\"Failed to send heartbeat to master: \"+ err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\terr = errors.New(\"Failed to send heartbeat to master: \" + resp.Status)\n\t\treturn\n\t}\n\tbr = &module.BusinessResponse{}\n\tbody, _ = ioutil.ReadAll(resp.Body)\n\terr =json.Unmarshal(body, br)\n\tif br.Code != 200 {\n\t\terr = errors.New(\"Failed to send heartbeat to master: \" + br.Message)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "d7aff580f0f040970fa40f17916301ff", "score": "0.50165135", "text": "func Heartbeat(ctx context.Context, mp1SvcId string) error {\n\tserviceID := mp1SvcId[:len(mp1SvcId)/2]\n\tinstanceID := mp1SvcId[len(mp1SvcId)/2:]\n\treq := &proto.HeartbeatRequest{\n\t\tServiceId: serviceID,\n\t\tInstanceId: instanceID,\n\t}\n\t_, err := core.InstanceAPI.Heartbeat(ctx, req)\n\treturn err\n}", "title": "" }, { "docid": "110208a608b19aee1c8966b6dca22139", "score": "0.50142473", "text": "func (w *AgreementBotWorker) databaseHeartBeat() int {\n\n\tif err := w.db.HeartbeatPartition(); err != nil {\n\t\tmsg := AWlogString(fmt.Sprintf(\"Error heartbeating to the database, error: %v\", err))\n\t\tglog.Errorf(msg)\n\n\t\t// This is the case where Postgresql database certificate got upgraded. The error is: \"x509: certificate signed by unknown authority\"\n\t\t// Only checks for \"x509\" here to support globalization.\n\t\tif strings.Contains(err.Error(), \"x509\") || strings.Contains(err.Error(), \"X509\") {\n\t\t\tglog.Warningf(logString(fmt.Sprintf(\"The agbot will panic due to the database certificate error.\")))\n\t\t\tpanic(msg)\n\t\t}\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "41bd1b26c58474242c57612604c8ba24", "score": "0.5012708", "text": "func (t *ServiceLivenessUpdate) UpdateHeartbeat() string {\n\treturn t.State\n}", "title": "" }, { "docid": "0cc8db2e7dd4eb91313f3a1af4080d7a", "score": "0.49783766", "text": "func GetHeartbeatDetails(ctx context.Context, d ...interface{}) error {\n\treturn internal.GetHeartbeatDetails(ctx, d...)\n}", "title": "" }, { "docid": "320414e72d0aa44c7de58911b84f0cf4", "score": "0.4958342", "text": "func (r *raft) bcastHeartbeat() {\n\tlastCtx := r.readOnly.lastPendingRequestCtx()\n\tif len(lastCtx) == 0 {\n\t\tr.bcastHeartbeatWithCtx(nil)\n\t} else {\n\t\tr.bcastHeartbeatWithCtx([]byte(lastCtx))\n\t}\n}", "title": "" }, { "docid": "917e95e4f9c6e9671739cf5795d310eb", "score": "0.49242458", "text": "func (rf *Raft) BroadcastHeartbeat() {\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\n\tbaseIndex := rf.log[0].Index\n\tsnapshot := rf.persister.ReadSnapshot()\n\n\tfor server := range rf.peers {\n\t\tif server != rf.me && rf.state == STATE_LEADER {\n\t\t\tif rf.nextIndex[server] > baseIndex {\n\t\t\t\targs := &AppendEntriesArgs{}\n\t\t\t\targs.Term = rf.currentTerm\n\t\t\t\targs.LeaderId = rf.me\n\t\t\t\targs.PrevLogIndex = rf.nextIndex[server] - 1\n\t\t\t\tif args.PrevLogIndex >= baseIndex {\n\t\t\t\t\targs.PrevLogTerm = rf.log[args.PrevLogIndex-baseIndex].Term\n\t\t\t\t}\n\t\t\t\tif rf.nextIndex[server] <= rf.GetLastLogIndex() {\n\t\t\t\t\targs.Entries = rf.log[rf.nextIndex[server]-baseIndex:]\n\t\t\t\t}\n\t\t\t\targs.LeaderCommit = rf.commitIndex\n\n\t\t\t\tgo rf.SendAppendEntries(server, args, &AppendEntriesReply{})\n\t\t\t} else {\n\t\t\t\targs := &InitiateSnapshotArgs{}\n\t\t\t\targs.Term = rf.currentTerm\n\t\t\t\targs.LeaderId = rf.me\n\t\t\t\targs.LastIncludedIndex = rf.log[0].Index\n\t\t\t\targs.LastIncludedTerm = rf.log[0].Term\n\t\t\t\targs.Data = snapshot\n\n\t\t\t\tgo rf.SendInstallSnapshot(server, args, &InitiateSnapshotReply{})\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "03ab078d5b33d573c45b2d6578ef5044", "score": "0.4913677", "text": "func Heartbeat(ctx context.Context, backend kvstore.BackendOperations) {\n\tlog.WithField(logfields.Interval, kvstore.HeartbeatWriteInterval).Info(\"Starting to update heartbeat key\")\n\ttimer, timerDone := inctimer.New()\n\tdefer timerDone()\n\tfor {\n\t\tlog.Debug(\"Updating heartbeat key\")\n\t\ttctx, cancel := context.WithTimeout(ctx, defaults.LockLeaseTTL)\n\t\terr := backend.Update(tctx, kvstore.HeartbeatPath, []byte(time.Now().Format(time.RFC3339)), true)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Warning(\"Unable to update heartbeat key\")\n\t\t}\n\t\tcancel()\n\n\t\tselect {\n\t\tcase <-timer.After(kvstore.HeartbeatWriteInterval):\n\t\tcase <-ctx.Done():\n\t\t\tlog.Info(\"Stopping to update heartbeat key\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "34672f525de173ccbcde79d31d8691b9", "score": "0.49132553", "text": "func (p *BeaconQueryServiceClient) QueryBeaconActions(ctx context.Context, hwid []byte, secureMessage []byte, applicationType ApplicationType, applicationVersion string, lang string) (r *BeaconQueryResponse, err error) {\r\n var _args850 BeaconQueryServiceQueryBeaconActionsArgs\r\n _args850.Hwid = hwid\r\n _args850.SecureMessage = secureMessage\r\n _args850.ApplicationType = applicationType\r\n _args850.ApplicationVersion = applicationVersion\r\n _args850.Lang = lang\r\n var _result851 BeaconQueryServiceQueryBeaconActionsResult\r\n if err = p.c.Call(ctx, \"queryBeaconActions\", &_args850, &_result851); err != nil {\r\n return\r\n }\r\n switch {\r\n case _result851.E!= nil:\r\n return r, _result851.E\r\n }\r\n\r\n return _result851.GetSuccess(), nil\r\n}", "title": "" }, { "docid": "9c59465a07e939e9dacb3d4b24294ce5", "score": "0.49090227", "text": "func Heartbeat(registry, addr string, duration time.Duration) {\n\tif duration == 0 {\n\t\t// make sure there is enough time to send heart beat\n\t\t// before it's removed from registry\n\t\tduration = defaultTimeout - time.Duration(1)*time.Minute\n\t}\n\tvar err error\n\terr = sendHeartbeat(registry, addr)\n\tgo func() {\n\t\tt := time.NewTicker(duration)\n\t\tfor err == nil {\n\t\t\t<-t.C\n\t\t\terr = sendHeartbeat(registry, addr)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "60b9633fe454671baaeacc4167067b9b", "score": "0.49044126", "text": "func reportHeartbeat(c *bm.Context) {\n\tparams := c.Request.Form\n\theader := c.Request.Header\n\tbuvid := header.Get(\"Buvid\")\n\tdisplayid := header.Get(\"Display-ID\")\n\tsts := params.Get(\"start_ts\")\n\taid := params.Get(\"aid\")\n\tif aid == \"\" {\n\t\taid = params.Get(\"avid\")\n\t}\n\tcid := params.Get(\"cid\")\n\tplayedTime := params.Get(\"played_time\")\n\tmid := params.Get(\"mid\")\n\tmoAp := params.Get(\"mobi_app\")\n\ttypeID := params.Get(\"type\")\n\tsubType := params.Get(\"sub_type\")\n\tsid := params.Get(\"sid\")\n\tepid := params.Get(\"epid\")\n\tplayType := params.Get(\"play_type\")\n\tif playType == \"\" {\n\t\tplayType = params.Get(\"playtype\")\n\t}\n\tinfocRealTime.Info(sts, buvid, displayid, mid, aid, cid, playedTime, strconv.FormatInt(time.Now().Unix(), 10), \"2\", moAp, \"\", typeID, subType, sid, epid, playType)\n\tc.JSON(nil, nil)\n}", "title": "" }, { "docid": "a17ced2435eaba1b4fcfecdd81e9b96b", "score": "0.49005836", "text": "func HeartBeat(data *HeartbeatData) Command {\n\tbody, _ := json.Marshal(data)\n\tcmd := newCommand(HeartBeatReq)\n\tcmd.Body = body\n\treturn *cmd\n}", "title": "" }, { "docid": "e268d3ce9884cb456bd92e1eaeb78857", "score": "0.48963022", "text": "func (l *Logic) Heartbeat(c context.Context, mid int64, key, server string) (err error) {\n\thas, err := l.dao.ExpireMapping(c, mid, key)\n\tif err != nil {\n\t\tlog.Errorf(\"l.dao.ExpireMapping(%d,%s,%s) error(%v)\", mid, key, server, err)\n\t\treturn\n\t}\n\tif !has {\n\t\tif err = l.dao.AddMapping(c, mid, key, server); err != nil {\n\t\t\tlog.Errorf(\"l.dao.AddMapping(%d,%s,%s) error(%v)\", mid, key, server, err)\n\t\t\treturn\n\t\t}\n\t}\n\tlog.Infof(\"conn heartbeat key:%s server:%s mid:%d\", key, server, mid)\n\treturn\n}", "title": "" }, { "docid": "8ff31cd3548bd5a770c7ef983f9d7ca3", "score": "0.48821193", "text": "func (c *Client) Heartbeat() {\n\n\t// Set up ticker\n\tticker := time.NewTicker(c.HeartbeatInterval)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tsequence := atomic.LoadInt64(c.Sequence)\n\t\tc.wsMutex.Lock()\n\t\terr := c.wsConn.WriteJSON(HeartbeatPayload{1, sequence})\n\t\tc.wsMutex.Unlock()\n\n\t\tif err != nil {\n\t\t\tc.Log.Fatalf(\"Websocket: was unable to send heartbeat: %v\", err)\n\t\t\tc.Reconnect <- nil\n\t\t\tc.Connected <- nil\n\t\t\treturn\n\t\t} else if time.Now().Sub(c.LastHeartbeatAck) > c.HeartbeatInterval*c.MissingHeartbeatAcks {\n\t\t\tc.Log.Errorf(\"Websocket: did not receive a hearbeat acknowledgement for the last %v heartbeats\", c.MissingHeartbeatAcks)\n\t\t\tc.Reconnect <- nil\n\t\t\tc.Connected <- nil\n\t\t\treturn\n\t\t}\n\t\tc.Log.Debug(\"Websocket: sent heartbeat to Discord\")\n\n\t\t// Wait for next tick or quit\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\t// continue loop\n\t\tcase <-c.Connected:\n\t\t\tc.Log.Info(\"Websocket: Stopped heartbeat\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e375c30c0924e273662bb7f146456a56", "score": "0.48768926", "text": "func newHeartbeatEvent() (*Event, error) {\n\tev, err := newEvent(\"_zpc_hb\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ev, nil\n}", "title": "" }, { "docid": "7331bcd7df10661e28465663879087ca", "score": "0.48677146", "text": "func MonitorHeartBeat(idleTimeout time.Duration, runTimeout time.Duration, heartbeat, isMonitorClosed, stopC chan bool, stop func() error, notifyEvent func(string, ...interface{})) {\n\tt := time.NewTimer(idleTimeout)\n\tr := time.NewTimer(runTimeout)\n\tdefer t.Stop()\n\tdefer r.Stop()\n\tfor alive := true; alive; {\n\t\tselect {\n\t\tcase <-stopC:\n\t\t\tnotifyEvent(\"StoppingHeartbeatMonitoring\", \"Stop signal received.\")\n\t\t\tclose(isMonitorClosed)\n\t\t\treturn // Return early to avoid calling stop()\n\n\t\tcase alive = <-heartbeat:\n\t\t\tif alive {\n\t\t\t\tif !t.Stop() {\n\t\t\t\t\t<-t.C\n\t\t\t\t}\n\t\t\t\tt.Reset(idleTimeout)\n\t\t\t} else {\n\t\t\t\tnotifyEvent(\"NegativeHeartbeat\", \"Stopping process.\")\n\t\t\t}\n\n\t\tcase <-t.C:\n\t\t\talive = false\n\t\t\tnotifyEvent(\"MissingHeartbeat\", \"Stopping process.\")\n\t\tcase <-r.C:\n\t\t\talive = false\n\t\t\tnotifyEvent(\"RunTimePassed\", \"Stopping process.\")\n\t\t}\n\t}\n\n\tclose(isMonitorClosed)\n\tif err := stop(); err != nil {\n\t\tnotifyEvent(\"StopError\", err.Error())\n\t}\n}", "title": "" }, { "docid": "d62cf3e833c913530c545df6817ecc1f", "score": "0.48557013", "text": "func (fs *FollowerSchedule) WaitForHeartbeat() bool {\n\tclockMark := fs.clock\n\ttimeoutMillis := HeartbeatTimeoutMinMillis +\n\t\trand.Intn(HeartbeatTimeoutMaxMillis-HeartbeatTimeoutMinMillis)\n\ttime.Sleep(time.Duration(timeoutMillis) * time.Millisecond)\n\treturn fs.clock > clockMark\n}", "title": "" }, { "docid": "2842d81680576895b06fa08e49e043ce", "score": "0.48467347", "text": "func (w *Websocket) Heartbeat() {\n\tw.SendOP(3)\n}", "title": "" }, { "docid": "142e8d11721e6f3cb7bc9629462bc583", "score": "0.4825704", "text": "func (t *trAMQP) SetupHeartbeat(path string) {\n\t//no setup necesarry for AMQP\n}", "title": "" }, { "docid": "759f7016e1a003b64b14a81ea83a7117", "score": "0.48209277", "text": "func (red *Client) Heartbeat(queueID string, taskID string, expirationSec int32) (int, error) {\n\n\tif red.clientpool == nil {\n\t\tlog.Fatal(\"Connection to Redis not initialized. Did you forget to initialize?\")\n\t}\n\n\tlog.Println(\"***************\")\n\tlog.Println(\"HEARTBEAT START\")\n\n\tset := queueID + \".running\"\n\tmember := taskID\n\n\texpiresAt := time.Now().Unix() + int64(expirationSec)\n\tscore := strconv.FormatInt(expiresAt, 10)\n\n\t// _, _, _ = set, score, value\n\tcount, _ := red.zaddUpdate(set, score, member)\n\tif count == 0 {\n\t\terrMsg := \"Heartbeat: no item could be found to update, was item already \" +\n\t\t\t\"completed?, or perhaps the item was updated < 1 sec ago.\"\n\t\tlog.Println(errMsg)\n\t\treturn 0, errors.New(errMsg)\n\t}\n\n\tlog.Println(\"HEARTBEAT END\")\n\tlog.Println(\"***************\")\n\n\treturn int(expiresAt), nil\n}", "title": "" }, { "docid": "554d4cd9875bd76f1497da9587cd8d16", "score": "0.48127377", "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": "6146e12ab4ac1fdeb30333da1a4a8ed7", "score": "0.47919676", "text": "func (c *VoiceClient) sendHeartbeat(i interface{}) error {\n\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\treturn c.emit(cmd.VoiceHeartbeat, r.Uint32())\n}", "title": "" }, { "docid": "320c79c490a673faefefc153d0f5689b", "score": "0.47917405", "text": "func (h *XenditHandler) GetHeartBeat(res http.ResponseWriter, req *http.Request) {\n\tlog.Debugln(\"invoke getHeartBeat\")\n\tresp := &model.GenericResponse{\n\t\tSuccess: true,\n\t}\n\n\tutils.WriteEntity(res, http.StatusOK, resp)\n\tlog.Debugln(\"end getHeartBeat\")\n}", "title": "" }, { "docid": "725851dd71537e68e4b81cb2f2af1735", "score": "0.47812498", "text": "func NewHeartbeatMessage(hb *Heartbeat) ([]byte, error) {\n\tif len(hb.NetworkID) > HeartbeatPacketMaxNetworkIDBytesSize {\n\t\treturn nil, fmt.Errorf(\"%w: heartbeat exceeds maximum length of NetworkID of %d \", ErrInvalidHeartbeat, HeartbeatPacketMaxNetworkIDBytesSize)\n\t}\n\tif len(hb.NetworkID) == 0 {\n\t\treturn nil, fmt.Errorf(\"%w: heartbeat NetworkID length is 0 \", ErrInvalidHeartbeat)\n\t}\n\tif len(hb.InboundIDs) > HeartbeatMaxInboundPeersCount {\n\t\treturn nil, fmt.Errorf(\"%w: heartbeat exceeds maximum inbound IDs of %d\", ErrInvalidHeartbeat, HeartbeatMaxInboundPeersCount)\n\t}\n\tif len(hb.OutboundIDs) > HeartbeatMaxOutboundPeersCount {\n\t\treturn nil, fmt.Errorf(\"%w: heartbeat exceeds maximum outbound IDs of %d\", ErrInvalidHeartbeat, HeartbeatMaxOutboundPeersCount)\n\t}\n\n\tif len(hb.OwnID) != HeartbeatPacketPeerIDSize {\n\t\treturn nil, fmt.Errorf(\"%w: heartbeat must contain the own peer ID\", ErrInvalidHeartbeat)\n\t}\n\n\t// calculate total needed bytes based on packet\n\tpacketSize := HeartbeatPacketMinSize + len(hb.NetworkID) + len(hb.OutboundIDs)*HeartbeatPacketPeerIDSize + len(hb.InboundIDs)*HeartbeatPacketPeerIDSize\n\tpacket := make([]byte, packetSize)\n\n\t// network id size\n\tpacket[0] = byte(len(hb.NetworkID))\n\n\toffset := HeartbeatPacketNetworkIDBytesCountSize\n\n\tcopy(packet[offset:offset+len(hb.NetworkID)], hb.NetworkID)\n\n\toffset += len(hb.NetworkID)\n\n\t// own nodeId\n\tcopy(packet[offset:offset+HeartbeatPacketPeerIDSize], hb.OwnID)\n\n\t// outbound id count\n\tpacket[offset+HeartbeatPacketPeerIDSize] = byte(len(hb.OutboundIDs))\n\toffset += HeartbeatPacketPeerIDSize + HeartbeatPacketOutboundIDCountSize\n\n\t// copy contents of hb.OutboundIDs\n\tfor i, outboundID := range hb.OutboundIDs {\n\t\tcopy(packet[offset+i*HeartbeatPacketPeerIDSize:offset+(i+1)*HeartbeatPacketPeerIDSize], outboundID[:HeartbeatPacketPeerIDSize])\n\t}\n\n\t// advance offset to after outbound IDs\n\toffset += len(hb.OutboundIDs) * HeartbeatPacketPeerIDSize\n\n\t// copy contents of hb.InboundIDs\n\tfor i, inboundID := range hb.InboundIDs {\n\t\tcopy(packet[offset+i*HeartbeatPacketPeerIDSize:offset+(i+1)*HeartbeatPacketPeerIDSize], inboundID[:HeartbeatPacketPeerIDSize])\n\t}\n\n\t// create a buffer for tlv header plus the packet\n\tbuf := bytes.NewBuffer(make([]byte, 0, tlv.HeaderMessageDefinition.MaxBytesLength+uint16(packetSize)))\n\t// write tlv header into buffer\n\tif err := tlv.WriteHeader(buf, MessageTypeHeartbeat, uint16(packetSize)); err != nil {\n\t\treturn nil, err\n\t}\n\t// write serialized packet bytes into the buffer\n\tif err := binary.Write(buf, binary.BigEndian, packet); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "f501c5e4dd462f1b5640eaabb79dd0c1", "score": "0.47713634", "text": "func (o *os) heartbeat() {\n\tt := time.NewTicker(o.opts.Interval)\n\n\tfor {\n\t\tselect {\n\t\tcase <-t.C:\n\t\t\tvar heartbeats [] *Heartbeat\n\n\t\t\to.RLock()\n\t\t\tfor _, hb := range o.heartbeats {\n\t\t\t\theartbeats = append(heartbeats, hb)\n\t\t\t}\n\t\t\to.RUnlock()\n\n\t\t\tfor _, hb := range heartbeats {\n\t\t\t\thb.timestamp = time.Now().Unix()\n\n\t\t\t\t// pub := o.opts.Client.NewPublication(HeartbeatTopic, hb)\n\t\t\t\t// o.opts.Client.Publish(context.TODO(), pub)\n\t\t\t\terr := registry.Register( hb.service )\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog2.Fatal(\"Heartbeats check failed!\")\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-o.exit:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d7f78e823129df9daf6c2a4dd88bfab3", "score": "0.4763491", "text": "func (i *InfluxStorage) Heartbeat(deviceID string) {\n\ti.Lock()\n\tdefer i.Unlock()\n\n\ti.addPoint(deviceID, map[string]interface{}{\"ping\": true}, map[string]string{eventToken: heartbeatToken})\n}", "title": "" }, { "docid": "78fb504bee3325ec30ea741471481c87", "score": "0.47296095", "text": "func (r *Raft) heartbeat(s *followerReplication) {\n\tfor {\n\t\tselect {\n\t\tcase <-randomTimeout(r.conf.HeartbeatTimeout/4, r.conf.HeartbeatTimeout/2):\n\t\t\treq := AppendEntriesRequest{\n\t\t\t\tTerm: r.getCurrentTerm(),\n\t\t\t\tLeader: []byte(r.localAddr.String()),\n\t\t\t}\n\t\t\tvar resp AppendEntriesResponse\n\t\t\tif err := r.trans.AppendEntries(s.peer, &req, &resp); err != nil {\n\t\t\t\tr.logE.Printf(\"Failed to heartbeat to %v: %v\", s.peer, err)\n\t\t\t}\n\t\tcase <-s.stopCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "60644f1d92e528141fd8eec48efc21e7", "score": "0.47169584", "text": "func heartbeat() {\n\t// Loop forever\n\tfor true {\n\t\tloggingClient.Info(configuration.HeartBeatMsg, \"\")\n\t\ttime.Sleep(time.Millisecond * time.Duration(configuration.HeartBeatTime)) // Sleep based on configuration\n\t}\n}", "title": "" }, { "docid": "f24ef1c820324cbd917ed30c65f0871d", "score": "0.47146", "text": "func (sc *ServerConn) SetHeartbeat(heartbeat int64) {\n\tsc.mu.Lock()\n\tdefer sc.mu.Unlock()\n\tsc.heart = heartbeat\n}", "title": "" }, { "docid": "bf3f96dfa2e2c5635750798431b57612", "score": "0.47077158", "text": "func (c *Cluster) SetHeartbeatFrequency(freq int) {\n\tc.heartbeatFrequency = freq\n}", "title": "" }, { "docid": "534cfc917a62a9e01ddb4f4a06976509", "score": "0.46989536", "text": "func (c *CbgtContext) StopHeartbeatListener() {\n\n\tif c.heartbeatListener != nil {\n\t\tc.heartbeater.UnregisterListener(c.heartbeatListener.Name())\n\t\tc.heartbeatListener.Stop()\n\t}\n}", "title": "" }, { "docid": "8d5a7be34726ea3a7744e843a8293617", "score": "0.4695634", "text": "func (m *Monitor) XColoLostHeartbeat() (err error) {\n\tcmd := struct {\n\t}{}\n\tbs, err := json.Marshal(map[string]interface{}{\n\t\t\"execute\": \"x-colo-lost-heartbeat\",\n\t\t\"arguments\": cmd,\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\tbs, err = m.mon.Run(bs)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "fabbc0c2a6150430ddbcc7b1857ea03f", "score": "0.4693877", "text": "func (m *manager) Heartbeat(ctx context.Context, indexerName string, indexIDs []int) error {\n\treturn m.requeueIndexes(ctx, m.pruneIndexes(indexerName, indexIDs))\n}", "title": "" }, { "docid": "35eba8d4ad5db32ac748834eddc241e5", "score": "0.4689849", "text": "func (r *Router) Heartbeat() {\n\t// log.Println(\"Beating my heart\")\n\t// log.Println(r.conns)\n\tretChan := make(chan heartbeatOutput, len(r.conns))\n\tping := func(ip string, cxn *grpc.ClientConn) {\n\t\tif cxn == nil {\n\t\t\tconn, err := grpc.Dial(ip, grpc.WithInsecure())\n\t\t\tif err != nil {\n\t\t\t\t// log.Println(\"Failed dail\", err)\n\t\t\t\tretChan <- heartbeatOutput{\n\t\t\t\t\tip: ip,\n\t\t\t\t\tconn: nil,\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tcxn = conn\n\t\t\t}\n\t\t}\n\t\t// TODO\n\t\tclient := NewRegionClient(cxn)\n\t\t_, err := client.Ping(context.Background(), &EmptyRequest{})\n\t\tif err != nil {\n\t\t\t// log.Println(\"Failed ping\", err)\n\t\t\tretChan <- heartbeatOutput{\n\t\t\t\tip: ip,\n\t\t\t\tconn: nil,\n\t\t\t}\n\t\t\treturn \n\t\t}\n\n\t\t// log.Println(\"OK\")\n\t\tretChan <- heartbeatOutput {\n\t\t\tip: ip,\n\t\t\tconn: cxn,\n\t\t}\n\t}\n\n\tfor {\n\t\t<-time.Tick(time.Second)\n\t\tr.lock.Lock()\n\t\tfor h, cxn := range r.conns {\n\t\t\t// send rpc\n\t\t\t// log.Println(h, cxn)\n\t\t\tgo ping(h, cxn)\n\t\t}\n\t\tr.liveBacks = []uint32{}\n\t\tfor i := 0; i < len(r.conns); i++ {\n\t\t\tstatus := <-retChan\n\t\t\tr.conns[status.ip] = status.conn\n\t\t\tif status.conn != nil {\n\t\t\t\tr.liveBacks = append(r.liveBacks, r.iphash[status.ip])\n\t\t\t}\t\t\t\n\t\t}\n\n\t\tsort.Slice(r.liveBacks, func(i, j int) bool {\n\t\t\treturn r.liveBacks[i] < r.liveBacks[j]\n\t\t})\n\n\t\tif r.Ready {\n\t\t\tnewSuccessor := r.successor(r.Hash+1)\n\t\t\tnewPredecessor := r.predecessor(r.Hash)\n\n\t\t\tif newSuccessor != r.CurrSuccessor {\n\t\t\t\t// handle one node case\n\t\t\t\tif newSuccessor == r.Hash {\n\t\t\t\t\tr.RegionChange <- RegionChangeInfo{\n\t\t\t\t\t\tSuccessor: true,\n\t\t\t\t\t\tJoin: true,\n\t\t\t\t\t\tPrevConn: nil,\n\t\t\t\t\t\tCurrConn: nil,\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tr.OnSccessorChange(r.CurrSuccessor, newSuccessor)\n\t\t\t\t}\n\t\t\t\tr.CurrSuccessor = newSuccessor\n\t\t\t}\n\n\t\t\tif newPredecessor != r.CurrPredecessor {\n\t\t\t\tif newPredecessor != r.Hash {\n\t\t\t\t\tr.onPredecessorChange(r.CurrPredecessor, newPredecessor)\n\t\t\t\t}\n\t\t\t\tr.CurrPredecessor = newPredecessor\n\t\t\t}\n\t\t}\n\t\tr.lock.Unlock()\n\t}\n}", "title": "" }, { "docid": "a71b1df57e58ca9017f8cb2ed5756033", "score": "0.46831056", "text": "func (v *PollForActivityTaskResponse) GetHeartbeatDetails() (o []byte) {\n\tif v != nil && v.HeartbeatDetails != nil {\n\t\treturn v.HeartbeatDetails\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "75b7cda4f49b600ffc4be6fb786ec218", "score": "0.46714064", "text": "func (env *Env) HeartBeatMechaism(session *libcoap.Session, customer *models.Customer) {\n\t// Set isSentHeartBeat is true to check the DOTS server sent ping to DOTS client\n\tsession.SetIsSentHeartBeat(true)\n\tfor {\n\t\t// If session is closed, DOTS server will doesn't sent Ping to DOTS client\n\t\tsessions := libcoap.ConnectingSessions()\n\t\tif sessions[session.GetSessionPtr()] == nil {\n\t\t\treturn\n\t\t}\n\t\tenv.session = session\n\t\t// Get session configuration of this session by customer id\n\t\tsessionConfig, err := controllers.GetSessionConfig(customer)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"[Session Mngt Thread]: Get session configuration failed.\")\n\t\t\treturn\n\t\t}\n\t\t// If DOTS server receives 2.04 but DOTS server doesn't recieve heartbeat from DOTS client, DOTS server set 'peer-hb-status' to false\n // Else DOTS server set 'peer-hb-status' to true\n\t\thbValue := true\n\t\tif session.GetIsReceiveResponseContent() == true && session.GetIsReceiveHeartBeat() == false {\n\t\t\thbValue = false\n\t\t}\n\t\thbMessage, err := messages.NewHeartBeatMessage(*env.CoapSession(), messages.JSON_HEART_BEAT_SERVER, hbValue)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to create heartbeat message\")\n\t\t\treturn\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"[Session Mngt Thread]: Failed to create new heartbeat message. Error: %+v\", err)\n\t\t\treturn\n\t\t}\n\t\tif env.CoapSession().GetIsHeartBeatTask() == true {\n\t\t\tlog.Debugf(\"[Session Mngt Thread]: Waiting for current heartbeat task (id = %+v)\", env.hbMessageTask.message.MessageID)\n\t\t} else {\n\t\t\tlog.Debugf(\"[Session Mngt Thread]: Create new heartbeat message (id = %+v) to check client connection\", hbMessage.MessageID)\n\t\t\tenv.Run(NewHeartBeatMessageTask(hbMessage, sessionConfig.MissingHbAllowedIdle,\n\t\t\t\ttime.Duration(sessionConfig.AckTimeoutIdle) * time.Second,\n\t\t\t\ttime.Duration(sessionConfig.HeartbeatIntervalIdle) * time.Second,\n\t\t\t\theartbeatResponseHandler, heartbeatTimeoutHandler))\n\n\t\t\tsession.SetIsReceiveResponseContent(false)\n\t\t\tsession.SetIsReceiveHeartBeat(false)\n\t\t}\n\t\ttime.Sleep(time.Duration(sessionConfig.HeartbeatIntervalIdle) * time.Second)\n\t}\n}", "title": "" }, { "docid": "dc8266ab557d297c0d5581f6699d6363", "score": "0.4665857", "text": "func NewHeartbeatClient(address string) HeartbeatClient {\n\tclient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\tDialContext: (&net.Dialer{\n\t\t\t\tTimeout: 5 * time.Second,\n\t\t\t\tKeepAlive: 5 * time.Second,\n\t\t\t}).DialContext,\n\t\t\tDisableCompression: false,\n\t\t\tDisableKeepAlives: false,\n\t\t\tMaxIdleConnsPerHost: 20,\n\t\t\tIdleConnTimeout: 5 * time.Minute,\n\t\t\tTLSHandshakeTimeout: 5 * time.Second,\n\t\t\tExpectContinueTimeout: 1 * time.Second,\n\t\t\tResponseHeaderTimeout: 60 * time.Second,\n\t\t},\n\t\tTimeout: 5 * time.Minute,\n\t}\n\n\tc := heartbeatClient{\n\t\tclient: client,\n\t\taddress: address,\n\t}\n\n\treturn &c\n}", "title": "" }, { "docid": "d9bc4bc77d92fe8f8163613d13164b3f", "score": "0.46650398", "text": "func NewHeartbeatClient(c config) *HeartbeatClient {\n\treturn &HeartbeatClient{config: c}\n}", "title": "" }, { "docid": "e065f7618fdb5ff08885f44494342602", "score": "0.4664382", "text": "func (c *Client) SubscribeToHeartbeat(ctx context.Context, ch chan<- string) (*rpc.ClientSubscription, error) {\n\treturn c.rpcClient.Subscribe(ctx, \"mesh\", ch, \"heartbeat\")\n}", "title": "" }, { "docid": "237b3aa67d9db787187a4ef935eb9be4", "score": "0.4662385", "text": "func heartBeatMonitoring(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar pingNow Ping\n\tpingNow.Timestamp = time.Now()\n\tif contextLock == true {\n\t\tpingNow.CtxStatus = \"alivectx\"\n\t} else {\n\t\tpingNow.CtxStatus = \"alive\"\n\t}\n\tpingNow.TotBot = len(bots)\n\tjson.NewEncoder(w).Encode(pingNow)\n}", "title": "" }, { "docid": "3e4213d858e7bdf91d41c77295c14405", "score": "0.46620604", "text": "func (h *Heartbeat) Health(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\tvar status struct {\n\t\tStatus string\n\t}\n\tif err := database.Open(); err != nil {\n\t\tstatus.Status = \"db not ready\"\n\t}\n\tstatus.Status = \"OK\"\n\tweb.Respond(ctx, w, status, http.StatusOK)\n\treturn nil\n}", "title": "" }, { "docid": "3c44cda292576fc3d243bb943910d838", "score": "0.4661088", "text": "func (r *Replicant) Heartbeat() {\n\tfor {\n\t\tselect {\n\t\tcase <-r.ctx.Done():\n\t\t\treturn\n\t\tcase <-time.Tick(time.Duration(10) * time.Second):\n\t\t\t{\n\t\t\t\tif err := r.sendHeartbeat(); err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8c1df0b0b573925abe596321c2770abc", "score": "0.46514344", "text": "func TestHandleHeartbeat(t *testing.T) {\n\tcommit := uint64(2)\n\tfixtures := []struct {\n\t\tmessage pb.Message\n\t\twCommit uint64\n\t}{\n\t\t{pb.Message{From: 2, To: 1, Type: pb.MsgHeartbeat, Term: 2, Commit: commit + 1}, commit + 1},\n\t\t{pb.Message{From: 2, To: 1, Type: pb.MsgHeartbeat, Term: 2, Commit: commit - 1}, commit}, // do not decrease commit\n\t}\n\n\tfor i, fixture := range fixtures {\n\t\tstorage := newTestMemoryStorage(withPeers(1, 2))\n\t\tstorage.Append([]pb.Entry{{Index: 1, Term: 1}, {Index: 2, Term: 2}, {Index: 3, Term: 3}})\n\t\tr := newTestRaft(1, 5, 1, storage)\n\t\tr.becomeFollower(2, 2)\n\t\tr.raftLog.commitTo(commit)\n\t\tr.handleHeartbeat(fixture.message)\n\t\tif r.raftLog.committed != fixture.wCommit {\n\t\t\tt.Errorf(\"#%d: committed = %d, want %d\", i, r.raftLog.committed, fixture.wCommit)\n\t\t}\n\t\tm := r.readMessages()\n\t\tif len(m) != 1 {\n\t\t\tt.Fatalf(\"#%d: msg = nil, want 1\", i)\n\t\t}\n\t\tif m[0].Type != pb.MsgHeartbeatResp {\n\t\t\tt.Errorf(\"#%d: type = %v, want MsgHeartbeatResp\", i, m[0].Type)\n\t\t}\n\n\t\tklog.Infof(fmt.Sprintf(\"[TestHandleHeartbeat]%+v\", m))\n\t}\n}", "title": "" }, { "docid": "93ba6f18ee873959f51df9cc79bdc027", "score": "0.46449682", "text": "func (c *AlarmStatusClient) Query() *AlarmStatusQuery {\n\treturn &AlarmStatusQuery{config: c.config}\n}", "title": "" }, { "docid": "2f358cc0f4f6b64a6248a82057bc9f9f", "score": "0.46317238", "text": "func (c *ringSharding) Heartbeat(ctx context.Context, frequency time.Duration) {\n\tticker := time.NewTicker(frequency)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tvar rebalance bool\n\n\t\t\tfor _, shard := range c.List() {\n\t\t\t\terr := shard.Client.Ping(ctx).Err()\n\t\t\t\tisUp := err == nil || err == pool.ErrPoolTimeout\n\t\t\t\tif shard.Vote(isUp) {\n\t\t\t\t\tinternal.Logger.Printf(ctx, \"ring shard state changed: %s\", shard)\n\t\t\t\t\trebalance = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif rebalance {\n\t\t\t\tc.mu.Lock()\n\t\t\t\tc.rebalanceLocked()\n\t\t\t\tc.mu.Unlock()\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b2dd8a762f14e651dc6f6139a3148f04", "score": "0.4626961", "text": "func (connector *DbConnector) UpdateMetricsHeartbeat() error {\n\tc := *connector.client\n\terr := c.Incr(connector.context, selfStateMetricsHeartbeatKey).Err()\n\treturn err\n}", "title": "" }, { "docid": "8675b72b425626e13124d4c65732241d", "score": "0.4626476", "text": "func HeartBeatRequest() {\n\tmsg := MakeMessage(HeartBeatMsg, ID, []Member{self})\n\tSendMessageToTargets(GossipTargets, msg)\n}", "title": "" }, { "docid": "6751d645ef689c5376d1d6fe3f6e13f0", "score": "0.4614405", "text": "func (catalog *NodeCatalog) HeartBeat(heartbeat map[string]interface{}) bool {\n\tsender := heartbeat[\"sender\"].(string)\n\tnode, nodeExists := catalog.nodes.Load(sender)\n\n\tif nodeExists && (node.(moleculer.Node)).IsAvailable() {\n\t\t(node.(moleculer.Node)).HeartBeat(heartbeat)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8bfe5fd4e20699a4c6636d92d44ed560", "score": "0.46038234", "text": "func (s *state) fanoutHeartbeatResponse(req *RaftMessageRequest) {\n\tfromID := roachpb.NodeID(req.Message.From)\n\toriginNode, ok := s.nodes[fromID]\n\tif !ok {\n\t\tlog.Warningf(\"node %v: not fanning out heartbeat response from unknown node %v\",\n\t\t\ts.nodeID, fromID)\n\t\treturn\n\t}\n\n\tcnt := 0\n\tfor groupID := range originNode.groupIDs {\n\t\t// If we don't think that the local node is leader, don't propagate.\n\t\tif s.groups[groupID].leader.NodeID != s.nodeID || fromID == s.nodeID {\n\t\t\tif log.V(8) {\n\t\t\t\tlog.Infof(\"node %v: not fanning out heartbeat response to %v, msg is from %v and leader is %v\",\n\t\t\t\t\ts.nodeID, groupID, fromID, s.groups[groupID].leader)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tfromRepID, err := s.Storage.ReplicaIDForStore(groupID, req.FromReplica.StoreID)\n\t\tif err != nil {\n\t\t\tif log.V(3) {\n\t\t\t\tlog.Infof(\"node %s: not fanning out heartbeat to %s, could not find replica id for sending store %s\",\n\t\t\t\t\ts.nodeID, groupID, req.FromReplica.StoreID)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\ttoRepID, err := s.Storage.ReplicaIDForStore(groupID, req.ToReplica.StoreID)\n\t\tif err != nil {\n\t\t\tif log.V(3) {\n\t\t\t\tlog.Infof(\"node %s: not fanning out heartbeat to %s, could not find replica id for receiving store %s\",\n\t\t\t\t\ts.nodeID, groupID, req.ToReplica.StoreID)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tmsg := raftpb.Message{\n\t\t\tType: raftpb.MsgHeartbeatResp,\n\t\t\tFrom: uint64(fromRepID),\n\t\t\tTo: uint64(toRepID),\n\t\t}\n\n\t\tif err := s.multiNode.Step(context.Background(), uint64(groupID), msg); err != nil {\n\t\t\tif log.V(4) {\n\t\t\t\tlog.Infof(\"node %v: coalesced heartbeat response step to group %v failed\", s.nodeID, groupID)\n\t\t\t}\n\t\t}\n\t\tcnt++\n\t}\n\tif log.V(7) {\n\t\tlog.Infof(\"node %v: received coalesced heartbeat response from node %v; \"+\n\t\t\t\"fanned out to %d leaders in %d overlapping groups\",\n\t\t\ts.nodeID, fromID, cnt, len(originNode.groupIDs))\n\t}\n}", "title": "" }, { "docid": "310ea48138948e3dc8a2a3fa745310e2", "score": "0.4595998", "text": "func Heartbeat(ctx *Context, remoteIP string) {\n\tconn, err := net.Dial(\"tcp\", remoteIP+HandlerPort)\n\tif err != nil {\n\t\tlog.Printf(HEARTBEATERROR, err)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\n\ttimer := time.Now()\n\tfor {\n\t\tif time.Since(timer) >= HeartbeatTime {\n\t\t\terr := checkNode(conn, remoteIP)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(HEARTBEATERROR, err)\n\t\t\t\tBroadcast(ctx, fmt.Sprintf(\"DEAD %s\\n\", remoteIP))\n\t\t\t}\n\t\t\ttimer = time.Now()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e1fe09ff7b44e0abf49c94db823c32f0", "score": "0.45816877", "text": "func (c *InstructionClient) QueryAgent(i *Instruction) *AgentQuery {\n\tquery := &AgentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := i.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(instruction.Table, instruction.FieldID, id),\n\t\t\tsqlgraph.To(agent.Table, agent.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, false, instruction.AgentTable, instruction.AgentColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(i.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "972241c6383c37323b917b1949696b27", "score": "0.4580358", "text": "func (r *raft) sendHeartbeat(to uint64, ctx []byte) {\n\t// Attach the commit as min(to.matched, r.committed).\n\t// When the leader sends out heartbeat message,\n\t// the receiver(follower) might not be matched with the leader\n\t// or it might not have all the committed entries.\n\t// The leader MUST NOT forward the follower's commit to\n\t// an unmatched index.\n\tcommit := min(r.prs.Progress[to].Match, r.raftLog.committed)\n\tm := pb.Message{\n\t\tTo: to,\n\t\tType: pb.MsgHeartbeat,\n\t\tCommit: commit,\n\t\tContext: ctx,\n\t}\n\n\tr.send(m)\n}", "title": "" }, { "docid": "9fe4a5e4b6f64007919f49336edd4d21", "score": "0.45750666", "text": "func (wa *WebAPI) HandleHeartbeatAgent(w http.ResponseWriter, r *http.Request) {\n\t// register with the id\n\twr := httputil.NewResponse(w)\n\tdefer wr.Flush()\n\n\tvar uid = mux.Vars(r)[\"uid\"]\n\tif uid == \"\" {\n\t\twr.WithCode(200).WithErrorf(\"agent id can't be empty\")\n\t\treturn\n\t}\n\n\t// TODO: add more information about device like location or status\n\n\t// update heartbeat_at\n\t_, err := wa.UpdateAgent(uid, &core.Agent{\n\t\tHeartbeatAt: time.Now(),\n\t})\n\n\twr.WithError(err)\n}", "title": "" }, { "docid": "003b05f5629b35c9bb3239da17cb1a90", "score": "0.45714566", "text": "func NewHeartbeatsFetcher(queryExecutor cloudwatch.QueryExecutor) HeartbeatsFetcher {\n\treturn HeartbeatsFetcher{queryExecutor}\n}", "title": "" }, { "docid": "3fe19cf94a9d1390c952e5151ec8a65d", "score": "0.45687458", "text": "func (v *PendingActivityInfo) GetHeartbeatDetails() (o []byte) {\n\tif v != nil && v.HeartbeatDetails != nil {\n\t\treturn v.HeartbeatDetails\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2d5eb6a80d70fdc6231eb5203da0dd23", "score": "0.45495483", "text": "func (db *DatabaseServer) HealthCheck(ctx context.Context, _ *emptypb.Empty) (*rpcdbpb.HealthCheckResponse, error) {\n\thealth, err := db.db.HealthCheck(ctx)\n\tif err != nil {\n\t\treturn &rpcdbpb.HealthCheckResponse{}, err\n\t}\n\n\tdetails, err := json.Marshal(health)\n\treturn &rpcdbpb.HealthCheckResponse{\n\t\tDetails: details,\n\t}, err\n}", "title": "" }, { "docid": "bb232d393276c347c553dca954c0b642", "score": "0.4545957", "text": "func (clientConfig *ClientConfig) HeartbeatTimeout() int32 {\n\treturn clientConfig.heartbeatTimeoutInSeconds\n}", "title": "" }, { "docid": "9fcd51cc2e0b04900921f405cacf8c0d", "score": "0.45285627", "text": "func (sm *sidecarManager) heartbeatHandler(w http.ResponseWriter, req *http.Request) {\n\tctx := context.Background()\n\tre := regexp.MustCompile(`.*/v1/sessionHosts\\/(.*?)(/heartbeats|$)`)\n\tmatch := re.FindStringSubmatch(req.RequestURI)\n\n\tsessionHostId := match[1]\n\n\tvar hb HeartbeatRequest\n\terr := json.NewDecoder(req.Body).Decode(&hb)\n\tif err != nil {\n\t\tbadRequest(w, err, \"cannot deserialize json\")\n\t\treturn\n\t}\n\n\tif logEveryHeartbeat {\n\t\tsm.logger.Debugf(\"heartbeat received from sessionHostId %s, data %#v\", sessionHostId, hb)\n\t}\n\n\tif err := validateHeartbeatRequestArgs(&hb); err != nil {\n\t\tsm.logger.Warnf(\"error validating heartbeat request %s\", err.Error())\n\t\tbadRequest(w, err, \"invalid heartbeat request\")\n\t\treturn\n\t}\n\n\tif err := sm.updateHealthIfNeeded(ctx, &hb); err != nil {\n\t\tsm.logger.Errorf(\"error updating health %s\", err.Error())\n\t\tinternalServerError(w, err, \"error updating health\")\n\t\treturn\n\t}\n\n\t// game has reached the standingBy state (GSDK ReadyForPlayers has been called)\n\tif sm.previousGameState != hb.CurrentGameState && hb.CurrentGameState == GameStateStandingBy {\n\t\tif err := sm.transitionStateToStandingBy(ctx, &hb); err != nil {\n\t\t\tsm.logger.Errorf(\"error updating state %s\", err.Error())\n\t\t\tinternalServerError(w, err, \"error updating state\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tif err := sm.updateConnectedPlayersCountIfNeeded(ctx, &hb); err != nil {\n\t\tsm.logger.Errorf(\"error updating connected players count %s\", err.Error())\n\t\tinternalServerError(w, err, \"error updating connected players count\")\n\t\treturn\n\t}\n\n\tvar op GameOperation = GameOperationContinue\n\n\tsessionDetailsMutex.RLock()\n\tsd := sessionDetails\n\tsessionDetailsMutex.RUnlock()\n\n\tif sd.State == string(GameStateInvalid) { // user has not set the status yet\n\t\top = GameOperationContinue\n\t} else if sd.State == string(GameStateInitializing) {\n\t\top = GameOperationContinue\n\t} else if sd.State == string(GameStateStandingBy) {\n\t\top = GameOperationContinue\n\t} else if sd.State == string(GameStateActive) {\n\t\top = GameOperationActive\n\t} else if sd.State == string(GameStateTerminated) || sd.State == string(GameStateTerminating) {\n\t\top = GameOperationTerminate\n\t}\n\n\tsc := &SessionConfig{}\n\tsc.SessionId = sd.SessionID\n\tsc.SessionCookie = sd.SessionCookie\n\tsc.InitialPlayers = sd.InitialPlayers\n\n\thr := &HeartbeatResponse{\n\t\tOperation: op,\n\t\tSessionConfig: *sc,\n\t}\n\n\tjson, _ := json.Marshal(hr)\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(json)\n}", "title": "" }, { "docid": "46d20d27fe3c63699dcacb1de7d3c790", "score": "0.45194337", "text": "func (m *Manager) Query(request *grpc_monitoring_go.QueryRequest) (*grpc_monitoring_go.QueryResponse, error) {\n\tlog.Debug().Interface(\"request\", request).Msg(\"forward Query request\")\n\treturn m.MetricsCollectorClient.Query(context.Background(), request)\n}", "title": "" }, { "docid": "037e62362c683ce0c0eb986b2054a4b3", "score": "0.45173097", "text": "func SubscribeHeartbeat(conn *amqp.Connection, ch *amqp.Channel, ping, pong string, verbose bool) {\n\tpingMsgs := listenToPing(conn, ch, ping)\n\tgo handlePing(ch, pingMsgs, pong, verbose)\n}", "title": "" }, { "docid": "b8df56e922a3decd6912cfee70c46aa7", "score": "0.45145315", "text": "func (dnode *DataNode) checkHeartBeat() {\n\tdnode.Lock()\n\tdefer dnode.Unlock()\n\tif time.Since(dnode.reportTime) > time.Second*(time.Duration(gConfig.NodeTimeOutSec)) {\n\t\tdnode.isActive = false\n\t}\n\n\treturn\n}", "title": "" } ]
f08bec7278025d614b2f0d7766189793
ExitReportGroupDescriptionEntryFormat1 is called when production reportGroupDescriptionEntryFormat1 is exited.
[ { "docid": "ea1fff279204568b88cdd8f7972f8aca", "score": "0.90945774", "text": "func (s *BaseCobol85Listener) ExitReportGroupDescriptionEntryFormat1(ctx *ReportGroupDescriptionEntryFormat1Context) {\n}", "title": "" } ]
[ { "docid": "4c00c02483bd3910a9c98d736df231d9", "score": "0.8457916", "text": "func (s *BaseCobol85Listener) ExitReportGroupDescriptionEntryFormat2(ctx *ReportGroupDescriptionEntryFormat2Context) {\n}", "title": "" }, { "docid": "1ce6f2fc22c8d1c1e9feb757871b9492", "score": "0.83276105", "text": "func (s *BaseCobol85Listener) ExitReportGroupDescriptionEntryFormat3(ctx *ReportGroupDescriptionEntryFormat3Context) {\n}", "title": "" }, { "docid": "7e2affd97b415d5ae07f4eca0b3d183c", "score": "0.8101309", "text": "func (s *BaseCobol85Listener) ExitDataDescriptionEntryFormat1(ctx *DataDescriptionEntryFormat1Context) {\n}", "title": "" }, { "docid": "0d36891242eb0dc98bd8da6a26c68e79", "score": "0.7834612", "text": "func (s *BaseCobol85Listener) ExitLibraryDescriptionEntryFormat1(ctx *LibraryDescriptionEntryFormat1Context) {\n}", "title": "" }, { "docid": "d2278fa44c107ae30707b67ef84bd5c3", "score": "0.76995623", "text": "func (s *BaseCobol85Listener) ExitCommunicationDescriptionEntryFormat1(ctx *CommunicationDescriptionEntryFormat1Context) {\n}", "title": "" }, { "docid": "c2cc45f03e977feb3020eaeb5a28e483", "score": "0.75675917", "text": "func (s *BaseCobol85Listener) ExitDataDescriptionEntryFormat2(ctx *DataDescriptionEntryFormat2Context) {\n}", "title": "" }, { "docid": "1e4d85d6a9a0004ca1a2cc72a57e8654", "score": "0.74888146", "text": "func (s *BaseCobol85Listener) ExitReportGroupDescriptionEntry(ctx *ReportGroupDescriptionEntryContext) {\n}", "title": "" }, { "docid": "32581faf150e1d4ba678b00f75ace1a6", "score": "0.7291684", "text": "func (s *BaseCobol85Listener) ExitLibraryDescriptionEntryFormat2(ctx *LibraryDescriptionEntryFormat2Context) {\n}", "title": "" }, { "docid": "4fd7472e8fe0edc2313e4178b4102951", "score": "0.7230915", "text": "func (s *BaseCobol85Listener) ExitDataDescriptionEntryFormat3(ctx *DataDescriptionEntryFormat3Context) {\n}", "title": "" }, { "docid": "90e70603771576c9c26a33744807b717", "score": "0.7147582", "text": "func (s *BaseCobol85Listener) ExitCommunicationDescriptionEntryFormat2(ctx *CommunicationDescriptionEntryFormat2Context) {\n}", "title": "" }, { "docid": "3a78232e48454cc68fdbae351333c534", "score": "0.7088971", "text": "func (s *BaseCobol85Listener) ExitLibraryEntryProcedureClauseFormat1(ctx *LibraryEntryProcedureClauseFormat1Context) {\n}", "title": "" }, { "docid": "1dec138d5f9ffe90ac311e4281acf377", "score": "0.6935501", "text": "func (s *BaseCobol85Listener) ExitCommunicationDescriptionEntryFormat3(ctx *CommunicationDescriptionEntryFormat3Context) {\n}", "title": "" }, { "docid": "a28c652e0b5b5adc145eaeddeb7568c0", "score": "0.68188375", "text": "func (s *BaseCobol85Listener) ExitRecordContainsClauseFormat1(ctx *RecordContainsClauseFormat1Context) {\n}", "title": "" }, { "docid": "982db041ff1f50761c27533979e1be3b", "score": "0.6802754", "text": "func (s *BaseCobol85Listener) ExitReportDescriptionEntry(ctx *ReportDescriptionEntryContext) {}", "title": "" }, { "docid": "ad36170949ade73699714a0f3f4f8ffb", "score": "0.6725591", "text": "func (s *BaseCobol85Listener) EnterReportGroupDescriptionEntryFormat1(ctx *ReportGroupDescriptionEntryFormat1Context) {\n}", "title": "" }, { "docid": "4973a8b35c93a6bf60cc2540f91a9e29", "score": "0.6718014", "text": "func (s *BaseCobol85Listener) ExitLibraryEntryProcedureClauseFormat2(ctx *LibraryEntryProcedureClauseFormat2Context) {\n}", "title": "" }, { "docid": "b567496770083d4a30df0be84ee14d33", "score": "0.6656942", "text": "func (s *BaseCobol85Listener) ExitQualifiedDataNameFormat1(ctx *QualifiedDataNameFormat1Context) {}", "title": "" }, { "docid": "253aafb0393c6ced8ca1b29088b680a5", "score": "0.66297394", "text": "func (s *BaseCobol85Listener) ExitAlphabetClauseFormat1(ctx *AlphabetClauseFormat1Context) {}", "title": "" }, { "docid": "2500f857f767d2b09547b0f3f102ac60", "score": "0.66263556", "text": "func (s *BaseCobol85Listener) ExitReportGroupTypeReportHeading(ctx *ReportGroupTypeReportHeadingContext) {\n}", "title": "" }, { "docid": "0604ccf883b1387e1a0172169b2b5208", "score": "0.65992504", "text": "func (s *BaseCobol85Listener) EnterReportGroupDescriptionEntryFormat2(ctx *ReportGroupDescriptionEntryFormat2Context) {\n}", "title": "" }, { "docid": "7b59b0893e8abc2236823c551f279c1f", "score": "0.6473384", "text": "func (s *BaseCobol85Listener) ExitReportGroupTypeReportFooting(ctx *ReportGroupTypeReportFootingContext) {\n}", "title": "" }, { "docid": "62917ff3b3cda4ac773003089cb9ef6f", "score": "0.6413132", "text": "func (s *BaseCobol85Listener) ExitLibraryAttributeClauseFormat1(ctx *LibraryAttributeClauseFormat1Context) {\n}", "title": "" }, { "docid": "dc407ee73b31ff42d903b6f7e0ac3e24", "score": "0.6399688", "text": "func (s *BaseCobol85Listener) ExitReportGroupTypeDetail(ctx *ReportGroupTypeDetailContext) {}", "title": "" }, { "docid": "0bc5c71413b0bb230030a235306ff5a5", "score": "0.63742447", "text": "func (s *BaseCobol85Listener) ExitReportGroupTypeControlHeading(ctx *ReportGroupTypeControlHeadingContext) {\n}", "title": "" }, { "docid": "27a81bafbea598a6bfaaedb24a1ae773", "score": "0.6367838", "text": "func (s *BaseCobol85Listener) ExitAlphabetClauseFormat2(ctx *AlphabetClauseFormat2Context) {}", "title": "" }, { "docid": "8266738342a5ac98d777af51ce94176e", "score": "0.63616097", "text": "func (s *BaseCobol85Listener) ExitReportGroupTypeControlFooting(ctx *ReportGroupTypeControlFootingContext) {\n}", "title": "" }, { "docid": "7e57f0a90b47de1c5ac374954fa69aee", "score": "0.6350137", "text": "func (s *BaseCobol85Listener) ExitReportGroupTypeClause(ctx *ReportGroupTypeClauseContext) {}", "title": "" }, { "docid": "70be675075aa883f06b2c537ee8413a0", "score": "0.6333003", "text": "func (s *BaseCobol85Listener) ExitReportDescription(ctx *ReportDescriptionContext) {}", "title": "" }, { "docid": "784ef0faf64a5461f999c434d5410599", "score": "0.6269927", "text": "func (s *BaseCobol85Listener) ExitQualifiedDataNameFormat2(ctx *QualifiedDataNameFormat2Context) {}", "title": "" }, { "docid": "c9738b35a800e57445ee5b6f618f8653", "score": "0.6258625", "text": "func (s *BaseCobol85Listener) ExitRecordContainsClauseFormat2(ctx *RecordContainsClauseFormat2Context) {\n}", "title": "" }, { "docid": "7ec462655183ac0e5679d3208a770392", "score": "0.6250267", "text": "func (s *BaseCobol85Listener) ExitReportGroupTypePageHeading(ctx *ReportGroupTypePageHeadingContext) {\n}", "title": "" }, { "docid": "2e0b02722cc5e7709627b470a66f73e2", "score": "0.62449783", "text": "func (s *BaseCobol85Listener) ExitReportGroupNextGroupClause(ctx *ReportGroupNextGroupClauseContext) {\n}", "title": "" }, { "docid": "56e9195c20429abc439db9cbda1ea193", "score": "0.62060934", "text": "func (s *BaseCobol85Listener) EnterReportGroupDescriptionEntryFormat3(ctx *ReportGroupDescriptionEntryFormat3Context) {\n}", "title": "" }, { "docid": "68828a67be40a27699d98b58679f9fbb", "score": "0.6177882", "text": "func (s *BaseCobol85Listener) ExitReportGroupResetClause(ctx *ReportGroupResetClauseContext) {}", "title": "" }, { "docid": "819646c2bc0d39eba3c6d53cbd38767e", "score": "0.61760515", "text": "func (s *BaseCobol85Listener) ExitReportDescriptionFirstDetailClause(ctx *ReportDescriptionFirstDetailClauseContext) {\n}", "title": "" }, { "docid": "6a7f4f102afdf9604ccd8a2084ee0951", "score": "0.6155294", "text": "func (s *BaseCobol85Listener) ExitReportGroupUsageClause(ctx *ReportGroupUsageClauseContext) {}", "title": "" }, { "docid": "1eb34f6050b54befa559287a0f859fcf", "score": "0.6142444", "text": "func (s *BaseCobol85Listener) ExitReportDescriptionFootingClause(ctx *ReportDescriptionFootingClauseContext) {\n}", "title": "" }, { "docid": "0a45f0a055c55e4fc52d45689ab4015b", "score": "0.61421454", "text": "func (s *BaseCobol85Listener) ExitReportDescriptionHeadingClause(ctx *ReportDescriptionHeadingClauseContext) {\n}", "title": "" }, { "docid": "150c39d66b58ad7a9387ab6cb060e586", "score": "0.60825354", "text": "func (s *BaseCobol85Listener) ExitReportGroupSourceClause(ctx *ReportGroupSourceClauseContext) {}", "title": "" }, { "docid": "b5d5e4ff0de934f6003e9b0409ba4271", "score": "0.607009", "text": "func (s *BaseCobol85Listener) ExitReportGroupTypePageFooting(ctx *ReportGroupTypePageFootingContext) {\n}", "title": "" }, { "docid": "d0723f5ea8efc392b7fccacea12c8469", "score": "0.60496306", "text": "func (s *BaseCobol85Listener) ExitDataDescriptionEntry(ctx *DataDescriptionEntryContext) {}", "title": "" }, { "docid": "dd2cf964496ef754ef7aa6759f963bee", "score": "0.60396695", "text": "func (s *BaseCobol85Listener) ExitReportDescriptionGlobalClause(ctx *ReportDescriptionGlobalClauseContext) {\n}", "title": "" }, { "docid": "2ed31b511d7ccde6abe37f266b237917", "score": "0.59978133", "text": "func (s *BaseCobol85Listener) ExitFileDescriptionEntry(ctx *FileDescriptionEntryContext) {}", "title": "" }, { "docid": "0e71d3416668766564f49ce7c58e1331", "score": "0.59940994", "text": "func (s *BaseCobol85Listener) ExitReportGroupSignClause(ctx *ReportGroupSignClauseContext) {}", "title": "" }, { "docid": "3899b7b931aafb0508637405ff3b5936", "score": "0.59382397", "text": "func (s *BaseCobol85Listener) ExitCommunicationDescriptionEntry(ctx *CommunicationDescriptionEntryContext) {\n}", "title": "" }, { "docid": "a70ee20e863c4b833764bd1179be182f", "score": "0.593677", "text": "func (s *BaseCobol85Listener) ExitReportGroupNextGroupPlus(ctx *ReportGroupNextGroupPlusContext) {}", "title": "" }, { "docid": "3bebbf60253a6155de35d8482a77f623", "score": "0.5928484", "text": "func (s *BaseCobol85Listener) ExitReportGroupIndicateClause(ctx *ReportGroupIndicateClauseContext) {}", "title": "" }, { "docid": "c58282cc0feab8a8aeee5b3f0401dcb2", "score": "0.5922598", "text": "func (s *BaseCobol85Listener) ExitLibraryDescriptionEntry(ctx *LibraryDescriptionEntryContext) {}", "title": "" }, { "docid": "558a94dec6b0f40c8879e077572c8f34", "score": "0.59152174", "text": "func (s *BaseSHARCParserListener) ExitMulti_mod1(ctx *Multi_mod1Context) {}", "title": "" }, { "docid": "93c499fc6c41aaec246e355dd25ecc06", "score": "0.58988476", "text": "func (s *BaseCobol85Listener) ExitQualifiedDataNameFormat3(ctx *QualifiedDataNameFormat3Context) {}", "title": "" }, { "docid": "7a610d250b5f612499a62059b6ae1336", "score": "0.5896348", "text": "func (s *BaseCobol85Listener) ExitReportDescriptionLastDetailClause(ctx *ReportDescriptionLastDetailClauseContext) {\n}", "title": "" }, { "docid": "9034353603e68919c6b6eea4fe295784", "score": "0.5880194", "text": "func (s *BaseSHARCParserListener) ExitMulti_mod1_(ctx *Multi_mod1_Context) {}", "title": "" }, { "docid": "b5928bd3d748ea0b62cf829f4f3d0fa0", "score": "0.58737147", "text": "func (s *BaseCobol85Listener) ExitReportGroupNextGroupNextPage(ctx *ReportGroupNextGroupNextPageContext) {\n}", "title": "" }, { "docid": "bf42922e29ee23d6038a0c5be0668fd5", "score": "0.58568674", "text": "func (s *BaseCobol85Listener) ExitLibraryAttributeClauseFormat2(ctx *LibraryAttributeClauseFormat2Context) {\n}", "title": "" }, { "docid": "0bb0916a01c86421aaedf1548e8b961c", "score": "0.5827546", "text": "func (s *BaseCobol85Listener) ExitReportGroupValueClause(ctx *ReportGroupValueClauseContext) {}", "title": "" }, { "docid": "ab72a678d6c6893dbb8301d717c71398", "score": "0.5774992", "text": "func (s *BaseCobol85Listener) ExitReportGroupPictureClause(ctx *ReportGroupPictureClauseContext) {}", "title": "" }, { "docid": "65d79c0ee8d497db9b1b001cabea3d3b", "score": "0.57716286", "text": "func (s *BaseCobol85Listener) ExitReportSection(ctx *ReportSectionContext) {}", "title": "" }, { "docid": "c6c45dd84c1c37a73a54b5ca2d520c01", "score": "0.57644945", "text": "func (s *BaseCobol85Listener) ExitReportGroupSumClause(ctx *ReportGroupSumClauseContext) {}", "title": "" }, { "docid": "20a375dbf763470b688c8bec334891ba", "score": "0.5753256", "text": "func (s *BaseCobol85Listener) ExitRecordContainsClauseFormat3(ctx *RecordContainsClauseFormat3Context) {\n}", "title": "" }, { "docid": "1f7171e1ace8f389ffb2e16adee8b30c", "score": "0.56973046", "text": "func (s *BaseCobol85Listener) EnterDataDescriptionEntryFormat1(ctx *DataDescriptionEntryFormat1Context) {\n}", "title": "" }, { "docid": "45f3fa88c15141424299e144191f74e8", "score": "0.56743383", "text": "func (s *BaseCobol85Listener) ExitScreenDescriptionEntry(ctx *ScreenDescriptionEntryContext) {}", "title": "" }, { "docid": "5289c133bfd33e7f93af7307b46e585a", "score": "0.56700885", "text": "func (s *BasegengineListener) ExitRuleDescription(ctx *RuleDescriptionContext) {}", "title": "" }, { "docid": "cab518efd418e463e89972d475911319", "score": "0.56526124", "text": "func (s *BaseCobol85Listener) ExitFileDescriptionEntryClause(ctx *FileDescriptionEntryClauseContext) {\n}", "title": "" }, { "docid": "a6f407ba4070165bc15aa6c9605c1de5", "score": "0.5651205", "text": "func (s *MyListener) ExitDesignator(ctx *DesignatorContext) {\r\n\tlog.Print(\"ExitDesignator\")\r\n}", "title": "" }, { "docid": "27ea1a3b5b1a640be347bd07758539b7", "score": "0.56180286", "text": "func (s *BaseFqlParserListener) ExitCollectGrouping(ctx *CollectGroupingContext) {}", "title": "" }, { "docid": "7d75bc6b370adeaaea116f82e3106b91", "score": "0.5612979", "text": "func (s *MyListener) ExitDesignation(ctx *DesignationContext) {\r\n\tlog.Print(\"ExitDesignation\")\r\n}", "title": "" }, { "docid": "caa814b995e72edcc524ca7658f11f53", "score": "0.5600515", "text": "func (s *BaseCobol85Listener) EnterDataDescriptionEntryFormat2(ctx *DataDescriptionEntryFormat2Context) {\n}", "title": "" }, { "docid": "f5de44bf763cf93b0a520bc174c7d4f5", "score": "0.55781984", "text": "func (s *BaseCobol85Listener) ExitReportGroupLineNumberClause(ctx *ReportGroupLineNumberClauseContext) {\n}", "title": "" }, { "docid": "dbcda60233a38bbcc7f17071714d4120", "score": "0.55722487", "text": "func (s *BaseCobol85Listener) ExitReportGroupColumnNumberClause(ctx *ReportGroupColumnNumberClauseContext) {\n}", "title": "" }, { "docid": "c59a0e44ce75ca3110ae6b37d2e8e883", "score": "0.5565745", "text": "func (s *MyListener) ExitDeclarationSpecifiers2(ctx *DeclarationSpecifiers2Context) {\r\n\tlog.Print(\"ExitDeclarationSpecifiers2\")\r\n}", "title": "" }, { "docid": "24d87b0f264513915d13f9e26849107e", "score": "0.55187035", "text": "func (s *BasesimplelangListener) ExitSingle1(ctx *Single1Context) {}", "title": "" }, { "docid": "ae60d8ea6064ce047b4e7089f35088b9", "score": "0.55051965", "text": "func (s *BaseSHARCParserListener) ExitMulti_mod2(ctx *Multi_mod2Context) {}", "title": "" }, { "docid": "4f5cae310ddb70f2dbfc6f582071a345", "score": "0.55016726", "text": "func (s *BaseCobol85Listener) ExitReportGroupJustifiedClause(ctx *ReportGroupJustifiedClauseContext) {\n}", "title": "" }, { "docid": "8213bb5effb39c85444de0bba0622eee", "score": "0.54918015", "text": "func (s *BaseCobol85Listener) ExitQualifiedDataNameFormat4(ctx *QualifiedDataNameFormat4Context) {}", "title": "" }, { "docid": "0874f8daab34ef1ba6e427b8d26cea34", "score": "0.5485682", "text": "func (s *BaseSHARCParserListener) ExitDeclaration_exp1(ctx *Declaration_exp1Context) {}", "title": "" }, { "docid": "d13390e069470bee393cac02149cc5dc", "score": "0.5480553", "text": "func (s *BaseCobol85Listener) EnterLibraryDescriptionEntryFormat1(ctx *LibraryDescriptionEntryFormat1Context) {\n}", "title": "" }, { "docid": "3bf6ce73d81252a4ba23e1434226ed8c", "score": "0.5449684", "text": "func (s *BaseSHARCParserListener) ExitMulti_mod2_(ctx *Multi_mod2_Context) {}", "title": "" }, { "docid": "3d13f76537839449c37dc62a700f2acf", "score": "0.5393062", "text": "func (s *BaseCobol85Listener) ExitReportGroupLineNumberPlus(ctx *ReportGroupLineNumberPlusContext) {}", "title": "" }, { "docid": "b98995faab35ff0779252277dbf0322a", "score": "0.5360753", "text": "func (s *BaseCobol85Listener) EnterLibraryDescriptionEntryFormat2(ctx *LibraryDescriptionEntryFormat2Context) {\n}", "title": "" }, { "docid": "8a217040a82684254e16f53c374285e0", "score": "0.5358475", "text": "func (s *BaseSHARCParserListener) ExitU_reg2(ctx *U_reg2Context) {}", "title": "" }, { "docid": "74be740d9a02e7e553dfdf5da6057263", "score": "0.5353356", "text": "func (s *BaseBSLListener) ExitDefinition(ctx *DefinitionContext) {}", "title": "" }, { "docid": "12517564cde315cfd5b614e744990648", "score": "0.5327298", "text": "func (s *BaseCobol85Listener) ExitReportName(ctx *ReportNameContext) {}", "title": "" }, { "docid": "3358ac98b28e1af0cfc45f39d6594525", "score": "0.5322869", "text": "func (s *BaseCobol85Listener) ExitReportClause(ctx *ReportClauseContext) {}", "title": "" }, { "docid": "4583a5509a6039df4317a73b096d2422", "score": "0.53205603", "text": "func (s *BaseCobol85Listener) ExitEntryStatement(ctx *EntryStatementContext) {}", "title": "" }, { "docid": "7c320fef38b80723f77c190b345808a5", "score": "0.53196126", "text": "func (s *BaseTSLListener) ExitShortDateLiteral(ctx *ShortDateLiteralContext) {}", "title": "" }, { "docid": "4d4e93ac03d94492ad61a1837efc51db", "score": "0.53128415", "text": "func (s *BaseCobol85Listener) ExitScreenDescriptionGridClause(ctx *ScreenDescriptionGridClauseContext) {\n}", "title": "" }, { "docid": "48aaf258818511c071a6168943716067", "score": "0.5303045", "text": "func (s *BaseCobol85Listener) EnterReportGroupDescriptionEntry(ctx *ReportGroupDescriptionEntryContext) {\n}", "title": "" }, { "docid": "9f4deae7d1b7d3746be3e88b2ff50e0f", "score": "0.5298961", "text": "func (pl *PMMPostParseListener) ExitExprgroup(ctx *grammar.ExprgroupContext) {\n\tcorelang.Endgroup(pl.rt)\n\t// the return expression is already on the stack\n\t//pl.Summary()\n}", "title": "" }, { "docid": "febfae63dd391a7c46024d60da965979", "score": "0.525461", "text": "func (s *BaseSHARCParserListener) ExitDeclaration_exp_f1(ctx *Declaration_exp_f1Context) {}", "title": "" }, { "docid": "82e9a6ad280313b995794258e5c7e4d4", "score": "0.5244347", "text": "func (s *BaseCobol85Listener) ExitReportGroupLineNumberNextPage(ctx *ReportGroupLineNumberNextPageContext) {\n}", "title": "" }, { "docid": "aa0168ae0087e8d96e7d25bdf6c7a86d", "score": "0.5243211", "text": "func (s *BaseSHARCParserListener) ExitF11_8(ctx *F11_8Context) {}", "title": "" }, { "docid": "93ff9e59ae7a3e1b9bcb2429a39758a5", "score": "0.5235545", "text": "func (s *BaseCobol85Listener) ExitReportDescriptionPageLimitClause(ctx *ReportDescriptionPageLimitClauseContext) {\n}", "title": "" }, { "docid": "34e56f68ad074115a356db410d687c03", "score": "0.52161586", "text": "func (s *BaseCobol85Listener) ExitScreenDescriptionBellClause(ctx *ScreenDescriptionBellClauseContext) {\n}", "title": "" }, { "docid": "4479cab429e8a100d8e4f59af9052d98", "score": "0.52092016", "text": "func (s *BaseCobol85Listener) ExitDataBaseSectionEntry(ctx *DataBaseSectionEntryContext) {}", "title": "" }, { "docid": "0e9ed5a1a19b1c0a8e9481cd05342205", "score": "0.52046156", "text": "func (s *BaseCobol85Listener) ExitReportGroupBlankWhenZeroClause(ctx *ReportGroupBlankWhenZeroClauseContext) {\n}", "title": "" }, { "docid": "934560d7342b6cd2a5702585dc57db72", "score": "0.5202799", "text": "func (s *BaseDart2Listener) ExitImportSpecification(ctx *ImportSpecificationContext) {}", "title": "" }, { "docid": "4944f51eaf681ab046f3ba7c42352691", "score": "0.5179275", "text": "func Exit(format string, args ...interface{}) {\n\tif len(format) > 0 && format[:len(format)-1] != \"\\n\" {\n\t\tformat += \"\\n\"\n\t}\n\tfmt.Fprintf(os.Stderr, format, args...)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "cb5d551b20101bbfa908489dc4ab7861", "score": "0.51770896", "text": "func (s *BaseCobol85Listener) EnterCommunicationDescriptionEntryFormat1(ctx *CommunicationDescriptionEntryFormat1Context) {\n}", "title": "" }, { "docid": "5730ce45500f92f4982702c5d99930aa", "score": "0.51582986", "text": "func (s *BaseCobol85Listener) ExitDataDescName(ctx *DataDescNameContext) {}", "title": "" }, { "docid": "cb7002153c06cd2510ac6cff073f3bfe", "score": "0.5156647", "text": "func (s *BaseCobol85Listener) ExitDataDescriptionEntryExecSql(ctx *DataDescriptionEntryExecSqlContext) {\n}", "title": "" } ]
dfaed6207fd139674fd0c596acddacbf
reduceSpace takes all space not with " " and reduces the space count to 1.
[ { "docid": "4f43c625528d16b8267cb0c8e36f10cb", "score": "0.6952872", "text": "func reduceSpace(s string) string {\n\trs := make([]rune, 0, len(s))\n\tvar inQuote bool\n\tvar lastWasSpace bool\n\tfor i := 0; i < len(s); i++ {\n\t\tr := rune(s[i])\n\t\tif r == '\"' {\n\t\t\tif inQuote {\n\t\t\t\tinQuote = false\n\t\t\t} else {\n\t\t\t\tinQuote = true\n\t\t\t}\n\t\t\tlastWasSpace = false\n\t\t\tcontinue\n\t\t}\n\t\tif inQuote {\n\t\t\trs = append(rs, r)\n\t\t\tcontinue\n\t\t}\n\t\tif unicode.IsSpace(r) {\n\t\t\tlastWasSpace = true\n\t\t\tcontinue\n\t\t}\n\t\tif lastWasSpace {\n\t\t\tlastWasSpace = false\n\t\t\trs = append(rs, rune(' '))\n\t\t}\n\t\trs = append(rs, r)\n\t}\n\treturn string(rs)\n}", "title": "" } ]
[ { "docid": "4678b4e1e0cf4c640c57cc628946ab94", "score": "0.7420027", "text": "func reduceSpaces(text string) string {\n\ttext = reSpace.ReplaceAllString(text, \" \")\n\treturn strings.Trim(text, \" \\t\\n\\r\\v\")\n}", "title": "" }, { "docid": "f276022a59ebd1d60a960eca1f35246d", "score": "0.64166516", "text": "func toSpaces(cnt int) string {\n\treturn strings.Repeat(\" \", cnt)\n}", "title": "" }, { "docid": "6c5471a573f5127a5a7c5f5da728d61e", "score": "0.6401214", "text": "func LenSpace(abc *st.Art) {\n\tif space, ok := abc.Alphabet.Rune[' ']; ok {\n\t\tfor _, line := range space {\n\t\t\tlLine := len(line)\n\t\t\tif lLine > abc.Alphabet.Space {\n\t\t\t\tabc.Alphabet.Space = lLine\n\t\t\t}\n\t\t}\n\t} else {\n\t\tabc.Alphabet.Space = 6\n\t}\n}", "title": "" }, { "docid": "3f327e083d83ba10d8fd6537f99735f2", "score": "0.6275609", "text": "func trimSpace(s []byte) []byte {\n\tj := len(s)\n\tfor j > 0 && (s[j-1] == ' ' || s[j-1] == '\\t' || s[j-1] == '\\n') {\n\t\tj--\n\t}\n\ti := 0\n\tfor i < j && (s[i] == ' ' || s[i] == '\\t') {\n\t\ti++\n\t}\n\treturn s[i:j]\n}", "title": "" }, { "docid": "6392e8c91b864db4945d9d6b61d1e5df", "score": "0.625729", "text": "func trimspace(s string)string {\n\treturn strings.Trim(s,\" \")\n}", "title": "" }, { "docid": "b4bf01c1f12e56b3741ce46746ec02bf", "score": "0.62554115", "text": "func spaces(n int) string {\n\tif n > 10 {\n\t\tn = 10\n\t}\n\treturn \" \"[:2*n]\n}", "title": "" }, { "docid": "6170b91bf75faf0c6a3f03e93c67c879", "score": "0.61711437", "text": "func Spaces(w int) string {\n\tif w <= 0 {\n\t\treturn \"\"\n\t}\n\treturn strings.Repeat(\" \", w)\n}", "title": "" }, { "docid": "61494b3268e7da36099cf0d4ff2e6c21", "score": "0.6152013", "text": "func toSpaces(n int) string {\n\treturn strings.Repeat(\" \", n)\n}", "title": "" }, { "docid": "1c42106339ba93daa886fcf48205dd06", "score": "0.61180544", "text": "func trimSpace(x []byte) []byte {\n\tfor len(x) > 0 && isSpace(x[0]) {\n\t\tx = x[1:]\n\t}\n\tfor len(x) > 0 && isSpace(x[len(x)-1]) {\n\t\tx = x[:len(x)-1]\n\t}\n\treturn x\n}", "title": "" }, { "docid": "99e731b3aad994a7add3adbbf11eb7f4", "score": "0.6097058", "text": "func stripExcessSpaces(vals []string) {\n\tvar j, k, l, m, spaces int\n\tfor i, str := range vals {\n\t\t// Trim trailing spaces\n\t\tfor j = len(str) - 1; j >= 0 && str[j] == ' '; j-- {\n\t\t}\n\n\t\t// Trim leading spaces\n\t\tfor k = 0; k < j && str[k] == ' '; k++ {\n\t\t}\n\t\tstr = str[k : j+1]\n\n\t\t// Strip multiple spaces.\n\t\tj = strings.Index(str, doubleSpace)\n\t\tif j < 0 {\n\t\t\tvals[i] = str\n\t\t\tcontinue\n\t\t}\n\n\t\tbuf := []byte(str)\n\t\tfor k, m, l = j, j, len(buf); k < l; k++ {\n\t\t\tif buf[k] == ' ' {\n\t\t\t\tif spaces == 0 {\n\t\t\t\t\t// First space.\n\t\t\t\t\tbuf[m] = buf[k]\n\t\t\t\t\tm++\n\t\t\t\t}\n\t\t\t\tspaces++\n\t\t\t} else {\n\t\t\t\t// End of multiple spaces.\n\t\t\t\tspaces = 0\n\t\t\t\tbuf[m] = buf[k]\n\t\t\t\tm++\n\t\t\t}\n\t\t}\n\n\t\tvals[i] = string(buf[:m])\n\t}\n}", "title": "" }, { "docid": "fe735531baf64af6ef67b84efe79c7d1", "score": "0.6049549", "text": "func CompactSpaces(s string) string {\n\tfor _, ch := range \"\\a\\b\\f\\n\\r\\t\\v\" { // <- no need to include a space here\n\t\tif strings.Contains(s, string(ch)) {\n\t\t\ts = strings.ReplaceAll(s, string(ch), \" \")\n\t\t}\n\t}\n\tfor strings.Contains(s, \" \") {\n\t\ts = strings.ReplaceAll(s, \" \", \" \")\n\t}\n\treturn s\n}", "title": "" }, { "docid": "3f2dbf0112b561a9b323a728039b12dd", "score": "0.60306", "text": "func NormalizeSpace(text string) string {\n\treturn rSpaceRegexp.ReplaceAllLiteralString(strings.TrimSpace(text), \" \")\n}", "title": "" }, { "docid": "076043861f9225918907142a3d29b874", "score": "0.60152113", "text": "func removeSpaces(input string) string {\n\n\tfor input[0] == ' ' {\n\t\tinput = strings.TrimPrefix(input, \" \")\n\t}\n\tfor input[len(input)-1] == ' ' {\n\t\tinput = strings.TrimSuffix(input, \" \")\n\t}\n\t\n\treturn input\n\t\n}", "title": "" }, { "docid": "64639649fb23d516daa65ebb3059494e", "score": "0.6012615", "text": "func trimSpace(s string) (string, error) {\n\treturn strings.TrimSpace(s), nil\n}", "title": "" }, { "docid": "2f2e31de34ec671da1ac4a6edfee968d", "score": "0.5968344", "text": "func TrimSpace(s string) string { return strings.TrimSpace(s) }", "title": "" }, { "docid": "979a8ce84512d8e6afff4daa087b424d", "score": "0.5965774", "text": "func (tracer *Tracer) Space() (spaces string) {\n\tif tracer.on {\n\t\tif tracer.depth > 0 {\n\t\t\tspaces = fmt.Sprintf(\"%*s\", 2*tracer.depth, \" \")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f0d3a7440e5e89e15deb20fd4a0d3f1d", "score": "0.59494776", "text": "func StandardizeSpaces(s string) string {\n\treturn strings.Join(strings.Fields(s), \" \")\n}", "title": "" }, { "docid": "2689128afe39228bdb7638dc81be48f7", "score": "0.5928002", "text": "func CombineSpaces(s string) string {\n\ts = strings.TrimSpace(s)\n\ts = whitespaceRegexp.ReplaceAllString(s, \" \")\n\treturn s\n}", "title": "" }, { "docid": "4bbdfca720b1ca5eb8e1f9a44854514f", "score": "0.588912", "text": "func fixSpace(s []byte) []byte {\n\ts = trimSpace(s)\n\tfor i := 0; i < len(s); i++ {\n\t\tif s[i] == '\\t' || s[i] == '\\n' || i > 0 && s[i] == ' ' && s[i-1] == ' ' {\n\t\t\tgoto Fix\n\t\t}\n\t}\n\treturn s\n\nFix:\n\tb := s\n\tw := 0\n\tfor i := 0; i < len(s); i++ {\n\t\tc := s[i]\n\t\tif c == '\\t' || c == '\\n' {\n\t\t\tc = ' '\n\t\t}\n\t\tif c == ' ' && w > 0 && b[w-1] == ' ' {\n\t\t\tcontinue\n\t\t}\n\t\tb[w] = c\n\t\tw++\n\t}\n\tif w > 0 && b[w-1] == ' ' {\n\t\tw--\n\t}\n\treturn b[:w]\n}", "title": "" }, { "docid": "f401b167336f7eb8ed2dc599c6f153fd", "score": "0.5886897", "text": "func Space(s string) string {\n\tin := []rune(s)\n\tout := []rune{}\n\n\tfor i := 0; i < len(in); i++ {\n\t\tr := in[i]\n\n\t\t// ignore certain punctuation\n\t\tif r == '\\'' {\n\t\t\tcontinue\n\t\t}\n\n\t\t// camelCase -> camel case\n\t\tif i >= 1 && unicode.IsUpper(r) && unicode.IsLower(in[i-1]) {\n\t\t\tout = append(out, ' ')\n\t\t\tout = append(out, r)\n\t\t\tcontinue\n\t\t}\n\n\t\t// 123Case -> 123 case\n\t\tif i >= 1 && unicode.IsUpper(r) && unicode.IsDigit(in[i-1]) {\n\t\t\tout = append(out, ' ')\n\t\t\tout = append(out, r)\n\t\t\tcontinue\n\t\t}\n\n\t\t// CAMELCase -> camel case\n\t\tif i >= 1 && i < len(in)-1 && unicode.IsUpper(in[i-1]) && unicode.IsUpper(r) && unicode.IsLower(in[i+1]) {\n\t\t\tout = append(out, ' ')\n\t\t\tout = append(out, r)\n\t\t\tcontinue\n\t\t}\n\n\t\t// letters to lowercase\n\t\tif unicode.IsLetter(r) || unicode.IsDigit(r) {\n\t\t\tout = append(out, r)\n\t\t\tcontinue\n\t\t}\n\n\t\t// punctuation and spaces get trimmed into a single space\n\t\tif unicode.IsPunct(r) || unicode.IsSpace(r) || unicode.IsSymbol(r) {\n\t\t\tif i >= 1 && !unicode.IsPunct(in[i-1]) && !unicode.IsSpace(in[i-1]) && !unicode.IsSymbol(in[i-1]) {\n\t\t\t\tout = append(out, ' ')\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: can we trim without going back through the string again?\n\treturn strings.TrimSpace(string(out))\n}", "title": "" }, { "docid": "477df16ef70dfca0cd1bbc40e5e66a1d", "score": "0.5850152", "text": "func trimLeftSpace(s string, relaxed bool) (outstr string, eol bool) {\n\tlog.Parse.Printf(\"TrimLeftSpace: begin %s\\n\", s)\n\n\twhitespace := func(c rune) bool { return unicode.IsSpace(c) || c == 0x00 }\n\n\twhitespaceNoEol := func(r rune) bool {\n\t\tswitch r {\n\t\tcase '\\t', '\\v', '\\f', ' ', 0x85, 0xA0, 0x00:\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\toutstr = s\n\n\tfor {\n\t\tif relaxed {\n\t\t\toutstr = strings.TrimLeftFunc(outstr, whitespaceNoEol)\n\t\t\tif len(outstr) >= 1 && (outstr[0] == '\\n' || outstr[0] == '\\r') {\n\t\t\t\teol = true\n\t\t\t}\n\t\t}\n\t\toutstr = strings.TrimLeftFunc(outstr, whitespace)\n\t\tlog.Parse.Printf(\"1 outstr: <%s>\\n\", outstr)\n\t\tif len(outstr) <= 1 || outstr[0] != '%' {\n\t\t\tbreak\n\t\t}\n\t\t// trim PDF comment (= '%' up to eol)\n\t\toutstr = positionToNextEOL(outstr)\n\t\tlog.Parse.Printf(\"2 outstr: <%s>\\n\", outstr)\n\n\t}\n\n\tlog.Parse.Printf(\"TrimLeftSpace: end %s\\n\", outstr)\n\n\treturn outstr, eol\n}", "title": "" }, { "docid": "1f634e075bd957dab6a0c70092d56963", "score": "0.58428335", "text": "func normalizeWhitespace(s string) string {\n\ts = strings.TrimSpace(s)\n\ts = strings.Replace(strings.Replace(s, \"\\n\", \" \", -1), \"\\t\", \" \", -1)\n\tfor strings.Index(s, \" \") != -1 {\n\t\t// TODO: speedup\n\t\ts = strings.Replace(s, \" \", \" \", -1)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "e8bfa9beb24a73d767421f79858dc72d", "score": "0.58315074", "text": "func (ha *MleHeapArray) space(size int) string {\n\tvar buf bytes.Buffer\n\tfor i := 0; i < size; i++ {\n\t\tbuf.WriteString(\" \")\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "59470b7455c5bec3c81058978e28864e", "score": "0.5815445", "text": "func trimSpace(s string) (string, error) {\n\ts = strings.TrimSpace(s)\n\tif len(s) == 0 {\n\t\treturn s, ErrNameEmpty\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "cbe0884fff86e6e990a7974e297152aa", "score": "0.5814313", "text": "func (s *Spacer) Space(pos, remain, maxWidth uint64) {\n\tvar min, max uint64\n\tif pos == s.Words+1 {\n\t\ts.notify <- s.State\n\t\treturn\n\t}\n\n\tswitch pos {\n\tcase 0:\n\t\tmin, max = 0, remain\n\tcase s.Words:\n\t\tmin, max = remain, remain\n\tdefault:\n\t\tmin, max = 1, remain\n\t}\n\n\tif max > maxWidth {\n\t\tmax = maxWidth\n\t}\n\n\tfor i := min; i <= max; i++ {\n\t\ts.State &= ^(0xF << (pos * 4))\n\t\ts.State |= i << (pos * 4)\n\t\ts.Space(pos+1, remain-i, maxWidth)\n\t}\n\tif pos == 0 {\n\t\tclose(s.notify)\n\t}\n}", "title": "" }, { "docid": "6fd97c58faece0238b76cba104171858", "score": "0.58080703", "text": "func Space(src *parse.Source) int {\n\tcount := 0\n\tfor src.Error() == nil {\n\t\tbuf := src.Peek()\n\t\tfor i := 0; i < len(buf); i++ {\n\t\t\tswitch buf[i] {\n\t\t\tcase '\\t', '\\n', '\\v', '\\f', '\\r', ' ':\n\t\t\t\tcount++\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\tsrc.ConsumeN(i)\n\t\t\t\treturn count\n\t\t\t}\n\t\t}\n\t\tsrc.Consume()\n\t}\n\treturn count\n}", "title": "" }, { "docid": "76b878370855a8b6bd7174b82c4cf341", "score": "0.5807919", "text": "func TrimSpace(s string) string {\n\t// Fast path for ASCII: look for the first ASCII non-space byte\n\tstart := 0\n\tfor ; start < len(s); start++ {\n\t\tc := s[start]\n\t\tif c >= utf8.RuneSelf {\n\t\t\t// If we run into a non-ASCII byte, fall back to the\n\t\t\t// slower unicode-aware method on the remaining bytes\n\t\t\treturn TrimFunc(s[start:], unicode.IsSpace)\n\t\t}\n\t\tif asciiSpace[c] == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Now look for the first ASCII non-space byte from the end\n\tstop := len(s)\n\tfor ; stop > start; stop-- {\n\t\tc := s[stop-1]\n\t\tif c >= utf8.RuneSelf {\n\t\t\treturn TrimFunc(s[start:stop], unicode.IsSpace)\n\t\t}\n\t\tif asciiSpace[c] == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// At this point s[start:stop] starts and ends with an ASCII\n\t// non-space bytes, so we're done. Non-ASCII cases have already\n\t// been handled above.\n\treturn s[start:stop]\n}", "title": "" }, { "docid": "382095dd685bf7028aacdd387014f601", "score": "0.58060294", "text": "func collapseSpace(in string) string {\n\twhiteSpace := false\n\tout := \"\"\n\tfor _, c := range in {\n\t\tif unicode.IsSpace(c) {\n\t\t\tif !whiteSpace {\n\t\t\t\tout = out + \" \"\n\t\t\t}\n\t\t\twhiteSpace = true\n\t\t} else {\n\t\t\tout = out + string(c)\n\t\t\twhiteSpace = false\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "1656a1389ad3066d0ea74a704b80d1fc", "score": "0.57867193", "text": "func normalizeWhitespace(s string) string {\n\treturn strings.TrimSpace(strings.Join(strings.Fields(s), \" \"))\n}", "title": "" }, { "docid": "a87828162e364372e96d13ebf4f21042", "score": "0.5784757", "text": "func replaceSpaces(S string, length int) string {\n\tstrNakeLength := len(strings.Replace(S, \" \", \"\", -1))\n\treturn strings.TrimRight(strings.Replace(S, \" \", \"%20\", length-strNakeLength), \" \")\n}", "title": "" }, { "docid": "9b93ee632d28e9251f363be8135f6be1", "score": "0.57809937", "text": "func TrimSpace(input string) string {\n\treturn strings.TrimSpace(input)\n}", "title": "" }, { "docid": "316af2c6362a697906551c6594790efd", "score": "0.5721878", "text": "func firstStripSpaces(num *string, newNum *string) {\n\tfor _, val := range *num {\n\t\tif !unicode.IsSpace(val) {\n\t\t\t*newNum += string(val)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a6a734b65a1807625ace9cccfcba3060", "score": "0.5694315", "text": "func numSpaces(num int) string {\n\tstr := \"\"\n\tfor num > 0 {\n\t\tstr += \" \"\n\t\tnum--\n\t}\n\treturn str\n}", "title": "" }, { "docid": "4e6980076fe0fd1a67cadd2551a2d276", "score": "0.5686652", "text": "func trim(s []byte) []byte {\n\ti := 0\n\tfor i < len(s) && isSpace(s[i]) {\n\t\ti++\n\t}\n\tn := len(s)\n\tfor n > i && isSpace(s[n-1]) {\n\t\tn--\n\t}\n\treturn s[i:n]\n}", "title": "" }, { "docid": "487360c1cd6638fa8bbe4880fafc3c5f", "score": "0.5678987", "text": "func justifyLine(line string, length int) string {\n\tspacesNeeded := length - len(line)\n\tif spacesNeeded <= 0 {\n\t\treturn line\n\t}\n\n\tif !strings.Contains(line, \" \") {\n\t\treturn line\n\t}\n\tindexes := make([]int, 0) // line index to space count\n\tfor i, rn := range line {\n\t\tif string(rn) == \" \" {\n\t\t\tindexes = append(indexes, i)\n\t\t}\n\t}\n\n\tspaceCount := getSpaces(len(indexes), spacesNeeded)\n\n\tfor i := len(indexes) - 1; i >= 0; i-- {\n\t\tline = line[:indexes[i]] + strings.Repeat(\" \", spaceCount[i]) + line[indexes[i]:]\n\t}\n\n\treturn line\n}", "title": "" }, { "docid": "5d92a08726c75855ece27f8e2a415e42", "score": "0.56614155", "text": "func (builder *Builder) Space() *Builder {\n\tbuilder.Grow(1)\n\tbuilder.WriteString(\" \")\n\treturn builder\n}", "title": "" }, { "docid": "e24443e7b8d7474c62df3e369d8d3dd2", "score": "0.5655509", "text": "func TrimSpace(s string) string {\n\treturn strings.TrimFunc(s, func(r rune) bool {\n\t\treturn unicode.IsSpace(r) || r == '\\uFEFF'\n\t})\n}", "title": "" }, { "docid": "563a05634092575c95785c891faef051", "score": "0.56447923", "text": "func splitSpace(s string) (left, middle, right string) {\n\tfor _, r := range s {\n\t\tif unicode.IsSpace(r) {\n\t\t\tright += string(r)\n\t\t} else if len(middle) == 0 {\n\t\t\tleft = right\n\t\t\tright = \"\"\n\t\t\tmiddle += string(r)\n\t\t} else {\n\t\t\tmiddle += right + string(r)\n\t\t\tright = \"\"\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1e69576a847dc3b25d231a19797372b8", "score": "0.5584146", "text": "func TrimSpace() BarOption {\n\treturn func(s *bState) {\n\t\ts.trimSpace = true\n\t}\n}", "title": "" }, { "docid": "9279c303579ba7556c793d97d64e2446", "score": "0.5574554", "text": "func countLeadingSpaces(line string) int {\n\treturn len(line) - len(strings.TrimLeft(line, \" \"))\n\n}", "title": "" }, { "docid": "c39ca1e3d6544c9e3b4160493e80a098", "score": "0.5563189", "text": "func squashe(s []byte) []byte {\n\tvar n int\n\tfor i := 0; i < len(s)-1; i++ {\n\t\tif unicode.IsSpace(rune(s[i])) && unicode.IsSpace(rune(s[i+1])) {\n\t\t\ts[i] = 32\n\t\t\tfor j := i + 1; j < len(s)-1; j++ {\n\t\t\t\ts[j] = s[j+1]\n\t\t\t}\n\t\t\tn = n + 1\n\t\t\ti = 0\n\t\t}\n\t}\n\treturn s[:len(s)-n]\n}", "title": "" }, { "docid": "079b291b61edde2d6b7685f46d641151", "score": "0.554978", "text": "func TrimpLeadingSpaces(text string) string {\n\tparts := strings.Split(text, \"\\n\")\n\tfor i := range parts {\n\t\tb := []byte(parts[i])\n\n\t\tvar spaces int\n\t\tfor i := 0; i < len(b); i++ {\n\t\t\tif unicode.IsSpace(rune(b[i])) {\n\t\t\t\tif b[i] == '\t' {\n\t\t\t\t\tspaces = spaces + 4\n\t\t\t\t} else {\n\t\t\t\t\tspaces++\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// this seems to be a list item\n\t\t\tif b[i] == '-' {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// this seems to be a code block\n\t\t\tif spaces >= 4 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// remove the space characters from the string\n\t\t\tb = b[i:]\n\t\t\tbreak\n\t\t}\n\t\tparts[i] = string(b)\n\t}\n\n\treturn strings.Join(parts, \"\\n\")\n}", "title": "" }, { "docid": "35de7088781014da9b1a8df9817cd708", "score": "0.5541609", "text": "func MultiToSingleSpaces(s string) string {\n\ts = UnicodeToAsciiSpaces(s)\n\tregWhiteSpace := regexp.MustCompile(`\\s{2,}`)\n\ts = regWhiteSpace.ReplaceAllString(s, \" \")\n\n\treturn strings.TrimSpace(s)\n}", "title": "" }, { "docid": "a3671384f29bd0a47ba7abf12a108cfe", "score": "0.55239993", "text": "func nSpacedFields(s string, n int) []string {\n\tvar asciiSpace = [256]uint8{'\\t': 1, '\\n': 1, '\\v': 1, '\\f': 1, '\\r': 1, ' ': 1}\n\ta := make([]string, n)\n\tna := 0\n\tfieldStart := 0\n\ti := 0\n\t// Skip spaces in the front of the input.\n\tfor i < len(s) && asciiSpace[s[i]] != 0 {\n\t\ti++\n\t}\n\tfieldStart = i\n\tfor i < len(s) && na+1 < n {\n\t\tif asciiSpace[s[i]] == 0 {\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\ta[na] = s[fieldStart:i]\n\t\tna++\n\t\ti++\n\t\t// Skip spaces in between fields.\n\t\tfor i < len(s) && asciiSpace[s[i]] != 0 {\n\t\t\ti++\n\t\t}\n\t\tfieldStart = i\n\t}\n\t// ignore trailing spaces\n\tfor i = len(s); i > fieldStart && asciiSpace[s[i-1]] != 0; i-- {\n\t}\n\ta[na] = s[fieldStart:i]\n\treturn a\n}", "title": "" }, { "docid": "ff44ae27587cd0d2c47a33f7b95da83a", "score": "0.5523471", "text": "func removeExtraSpaces(args string) string {\n\treturn re.ReplaceAllString(strings.TrimSpace(args), \" \")\n}", "title": "" }, { "docid": "4ed4b5685c0bf649f0ff69c800829a2a", "score": "0.5520931", "text": "func UnicodeSpace(src *parse.Source) int {\n\tcount := 0\n\tfor src.Error() == nil {\n\t\tr, n := src.PeekRune()\n\t\tif unicode.IsSpace(r) {\n\t\t\tsrc.ConsumeN(n)\n\t\t\tcount += n\n\t\t\tcontinue\n\t\t}\n\t\treturn count\n\t}\n\treturn count\n}", "title": "" }, { "docid": "a7a8a6baf7b3db15093fd7691e39c54c", "score": "0.551689", "text": "func cleanSpace(s string) string {\n\tvar res []string\n\tfor _, l := range strings.Split(s, \"\\n\") {\n\t\tif line := cleanLine(l); len(line) > 0 {\n\t\t\tres = append(res, line)\n\t\t}\n\t}\n\treturn strings.Join(res, \"\\n\")\n}", "title": "" }, { "docid": "310202bc8b8eb0d13e8fd1d919f623d8", "score": "0.54725415", "text": "func removeExcessiveWhitespace(s string) string {\n\tvar buf bytes.Buffer\n\tneedsSeparation := false\n\tfor i, w := 0, 0; i < len(s); i += w {\n\t\truneValue, width := utf8.DecodeRuneInString(s[i:])\n\t\tif runeValue == '\\n' || runeValue == ' ' {\n\t\t\tneedsSeparation = true\n\t\t} else {\n\t\t\tif needsSeparation {\n\t\t\t\tbuf.WriteString(\" \")\n\t\t\t\tneedsSeparation = false\n\t\t\t}\n\t\t\tbuf.WriteRune(runeValue)\n\t\t}\n\t\tw = width\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "ec83a94cdc834afcc10487c98e39b54b", "score": "0.5450693", "text": "func limitWidth(c Content) string {\n\tvar lines []string\n\tvar prefix string\n\n\tswitch c.(type) {\n\tcase TextContent:\n\t\tlines = strings.Split(string(c.(TextContent)), \"\\n\")\n\t\tprefix = \"\"\n\tcase ListText:\n\t\tlines = strings.Split(string(c.(ListText)), \"\\n\")\n\t\tprefix = \" \"\n\t}\n\n\tprefixWidth := utf8.RuneCountInString(prefix)\n\tvar buf bytes.Buffer\n\tfor _, line := range lines {\n\t\twords := strings.Split(line, \" \")\n\t\twidth := 0\n\t\tfor i, word := range words {\n\t\t\twl := utf8.RuneCountInString(word)\n\t\t\tif width+wl < lineWidth || width < lineWidth/2 ||\n\t\t\t\twidth < lineWidth-5 && width+wl < lineWidth+5 {\n\t\t\t\tif width == 0 {\n\t\t\t\t\tbuf.WriteString(prefix)\n\t\t\t\t\twidth += prefixWidth\n\t\t\t\t}\n\t\t\t\tif wl == 0 || i > 0 && utf8.RuneCountInString(words[i-1]) != 0 {\n\t\t\t\t\tbuf.WriteByte(' ')\n\t\t\t\t\twidth++\n\t\t\t\t}\n\t\t\t\tbuf.WriteString(word)\n\t\t\t\twidth += wl\n\t\t\t} else {\n\t\t\t\tbuf.WriteString(\"\\n\" + prefix + word)\n\t\t\t\twidth = prefixWidth + wl\n\t\t\t}\n\t\t}\n\t\tbuf.WriteByte('\\n')\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "75442c4027691f63566f22d1cc0ad898", "score": "0.5425443", "text": "func TrimWhiteSpace(s string) string {\n\treturn strings.Join(strings.Fields(s), \" \")\n}", "title": "" }, { "docid": "f685199af20e60a0a34f171053146154", "score": "0.5423897", "text": "func removeWhiteSpaces(s string) string {\n\ts = strings.TrimSpace(s)\n\treturn removeExtraWhiteSpaces(s)\n}", "title": "" }, { "docid": "b63d4433041bb1ffba3934229b632563", "score": "0.54082936", "text": "func TrimLen(runes []rune) int {\n\tvar i int\n\tfor i = len(runes) - 1; i >= 0; i-- {\n\t\tchar := runes[i]\n\t\tif char != ' ' && char != '\\t' {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Completely empty\n\tif i < 0 {\n\t\treturn 0\n\t}\n\n\tvar j int\n\tfor j = 0; j < len(runes); j++ {\n\t\tchar := runes[j]\n\t\tif char != ' ' && char != '\\t' {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn i - j + 1\n}", "title": "" }, { "docid": "e8a3417a1849fc79bbc3114749b672c8", "score": "0.5405214", "text": "func skipSpace(s string) (rest string) {\n\ti := 0\n\tfor ; i < len(s); i++ {\n\t\tif b := s[i]; b != ' ' && b != '\\t' {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn s[i:]\n}", "title": "" }, { "docid": "201582e3b3367fabfe8c9191ee1b80a5", "score": "0.539058", "text": "func JustifyRemoveSpacesStart(abc *st.Art) {\n\tlRune := len(abc.Text.Rune)\n\tstart := false\n\tfor i := 0; i < lRune; i++ {\n\t\tsymbol := abc.Text.Rune[i]\n\t\tif symbol != ' ' {\n\t\t\tstart = true\n\t\t}\n\t\tif !start {\n\t\t\tabc.Text.Rune = sli.RemoveRune(abc.Text.Rune, i)\n\t\t\tabc.Text.Count--\n\t\t\tlRune = len(abc.Text.Rune)\n\t\t\ti--\n\t\t\tcontinue\n\t\t}\n\t\tif symbol == '\\n' {\n\t\t\tstart = false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a4edd98fa8e3b9932323253be19743fe", "score": "0.5387667", "text": "func removeSpace(str string) string {\n\tlog.Printf(\"format.go > removeSpace [ %v ]\", str)\n\tif str[:1] == \" \" {\n\t\treturn str[1:]\n\t}\n\treturn str\n}", "title": "" }, { "docid": "e8b5d3c20135dd4ecfa26f3222df3144", "score": "0.5383047", "text": "func printRemainingWidth(width int, value string) {\n\t//Determine the remaining width\n\trem := width - len(value)\n\tfor j := 0; j < rem; j++ {\n\t\tfmt.Print(\" \")\n\t}\n}", "title": "" }, { "docid": "c7be0e41490ebb1c9d07cfcfcc6857bb", "score": "0.5367538", "text": "func ShiftSpace(x, y float64, s *Space) error {\n\treturn DefaultTree.ShiftSpace(x, y, s)\n}", "title": "" }, { "docid": "09b7c44f485b5cf5a34f55145ec91582", "score": "0.53422445", "text": "func JustifyRemoveSpacesEnd(abc *st.Art) {\n\tlRune := len(abc.Text.Rune)\n\tstart := false\n\tfor i := lRune - 1; i >= 0; i-- {\n\t\tsymbol := abc.Text.Rune[i]\n\t\tif symbol != ' ' {\n\t\t\tstart = true\n\t\t}\n\t\tif !start {\n\t\t\tabc.Text.Rune = sli.RemoveRune(abc.Text.Rune, i)\n\t\t\tabc.Text.Count--\n\t\t\tcontinue\n\t\t}\n\t\tif symbol == '\\n' {\n\t\t\tstart = false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f492055c914c09a8b1e05b29c46f92ac", "score": "0.53341943", "text": "func replaceSpace(s string) string {\n\treturn _05(s)\n}", "title": "" }, { "docid": "b3ab933dbd42052f4d9ab24efe99b070", "score": "0.533173", "text": "func getSpace(y, x int, spaces [][]string) string {\n\tif x < 0 || x >= len(spaces[0]) {\n\t\treturn \"\"\n\t}\n\n\tif y < 0 || y >= len(spaces) {\n\t\treturn \"\"\n\t}\n\n\treturn spaces[y][x]\n\n}", "title": "" }, { "docid": "c0193de36905a3492960e43c829c99bf", "score": "0.53293455", "text": "func spacify(s string) string {\n\tv := spaceRE.Split(s, -1)\n\tif len(v) > 0 && v[0] == \"\" {\n\t\tv = v[1:]\n\t}\n\tl := len(v)\n\tif l > 0 && v[l-1] == \"\" {\n\t\tv = v[0:(l - 1)]\n\t}\n\treturn strings.Join(v, \" \")\n}", "title": "" }, { "docid": "70ac6be8a981587e14d3ff6b0b3244a0", "score": "0.5324031", "text": "func restrainTrim(bs []byte) []byte {\n buff := bytes.Buffer{}\n var b byte\n for i, l := 0, len(bs); i < l; i++{\n switch bs[i] {\n case ' ', '\\n', '\\t', '\\r':\n if b > 0 && b != ' ' && b != '\\n' && b != '\\t' && b != '\\r' {\n buff.WriteByte(' ')\n }\n default:\n buff.WriteByte(bs[i])\n }\n b = bs[i]\n }\n return bytes.TrimSpace(buff.Bytes())\n}", "title": "" }, { "docid": "9e54d71ab162a0ebef968a3599a4ca9f", "score": "0.5321395", "text": "func (s *Scanner) skipSpaces() {\n\tfor {\n\t\tif s.isEOF() {\n\t\t\tbreak\n\t\t}\n\t\tc := s.str[s.offset]\n\t\tif isNL(c) {\n\t\t\ts.line++\n\t\t\ts.col = 1\n\t\t\ts.offset++\n\t\t} else if isSpace(c) {\n\t\t\ts.col++\n\t\t\ts.offset++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4662ee3a9c4b5f4ff0e742a5b1fa8e9c", "score": "0.5293036", "text": "func wraptext2(s string) string {\n\tre := regexp.MustCompile(`\\s+`)\n\ts = re.ReplaceAllString(s, \" \")\n\ts2 := \" \" // start with indent\n\trunecount := 0\n\tfor utf8.RuneCountInString(s) > 0 {\n\t\tr, size := utf8.DecodeRuneInString(s) // first rune\n\t\trunecount++ // how many we have collected\n\t\t// first space after rune #68 becomes newline\n\t\tif runecount >= 68 && r == ' ' {\n\t\t\ts2 += \"\\n \"\n\t\t\trunecount = 0\n\t\t} else {\n\t\t\ts2 += string(r) // append single rune to string\n\t\t}\n\t\ts = s[size:] // chop off rune\n\t}\n\treturn s2\n}", "title": "" }, { "docid": "66f67c530e7090931c1a3ca4cf19437b", "score": "0.52909684", "text": "func ActionSpace(info ActionInfo, _ interface{}) ActionResult {\n\t*info.Rune = ' '\n\treturn ActionResult{}\n}", "title": "" }, { "docid": "d8cae68acb65f0fe03ce672a464b45e1", "score": "0.5273069", "text": "func getLengthToWhitespace(str []rune, index int) (int, bool) {\n\tfor i, c := range str[index:] {\n\t\tif c == []rune(\" \")[0] {\n\t\t\treturn i, true\n\t\t}\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "6486f2b3c90a42166c3d2f52ddade199", "score": "0.5272443", "text": "func StrSpaces(n int) (l string) {\n\tfor i := 0; i < n; i++ {\n\t\tl += \" \"\n\t}\n\treturn\n}", "title": "" }, { "docid": "e3df9a6855739093824a0fc1aeb3cd8e", "score": "0.52237594", "text": "func skipSpace(s string) string {\n\tfor i := 0; i < len(s); i++ {\n\t\tv := s[i]\n\t\tif chars[v]&isSpace == 0 {\n\t\t\treturn s[i:]\n\t\t}\n\t}\n\treturn s\n}", "title": "" }, { "docid": "57e09abfd58366f09f5993229aae83a9", "score": "0.52018857", "text": "func (comp *LogComponent) addSpaceToTitle(title string) string {\n\n\ttitleLen := len(title)\n\tif titleLen > comp.titleMaxLen {\n\t\tcomp.titleMaxLen = titleLen\n\t}\n\n\tspaceNum := comp.titleMaxLen - titleLen\n\tstrArr := make([]string, spaceNum)\n\n\treturn title + strings.Join(strArr, \" \")\n}", "title": "" }, { "docid": "8b9922fbbd58285f63036f64b26ee712", "score": "0.516035", "text": "func (e *editBuffer) moveGap(caret, space int) {\n\tif e.gapLen() < space {\n\t\tif space < minSpace {\n\t\t\tspace = minSpace\n\t\t}\n\t\ttxt := make([]byte, int(e.Size())+space)\n\t\t// Expand to capacity.\n\t\ttxt = txt[:cap(txt)]\n\t\tgaplen := len(txt) - int(e.Size())\n\t\tif caret > e.gapstart {\n\t\t\tcopy(txt, e.text[:e.gapstart])\n\t\t\tcopy(txt[caret+gaplen:], e.text[caret:])\n\t\t\tcopy(txt[e.gapstart:], e.text[e.gapend:caret+e.gapLen()])\n\t\t} else {\n\t\t\tcopy(txt, e.text[:caret])\n\t\t\tcopy(txt[e.gapstart+gaplen:], e.text[e.gapend:])\n\t\t\tcopy(txt[caret+gaplen:], e.text[caret:e.gapstart])\n\t\t}\n\t\te.text = txt\n\t\te.gapstart = caret\n\t\te.gapend = e.gapstart + gaplen\n\t} else {\n\t\tif caret > e.gapstart {\n\t\t\tcopy(e.text[e.gapstart:], e.text[e.gapend:caret+e.gapLen()])\n\t\t} else {\n\t\t\tcopy(e.text[caret+e.gapLen():], e.text[caret:e.gapstart])\n\t\t}\n\t\tl := e.gapLen()\n\t\te.gapstart = caret\n\t\te.gapend = e.gapstart + l\n\t}\n}", "title": "" }, { "docid": "577c40f8434b10f714558b6ec6c13289", "score": "0.51541984", "text": "func normalizeStringLength(lines []string, maxwidth int) []string {\n\tvar ret []string\n\tfor _, l := range lines {\n\t\ts := l + strings.Repeat(\" \", maxwidth - utf8.RuneCountInString(l))\n\t\tret = append(ret, s)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "d20bc9470cb87c2918b135ffcc799ea4", "score": "0.51532197", "text": "func removeWhitespace(str string)(string){\n\ttoks := strings.Split(str, \"\\n\")\n\tstr = strings.Join(toks, \"\")\n\ttoks = strings.Fields(str);\n\tstr = strings.Join(toks, \"\")\n\treturn str\n}", "title": "" }, { "docid": "41313f2fab82a1660944ef64a8837424", "score": "0.51435596", "text": "func skipSpace(rs io.RuneScanner) error {\n\tfor {\n\t\tswitch r, _, err := rs.ReadRune(); {\n\t\tcase err == io.EOF:\n\t\t\treturn nil\n\t\tcase err != nil:\n\t\t\treturn err\n\t\tcase r != '\\n' && unicode.IsSpace(r):\n\t\t\tcontinue\n\t\tdefault:\n\t\t\treturn rs.UnreadRune()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8c23ab1f1e010cecfab447ec89dc288f", "score": "0.513949", "text": "func MallocTrim() int { return int(C.malloc_trim(0)) }", "title": "" }, { "docid": "0be29e8323305f6b572f86a6f7c63822", "score": "0.5138761", "text": "func (d *Decoder) consumeSpace() (rune, error) {\n\treturn d.consume(unicode.IsSpace, false)\n}", "title": "" }, { "docid": "810b8669721cca73a3172f745fe16ff8", "score": "0.5129259", "text": "func reduceString(str string) string {\n\tre := regexp.MustCompile(`(?)\\n+`)\n\tstr = re.ReplaceAllString(str, \"\")\n\tre = regexp.MustCompile(`[ \\t]+`)\n\treturn re.ReplaceAllString(str, \" \")\n}", "title": "" }, { "docid": "280aaf5fa160fcc1be3d11dd80d65807", "score": "0.51152325", "text": "func NormalizeWhitespace(in string) (out string) {\n\twhitespace, _ := regexp.Compile(`\\s{2,}`)\n\tout = strings.TrimSpace(whitespace.ReplaceAllString(in, \" \"))\n\n\treturn\n}", "title": "" }, { "docid": "e9c9930eb12ebaa207e2fca09a6e5464", "score": "0.51131016", "text": "func (p *printer) flushSpace() {\n\tif p.pendingNewline == 1 {\n\t\tp.output = append(p.output, '\\n')\n\t\tp.pad(p.curIndent())\n\t} else if p.pendingNewline == 2 {\n\t\tp.output = append(p.output, \"\\n\\n\"...)\n\t\tp.pad(p.curIndent())\n\t} else if p.pendingSpace == true && p.pendingNewline != -1 {\n\t\tp.output = append(p.output, ' ')\n\t}\n\n\tp.pendingSpace = false\n\tp.pendingNewline = 0\n}", "title": "" }, { "docid": "dc01ce5b88c15afdbcb696a36a8a71a3", "score": "0.50940466", "text": "func GetSpace(string) (uint64, uint64, uint64, error) {\n\treturn 0, 0, 0, fmt.Errorf(\"not implemented\")\n}", "title": "" }, { "docid": "8714d7c1ce9cbe7df39283a3a8f3d2d2", "score": "0.5093697", "text": "func (l *lexer) ignoreSpace() {\n\tfor unicode.IsSpace(l.next()) {\n\t\tl.ignore()\n\t}\n\tl.backup()\n}", "title": "" }, { "docid": "9a09c7e48991fd82ae3871dcdb8afdce", "score": "0.50927186", "text": "func SpaceRequiredToMove(srcPath string, dstPath string) (uint64, error) {\n\tsameFs, err := IsSameFilesystem(srcPath, dstPath)\n\tif err != nil {\n\t\treturn uint64(0), err\n\t}\n\n\tif sameFs {\n\t\treturn uint64(0), nil\n\t}\n\n\tspaceRequired, err := SpaceUsedByDir(srcPath)\n\tif err != nil {\n\t\treturn uint64(0), err\n\t}\n\treturn spaceRequired, nil\n}", "title": "" }, { "docid": "d1ab8e3e91e0c31415fcfb01080160d4", "score": "0.5081315", "text": "func trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119735:13: */\n\tvar zIn uintptr // Input string\n\tvar zCharSet uintptr // Set of characters to trim\n\tvar nIn int32 // Number of bytes in input\n\tvar flags int32 // 1: trimleft 2: trimright 3: trim\n\tvar i int32 // Loop counter\n\tvar aLen uintptr = uintptr(0) // Length of each character in zCharSet\n\tvar azChar uintptr = uintptr(0) // Individual characters in zCharSet\n\tvar nChar int32 // Number of characters in zCharSet\n\n\tif Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {\n\t\treturn\n\t}\n\tzIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))\n\tif zIn == uintptr(0) {\n\t\treturn\n\t}\n\tnIn = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))\n\n\tif argc == 1 {\n\t\tnChar = 1\n\t\taLen = uintptr(uintptr(unsafe.Pointer(&lenOne)))\n\t\tazChar = uintptr(uintptr(unsafe.Pointer(&azOne)))\n\t\tzCharSet = uintptr(0)\n\t} else if (libc.AssignUintptr(&zCharSet, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) == uintptr(0) {\n\t\treturn\n\t} else {\n\t\tvar z uintptr\n\t\tz = zCharSet\n\t\tnChar = 0\n\t\tfor ; *(*uint8)(unsafe.Pointer(z)) != 0; nChar++ {\n\t\t\t{\n\t\t\t\tif (int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) >= 0xc0 {\n\t\t\t\t\tfor (int32(*(*uint8)(unsafe.Pointer(z))) & 0xc0) == 0x80 {\n\t\t\t\t\t\tz++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tif nChar > 0 {\n\t\t\tazChar = contextMalloc(tls, context, (int64((uint64(I64(nChar))) * (uint64(unsafe.Sizeof(uintptr(0))) + uint64(1)))))\n\t\t\tif azChar == uintptr(0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\taLen = (azChar + uintptr(nChar)*8)\n\t\t\tz = zCharSet\n\t\t\tnChar = 0\n\t\t\tfor ; *(*uint8)(unsafe.Pointer(z)) != 0; nChar++ {\n\t\t\t\t*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)) = z\n\t\t\t\t{\n\t\t\t\t\tif (int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) >= 0xc0 {\n\t\t\t\t\t\tfor (int32(*(*uint8)(unsafe.Pointer(z))) & 0xc0) == 0x80 {\n\t\t\t\t\t\t\tz++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t*(*uint8)(unsafe.Pointer(aLen + uintptr(nChar))) = (U8((int64(z) - int64(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)))) / 1))\n\t\t\t}\n\t\t}\n\t}\n\tif nChar > 0 {\n\t\tflags = int32(Xsqlite3_user_data(tls, context))\n\t\tif (flags & 1) != 0 {\n\t\t\tfor nIn > 0 {\n\t\t\t\tvar len int32 = 0\n\t\t\t\tfor i = 0; i < nChar; i++ {\n\t\t\t\t\tlen = int32(*(*uint8)(unsafe.Pointer(aLen + uintptr(i))))\n\t\t\t\t\tif (len <= nIn) && (libc.Xmemcmp(tls, zIn, *(*uintptr)(unsafe.Pointer(azChar + uintptr(i)*8)), uint64(len)) == 0) {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif i >= nChar {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tzIn += uintptr(len)\n\t\t\t\tnIn = nIn - (len)\n\t\t\t}\n\t\t}\n\t\tif (flags & 2) != 0 {\n\t\t\tfor nIn > 0 {\n\t\t\t\tvar len int32 = 0\n\t\t\t\tfor i = 0; i < nChar; i++ {\n\t\t\t\t\tlen = int32(*(*uint8)(unsafe.Pointer(aLen + uintptr(i))))\n\t\t\t\t\tif (len <= nIn) && (libc.Xmemcmp(tls, (zIn+uintptr((nIn-len))), *(*uintptr)(unsafe.Pointer(azChar + uintptr(i)*8)), uint64(len)) == 0) {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif i >= nChar {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tnIn = nIn - (len)\n\t\t\t}\n\t\t}\n\t\tif zCharSet != 0 {\n\t\t\tXsqlite3_free(tls, azChar)\n\t\t}\n\t}\n\tXsqlite3_result_text(tls, context, zIn, nIn, libc.UintptrFromInt32(-1))\n}", "title": "" }, { "docid": "a82aa4c5aa7c9ec35a4de94485ffa2b5", "score": "0.5072135", "text": "func MergeSpaces(in []byte) (out []byte) {\n\tvar isSpace bool\n\tfor _, c := range in {\n\t\tif c == ' ' || c == '\\t' || c == '\\v' || c == '\\f' || c == '\\n' || c == '\\r' {\n\t\t\tisSpace = true\n\t\t\tcontinue\n\t\t}\n\t\tif isSpace {\n\t\t\tout = append(out, ' ')\n\t\t\tisSpace = false\n\t\t}\n\t\tout = append(out, c)\n\t}\n\tif isSpace {\n\t\tout = append(out, ' ')\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "080deda618c6f4a5a4e9152d450df8f7", "score": "0.5069801", "text": "func spacePlus(items [9]int) (str string) {\r\n\r\n\tfor _, item := range items {\r\n\t\ts := strconv.Itoa(item)\r\n\t\tif item < 10 {\r\n\t\t\tstr += s + \" \"\r\n\t\t} else {\r\n\t\t\tstr += \"-\" + \" \"\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "1b93de2348029f52690678536de5ed23", "score": "0.50684834", "text": "func TrimSpaceFromItems(arr []string) []string {\n\tnewArr := make([]string, len(arr))\n\tfor i := range arr {\n\t\tnewArr[i] = strings.TrimSpace(arr[i])\n\t}\n\n\treturn newArr\n}", "title": "" }, { "docid": "2e7629344edeb130035e972221f89d09", "score": "0.5061677", "text": "func allSpaces(s string) bool {\n\treturn strings.IndexFunc(s, func(r rune) bool { return r != ' ' }) == -1\n}", "title": "" }, { "docid": "1a2d3db00880a97494b6327601ad9318", "score": "0.5053809", "text": "func cleansingEarlyBlankSpace(sentence string) (string, string) {\n\tsentence = regexEarlyBlankSpace.ReplaceAllString(sentence, \"\")\n\n\treturn \"cleansing_early_blank_space\", sentence\n}", "title": "" }, { "docid": "a6cd46134f30b390c71ee8d8c0fd655f", "score": "0.50507003", "text": "func trim(a string) string {\n\n\treturn strings.Trim(a, \"\\t\\n \")\n}", "title": "" }, { "docid": "7f640ae2b883ff4cfd5b1576773fc7a8", "score": "0.50497526", "text": "func (p *Parser) SkipHorizontalSpaces() rune {\n\tfor x, r := range p.v[p.x:] {\n\t\tswitch r {\n\t\tcase ' ', '\\t', '\\r', '\\f':\n\t\tdefault:\n\t\t\tp.x += x\n\t\t\tp.d = r\n\t\t\treturn r\n\t\t}\n\t}\n\n\tp.d = 0\n\tp.x = len(p.v)\n\n\treturn 0\n}", "title": "" }, { "docid": "4bfc2e9f29435239e4a9f8beab6a91ac", "score": "0.50487065", "text": "func isSpace(r rune) bool {\n\treturn r == ' '\n}", "title": "" }, { "docid": "fe574cd5806701bd85a117044676d5d8", "score": "0.50419027", "text": "func matchSpace(orig []byte, src []byte) []byte {\n\tbefore, _, after := cutSpace(orig)\n\ti := bytes.LastIndex(before, []byte{'\\n'})\n\tbefore, indent := before[:i+1], before[i+1:]\n\n\t_, src, _ = cutSpace(src)\n\n\tvar b bytes.Buffer\n\tb.Write(before)\n\tfor len(src) > 0 {\n\t\tline := src\n\t\tif i := bytes.IndexByte(line, '\\n'); i >= 0 {\n\t\t\tline, src = line[:i+1], line[i+1:]\n\t\t} else {\n\t\t\tsrc = nil\n\t\t}\n\t\tif len(line) > 0 && line[0] != '\\n' { // not blank\n\t\t\tb.Write(indent)\n\t\t}\n\t\tb.Write(line)\n\t}\n\tb.Write(after)\n\treturn b.Bytes()\n}", "title": "" }, { "docid": "07aeabc2eeba1d497dffbd4516740e7e", "score": "0.5038319", "text": "func (h *Header) fillSpace() {\n\tvar num int\n\tvar tot int\n\n\tfor _, title := range h.Titles {\n\t\ttot += title.Per\n\t\tif title.Per == 0 {\n\t\t\tnum += 1\n\t\t}\n\t}\n\n\tif num == 0 {\n\t\treturn\n\t}\n\n\tnum = (100 - tot) / num\n\n\tfor it := 0; it < len(h.Titles); it++ {\n\t\tif h.Titles[it].Per == 0 {\n\t\t\th.Titles[it].Per = num\n\t\t}\n\t}\n}", "title": "" }, { "docid": "40bc17ee87da114aa44d66172ec73c6e", "score": "0.50342315", "text": "func lexSpace(l *lexer) stateFn {\n\tfor {\n\t\tr := l.peek()\n\t\tif isEndOfLine(r) {\n\t\t\t// Don't use next since it also counts newlines\n\t\t\t// Newlines will be counted at the end when calling l.ignore\n\t\t\tl.pos++\n\t\t\tl.emitAutomaticComma()\n\t\t\tcontinue\n\t\t}\n\t\tif !isSpace(r) {\n\t\t\tbreak\n\t\t}\n\t\tl.next()\n\t}\n\tl.ignore()\n\treturn lexText\n}", "title": "" }, { "docid": "7135feafbe4b412af1bcba8a62634782", "score": "0.50331545", "text": "func FollowSpaces(r rune, state uint32) uint32 {\n\tif r == ' ' {\n\t\treturn 1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "5c3ee26f640bf9b1aca9a98532c71c1e", "score": "0.50221556", "text": "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "title": "" }, { "docid": "5c3ee26f640bf9b1aca9a98532c71c1e", "score": "0.50221556", "text": "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "title": "" }, { "docid": "5c3ee26f640bf9b1aca9a98532c71c1e", "score": "0.50221556", "text": "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "title": "" }, { "docid": "5c3ee26f640bf9b1aca9a98532c71c1e", "score": "0.50221556", "text": "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "title": "" }, { "docid": "5c3ee26f640bf9b1aca9a98532c71c1e", "score": "0.50221556", "text": "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "title": "" }, { "docid": "5c3ee26f640bf9b1aca9a98532c71c1e", "score": "0.50221556", "text": "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "title": "" } ]
cd049ec37ab2b279a951ff0886b7deb2
GetId returns the Id field if nonnil, zero value otherwise.
[ { "docid": "c11263a9270ab1a599a5c526e2cc032d", "score": "0.0", "text": "func (o *Ga4ghVariantSetMetadata) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" } ]
[ { "docid": "88a92bb77bf48cf3bcc8e7961de83391", "score": "0.6622591", "text": "func (i Invoice) GetId() string {\n\treturn i.Id\n}", "title": "" }, { "docid": "d65023238d4719fd81dadf7c0ab436dc", "score": "0.6561582", "text": "func (c *Creator) GetId() int {\n\tif c == nil || c.Id == nil {\n\t\treturn 0\n\t}\n\treturn *c.Id\n}", "title": "" }, { "docid": "4342ff8f70c6b734ec2b0dd716dca964", "score": "0.64997387", "text": "func (o *User) GetId() int64 {\n\tif o == nil || IsNil(o.Id) {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "7e63c9dc65af790d407078f41ac9ff85", "score": "0.64717174", "text": "func (o *ViewCustomField) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "5b22d8ca652714b5c6743ca8950128f1", "score": "0.64653116", "text": "func (p *UserForUServ) GetId() int64 { return p.Id }", "title": "" }, { "docid": "889e2349ef23a376fda3fd8e8624c3b3", "score": "0.64395267", "text": "func (d *DashboardLite) GetIdOk() (int, bool) {\n\tif d == nil || d.Id == nil {\n\t\treturn 0, false\n\t}\n\treturn *d.Id, true\n}", "title": "" }, { "docid": "5452533d4f199bbc9d5a3f1b1c117fcf", "score": "0.6424404", "text": "func (d *DashboardLite) GetId() int {\n\tif d == nil || d.Id == nil {\n\t\treturn 0\n\t}\n\treturn *d.Id\n}", "title": "" }, { "docid": "dfc5c0c5b1aeb8a83109f9c3536a2f4a", "score": "0.6400145", "text": "func (e *Event) GetId() int {\n\tif e == nil || e.Id == nil {\n\t\treturn 0\n\t}\n\treturn *e.Id\n}", "title": "" }, { "docid": "bf9e4ad9e931f36502e64c64925a1d72", "score": "0.6395015", "text": "func (a Ping) GetId() int64 {\n\treturn 0\n}", "title": "" }, { "docid": "4f03cff8fedeaf6bdd662f0b12e35666", "score": "0.6381072", "text": "func (m *AddIn) GetId()(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)\n }\n return nil\n}", "title": "" }, { "docid": "c5697ae19eba77a7d5eeb0b83fe80b09", "score": "0.637548", "text": "func (e EventData) GetId() int64 {\n\treturn e.ID\n}", "title": "" }, { "docid": "c4750d81295d32f3eef9981f01342819", "score": "0.6364273", "text": "func (o *Source) GetId() string {\n\tif o == nil || IsNil(o.Id) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "e8b218c0cf73e01dbce6f436c1a48031", "score": "0.6326007", "text": "func (o *DatabaseResponse) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "title": "" }, { "docid": "1c7ec08e62cddcca5083f4b7ecba5a2b", "score": "0.6325432", "text": "func (o *Service) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "186c4a72e71446f93292ce0004d3a039", "score": "0.6310796", "text": "func (e Event) GetId() int64 {\n\treturn e.ID\n}", "title": "" }, { "docid": "15ef820fc51a1359a5f282bfeca3600f", "score": "0.6310695", "text": "func (v *GetUsersUser) GetId() string { return v.Id }", "title": "" }, { "docid": "4c9289dffa31765544a52ea7dd94542b", "score": "0.63063335", "text": "func (o *UserDTO) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "d8384c19aa673aeb7374d46634138900", "score": "0.63035905", "text": "func (o *ViewCustomField) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "21963672055ddebe651dc27d0b76971f", "score": "0.6283809", "text": "func (file File) GetId() string {\n\treturn file.Id\n}", "title": "" }, { "docid": "129ca7710952077dc97dd8027817c77c", "score": "0.62792885", "text": "func (o *Gvm) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "e6093a879a5411b6a25b02742acc70f8", "score": "0.6277698", "text": "func (o *WebForm) GetId() int64 {\n\tif o == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "title": "" }, { "docid": "0d99e94464a624697aed3261794e1462", "score": "0.62143177", "text": "func (v *AddOnData) GetId() string { return v.Id }", "title": "" }, { "docid": "9423f43748af5dffce88e761c859bca9", "score": "0.6213824", "text": "func Get() ID {\n\treturn Default.Get()\n}", "title": "" }, { "docid": "d6659cd1edea92c6fdfd01ac24227249", "score": "0.62115586", "text": "func (o *Sa) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "title": "" }, { "docid": "cc9f9af81f9fca341cb92d74fc6d02fa", "score": "0.62092996", "text": "func (o *Sa) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "fdaeeb08920e994091694e0526173462", "score": "0.6207022", "text": "func (g Game) GetId() uint64 {\n\treturn g.id\n}", "title": "" }, { "docid": "e40f460afc5b822baa647224ec207166", "score": "0.62067246", "text": "func (v *VAO) GetId() uint32 {\n\treturn v.id\n}", "title": "" }, { "docid": "ee0b013cdca231bf3d2c61d3bf832953", "score": "0.6200899", "text": "func (o *ViewTask) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "4b856a33f2997e0e227cbeccf6942c24", "score": "0.61855495", "text": "func (o *RollupFieldFieldSerializerWithRelatedFields) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "c2b6124629299897df32dbefe8616cf3", "score": "0.6181049", "text": "func (u *User) GetId() string {\n\treturn u.ID.String()\n}", "title": "" }, { "docid": "da7e3b830fba0ceb56744505f1a70a6d", "score": "0.6175235", "text": "func (o *Token) GetId() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "title": "" }, { "docid": "a1e1e9513df937c2b3a350672af0b811", "score": "0.6172384", "text": "func (users *Users) GetId() dna.Int {\n\treturn users.InitialId\n}", "title": "" }, { "docid": "5dd8d9670ec1bcbbb54ede9e2f74e888", "score": "0.61705613", "text": "func (o *GenericError) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "8eafd9921a60395c12e0665020b48698", "score": "0.61624867", "text": "func (o *DatabaseResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "8c8f4a495db45ecf33630b078f12a200", "score": "0.61580265", "text": "func (o *Member) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "84ae07a7134c644373c67917566d3c4f", "score": "0.61490697", "text": "func (v *GetAddOnAddOn) GetId() string { return v.AddOnData.Id }", "title": "" }, { "docid": "6b1a8679af962b9f221deb5cfbc4ffc3", "score": "0.61385185", "text": "func (e Expense) GetId() string {\n\treturn e.Id\n}", "title": "" }, { "docid": "943677515d729ae49ca1844728c9f39b", "score": "0.6120415", "text": "func (o *Service) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "c2248413613bb8298322d7766a4c7e38", "score": "0.6117453", "text": "func (model *User) GetID() interface{} {\n\treturn model.ID\n}", "title": "" }, { "docid": "d3494df1bfb91424aa6306ad6e00f02e", "score": "0.61162764", "text": "func (o *Item) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "a52ccb73ef3ce0b47d03ff2cb69bb91a", "score": "0.61100423", "text": "func (o *Lap) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "c5ca21381f13e960e967babbf4294eff", "score": "0.61092097", "text": "func (s *ScreenboardLite) GetId() int {\n\tif s == nil || s.Id == nil {\n\t\treturn 0\n\t}\n\treturn *s.Id\n}", "title": "" }, { "docid": "7f75856fb5860e3da2996122025e8d6e", "score": "0.6107651", "text": "func GetID(source mongox.InterfaceBased) (id interface{}, err error) {\n\tid = source.GetID()\n\tif !reflect2.IsNil(id) {\n\t\treturn id, nil\n\t}\n\n\treturn nil, mongox.ErrUninitializedBase\n}", "title": "" }, { "docid": "882040a26ff7c70f388acf92b4c0c744", "score": "0.60956246", "text": "func (o *ImageReference) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "7a81e855e03cca3b1ff266fa45467af7", "score": "0.6093028", "text": "func (o *Member) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "1a6c712fa001500a2b38ca4a2edc5d40", "score": "0.6091716", "text": "func (c *Creator) GetIdOk() (int, bool) {\n\tif c == nil || c.Id == nil {\n\t\treturn 0, false\n\t}\n\treturn *c.Id, true\n}", "title": "" }, { "docid": "83564d9473f82251385a3a2b02055bb8", "score": "0.60876745", "text": "func (o *Lap) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "6bbdae6100f9693690672805066070c9", "score": "0.60849804", "text": "func (o *CustconfQueryStrParam) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "65bd499014703ab61e48ad2b47ba1068", "score": "0.6079968", "text": "func (d *Dashboard) GetIdOk() (int, bool) {\n\tif d == nil || d.Id == nil {\n\t\treturn 0, false\n\t}\n\treturn *d.Id, true\n}", "title": "" }, { "docid": "396db8833e7367f4b0e2e49d238b7eac", "score": "0.60784644", "text": "func (o *ViewTaskCard) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "98bb75db64672361e2465a062f02a282", "score": "0.6074792", "text": "func (f EventFields) GetID() string {\n\treturn f.GetString(EventID)\n}", "title": "" }, { "docid": "b9bead97e2f53069d53d9cbcd35e5224", "score": "0.60743076", "text": "func (m *Currency) GetId()(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)\n }\n return nil\n}", "title": "" }, { "docid": "f3294e0db44d9a4765d074ba6f1e6108", "score": "0.60732377", "text": "func (o *BaseSm) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "990bfdb8c96295c29c0a0efcde0fb15b", "score": "0.60730547", "text": "func (o *User) GetIdOk() (*int64, bool) {\n\tif o == nil || IsNil(o.Id) {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "b4f9749b308eff5408e7cf1e53343469", "score": "0.6069675", "text": "func (o *StandaloneVulnerability) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "8361d538916acfe6455f679d38c52276", "score": "0.6069263", "text": "func (o *Error) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "9f36b0fd55baceec324bff18797f5db8", "score": "0.60597503", "text": "func (o *RuleRead) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "title": "" }, { "docid": "bac50277ed8aec2f3c528096b065c894", "score": "0.6059548", "text": "func (p Party) GetId() string {\n\treturn p.Id\n}", "title": "" }, { "docid": "cdee13b69f575fd3215e884d4e2f14f2", "score": "0.60491043", "text": "func (o *DashboardUser) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "5e8215e27289079d41fa7467e810c824", "score": "0.6035745", "text": "func (o *MethodRule) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "840b0ee975597b83c97ea3857552325d", "score": "0.60315645", "text": "func (m *AppliedConditionalAccessPolicy) GetId()(*string) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "561216db1384147ed274e257eb402079", "score": "0.60306156", "text": "func (o *WebForm) GetIdOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "9d63396b688243cf8bbb6e2adc302b14", "score": "0.6030501", "text": "func (o *Gvm) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "5a81177ac3f3789c19932592463e3156", "score": "0.60282093", "text": "func (s *ScreenboardLite) GetIdOk() (int, bool) {\n\tif s == nil || s.Id == nil {\n\t\treturn 0, false\n\t}\n\treturn *s.Id, true\n}", "title": "" }, { "docid": "3315ee247753abc5aa1d9abdbe94f4f1", "score": "0.60220075", "text": "func (d *Downtime) GetId() int {\n\tif d == nil || d.Id == nil {\n\t\treturn 0\n\t}\n\treturn *d.Id\n}", "title": "" }, { "docid": "100a407919ebc67ec842324ece28fac4", "score": "0.6017615", "text": "func (o *AddOn) GetID() (value string, ok bool) {\n\tok = o != nil && o.id != nil\n\tif ok {\n\t\tvalue = *o.id\n\t}\n\treturn\n}", "title": "" }, { "docid": "82220de4a5d6e64433ca17dbd5ba11e7", "score": "0.6017217", "text": "func (o *ServiceDependency) GetID() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&2 != 0\n\tif ok {\n\t\tvalue = o.id\n\t}\n\treturn\n}", "title": "" }, { "docid": "8771a0ccc311b1e50b9162c7346739b7", "score": "0.60134625", "text": "func (v *GetOrganizationOrganization) GetId() string { return v.Id }", "title": "" }, { "docid": "de8ac894e83274fd75c23ea91b373839", "score": "0.60046965", "text": "func (o *RuleRead) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "ef693ebe0ad38fd73f972f20ded9aa98", "score": "0.60045195", "text": "func (o *BookingModel) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "title": "" }, { "docid": "0ce64ec0b1c0634fea2a1bd6bb08988c", "score": "0.60016173", "text": "func (o *Policy) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "335373090b05aa5c61e263143dad622a", "score": "0.6000804", "text": "func (o *Audience) GetId() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "title": "" }, { "docid": "44806fa3021bd5475bae9cb01b6e6a75", "score": "0.59985626", "text": "func (d *Dependency) GetId() uint64 {\n\treturn d.id\n}", "title": "" }, { "docid": "5e53b5ff9087d8ab2658482e7086a572", "score": "0.599792", "text": "func (o *LedDTO) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "d867d0b8e463f7d8340ffa772dc3e022", "score": "0.59967667", "text": "func (e *Event) GetIdOk() (int, bool) {\n\tif e == nil || e.Id == nil {\n\t\treturn 0, false\n\t}\n\treturn *e.Id, true\n}", "title": "" }, { "docid": "57668fe467956a6a031389dd581607c7", "score": "0.5988629", "text": "func (ptr PointerProperty) GetId() ident.Id {\n\treturn ptr.Id\n}", "title": "" }, { "docid": "54bc17b74cc96fc0c1f684660d0ea00a", "score": "0.59850204", "text": "func (e *Entity) Id() int {\n\treturn e.id\n}", "title": "" }, { "docid": "d723865ce5f55fbb1ed6a13a4417d17e", "score": "0.59837836", "text": "func (d *Downtime) GetIdOk() (int, bool) {\n\tif d == nil || d.Id == nil {\n\t\treturn 0, false\n\t}\n\treturn *d.Id, true\n}", "title": "" }, { "docid": "4982e3d560376f00704c77ee585aaeb7", "score": "0.5976444", "text": "func (o *UserDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "c4c0529e1e2734e0004fba9dbd3ac5a2", "score": "0.5971362", "text": "func (o *FindingRule) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "e247ef93b4619ab998fa11cafa2647c0", "score": "0.5970491", "text": "func (o *Item) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "48284704871c302813edb8bb1f001014", "score": "0.5965329", "text": "func (r *Nullable) GetID() kallax.Identifier {\n\treturn (*kallax.NumericID)(&r.ID)\n}", "title": "" }, { "docid": "e1f3849ca343ba71683a74738c125111", "score": "0.59603006", "text": "func (o *BookingModel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "8f20a2234b8c0edfc71f44733783da16", "score": "0.59576464", "text": "func (o *ContractOwner) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "0dc57c556d3f7ea5e47864390850c351", "score": "0.5956589", "text": "func (o *ApiKeyResponseOnDelete) GetId() string {\n\tif o == nil || IsNil(o.Id) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "a72e8bbf65da30a9c8aaa653c871c969", "score": "0.59495324", "text": "func (o *ActivityLog) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "aff4e8ec6c01438d6af2067ac68e4d08", "score": "0.59455067", "text": "func (o *FechaduraDTO) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "41d08aca05e062d290edf95dcf2a916c", "score": "0.59450626", "text": "func (o *AccessFeature) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "5b25d203118d0a234d7680ede89c698f", "score": "0.5940691", "text": "func (p *Policy) GetID() (string, bool) {\n\treturn p.id, !p.hidden\n}", "title": "" }, { "docid": "e1a376f16011f3bef46080f9750bab07", "score": "0.59390265", "text": "func (o *Source) GetIdOk() (*string, bool) {\n\tif o == nil || IsNil(o.Id) {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "58c40a420e3706c6e1fbc8baea5378eb", "score": "0.5936815", "text": "func (a *Alert) GetId() int {\n\tif a == nil || a.Id == nil {\n\t\treturn 0\n\t}\n\treturn *a.Id\n}", "title": "" }, { "docid": "342c6f99916b195adf2f56d192d00a53", "score": "0.59300506", "text": "func (o *MessagesBase) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "2b9995dc66d6c498b4030d81701f7aba", "score": "0.5928806", "text": "func (_Register_0_0_1 *Register_0_0_1Caller) GetId(opts *bind.CallOptsWithNumber, id string) (struct {\n\tId string\n\tCb common.Address\n}, error) {\n\tret := new(struct {\n\t\tId string\n\t\tCb common.Address\n\t})\n\tout := ret\n\terr := _Register_0_0_1.contract.CallWithNumber(opts, out, \"getId\", id)\n\treturn *ret, err\n}", "title": "" }, { "docid": "32f7cebe86ccccb318f9a44138a1e9d2", "score": "0.59136564", "text": "func (o *InvoiceIndexResponseInvoices) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "624b984d6c349b8ae76634077fd848aa", "score": "0.5912228", "text": "func (o *MessagesBase) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "cc6f561f8d5d6f2821c60fa175d5556b", "score": "0.5912225", "text": "func (o *Monitor) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" }, { "docid": "921214d1a6864363e8c01b2d56c9932e", "score": "0.5907761", "text": "func (o *Webhook) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "88fc4185f85e187566601cb6bd875adb", "score": "0.5907451", "text": "func (o *Telegraf) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "890d688a5c7f8710e7a7a45d4536597b", "score": "0.59038055", "text": "func (o *LedDTO) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "0d9c7096842efd7f21e1d7fcfd86471c", "score": "0.59030944", "text": "func (o *Telegraf) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "title": "" }, { "docid": "4c1b96ea329a5b2c309d7760c7590d76", "score": "0.58986384", "text": "func (o *Token) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "title": "" } ]
87e517b5418688256e5e7c5d37bc7d73
SetRecipients sets the recipients property value. The recipients property
[ { "docid": "e79c442b45a9405c8b918e6315194a29", "score": "0.7791434", "text": "func (m *SendActivityNotificationToRecipientsPostRequestBody) SetRecipients(value []iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamworkNotificationRecipientable)() {\n m.recipients = value\n}", "title": "" } ]
[ { "docid": "b2883ea232b60ba99d1982022b051610", "score": "0.8398947", "text": "func (m *EducationAssignmentIndividualRecipient) SetRecipients(value []string)() {\n err := m.GetBackingStore().Set(\"recipients\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b10d3e8b7802b98bd873c9d32b687ee3", "score": "0.80509186", "text": "func (m *Message) SetToRecipients(value []Recipientable)() {\n m.toRecipients = value\n}", "title": "" }, { "docid": "7324555cdfb5cdf71a4d844ba6132a74", "score": "0.79976773", "text": "func (m *postPostcard) SetRecipients(val []PostRecipient) {\n\tm.recipientsField = val\n}", "title": "" }, { "docid": "d6f28089392cdcb464a6909169526a3d", "score": "0.79599696", "text": "func (m *InvitePostRequestBody) SetRecipients(value []iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.DriveRecipientable)() {\n m.recipients = value\n}", "title": "" }, { "docid": "68b0e209ef0a7a6c628ffa9abebf338b", "score": "0.78296673", "text": "func (m *SendActivityNotificationToRecipientsPostRequestBody) SetRecipients(value []iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamworkNotificationRecipientable)() {\n err := m.GetBackingStore().Set(\"recipients\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "18c2143ab4a156c203a14bc0775e3ab5", "score": "0.77996105", "text": "func (m *ForwardPostRequestBody) SetToRecipients(value []iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Recipientable)() {\n m.toRecipients = value\n}", "title": "" }, { "docid": "8c9d7c7571bcc1bdbec50a89bc924104", "score": "0.7633378", "text": "func (s *SMSConfiguration) SetRecipients(v []*RecipientDetail) *SMSConfiguration {\n\ts.Recipients = v\n\treturn s\n}", "title": "" }, { "docid": "b4c1113761bb2dbca2aefe289915342f", "score": "0.7388823", "text": "func (s *EmailConfiguration) SetRecipients(v *EmailRecipients) *EmailConfiguration {\n\ts.Recipients = v\n\treturn s\n}", "title": "" }, { "docid": "703e82c1ff0af498c88fc668c0fc69fd", "score": "0.7065134", "text": "func (m *Message) SetCcRecipients(value []Recipientable)() {\n m.ccRecipients = value\n}", "title": "" }, { "docid": "f33399dd64c5b0e75715bb37db2e7549", "score": "0.6825455", "text": "func (m *Message) SetBccRecipients(value []Recipientable)() {\n m.bccRecipients = value\n}", "title": "" }, { "docid": "82dafcffea9c18071eaf50993696b0e1", "score": "0.66070247", "text": "func (o *MicrosoftGraphConversationThread) SetToRecipients(v []MicrosoftGraphRecipient) {\n\to.ToRecipients = &v\n}", "title": "" }, { "docid": "7e836b8e832df725fbba476b40176538", "score": "0.6497832", "text": "func (m *Call) SetTargets(value []InvitationParticipantInfoable)() {\n err := m.GetBackingStore().Set(\"targets\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "80cf0c25c4509f178217e5ab31e8258a", "score": "0.58330154", "text": "func (m *Contact) SetEmailAddresses(value []EmailAddressable)() {\n err := m.GetBackingStore().Set(\"emailAddresses\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e08d737c6657bbd8015b63a8312bebb2", "score": "0.55865884", "text": "func (m *OrgContact) SetAddresses(value []PhysicalOfficeAddressable)() {\n err := m.GetBackingStore().Set(\"addresses\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b257607fc3510e2bd6b28283dc9acc0e", "score": "0.5511973", "text": "func (m *AddressBookAccountTargetContent) SetAccountTargetEmails(value []string)() {\n err := m.GetBackingStore().Set(\"accountTargetEmails\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f31f3bfbfa174d0e129fc876f40563b6", "score": "0.54930866", "text": "func (s PartnerSet) SetUsers(value m.UserSet) {\n\ts.RecordCollection.Set(models.NewFieldName(\"Users\", \"user_ids\"), value)\n}", "title": "" }, { "docid": "c6d09de108c6bb28e3be4eba73527334", "score": "0.5479627", "text": "func (m *EmailFileAssessmentRequest) SetRecipientEmail(value *string)() {\n m.recipientEmail = value\n}", "title": "" }, { "docid": "dc00c2e9541e2e1c73078b0c6a996b46", "score": "0.54570186", "text": "func (m *Message) SetReplyTo(value []Recipientable)() {\n m.replyTo = value\n}", "title": "" }, { "docid": "f5e25155ad9ed50d67490bae4d4cd121", "score": "0.54139715", "text": "func (m *InvitePostRequestBody) GetRecipients()([]iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.DriveRecipientable) {\n return m.recipients\n}", "title": "" }, { "docid": "89157914bcd402e683ad71f1100c710b", "score": "0.5398861", "text": "func (s *IRCServer) SetTargets(targets []Target) error {\n\ts.Targets = targets\n\tfor _, target := range targets {\n\t\tlog.Infof(\"Joining room [%s]\", target.Name)\n\t\ts.conn.Join(target.Name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "855a912d878200cf4aa600265a5fe175", "score": "0.5397472", "text": "func (m *SendActivityNotificationToRecipientsPostRequestBody) GetRecipients()([]iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamworkNotificationRecipientable) {\n return m.recipients\n}", "title": "" }, { "docid": "61017dd5f5ade14f9f6767a164d2f76a", "score": "0.53883195", "text": "func (o *MicrosoftGraphConversationThread) HasToRecipients() bool {\n\tif o != nil && o.ToRecipients != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c363d5f761d50b60c1883fd26276e2f3", "score": "0.5386588", "text": "func (svc notification) AttachEmailRecipients(ctx context.Context, message *gomail.Message, field string, recipients ...string) (err error) {\n\tvar (\n\t\temail string\n\t\tname string\n\t)\n\n\tif len(recipients) == 0 {\n\t\treturn\n\t}\n\n\tfor r, rcpt := range recipients {\n\t\tname, email = \"\", \"\"\n\t\trcpt = strings.TrimSpace(rcpt)\n\n\t\tif userID, err := strconv.ParseUint(rcpt, 10, 64); err == nil && userID > 0 {\n\t\t\t// handle user ID\n\t\t\tif user, err := svc.users.FindByID(ctx, userID); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"could not get notification address\")\n\t\t\t} else {\n\t\t\t\temail = user.Email\n\t\t\t\tname = user.Name\n\t\t\t}\n\n\t\t} else if spaceAt := strings.Index(rcpt, \" \"); spaceAt > -1 {\n\t\t\t// handle: <email> <name> (\"foo@bar.baz foo baz\")\n\t\t\temail, name = rcpt[:spaceAt], strings.TrimSpace(rcpt[spaceAt+1:])\n\t\t} else {\n\t\t\t// handle: <email>\n\t\t\temail = rcpt\n\t\t}\n\n\t\t// Validate email here\n\t\tif !mail.IsValidAddress(email) {\n\t\t\treturn errors.New(\"Invalid recipient email format\")\n\t\t}\n\n\t\trecipients[r] = message.FormatAddress(email, name)\n\t}\n\n\tmessage.SetHeader(field, recipients...)\n\treturn\n}", "title": "" }, { "docid": "54c95cce3d14bad8ac91981b0dc757b3", "score": "0.53852016", "text": "func SetAddresses(newAddresses []string) {\n\taddresses = newAddresses\n}", "title": "" }, { "docid": "574a707b8606cd838a5c3e7996abb2b4", "score": "0.5378102", "text": "func (m *OfferShiftRequest) SetRecipientUserId(value *string)() {\n err := m.GetBackingStore().Set(\"recipientUserId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4c052dbba9104376068dfbe6dbb39433", "score": "0.5357239", "text": "func (m *Call) SetParticipants(value []Participantable)() {\n err := m.GetBackingStore().Set(\"participants\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "bc7893b6118810af11bcfe12868dc4bb", "score": "0.53363913", "text": "func (m *EducationAssignmentIndividualRecipient) GetRecipients()([]string) {\n val, err := m.GetBackingStore().Get(\"recipients\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]string)\n }\n return nil\n}", "title": "" }, { "docid": "cf479555257bf9988ac1269a4921c7b2", "score": "0.5322258", "text": "func (mgr *dsAddrBook) SetAddrs(p peer.ID, addrs []ma.Multiaddr, ttl time.Duration) {\n\tif ttl <= 0 {\n\t\tmgr.deleteAddrs(p, addrs)\n\t\treturn\n\t}\n\tmgr.setAddrs(p, addrs, ttl, ttlOverride)\n}", "title": "" }, { "docid": "b2682b408f40d087b48fb0fa2e7102a2", "score": "0.5314781", "text": "func (m *Email) To(emails ...string) {\n\tm.to = []string{}\n\n\t// for _, email := range emails {\n\tm.to = append(m.to, emails...)\n\t// }\n}", "title": "" }, { "docid": "76fcaeb15b5d2704e5fa3e666aab6138", "score": "0.5286179", "text": "func (m *ForwardPostRequestBody) GetToRecipients()([]iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Recipientable) {\n return m.toRecipients\n}", "title": "" }, { "docid": "4501e0dabadb51338052b63d3c428c7e", "score": "0.5280795", "text": "func (m *Recipient) SetEmailAddress(value EmailAddressable)() {\n m.emailAddress = value\n}", "title": "" }, { "docid": "749d86a0d7555912299d173dca329d53", "score": "0.5275408", "text": "func (p *MailBuilder) ToAddrs(to []mail.Address) *MailBuilder {\n\tc := *p\n\tc.to = to\n\treturn &c\n}", "title": "" }, { "docid": "75f3e85f4d5750638861f73b2a360e21", "score": "0.52662146", "text": "func (o *SmtpPolicyAllOf) SetSmtpRecipients(v []string) {\n\to.SmtpRecipients = v\n}", "title": "" }, { "docid": "75f3e85f4d5750638861f73b2a360e21", "score": "0.52662146", "text": "func (o *SmtpPolicyAllOf) SetSmtpRecipients(v []string) {\n\to.SmtpRecipients = v\n}", "title": "" }, { "docid": "aac4b0156d07d644f14aac56c1d15b8d", "score": "0.5253086", "text": "func BookingReminderRecipientsPStaff() *BookingReminderRecipients {\n\tv := BookingReminderRecipientsVStaff\n\treturn &v\n}", "title": "" }, { "docid": "5313dc33ae768f3a8ed08c833466be67", "score": "0.52304995", "text": "func (o ClusterAlterGroupOutput) Recipients() ClusterAlterGroupRecipientArrayOutput {\n\treturn o.ApplyT(func(v *ClusterAlterGroup) ClusterAlterGroupRecipientArrayOutput { return v.Recipients }).(ClusterAlterGroupRecipientArrayOutput)\n}", "title": "" }, { "docid": "fef8f134a62f18b4a9144e3835fb5e65", "score": "0.5228799", "text": "func (m *AnalyzedMessageEvidence) SetRecipientEmailAddress(value *string)() {\n err := m.GetBackingStore().Set(\"recipientEmailAddress\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "bb44cbbae86144df6f082aacba308277", "score": "0.52258027", "text": "func (m *AccessReviewScheduleDefinition) SetAdditionalNotificationRecipients(value []AccessReviewNotificationRecipientItemable)() {\n m.additionalNotificationRecipients = value\n}", "title": "" }, { "docid": "fb4d20db5719b7d7764990f5ba9b1ecc", "score": "0.5202297", "text": "func (_OffchainAggregator *OffchainAggregatorTransactor) SetPayees(opts *bind.TransactOpts, _transmitters []common.Address, _payees []common.Address) (*types.Transaction, error) {\n\treturn _OffchainAggregator.contract.Transact(opts, \"setPayees\", _transmitters, _payees)\n}", "title": "" }, { "docid": "b931447ce1f33a07a8af9f46e7b5e243", "score": "0.51846105", "text": "func (m *postPostcard) Recipients() []PostRecipient {\n\treturn m.recipientsField\n}", "title": "" }, { "docid": "d21e93b08b2ae0c4a9aff959adbe9707", "score": "0.5120729", "text": "func (m *SendActivityNotificationToRecipientsPostRequestBody) GetRecipients()([]iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamworkNotificationRecipientable) {\n val, err := m.GetBackingStore().Get(\"recipients\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamworkNotificationRecipientable)\n }\n return nil\n}", "title": "" }, { "docid": "90b64392c2237b964285fe3862c6be6f", "score": "0.5085791", "text": "func (c *Config) EntityListRecipients() (openpgp.EntityList, error) {\n\tel, err := getKeyRing(c.PubringDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tel = filterEntityList(el, c.RecipientKeyIds)\n\treturn el, nil\n}", "title": "" }, { "docid": "95236eba7bb4e6e5504ca4186037539c", "score": "0.50798136", "text": "func (m *Message) GetToRecipients()([]Recipientable) {\n return m.toRecipients\n}", "title": "" }, { "docid": "228178ad821a210ae246a67460cf7b72", "score": "0.5078874", "text": "func (o *MicrosoftGraphConversationThread) GetToRecipients() []MicrosoftGraphRecipient {\n\tif o == nil || o.ToRecipients == nil {\n\t\tvar ret []MicrosoftGraphRecipient\n\t\treturn ret\n\t}\n\treturn *o.ToRecipients\n}", "title": "" }, { "docid": "59e0e767735ca42c163f0be1f6044fc7", "score": "0.507044", "text": "func (m *Message) SetTO(emails ...string) *Message {\n\tm.to = emails\n\treturn m\n}", "title": "" }, { "docid": "47c61aeac9959265bae2b4257a678b94", "score": "0.5056224", "text": "func (m *Contact) SetImAddresses(value []string)() {\n err := m.GetBackingStore().Set(\"imAddresses\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "60854e75f1add146ecbc4e6aa3843f33", "score": "0.5045894", "text": "func (kw *keyProviderKeyWrapper) GetRecipients(_ string) ([]string, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "12bcd23a0202ad69574db3021ba15331", "score": "0.503516", "text": "func (t *TestObject) SetSigners(orgID string, pubKeys []types.PubKey) (err types.Error) {\n\terr.ErrorCode = types.CodeOK\n\tdefer FuncRecover(&err)\n\tutest.NextBlock(1)\n\tt.obj.SetSigners(orgID, pubKeys)\n\tutest.Commit()\n\treturn\n}", "title": "" }, { "docid": "c333fad7b5349fff3a04608a56e62812", "score": "0.5031889", "text": "func (m *TCPDetectorMutation) SetAddrs(s []string) {\n\tm.addrs = &s\n\tm.appendaddrs = nil\n}", "title": "" }, { "docid": "fd490be761998bf21d9f07ab0f7af1ba", "score": "0.5021754", "text": "func AddUpdateRecipient(c *gin.Context) {\n\n\trFile, err := c.FormFile(\"recipients\")\n\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\tvar errorList serializers.ErrorInfo\n\t\terrorList.Error = map[int][]string{\n\t\t\t1: {constants.Errors().FileFormatError},\n\t\t}\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, errorList)\n\t\treturn\n\t}\n\trecipientRecords, err := recipients.ReadCSV(rFile)\n\tif err != nil {\n\t\tvar errorList serializers.ErrorInfo\n\t\terrorList.Error = map[int][]string{\n\t\t\t1: {err.Error()},\n\t\t}\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, errorList)\n\t\treturn\n\t}\n\n\tstatus, errorList := recipients.AddUpdateRecipients(recipientRecords)\n\n\tif status == http.StatusOK {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"status\": \"OK\",\n\t\t\t\"records_affected\": len(*recipientRecords),\n\t\t})\n\t} else {\n\t\tc.AbortWithStatusJSON(status, errorList)\n\t}\n}", "title": "" }, { "docid": "c70722d72b9ddbd279f299c8b9693028", "score": "0.5012981", "text": "func (s EmailRecipients) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d8cb206f082015c236e6e1867f0c812d", "score": "0.50105184", "text": "func (m *Message) SetFrom(value Recipientable)() {\n m.from = value\n}", "title": "" }, { "docid": "45fbc77a2811c6fac66056543083f951", "score": "0.50076133", "text": "func (d PartnerData) SetUsers(value m.UserSet) m.PartnerData {\n\td.ModelData.Set(models.NewFieldName(\"Users\", \"user_ids\"), value)\n\treturn d\n}", "title": "" }, { "docid": "2026cef2285c9889f0dcc2413012baf9", "score": "0.5006209", "text": "func (a *Authenticator) SetUserEmails(ctx context.Context, userID primitive.ObjectID, loweredEmails []string) (err error) {\n\tvar updateResult *mongo.UpdateResult\n\tupdateResult, err = a.cu.UpdateByID(ctx,\n\t\tuserID,\n\t\tbson.M{\"$set\": bson.M{\"lemails\": loweredEmails}},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to update user: %w\", err)\n\t}\n\tif updateResult.ModifiedCount == 0 {\n\t\treturn ErrUnknown\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7d0bdcf2c1af96972639178abc726657", "score": "0.49957502", "text": "func BookingReminderRecipientsPAllAttendees() *BookingReminderRecipients {\n\tv := BookingReminderRecipientsVAllAttendees\n\treturn &v\n}", "title": "" }, { "docid": "8a187aa091ff4cf5e49bdb2679ca061f", "score": "0.49857545", "text": "func (ddc *DatabaseDetectorCreate) SetReceivers(s []string) *DatabaseDetectorCreate {\n\tddc.mutation.SetReceivers(s)\n\treturn ddc\n}", "title": "" }, { "docid": "2c7a34c3acf9bb32898a55ca87604b06", "score": "0.49806324", "text": "func (m *Message) SetSender(value Recipientable)() {\n m.sender = value\n}", "title": "" }, { "docid": "a4866b5445a7fe52a24984529bfb9280", "score": "0.4980259", "text": "func (con *MultipleEqualsCondition) SetTargets(req string, targets []UserInput) error {\n\n\tcon.targets = targets\n\treturn nil\n}", "title": "" }, { "docid": "182ca84befe82c0416a612be07b345ce", "score": "0.4956072", "text": "func (m *DatabaseDetectorMutation) SetReceivers(s []string) {\n\tm.receivers = &s\n\tm.appendreceivers = nil\n}", "title": "" }, { "docid": "615f2fa36a3656b63024cd0faee8cbca", "score": "0.49521774", "text": "func (s *EmailRecipients) SetTo(v []*RecipientDetail) *EmailRecipients {\n\ts.To = v\n\treturn s\n}", "title": "" }, { "docid": "4dd1d5537163d86f111aeb3b82309915", "score": "0.49332222", "text": "func (m *TCPDetectorResultMutation) SetAddrs(s []string) {\n\tm.addrs = &s\n\tm.appendaddrs = nil\n}", "title": "" }, { "docid": "81adb561256cd9449f24a86444b1148e", "score": "0.49252224", "text": "func (o *SmtpPolicyAllOf) HasSmtpRecipients() bool {\n\tif o != nil && o.SmtpRecipients != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "81adb561256cd9449f24a86444b1148e", "score": "0.49252224", "text": "func (o *SmtpPolicyAllOf) HasSmtpRecipients() bool {\n\tif o != nil && o.SmtpRecipients != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e892d9bf9e59b4988e214278d8923dc0", "score": "0.49026123", "text": "func (m *Team) SetMembers(value []ConversationMemberable)() {\n m.members = value\n}", "title": "" }, { "docid": "d525eb0b9a21edae91913fb5ad20193e", "score": "0.48809752", "text": "func (o ProjectAlertGroupOutput) Recipients() ProjectAlertGroupRecipientArrayOutput {\n\treturn o.ApplyT(func(v *ProjectAlertGroup) ProjectAlertGroupRecipientArrayOutput { return v.Recipients }).(ProjectAlertGroupRecipientArrayOutput)\n}", "title": "" }, { "docid": "04f52bd486b8c9334323ff7cf564e54f", "score": "0.48629227", "text": "func (m *HTTPDetectorMutation) SetReceivers(s []string) {\n\tm.receivers = &s\n\tm.appendreceivers = nil\n}", "title": "" }, { "docid": "c3e596479085a8d76ee9907ecb0aa62b", "score": "0.48570088", "text": "func (m *DNSDetectorMutation) SetReceivers(s []string) {\n\tm.receivers = &s\n\tm.appendreceivers = nil\n}", "title": "" }, { "docid": "3e0018587d08d2093a105d96e8c240e0", "score": "0.4849223", "text": "func (m *Mail) AddReceivers(addresses ...string) {\n\tm.receiverAddresses = append(m.receiverAddresses, addresses...)\n}", "title": "" }, { "docid": "ce3039c3ceb691ace80dac0534262520", "score": "0.48448887", "text": "func (g *Domain) SetContacts(domain string, contacts DomainContacts) (err error) {\n\t_, err = g.client.Patch(\"domains/\"+domain+\"/contacts\", contacts, nil)\n\treturn\n}", "title": "" }, { "docid": "de13e210a32b84f4b4b80e3260d6dab8", "score": "0.48337117", "text": "func (client BaseClient) SetCertificateContactsSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "1bed5b1a05770fb15260b115f11a753c", "score": "0.48274186", "text": "func (m *TCPDetectorMutation) SetReceivers(s []string) {\n\tm.receivers = &s\n\tm.appendreceivers = nil\n}", "title": "" }, { "docid": "f3f19f8f6ae6544b534beebf2a698ff1", "score": "0.48127455", "text": "func (client BaseClient) SetCertificateContacts(ctx context.Context, vaultBaseURL string, contacts Contacts) (result Contacts, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/BaseClient.SetCertificateContacts\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.SetCertificateContactsPreparer(ctx, vaultBaseURL, contacts)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.BaseClient\", \"SetCertificateContacts\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.SetCertificateContactsSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.BaseClient\", \"SetCertificateContacts\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.SetCertificateContactsResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"keyvault.BaseClient\", \"SetCertificateContacts\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b226a07f2cff2b63b963b6e2c5555c9d", "score": "0.47826597", "text": "func (svc notification) procEmailRecipients(ctx context.Context, m *gomail.Message, field string, rr ...string) (err error) {\n\tvar (\n\t\temail string\n\t\tname string\n\t)\n\n\tif len(rr) == 0 {\n\t\treturn\n\t}\n\n\tfor r, rcpt := range rr {\n\t\taProps := &notificationActionProps{recipient: rcpt}\n\n\t\tname, email = \"\", \"\"\n\t\trcpt = strings.TrimSpace(rcpt)\n\n\t\tif userID, err := strconv.ParseUint(rcpt, 10, 64); err == nil && userID > 0 {\n\t\t\t// proc <user ID>\n\t\t\tif user, err := svc.users.FindByID(userID); err != nil {\n\t\t\t\treturn NotificationErrFailedToLoadUser(aProps).Wrap(err)\n\t\t\t} else {\n\t\t\t\temail = user.Email\n\t\t\t\tname = user.Name\n\t\t\t}\n\n\t\t} else if spaceAt := strings.Index(rcpt, \" \"); spaceAt > -1 {\n\t\t\t// proc <email> <name> (\"foo@bar.baz foo baz\")\n\t\t\temail, name = rcpt[:spaceAt], strings.TrimSpace(rcpt[spaceAt+1:])\n\t\t} else {\n\t\t\t// proc <email>\n\t\t\temail = rcpt\n\t\t}\n\n\t\t// Validate email here\n\t\tif !mail.IsValidAddress(email) {\n\t\t\treturn NotificationErrInvalidReceipientFormat(aProps)\n\t\t}\n\n\t\trr[r] = m.FormatAddress(email, name)\n\t}\n\n\tm.SetHeader(field, rr...)\n\treturn nil\n}", "title": "" }, { "docid": "5070408385f2dd6d02177975661eaef1", "score": "0.4772357", "text": "func (e *Envelope) AddRecipient(rcpt *mail.Address) error {\n\te.MailTo = append(e.MailTo, rcpt)\n\treturn nil\n}", "title": "" }, { "docid": "0fe35ab27068127e9328a8718df44757", "score": "0.4769136", "text": "func (d Delegation) Addresses(set *tezos.AddressSet) {\n\tset.AddUnique(d.Source)\n\tif d.Delegate.IsValid() {\n\t\tset.AddUnique(d.Delegate)\n\t}\n}", "title": "" }, { "docid": "76d0a1e8647e86a5fb10a622402e4773", "score": "0.47373515", "text": "func (o LookupProjectAlertGroupResultOutput) Recipients() GetProjectAlertGroupRecipientArrayOutput {\n\treturn o.ApplyT(func(v LookupProjectAlertGroupResult) []GetProjectAlertGroupRecipient { return v.Recipients }).(GetProjectAlertGroupRecipientArrayOutput)\n}", "title": "" }, { "docid": "3f22f424ce13422466ae382895f17bd7", "score": "0.4719738", "text": "func (m *PingDetectorMutation) SetReceivers(s []string) {\n\tm.receivers = &s\n\tm.appendreceivers = nil\n}", "title": "" }, { "docid": "2605b730cbcaf0511bd97947dabb9915", "score": "0.4679512", "text": "func (c *Contact) SetEmails(emails []contact.Email) {\n\tfor _, email := range emails {\n\t\tswitch email.Type {\n\t\tcase contact.TypeWork:\n\t\t\tc.Email2 = email.Address\n\t\t\tc.Email2Title = email.Type\n\t\tdefault:\n\t\t\tc.Email = email.Address\n\t\t\tc.EmailTitle = email.Type\n\t\t}\n\t}\n}", "title": "" }, { "docid": "730dd0ddce9e78bcec6e0b06cfae7624", "score": "0.46780983", "text": "func (m *Message) SetAttachments(value []Attachmentable)() {\n m.attachments = value\n}", "title": "" }, { "docid": "e0800442edd37a838391add37c7e02f7", "score": "0.46748358", "text": "func (s *Service) AddReceivers(contacts ...string) {\n\ts.contacts = append(s.contacts, contacts...)\n}", "title": "" }, { "docid": "318c82550b5c0a7543e84593171b1eb4", "score": "0.46679547", "text": "func (_OffchainAggregator *OffchainAggregatorSession) SetPayees(_transmitters []common.Address, _payees []common.Address) (*types.Transaction, error) {\n\treturn _OffchainAggregator.Contract.SetPayees(&_OffchainAggregator.TransactOpts, _transmitters, _payees)\n}", "title": "" }, { "docid": "e41e6a8aaf155ede1443baa45f98b423", "score": "0.46536535", "text": "func (*AudienceObject) Recipient() {}", "title": "" }, { "docid": "562df79a6d858f84a9b1c36c597465fb", "score": "0.4653164", "text": "func (_OffchainAggregator *OffchainAggregatorTransactorSession) SetPayees(_transmitters []common.Address, _payees []common.Address) (*types.Transaction, error) {\n\treturn _OffchainAggregator.Contract.SetPayees(&_OffchainAggregator.TransactOpts, _transmitters, _payees)\n}", "title": "" }, { "docid": "87e6a992ca51c02e010e08693f79674a", "score": "0.46530828", "text": "func (m *EducationAssignmentIndividualRecipient) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.EducationAssignmentRecipient.Serialize(writer)\n if err != nil {\n return err\n }\n if m.GetRecipients() != nil {\n err = writer.WriteCollectionOfStringValues(\"recipients\", m.GetRecipients())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "d0c1980f713387a1dfc7f567386daeb7", "score": "0.4602203", "text": "func (l *LocalProxy) SetCerts(certs []tls.Certificate) {\n\tl.certsMu.Lock()\n\tdefer l.certsMu.Unlock()\n\tl.cfg.Certs = certs\n}", "title": "" }, { "docid": "2effd99d76e37d46c1ae81d6e97e454a", "score": "0.45919883", "text": "func (s PartnerSet) SetUser(value m.UserSet) {\n\ts.RecordCollection.Set(models.NewFieldName(\"User\", \"user_id\"), value)\n}", "title": "" }, { "docid": "2bc634fc799abe73e2cc0d9504e3f7ec", "score": "0.45913225", "text": "func (m *OrgContact) SetPhones(value []Phoneable)() {\n err := m.GetBackingStore().Set(\"phones\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7cdb66068e2230243afcd8a3953f653a", "score": "0.45758417", "text": "func (sr *SendRequest) To(userID string) *SendRequest {\n\tsr.Recipient = Recipient{ID: userID}\n\n\treturn sr\n}", "title": "" }, { "docid": "9a3630e42f875a7e60644176d66485e2", "score": "0.45739135", "text": "func (s PartnerSet) SetEmail(value string) {\n\ts.RecordCollection.Set(models.NewFieldName(\"Email\", \"email\"), value)\n}", "title": "" }, { "docid": "659cd82472f342a082ae651fa3ed4a97", "score": "0.45728973", "text": "func (o *InvitationsErrorAllOf) SetEmails(v []string) {\n\to.Emails = &v\n}", "title": "" }, { "docid": "112569feac8b8db756aed20ccac275e4", "score": "0.45649737", "text": "func (s *MockSyncer) SetPubKeys(ctx context.Context, name string, pubkeys []string) error {\n\tif u, ok := s.Users[name]; ok {\n\t\tpks := make([]string, len(pubkeys))\n\t\tcopy(pks, pubkeys)\n\t\tu.PubKeys = pks\n\t\treturn nil\n\t}\n\treturn errors.New(\"not exists\")\n}", "title": "" }, { "docid": "9161b18280262132a533cf2112910db3", "score": "0.45649737", "text": "func (m *SubjectRightsRequestEnumeratedSiteLocation) SetUrls(value []string)() {\n err := m.GetBackingStore().Set(\"urls\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "02521056dfb654504655b55ed85a030e", "score": "0.45629415", "text": "func (m *OrgContact) SetSurname(value *string)() {\n err := m.GetBackingStore().Set(\"surname\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "737755a98d8714529367b5e53acdf355", "score": "0.45368078", "text": "func (ddc *DNSDetectorCreate) SetReceivers(s []string) *DNSDetectorCreate {\n\tddc.mutation.SetReceivers(s)\n\treturn ddc\n}", "title": "" }, { "docid": "83a8f65771e175cdd815a0f5a0b1f15c", "score": "0.4527106", "text": "func (r *BatchCreateRequest) SetDomains(domains []string) {\n r.Domains = domains\n}", "title": "" }, { "docid": "7868b029cbebc0e6d0a6961a1d3c3bcc", "score": "0.45263392", "text": "func (i *X25519Identity) Recipient() *X25519Recipient {\n\tr := &X25519Recipient{}\n\tr.theirPublicKey = i.ourPublicKey\n\treturn r\n}", "title": "" }, { "docid": "38cdf570fbbd15ae2aabe5e24c24ff2f", "score": "0.45213807", "text": "func (client BaseClient) SetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "a0b03461648f158ef27991551e109cff", "score": "0.45171654", "text": "func (m *CrossTenantAccessPolicyTargetConfiguration) SetTargets(value []CrossTenantAccessPolicyTargetable)() {\n err := m.GetBackingStore().Set(\"targets\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "df0bb31e012d7a56fa4ad289b83c9394", "score": "0.45166066", "text": "func Email(recipients []string, subject, body string) error {\n\tcfg := LoadConfig()\n\n\tfrom, err := mail.ParseAddress(cfg.Email.From)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc, err := smtp.Dial(cfg.Email.Host + \":\" + cfg.Email.Port)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttls := new(tls.Config)\n\ttls.ServerName = cfg.Email.Host\n\ttls.InsecureSkipVerify = !cfg.Email.VerifyTLS\n\n\tc.StartTLS(tls)\n\n\tauth := smtp.PlainAuth(\"\", cfg.Email.User, cfg.Email.Pass, cfg.Email.Host)\n\n\tif err = c.Auth(auth); err != nil {\n\t\treturn err\n\t}\n\n\tif err = c.Mail(from.Address); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, rcpt := range recipients {\n\t\tto, err := mail.ParseAddress(rcpt)\n\t\tif err = c.Rcpt(to.Address); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tw, err := c.Data()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// omit \"To:\" to force bcc recipients\n\tmessage := fmt.Sprintf(\"To: %v\\r\\nFrom: %v\\r\\nSubject: %v\\r\\n\\r\\n%v\",\n\t\tstrings.Join(recipients, \",\"), from, subject, body)\n\n\t_, err = w.Write([]byte(message))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = w.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.Quit()\n\treturn nil\n}", "title": "" }, { "docid": "ef3b281e54b91b867dfe0b6e520e740e", "score": "0.4511764", "text": "func (p *DubboRPCInvocation) SetArguments(agrs []util.Argument) {\n\tp.arguments = agrs\n}", "title": "" } ]
b89b3a71a82109484dce3382d0f3e4f6
NewSaveableOption creates a new SaveableOption factory
[ { "docid": "f75e15207b61dc5b1224d7b3307b0c31", "score": "0.7386541", "text": "func NewSaveableOption() SaveableOption {\n\treturn &saveableOption{}\n}", "title": "" } ]
[ { "docid": "8eab63e484eb98444b0d5b35f544f7d5", "score": "0.6114806", "text": "func newFactory(option *Option) *factory {\n\treturn &factory{option: option}\n}", "title": "" }, { "docid": "c5f970fcdf22d2192afa9e78d423f26e", "score": "0.58784074", "text": "func (o *Option) Save() error {\n\tif o._new == true {\n\t\treturn o.Create()\n\t}\n\tvar sets []string\n\n\tif o.IsOptionNameDirty == true {\n\t\tsets = append(sets, fmt.Sprintf(`option_name = '%s'`, o._adapter.SafeString(o.OptionName)))\n\t}\n\n\tif o.IsOptionValueDirty == true {\n\t\tsets = append(sets, fmt.Sprintf(`option_value = '%s'`, o._adapter.SafeString(o.OptionValue)))\n\t}\n\n\tif o.IsAutoloadDirty == true {\n\t\tsets = append(sets, fmt.Sprintf(`autoload = '%s'`, o._adapter.SafeString(o.Autoload)))\n\t}\n\n\tfrmt := fmt.Sprintf(\"UPDATE %s SET %s WHERE %s = '%d'\", o._table, strings.Join(sets, `,`), o._pkey, o.OptionId)\n\terr := o._adapter.Execute(frmt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "df7ab2501f32bfbe8684899766b0fb7d", "score": "0.5518195", "text": "func New(opt *Option) *Option {\n\treturn opt\n}", "title": "" }, { "docid": "422ba2281988a29c0605830528c8a9f8", "score": "0.5221631", "text": "func NewOption(key OptionKey, value interface{}) *Option {\n\treturn &Option{key, value}\n}", "title": "" }, { "docid": "38dfa7728c43a73b434ab485374fbdd4", "score": "0.52085847", "text": "func NewOption(a Adapter) *Option {\n\tvar o Option\n\to._table = fmt.Sprintf(\"%soptions\", a.DatabasePrefix())\n\to._adapter = a\n\to._pkey = \"option_id\"\n\to._new = false\n\treturn &o\n}", "title": "" }, { "docid": "00b679983540bd0fea4665e3f2619254", "score": "0.5107979", "text": "func NewOption(id int64, action string) *Option {\n\treturn &Option{\n\t\tid,\n\t\taction,\n\t}\n}", "title": "" }, { "docid": "16c891e6e40528bb9297b2318acf4ac6", "score": "0.50973195", "text": "func NewOption(fns []OptionFn) *Option {\n\topt := &Option{}\n\treturn opt.WithOptionFn(fns...)\n}", "title": "" }, { "docid": "3b28ee458ea9de069fb95fc51b98c446", "score": "0.4973786", "text": "func New(args ...options.Option) Interface {\n\tvar o = new(impl)\n\tfor _, arg := range args {\n\t\to.Option = arg\n\t}\n\to.templates = make(map[string]*pongo2.Template)\n\treturn o\n}", "title": "" }, { "docid": "cdf162b52fb2ca1249d4a6a96a4a1179", "score": "0.4968594", "text": "func NewOpt(fns ...OptionFn) *Option {\n\treturn NewOption(fns)\n}", "title": "" }, { "docid": "5c1bcd538d89b1618a58432aa72537d6", "score": "0.4920137", "text": "func New(args ...Option) Interface {\n\tvar o = new(impl)\n\tfor _, arg := range args {\n\t\to.Option = options.Option(arg)\n\t}\n\to.SetDefaultEngine(RenderPongo2Template)\n\treturn o\n}", "title": "" }, { "docid": "c8eb1e8123ac7705fbccd71965906ba8", "score": "0.49122703", "text": "func (o *Option) Create() error {\n\tfrmt := fmt.Sprintf(\"INSERT INTO %s (`option_name`, `option_value`, `autoload`) VALUES ('%s', '%s', '%s')\", o._table, o.OptionName, o.OptionValue, o.Autoload)\n\terr := o._adapter.Execute(frmt)\n\tif err != nil {\n\t\treturn o._adapter.Oops(fmt.Sprintf(`%s led to %s`, frmt, err))\n\t}\n\to.OptionId = o._adapter.LastInsertedId()\n\to._new = false\n\treturn nil\n}", "title": "" }, { "docid": "3261d264057e81cc0ca9a9df380a7dcd", "score": "0.48747522", "text": "func NewOpt(destP interface{}, flag string, dflt interface{}, desc string) Opt {\n\treturn Opt{\n\t\tDestP: destP,\n\t\tFlag: flag,\n\t\tDefault: dflt,\n\t\tDesc: desc,\n\t}\n}", "title": "" }, { "docid": "92a412dd74350fec3418c1de911e63b1", "score": "0.4820598", "text": "func init() {\n\tfactory.AddOption(&optionA{})\n\tfmt.Println(EnumOptionA + \" added to factory\")\n}", "title": "" }, { "docid": "b7115d670f2c7257a9b342912c9aff4f", "score": "0.48191914", "text": "func New(options ...func(*Book) error) (*Book, error) {\n\tb := &Book{}\n\n\tfor _, o := range options {\n\t\tif err := o(b); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to persist option to Book\")\n\t\t}\n\t}\n\n\t// Check required properties\n\tif b.EPub == nil {\n\t\treturn nil, errors.New(\"cannot create http book: no book supplied\")\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "7c57f3868a596f2e2c97c25b7e5facfb", "score": "0.48109227", "text": "func NewOption() *Option {\n\treturn &Option{}\n}", "title": "" }, { "docid": "8bf0826e8fff0e12ec623b2c3af2ba10", "score": "0.47714284", "text": "func NewOption(name string, params map[string]string) Option {\n\tp := Parameters{}\n\tfor k, v := range params {\n\t\tp.Set([]byte(k), []byte(v))\n\t}\n\treturn Option{\n\t\tName: []byte(name),\n\t\tParameters: p,\n\t}\n}", "title": "" }, { "docid": "5dbbcfc3bc77cb5e6b71a4e1ef00fde1", "score": "0.47664565", "text": "func New(opts ...Option) *Retriable {\n\tr := Default()\n\tfor _, o := range opts {\n\t\to(r)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "d005880f8e968c1c66844ddde9393dbe", "score": "0.4748528", "text": "func NewOption(name string, desc string, param bool) *Option {\n\topt := &Option{\n\t\tName: name,\n\t\tDesc: desc,\n\t\tParam: param,\n\t}\n\n\treturn opt\n}", "title": "" }, { "docid": "178cf872146bb6d7f6ad5918b580b2ee", "score": "0.47357163", "text": "func New(opts ...Option) (*Simple, error) {\n\treturn &Simple{\n\t\topts: opts,\n\t}, nil\n}", "title": "" }, { "docid": "dc08c2add99f53782490bfd88b2b43e8", "score": "0.47342443", "text": "func New(opts ...Option) *Sigstruct {\n\tvar s Sigstruct\n\tfor _, v := range opts {\n\t\tv(&s)\n\t}\n\n\treturn &s\n}", "title": "" }, { "docid": "e5e9187d58b86d0807b612218f7b5ca3", "score": "0.4724846", "text": "func newStoreInfo(storeOption StoreOption) *storeInfo {\n\treturn &storeInfo{\n\t\tStoreOption: storeOption,\n\t\tFamilies: make(map[string]FamilyOption),\n\t}\n}", "title": "" }, { "docid": "91ca4368f87209a1720d469955f2fa97", "score": "0.47020516", "text": "func New(ctx context.Context, opts Options) (*OPA, error) {\n\n\tvar err error\n\n\tid := opts.ID\n\tif id == \"\" {\n\t\tid, err = uuid.New(rand.Reader)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err := opts.init(); err != nil {\n\t\treturn nil, err\n\t}\n\n\topa := &OPA{\n\t\tid: id,\n\t\tstore: opts.Store,\n\t\thooks: opts.Hooks,\n\t\tstate: &state{\n\t\t\tqueryCache: newQueryCache(),\n\t\t},\n\t}\n\n\topa.config = opts.config\n\topa.logger = opts.Logger\n\topa.console = opts.ConsoleLogger\n\topa.plugins = opts.Plugins\n\n\treturn opa, opa.configure(ctx, opa.config, opts.Ready, opts.block)\n}", "title": "" }, { "docid": "0bd3317f8aec3d90f28818c235a704cc", "score": "0.4700074", "text": "func New(m map[string]interface{}) (*Options, error) {\n\to := &Options{}\n\tif err := mapstructure.Decode(m, o); err != nil {\n\t\terr = errors.Wrap(err, \"error decoding conf\")\n\t\treturn nil, err\n\t}\n\n\tif o.UserLayout == \"\" {\n\t\to.UserLayout = \"{{.Id.OpaqueId}}\"\n\t}\n\t// ensure user layout has no starting or trailing /\n\to.UserLayout = strings.Trim(o.UserLayout, \"/\")\n\n\tif o.ShareFolder == \"\" {\n\t\to.ShareFolder = \"/Shares\"\n\t}\n\t// ensure share folder always starts with slash\n\to.ShareFolder = filepath.Join(\"/\", o.ShareFolder)\n\n\t// c.DataDirectory should never end in / unless it is the root\n\to.Root = filepath.Clean(o.Root)\n\n\treturn o, nil\n}", "title": "" }, { "docid": "856137f03f32cc6b23d92381c724c980", "score": "0.46321756", "text": "func New(options ...Option) *API {\n\ta := &API{\n\t\tOptions: &Options{PayloadLinks: true},\n\t\thandlers: map[*mapping.ModelStruct]interface{}{},\n\t\tmodels: map[*mapping.ModelStruct]struct{}{},\n\t\tdefaultHandler: &DefaultHandler{},\n\t}\n\tfor _, option := range options {\n\t\toption(a.Options)\n\t}\n\treturn a\n}", "title": "" }, { "docid": "e8bfdbd303bebd6328c56c4b516157bd", "score": "0.46100008", "text": "func New(id string, cfg config.Command) Command {\n\tswitch cfg.Type {\n\tcase TypeBully:\n\t\treturn bully.New(id, cfg)\n\tcase TypeCopycat:\n\t\treturn copycat.New(id, cfg)\n\tcase TypeHelp:\n\t\treturn help.New(id, cfg)\n\tcase TypePostman:\n\t\treturn postman.New(id, cfg)\n\tcase TypeProxy:\n\t\treturn proxy.New(id, cfg)\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "9b710a5af0dadf35d28dd2b00b665186", "score": "0.46084777", "text": "func New(settings *environment.Settings, p FactoryProvider) *Command {\n\tc := &Command{}\n\tif p == nil {\n\t\tp = defaultFactoryProvider\n\t}\n\tc.FactoryProvider = p\n\tc.Settings = settings\n\treturn c\n}", "title": "" }, { "docid": "af2bec22bcdfe3049e1c0bab3ed3f958", "score": "0.46011946", "text": "func (o *OptionModel) Save() int64 {\n\n\tpstmt, err := DB.Prepare(`\n\t\tINSERT INTO options (\n\t\t\t\n\t\t) VALUES (\n\t\t\t\n\t\t)\n\t`)\n\n\tif err != nil {\n\t\tconsole.PrintColoredLn(err, console.Danger)\n\t}\n\n\tdefer pstmt.Close()\n\n\tresult, err := pstmt.Exec()\n\n\tif err != nil {\n\t\tconsole.PrintColored(\"pstmt: \", console.White)\n\t\tconsole.PrintColoredLn(err, console.Danger)\n\t}\n\n\tid, err := result.LastInsertId()\n\n\tif err != nil {\n\t\tconsole.PrintColored(\"extract Id: \", console.White)\n\t\tconsole.PrintColoredLn(err, console.Danger)\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "5021d946441cf924827958f20bd8197a", "score": "0.4599911", "text": "func newOptions(opts ...Option) *options {\n\to := new(options)\n\n\tfor _, opt := range opts {\n\t\topt(o)\n\t}\n\n\t// Default clock\n\tif o.clock == nil {\n\t\to.clock = clock.SystemClock\n\t}\n\n\treturn o\n}", "title": "" }, { "docid": "caec90501b6a7402cd32f3d8b2e1af1f", "score": "0.45813647", "text": "func (app *Arg) saveOptionDick(key string, value string) {\n\tvRaw := value\n\tif oV, hasOv := app.DataRaw[key]; hasOv {\n\t\tvRaw = fmt.Sprintf(\"%v %v\", oV, value)\n\t\tif cData, hasData := app.Data[key]; hasData {\n\t\t\tswitch cData.(type) {\n\t\t\tcase string:\n\t\t\t\toldSs := app.Data[key].(string)\n\t\t\t\tapp.Data[key] = []string{oldSs, value}\n\t\t\tcase []string:\n\t\t\t\toldVar := app.Data[key].([]string)\n\t\t\t\toldVar = append(oldVar, value)\n\t\t\t\tapp.Data[key] = oldVar\n\t\t\t}\n\t\t}\n\t} else {\n\t\tapp.Data[key] = value\n\t}\n\tapp.DataRaw[key] = vRaw\n}", "title": "" }, { "docid": "d3d039c7ed635c0b606f474845427686", "score": "0.45786703", "text": "func NewOption() *Option {\n\treturn &Option{\n\t\tOutput: OutputOption{},\n\t\tSearch: SearchOption{},\n\t}\n}", "title": "" }, { "docid": "7c4a9d6523570013b78bc8c2dd528635", "score": "0.45636433", "text": "func (ff *FactoryFeature) Save(ctx context.Context) error {\n\tif ff.Exists() {\n\t\treturn ff.Update(ctx)\n\t}\n\n\treturn ff.Insert(ctx)\n}", "title": "" }, { "docid": "94ce5f6ceb510fb573b3ed02341e159a", "score": "0.45580536", "text": "func NewSwagger(info Info, paths Paths, options ...Option) *SwaggerBuilder {\n\tvar lock sync.Locker = &sync.Mutex{}\n\tfor _, option := range options {\n\t\tswitch option.Name() {\n\t\tcase optkeyLocker:\n\t\t\tlock = option.Value().(sync.Locker)\n\t\t}\n\t}\n\tvar b SwaggerBuilder\n\tif lock == nil {\n\t\tlock = nilLock{}\n\t}\n\tb.lock = lock\n\tb.target = &swagger{\n\t\tversion: defaultSwaggerVersion,\n\t\tinfo: info,\n\t\tpaths: paths,\n\t}\n\treturn &b\n}", "title": "" }, { "docid": "fbebb3dd54f0d8e131408bc08058e12c", "score": "0.45580152", "text": "func New(name string, optType Type) *Option {\n\topt := &Option{\n\t\tName: name,\n\t\tOptType: optType,\n\t\tAliases: []string{name},\n\t}\n\tswitch optType {\n\tcase StringType, StringRepeatType:\n\t\topt.HelpArgName = \"string\"\n\tcase IntType, IntRepeatType:\n\t\topt.HelpArgName = \"int\"\n\tcase Float64Type:\n\t\topt.HelpArgName = \"float64\"\n\tcase StringMapType:\n\t\topt.HelpArgName = \"key=value\"\n\t}\n\topt.synopsis()\n\treturn opt\n}", "title": "" }, { "docid": "306e9fda98e92c2154250edfb82d38a8", "score": "0.45498076", "text": "func NewSaveModeFromValue(v string) (*SaveMode, error) {\n\tev := SaveMode(v)\n\tif ev.IsValid() {\n\t\treturn &ev, nil\n\t} else {\n\t\treturn nil, fmt.Errorf(\"invalid value '%v' for SaveMode: valid values are %v\", v, allowedSaveModeEnumValues)\n\t}\n}", "title": "" }, { "docid": "bf060c75ed6bdebb827136275223c7f2", "score": "0.45490867", "text": "func bindOptionsFactory(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(OptionsFactoryABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "123378680a2e277e74f81e5474c76be1", "score": "0.4529601", "text": "func New(typ Type, o *Options) (Driver, error) {\n\tinit, ok := driversMap[typ]\n\tif !ok {\n\t\treturn nil, ErrDriverNotFound\n\t}\n\treturn init(o)\n}", "title": "" }, { "docid": "974674fd90a8917ec05007e88aa39fad", "score": "0.45102236", "text": "func newOptions(streams genericclioptions.IOStreams) *options {\n\to := &options{\n\t\tIOStreams: streams,\n\t\tzip: archiver.NewZip(),\n\t}\n\to.SetConfigFlags()\n\treturn o\n}", "title": "" }, { "docid": "11490707a884659e67251bbcaaf9a643", "score": "0.4502436", "text": "func NewOpt(o *container.Container, index map[string]*container.Container) Matcher {\n\treturn &opt{\n\t\ttheOne: o,\n\t\tindex: index,\n\t}\n}", "title": "" }, { "docid": "72d852209bb8dc0502353f7c0ae23eb8", "score": "0.45020562", "text": "func New(opts types.Options) (types.Deployer, *pflag.FlagSet) {\n\t// create a deployer object and set fields that are not flag controlled\n\td := &deployer{\n\t\tcommonOptions: opts,\n\t\tBuildOptions: &builder.BuildOptions{},\n\t}\n\n\t// register flags\n\tfs := bindFlags(d)\n\n\t// register flags for klog\n\tklog.InitFlags(nil)\n\tfs.AddGoFlagSet(flag.CommandLine)\n\treturn d, fs\n}", "title": "" }, { "docid": "1321279959a6a4bee68697e242796e74", "score": "0.44887236", "text": "func (_factory *ValidationFactory) New(options ...Options) *Validation {\n\n\tvar _options *Options\n\tfinalOptions := Options{\n\t\tlocaleCodeDefaultFromFactory: _factory.localeCodeDefault,\n\t}\n\n\tif _factory.locales != nil {\n\t\tfinalOptions.localesFromFactory = _factory.locales\n\t}\n\n\tif len(options) > 0 {\n\t\t_options = &options[0]\n\t}\n\n\tif _options != nil && _options.LocaleCode != \"\" {\n\t\tfinalOptions.LocaleCode = _options.LocaleCode\n\t}\n\n\tif _options != nil && _options.MarshalJsonFunc != nil {\n\t\tfinalOptions.MarshalJsonFunc = _options.MarshalJsonFunc\n\t} else if _factory.marshalJsonFunc != nil {\n\t\tfinalOptions.MarshalJsonFunc = _factory.marshalJsonFunc\n\t}\n\n\treturn newValidation(finalOptions)\n}", "title": "" }, { "docid": "152965fc50cead11be17a01add2852a3", "score": "0.44863325", "text": "func New(args []string) pakelib.Command {\n\treturn &setdefault{\n\t\targs: args,\n\t}\n}", "title": "" }, { "docid": "eeced37562491adffa762db4821a135f", "score": "0.4459782", "text": "func New(opts ...Option) (Kraph, error) {\n\to, err := NewOptions()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, apply := range opts {\n\t\tapply(o)\n\t}\n\n\treturn &kraph{\n\t\tstore: o.Store,\n\t}, nil\n}", "title": "" }, { "docid": "7d1614b2ad2e582adda2efd76063c98f", "score": "0.44488868", "text": "func NewOptions() *OptionModel {\n\treturn &OptionModel{}\n}", "title": "" }, { "docid": "eaf960fd2f63ea6034367c5013a8cfd2", "score": "0.4444", "text": "func New(store Store, options ...Option) (*API, error) {\n\n\tapi := &API{\n\t\tstore: store,\n\t}\n\n\tfor _, o := range options {\n\t\to(api)\n\t}\n\n\treturn api, nil\n}", "title": "" }, { "docid": "6c165ab0a26dcd0c060644384046078e", "score": "0.4442033", "text": "func newOptions(opts ...Option) Options {\n\t// reg := registry.NewDNSNamingRegistry()\n\topt := Options{\n\t\tClient: client.NewClient(),\n\t\tServer: server.NewServer(),\n\t\t// Registry: &registry.Registry{\n\t\t// \tRegNaming: reg,\n\t\t// },\n\t\tContext: context.Background(),\n\t}\n\n\tfor _, o := range opts {\n\t\to(&opt)\n\t}\n\n\tif opt.Registry == nil { // 默认注册 服务发现\n\t\topt.Registry = &registry.Registry{\n\t\t\tRegNaming: registry.NewDNSNamingRegistry(),\n\t\t}\n\t\topt.Client.Init(client.WithRegistryNaming(opt.Registry.RegNaming))\n\t\topt.Server.Init(server.WithRegistryNaming(opt.Registry.RegNaming))\n\t}\n\treturn opt\n}", "title": "" }, { "docid": "090ba79c68b25473ff13f6c4b27c7ca9", "score": "0.4428567", "text": "func New(opts ...Option) (api.Feed, error) {\n\tfeed := &genericFeed{\n\t\tDefaultFeed: api.DefaultFeed{\n\t\t\tType: \"generic\",\n\t\t},\n\t}\n\n\t// Assign all options\n\tfor _, opt := range opts {\n\t\topt(&feed.dopts)\n\t}\n\n\t// Internal values\n\n\tif feed.dopts.puller != nil {\n\t\tfeed.SetPuller(feed.dopts.puller)\n\t}\n\tif feed.dopts.parser != nil {\n\t\tfeed.SetParser(feed.dopts.parser)\n\t}\n\tif len(strings.TrimSpace(feed.dopts.name)) > 0 {\n\t\tfeed.Name = feed.dopts.name\n\t}\n\tif len(feed.dopts.tags) > 0 {\n\t\tfeed.Tags = feed.dopts.tags\n\t}\n\n\treturn feed, nil\n}", "title": "" }, { "docid": "071095c0923a09edb93dc46f0c273e8a", "score": "0.44195676", "text": "func (s *etcdStore) Save(newStorable runtime.Storable, opts ...store.SaveOpt) (bool, error) {\n\tif newStorable == nil {\n\t\treturn false, fmt.Errorf(\"can't save nil\")\n\t}\n\n\tsaveOpts := store.NewSaveOpts(opts)\n\tinfo := s.types.Get(newStorable.GetKind())\n\tindexes := store.IndexesFor(info)\n\tkey := \"/\" + runtime.KeyForStorable(newStorable)\n\n\tif !info.Versioned {\n\t\tdata := s.marshal(newStorable)\n\t\t_, err := s.client.KV.Put(context.TODO(), \"/object\"+key+\"@\"+runtime.LastOrEmptyGen.String(), string(data))\n\t\t// todo should it be true or false always?\n\t\treturn false, err\n\t}\n\n\tvar newVersion bool\n\tnewObj := newStorable.(runtime.Versioned) // nolint: errcheck\n\t// todo prefetch all needed keys for STM to maximize performance (in fact it'll get all data in one first request)\n\t// todo consider unmarshal to the info.New() to support gob w/o need to register types?\n\t_, err := etcdconc.NewSTM(s.client, func(stm etcdconc.STM) error {\n\t\t// need to remove this obj from indexes\n\t\tvar prevObj runtime.Storable\n\n\t\tif saveOpts.IsReplaceOrForceGen() {\n\t\t\tnewGen := newObj.GetGeneration()\n\t\t\tif newGen == runtime.LastOrEmptyGen {\n\t\t\t\treturn fmt.Errorf(\"error while saving object %s with replaceOrForceGen option but with empty generation\", key)\n\t\t\t}\n\t\t\t// need to check if there is an object already exists with gen from the object, if yes - remove it from indexes\n\t\t\toldObjRaw := stm.Get(\"/object\" + key + \"@\" + newGen.String())\n\t\t\tif oldObjRaw != \"\" {\n\t\t\t\t// todo avoid\n\t\t\t\tprevObj = info.New().(runtime.Storable) // nolint: errcheck\n\t\t\t\t/*\n\t\t\t\t\tadd field require not nil val for unmarshal field into codec\n\t\t\t\t\tif nil passed => create instance of desired object (w/o casting to storable) and pass to unmarshal\n\t\t\t\t\tif not nil => error if incorrect type\n\t\t\t\t*/\n\t\t\t\ts.unmarshal([]byte(oldObjRaw), prevObj)\n\t\t\t}\n\n\t\t\t// todo compare - if not changed - nothing to do\n\t\t} else {\n\t\t\t// need to get last gen using index, if exists - compare with, if different - increment revision and delete old from indexes\n\t\t\tlastGenRaw := stm.Get(\"/index/\" + indexes.NameForStorable(store.LastGenIndex, newStorable, s.codec))\n\t\t\tif lastGenRaw == \"\" {\n\t\t\t\tnewObj.SetGeneration(runtime.FirstGen)\n\t\t\t\tnewVersion = true\n\t\t\t} else {\n\t\t\t\tlastGen := s.unmarshalGen(lastGenRaw)\n\t\t\t\toldObjRaw := stm.Get(\"/object\" + key + \"@\" + lastGen.String())\n\t\t\t\tif oldObjRaw == \"\" {\n\t\t\t\t\treturn fmt.Errorf(\"last gen index for %s seems to be corrupted: generation doesn't exist\", key)\n\t\t\t\t}\n\t\t\t\t// todo avoid\n\t\t\t\tprevObj = info.New().(runtime.Storable) // nolint: errcheck\n\t\t\t\ts.unmarshal([]byte(oldObjRaw), prevObj)\n\t\t\t\tnewObj.SetGeneration(lastGen)\n\n\t\t\t\t// todo should we compare marshaled objects for safety?\n\t\t\t\tif reflect.DeepEqual(prevObj, newObj) {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\t// objects are different\n\t\t\t\tnewObj.SetGeneration(lastGen.Next())\n\t\t\t\tnewVersion = true\n\t\t\t}\n\t\t}\n\n\t\tdata := s.marshal(newObj)\n\t\tnewGen := newObj.GetGeneration()\n\t\tstm.Put(\"/object\"+key+\"@\"+newGen.String(), string(data))\n\n\t\tif prevObj != nil && prevObj.(runtime.Versioned).GetGeneration() == newGen {\n\t\t\tfor _, index := range indexes.List {\n\t\t\t\tindexName := index.NameForStorable(prevObj, s.codec)\n\t\t\t\tif indexName == \"\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tindexKey := \"/index/\" + indexName\n\t\t\t\tif index.Type == store.IndexTypeListGen {\n\t\t\t\t\ts.updateIndex(stm, indexKey, prevObj.(runtime.Versioned).GetGeneration(), true)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, index := range indexes.List {\n\t\t\tindexName := index.NameForStorable(newStorable, s.codec)\n\t\t\tif indexName == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tindexKey := \"/index/\" + indexName\n\t\t\tif index.Type == store.IndexTypeLastGen {\n\t\t\t\tstm.Put(indexKey, s.marshalGen(newGen))\n\t\t\t} else if index.Type == store.IndexTypeListGen {\n\t\t\t\ts.updateIndex(stm, indexKey, newGen, false)\n\t\t\t} else {\n\t\t\t\tpanic(\"only indexes with types store.IndexTypeLastGen and store.IndexTypeListGen are currently supported by Etcd store\")\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn newVersion, err\n}", "title": "" }, { "docid": "b1102779be140e02cfad15ecff481227", "score": "0.44146207", "text": "func OptOrNew(opt *Option) *Option {\n\tif opt == nil {\n\t\topt = &Option{}\n\t}\n\treturn opt\n}", "title": "" }, { "docid": "ad5bd74e80c53647a495ca9a39fbe3ba", "score": "0.44103962", "text": "func New(options schema.OptionBlock) (*Provider, error) {\n\ttoken, ok := options.GetMetadata(apiKey)\n\tif !ok {\n\t\treturn nil, &schema.ErrNoSuchKey{Name: apiKey}\n\t}\n\tprofile, _ := options.GetMetadata(\"profile\")\n\treturn &Provider{profile: profile, client: godo.NewFromToken(token)}, nil\n}", "title": "" }, { "docid": "da044db70eb9ceba1614f0d83cc7a9a5", "score": "0.44069594", "text": "func New(plainLog log.Logger, jsonLog log.Logger, conf config.Provider, pluginRepo models.PluginRepository, dsRepo models.DatastoreRepo) *cli.Command {\n\tvar cmd = &cli.Command{\n\t\tUse: \"optimus\",\n\t\tLong: programPrologue(config.Version),\n\t\tPersistentPreRun: func(cmd *cli.Command, args []string) {\n\t\t\t//initialise color if not requested to be disabled\n\t\t\tif !disableColoredOut {\n\t\t\t\tcoloredNotice = color.New(color.Bold, color.FgCyan).SprintFunc()\n\t\t\t\tcoloredError = color.New(color.Bold, color.FgHiRed).SprintFunc()\n\t\t\t\tcoloredSuccess = color.New(color.Bold, color.FgHiGreen).SprintFunc()\n\t\t\t\tcoloredShow = color.New(color.Bold, color.FgHiWhite).SprintFunc()\n\t\t\t\tcoloredPrint = color.New(color.Bold, color.FgHiYellow).SprintFunc()\n\t\t\t}\n\t\t},\n\t\tSilenceUsage: true,\n\t}\n\tcmd.PersistentFlags().BoolVar(&disableColoredOut, \"no-color\", disableColoredOut, \"disable colored output\")\n\n\t//init local specs\n\tvar jobSpecRepo JobSpecRepository\n\tjobSpecFs := afero.NewBasePathFs(afero.NewOsFs(), conf.GetJob().Path)\n\tif conf.GetJob().Path != \"\" {\n\t\tjobSpecRepo = local.NewJobSpecRepository(\n\t\t\tjobSpecFs,\n\t\t\tlocal.NewJobSpecAdapter(pluginRepo),\n\t\t)\n\t}\n\tdatastoreSpecsFs := map[string]afero.Fs{}\n\tfor _, dsConfig := range conf.GetDatastore() {\n\t\tdatastoreSpecsFs[dsConfig.Type] = afero.NewBasePathFs(afero.NewOsFs(), dsConfig.Path)\n\t}\n\n\tcmd.AddCommand(versionCommand(plainLog, conf.GetHost(), pluginRepo))\n\tcmd.AddCommand(configCommand(plainLog, dsRepo))\n\tcmd.AddCommand(createCommand(plainLog, jobSpecFs, datastoreSpecsFs, pluginRepo, dsRepo))\n\tcmd.AddCommand(deployCommand(plainLog, conf, jobSpecRepo, pluginRepo, dsRepo, datastoreSpecsFs))\n\tcmd.AddCommand(renderCommand(plainLog, conf.GetHost(), jobSpecRepo))\n\tcmd.AddCommand(validateCommand(plainLog, conf.GetHost(), pluginRepo, jobSpecRepo))\n\tcmd.AddCommand(serveCommand(jsonLog, conf))\n\tcmd.AddCommand(replayCommand(plainLog, conf))\n\tcmd.AddCommand(runCommand(plainLog, conf.GetHost(), jobSpecRepo, pluginRepo))\n\tcmd.AddCommand(backupCommand(plainLog, dsRepo, conf))\n\n\t// admin specific commands\n\tif conf.GetAdmin().Enabled {\n\t\tcmd.AddCommand(adminCommand(plainLog, pluginRepo))\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "292b01a2e78f3845f201349a978316a2", "score": "0.4398266", "text": "func NewSaveCommand(dockerCli command.Cli) *cobra.Command {\n\tvar opts saveOptions\n\n\tcmd := &cobra.Command{\n\t\tUse: \"save [OPTIONS] IMAGE [IMAGE...]\",\n\t\tShort: \"Save one or more images to a tar archive (streamed to STDOUT by default)\",\n\t\tArgs: cli.RequiresMinArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\topts.images = args\n\t\t\treturn RunSave(dockerCli, opts)\n\t\t},\n\t\tAnnotations: map[string]string{\n\t\t\t\"aliases\": \"docker image save, docker save\",\n\t\t},\n\t\tValidArgsFunction: completion.ImageNames(dockerCli),\n\t}\n\n\tflags := cmd.Flags()\n\n\tflags.StringVarP(&opts.output, \"output\", \"o\", \"\", \"Write to a file, instead of STDOUT\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "19cedff3d4ad7be020a4ae254e46873f", "score": "0.43909103", "text": "func newOptions(streams genericclioptions.IOStreams) *options {\n\to := &options{\n\t\tIOStreams: streams,\n\t}\n\to.SetConfigFlags()\n\n\treturn o\n}", "title": "" }, { "docid": "19cedff3d4ad7be020a4ae254e46873f", "score": "0.43909103", "text": "func newOptions(streams genericclioptions.IOStreams) *options {\n\to := &options{\n\t\tIOStreams: streams,\n\t}\n\to.SetConfigFlags()\n\n\treturn o\n}", "title": "" }, { "docid": "946c92215034ff790ea4f31ba1209668", "score": "0.43793133", "text": "func (o ManagedDiskOutput) CreateOption() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ManagedDisk) pulumi.StringOutput { return v.CreateOption }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2c52314eb11141c16308e25e305dbdaf", "score": "0.43772507", "text": "func New(options ...Options) FileSystem {\n\t// Default values\n\tfs := fileSystem{\n\t\tfs: afero.NewOsFs(),\n\t\tdirPerm: defaultDirectoryPermission,\n\t\tfilePerm: defaultFilePermission,\n\t\tfileMode: createOrUpdate,\n\t}\n\n\t// Apply options\n\tfor _, option := range options {\n\t\toption(&fs)\n\t}\n\n\treturn fs\n}", "title": "" }, { "docid": "342bb9f94b6107bb4ff98b69dce6bffe", "score": "0.43737277", "text": "func New(opt *Options) (*Options, error) {\n\tswitch {\n\tcase opt.TokenFetcherFunc != nil:\n\t\treturn opt, nil\n\tcase opt.AUD != nil:\n\t\t// TODO(jbd): Assert the required JWT params.\n\t\topt.TokenFetcherFunc = makeTwoLeggedFetcher(opt)\n\t\treturn opt, nil\n\tcase opt.AuthURL != nil && opt.TokenURL != nil:\n\t\t// TODO(jbd): Assert the required OAuth2 params.\n\t\topt.TokenFetcherFunc = makeThreeLeggedFetcher(opt)\n\t\treturn opt, nil\n\tdefault:\n\t\treturn nil, errors.New(\"oauth2: missing endpoints, can't determine how to fetch tokens\")\n\t}\n}", "title": "" }, { "docid": "3aad86341b92fb331765ef71f2479a68", "score": "0.43683842", "text": "func (sc *SpecCreate) Save(ctx context.Context) (*Spec, error) {\n\treturn sc.gremlinSave(ctx)\n}", "title": "" }, { "docid": "2bcf4f28b45cea748fce42f64f72eae3", "score": "0.43618804", "text": "func gamesSaveOptionPairs(c buffalo.Context) error {\n\tvar err error\n\tsugar := base.Sugar()\n\n\ttype paramT struct {\n\t\tID string `json:\"id\"`\n\t\tSeq string `json:\"seq\"`\n\t\tPairs string `json:\"pairs\"`\n\t}\n\tparam := paramT{}\n\terr = c.Bind(&param)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tsugar.Infow(\"param\", \"param\", param)\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\tvar entries models.GameOptions\n\tcond := fmt.Sprintf(\"game_id = '%s' and seq = %s\", param.ID, param.Seq)\n\terr = tx.Where(cond).All(&entries)\n\tif err != nil {\n\t\tsugar.Errorw(\"sql error\", \"param\", param, \"err\", \"err\")\n\t\treturn errors.WithStack(err)\n\t}\n\n\tvar entry models.GameOption\n\tif len(entries) == 0 {\n\t\tentry = models.GameOption{}\n\n\t\tid, err := uuid.FromString(param.ID)\n\t\tif err != nil {\n\t\t\tsugar.Errorw(\"uuid failed\", \"param\", param, \"err\", err)\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\tentry.GameID = id\n\t\ti, err := strconv.Atoi(param.Seq)\n\t\tif err != nil {\n\t\t\tsugar.Errorw(\"parse seq\", \"param\", param)\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\tentry.Seq = i\n\t\tsugar.Debugw(\"new\", \"entry\", entry)\n\t} else {\n\t\tentry = entries[0]\n\t\tsugar.Debugw(\"exist\", \"entry\", entry)\n\t}\n\n\tentry.Pairs = param.Pairs\n\tsugar.Debugw(\"save\", \"entry\", entry)\n\n\tresult, s, err := gamesCalcMaxEig(param.Pairs)\n\tif err != nil {\n\t\tsugar.Errorw(\"calc eig\", \"err\", err)\n\t\treturn errors.WithStack(err)\n\t}\n\tentry.Weights = s\n\n\tverrs, err := tx.ValidateAndSave(&entry)\n\tif err != nil {\n\t\tsugar.Errorw(\"save pairs\", \"entry\", entry, \"err\", err)\n\t\treturn errors.WithStack(err)\n\t}\n\tif verrs.Count() > 0 {\n\t\tsugar.Errorw(\"validate\", \"verrs\", verrs)\n\t\treturn errors.WithStack(verrs)\n\t}\n\n\treturn c.Render(200, r.JSON(H{\n\t\t\"item\": entry,\n\t\t\"result\": result,\n\t}))\n}", "title": "" }, { "docid": "121f7a038944cfd82c4bdb28f5d118bf", "score": "0.43451217", "text": "func Option() keyring.Option {\n\treturn func(options *keyring.Options) {\n\t\toptions.SupportedAlgos = SupportedAlgorithms\n\t\toptions.SupportedAlgosLedger = SupportedAlgorithmsLedger\n\t}\n}", "title": "" }, { "docid": "9317053d249e40de2423430109084b5e", "score": "0.43337703", "text": "func New(opt ...Option) *Watcher {\n\to := &options{}\n\tfor _, v := range opt {\n\t\tv(o)\n\t}\n\tif o.notify == nil {\n\t\tpanic(\"notify can not be nil\")\n\t}\n\tif o.logger == nil {\n\t\to.logger = log.Println\n\t}\n\n\tres := &Watcher{\n\t\tadd: make(chan fspath),\n\t\tpaths: make(map[string]bool),\n\t\tnotify: o.notify,\n\t\texclude: o.exclude,\n\t\tlogger: o.logger,\n\t}\n\tres.ctx, res.cancel = context.WithCancel(context.Background())\n\n\tres.start()\n\treturn res\n}", "title": "" }, { "docid": "ba9b96a55a7be54ab280fb1057f05c96", "score": "0.43274656", "text": "func (pip *PgInitPriv) Save(ctx context.Context, db DB) error {\n\tif pip.Exists() {\n\t\treturn pip.Update(ctx, db)\n\t}\n\treturn pip.Insert(ctx, db)\n}", "title": "" }, { "docid": "068f707f3f27760e30cf2e82408fc09a", "score": "0.43224922", "text": "func (t *Trip) SaveNew(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\ttokenUser := common.GetTokenUser(request)\n\n\terr := json.Unmarshal([]byte(request.Body), t)\n\tif err != nil {\n\t\treturn common.APIError(http.StatusBadRequest, err)\n\t}\n\n\tif t.Title.IsEmpty() {\n\t\treturn common.APIError(http.StatusBadRequest, errors.New(\"invalid request empty title\"))\n\t}\n\n\tt.ID = uuid.New().String()\n\tt.Active = true\n\tt.Title.ID = uuid.New().String()\n\tt.Title.Table = db.TableTrip\n\tt.Title.Field = \"title\"\n\tt.Title.ParentID = t.ID\n\tt.Description.ID = uuid.New().String()\n\tt.Description.Table = db.TableTrip\n\tt.Description.Field = \"description\"\n\tt.Description.ParentID = t.ID\n\tt.CreatedBy = tokenUser.UserID\n\tt.CreatedDate = time.Now()\n\tt.UpdatedBy = tokenUser.UserID\n\tt.UpdatedDate = time.Now()\n\n\tt.Scope = \"user\"\n\tif tokenUser.IsAdmin() {\n\t\tt.Scope = \"global\"\n\t}\n\n\tt.ItineraryID = uuid.New().String()\n\tdefaultItinerary := Itinerary{}\n\tdefaultItinerary.ID = t.ItineraryID\n\tdefaultItinerary.TripID = t.ID\n\tdefaultItinerary.OwnerID = tokenUser.UserID\n\tdefaultItinerary.StartDate = time.Now()\n\tdefaultItinerary.EndDate = time.Now()\n\tdefaultItinerary.Title.ID = uuid.New().String()\n\tdefaultItinerary.Title.ParentID = defaultItinerary.ID\n\tdefaultItinerary.Title.Table = db.TableTripItinerary\n\tdefaultItinerary.Title.Field = \"title\"\n\tdefaultItinerary.Title.PT = \"Padrão\"\n\tdefaultItinerary.Title.EN = \"Default\"\n\tdefaultItinerary.Title.ES = \"Estándar\"\n\tdefaultItinerary.CreatedBy = tokenUser.UserID\n\tdefaultItinerary.CreatedDate = time.Now()\n\tdefaultItinerary.UpdatedBy = tokenUser.UserID\n\tdefaultItinerary.UpdatedDate = time.Now()\n\n\townerParticipant := Participant{}\n\townerParticipant.ID = uuid.New().String()\n\townerParticipant.TripID = t.ID\n\townerParticipant.UserID = tokenUser.UserID\n\townerParticipant.Role = ParticipantOwnerRole\n\townerParticipant.CreatedBy = tokenUser.UserID\n\townerParticipant.CreatedDate = time.Now()\n\townerParticipant.UpdatedBy = tokenUser.UserID\n\townerParticipant.UpdatedDate = time.Now()\n\n\tconn, err := db.Connect()\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\n\tsession := conn.NewSession(nil)\n\ttx, err := session.Begin()\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\tdefer tx.RollbackUnlessCommitted()\n\tdefer session.Close()\n\tdefer conn.Close()\n\n\terr = db.Insert(tx, db.TableTrip, *t)\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\n\terr = db.Insert(tx, db.TableTripItinerary, defaultItinerary)\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\n\terr = db.Insert(tx, db.TableTripParticipant, ownerParticipant)\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\n\ttx.Commit()\n\n\tresult, err := db.QueryOne(session, db.TableTrip, t.ID, Trip{})\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\n\treturn common.APIResponse(result, http.StatusCreated)\n}", "title": "" }, { "docid": "23aa1d57a3ac4d79c1caf69e69be3a14", "score": "0.4314878", "text": "func newPacketOptions() packetOptions {\n\treturn packetOptions{\n\t\tsigner: \"creator\",\n\t}\n}", "title": "" }, { "docid": "26bac4a77a3d89a2815507761cce15d2", "score": "0.43102", "text": "func (_OptionsFactory *OptionsFactoryTransactor) CreateOptionsContract(opts *bind.TransactOpts, _collateralType string, _collateralExp int32, _underlyingType string, _underlyingExp int32, _oTokenExchangeExp int32, _strikePrice *big.Int, _strikeExp int32, _strikeAsset string, _expiry *big.Int, _windowSize *big.Int) (*types.Transaction, error) {\n\treturn _OptionsFactory.contract.Transact(opts, \"createOptionsContract\", _collateralType, _collateralExp, _underlyingType, _underlyingExp, _oTokenExchangeExp, _strikePrice, _strikeExp, _strikeAsset, _expiry, _windowSize)\n}", "title": "" }, { "docid": "c4b1b62fc1a3e66ab90867705502b8aa", "score": "0.43088067", "text": "func (this *Finder) Option(m map[string]interface{}) *goption.Option {\n return goption.NewOption(m)\n}", "title": "" }, { "docid": "0187ea965b0118537e2443b5d7d6093a", "score": "0.43077502", "text": "func (h *Holder) Save() error {\n\th.recurseCallInLeaf(h.registerDifferentValue, h.Configuration)\n\treturn h.viper.WriteConfig()\n}", "title": "" }, { "docid": "88d14dc5b055badcc273a589d1f6a9e4", "score": "0.43073243", "text": "func NewCmdPKICreate(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Command {\n\toptions := &PKICreateOptions{\n\t\tPKIOptions: PKIOptions{\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: \"create\",\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\tcmdhelper.CheckErr(err)\n\t\t},\n\t}\n\n\tcmd.AddCommand(NewCmdPKICreateCA(f, out, errOut))\n\tcmd.AddCommand(NewCmdPKICreateIntermediate(f, out, errOut))\n\tcmd.AddCommand(NewCmdPKICreateKey(f, out, errOut))\n\tcmd.AddCommand(NewCmdPKICreateServer(f, out, errOut))\n\tcmd.AddCommand(NewCmdPKICreateClient(f, out, errOut))\n\tcmd.AddCommand(NewCmdPKICreateCSR(f, out, errOut))\n\n\toptions.addPKICreateFlags(cmd)\n\treturn cmd\n}", "title": "" }, { "docid": "9292f69609a1efd0a2b96dfb41e705d8", "score": "0.4307202", "text": "func New(options ...Option) (*Chain, error) {\n\t// create the struct\n\tc := &Chain{}\n\n\t// apply options to the new struct\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\n\t// return the new Chain struct\n\treturn c, nil\n}", "title": "" }, { "docid": "0c9143102a0b63ff3f9314419bba2a8f", "score": "0.43061015", "text": "func NewOptional(tok token.Token) *Optional {\n\treturn &Optional{\n\t\ttoken: tok,\n\t\tvalue: false,\n\t}\n}", "title": "" }, { "docid": "a86fbf610eb01561a57045b7bd0abc5a", "score": "0.43048283", "text": "func (c *Policy) Factory() db.Object {\n\treturn &Policy{}\n}", "title": "" }, { "docid": "f5a0f7a260007859c3bb0a63c43be7ce", "score": "0.4289682", "text": "func Constructor(f Factory) Option {\n\treturn func(register *objectRegister) {\n\t\tregister.factory = f\n\t}\n}", "title": "" }, { "docid": "dfe28f0bf6602aa0d2b8f6fc06ee8ae8", "score": "0.42894614", "text": "func New(opts ...func(*OPA) error) (*OPA, error) {\n\n\topa := &OPA{}\n\n\tfor _, opt := range opts {\n\t\tif err := opt(opa); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tstore := inmem.New()\n\n\tid, err := uuid4()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\topa.manager, err = plugins.New(opa.configBytes, id, store)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdiscovery, err := discovery.New(opa.manager)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\topa.manager.Register(\"discovery\", discovery)\n\n\treturn opa, nil\n}", "title": "" }, { "docid": "8741629ab8190ec8dce7799ce9129df9", "score": "0.4257297", "text": "func NewDefault(base string, options ...Option) (Interface, error) {\n\tdo := &defaultOpener{\n\t\tbase: base,\n\t\tt: http.DefaultTransport,\n\t\tuserAgent: \"ko\",\n\t\tkeychain: authn.DefaultKeychain,\n\t\tnamer: identity,\n\t\ttags: []string{latestTag},\n\t}\n\n\tfor _, option := range options {\n\t\tif err := option(do); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn do.Open()\n}", "title": "" }, { "docid": "7aa5c042974e0b8ae65eaf1a39826101", "score": "0.42569116", "text": "func newWriter(kmsStore storage.Store, opts ...kms.PrivateKeyOpts) *storeWriter {\n\tpOpts := kms.NewOpt()\n\n\tfor _, opt := range opts {\n\t\topt(pOpts)\n\t}\n\n\treturn &storeWriter{\n\t\tstorage: kmsStore,\n\t\trequestedKeysetID: pOpts.KsID(),\n\t}\n}", "title": "" }, { "docid": "9c77a638b9c59cd81d37649077278124", "score": "0.42452437", "text": "func (c handlerConfiguration) NewOptions(\n\twriteFn WriteFn,\n\tiOpts instrument.Options,\n) Options {\n\treturn Options{\n\t\tWriteFn: writeFn,\n\t\tInstrumentOptions: iOpts,\n\t\tProtobufDecoderPoolOptions: c.ProtobufDecoderPool.NewObjectPoolOptions(iOpts),\n\t}\n}", "title": "" }, { "docid": "d661bef6f3dfe7e7970760aaa593279d", "score": "0.4238179", "text": "func New(name string, setType SetType, options ...Option) (IPSet, error) {\n\tc := getCmd(_create, name, setType, string(setType))\n\tdefer putCmd(c)\n\tif err := c.exec(options...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &set{name, setType}, nil\n}", "title": "" }, { "docid": "fd5010912c889de7e6b1deae3134ea02", "score": "0.42310515", "text": "func NewStore(options Options) (kvstore.KvStore, error) {\n result := &Store{}\n\n // Set default values\n if options.BucketName == \"\" {\n options.BucketName = DefaultOptions.BucketName\n }\n if options.Path == \"\" {\n options.Path = DefaultOptions.Path\n }\n\n // Open DB\n db, err := bolt.Open(options.Path, 0600, nil)\n if err != nil {\n return result, err\n }\n\n // Create a bucket if it doesn't exist yet.\n // In bbolt key/value pairs are stored to and read from buckets.\n err = db.Update(func(tx *bolt.Tx) error {\n _, err := tx.CreateBucketIfNotExists([]byte(options.BucketName))\n if err != nil {\n return err\n }\n return nil\n })\n if err != nil {\n return result, err\n }\n\n result.db = db\n result.bucketName = options.BucketName\n return result, nil\n}", "title": "" }, { "docid": "d16975401dbbc329ae61f6908ab43ee5", "score": "0.42276132", "text": "func New(t *testing.T, options ...Option) *Goldie {\n\tg := Goldie{\n\t\tfixtureDir: defaultFixtureDir,\n\t\tfileNameSuffix: defaultFileNameSuffix,\n\t\tfilePerms: defaultFilePerms,\n\t\tdirPerms: defaultDirPerms,\n\t\tdiffEngine: defaultDiffEngine,\n\t\tignoreTemplateErrors: defaultIgnoreTemplateErrors,\n\t\tuseTestNameForDir: defaultUseTestNameForDir,\n\t\tuseSubTestNameForDir: defaultUseSubTestNameForDir,\n\t}\n\n\tvar err error\n\tfor _, option := range options {\n\t\terr = option(&g)\n\t\tif err != nil {\n\t\t\tt.Error(fmt.Errorf(\"could not apply option: %w\", err))\n\t\t\tt.FailNow()\n\t\t}\n\t}\n\n\treturn &g\n}", "title": "" }, { "docid": "8eebc474a638d05a0f4614330e95e39b", "score": "0.42234197", "text": "func New() *Options {\n\treturn &Options{\n\t\tDiscoverMode: RevisionDiscoveryModeNONE,\n\t\tGithubOrg: git.DefaultGithubOrg,\n\t\tGithubRepo: git.DefaultGithubRepo,\n\t\tFormat: FormatMarkdown,\n\t\tGoTemplate: GoTemplateDefault,\n\t\tPull: true,\n\t\tgitCloneFn: git.CloneOrOpenGitHubRepo,\n\t\tMapProviderStrings: []string{},\n\t\tAddMarkdownLinks: false,\n\t}\n}", "title": "" }, { "docid": "d1fd2ffbaf927867da382b2800cca32e", "score": "0.42227754", "text": "func NewOption(c *cli.Context) (Option, error) {\n\tgc, err := option.NewGlobalOption(c)\n\tif err != nil {\n\t\treturn Option{}, xerrors.Errorf(\"failed to initialize global options: %w\", err)\n\t}\n\n\treturn Option{\n\t\tGlobalOption: gc,\n\t\tArtifactOption: option.NewArtifactOption(c),\n\t\tDBOption: option.NewDBOption(c),\n\t\tImageOption: option.NewImageOption(c),\n\t\tReportOption: option.NewReportOption(c),\n\t\tCacheOption: option.NewCacheOption(c),\n\t\tConfigOption: option.NewConfigOption(c),\n\n\t\tonlyUpdate: c.String(\"only-update\"),\n\t\trefresh: c.Bool(\"refresh\"),\n\t\tautoRefresh: c.Bool(\"auto-refresh\"),\n\t}, nil\n}", "title": "" }, { "docid": "8e50eadf8bf123ceac255f7ac96ec590", "score": "0.4218222", "text": "func (ic *ItemCreate) Save(ctx context.Context) (*Item, error) {\n\tic.defaults()\n\treturn withHooks[*Item, ItemMutation](ctx, ic.gremlinSave, ic.mutation, ic.hooks)\n}", "title": "" }, { "docid": "2be8b6a7e02f3550516ef0dcc4f589bc", "score": "0.42093372", "text": "func (s *store) Save(ctx context.Context, builder lkb.Builder, dest interface{}) error {\n\treturn s.Exec(ctx, builder, dest)\n}", "title": "" }, { "docid": "97fddb88b1dfed239cff47dc5fa8041d", "score": "0.42084056", "text": "func NewOptions(sm, iss, keyPath string) (*Options, error) {\n\tpk, err := os.ReadFile(keyPath)\n\tif err != nil {\n\t\tlog.Errorf(fmt.Sprintf(\"failed to read private key %v\", err))\n\t\treturn nil, err\n\t}\n\treturn &Options{\n\t\tPrivateKey: pk,\n\t\tSignMethod: jwt.GetSigningMethod(sm),\n\t\tIssuer: iss,\n\t}, nil\n}", "title": "" }, { "docid": "b13b6f552e48488a072bd1500e9c913d", "score": "0.42036578", "text": "func save(info InitCommandInfo) error {\n\tstore, err := OpenDeviceStore()\n\tdefer func() { _ = store.Close() }()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn info.Store(store)\n}", "title": "" }, { "docid": "0abe46ba761aafee68ec51f6757a5b42", "score": "0.4183462", "text": "func CreateOptSelector(_log *log.Logger) *OptSelector {\n\n\tp := &OptSelector{logger: _log}\n\n\treturn p\n}", "title": "" }, { "docid": "649204a737c3a70ac8069c1f695f717d", "score": "0.41833535", "text": "func newOptions() *options {\n\treturn &options{\n\t\texplainOpts: explainerOptions{\n\t\t\tExtraBlackList: ExtraList{},\n\t\t\tExtraWhiteList: ExtraList{},\n\t\t\tSelectTypeBlackList: SelectTypeList{},\n\t\t\tSelectTypeWhiteList: SelectTypeList{},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "24be3b4398504a042e1882915af3b176", "score": "0.4179759", "text": "func New(opts types.Options) (types.Deployer, *pflag.FlagSet) {\n\t// create a deployer object and set fields that are not flag controlled\n\td := &deployer{\n\t\tcommonOptions: opts,\n\t\t// logsDir: filepath.Join(opts.RunDir(), \"logs\"),\n\t}\n\t// register flags and return\n\treturn d, bindFlags(d)\n}", "title": "" }, { "docid": "26e59e4772734ef6f3e70ae3d53fcd13", "score": "0.41788408", "text": "func (f *Factory) Create(file string, opts ...FactoryOpt) types.JGameObject {\n\tdefer debug.Trace().UnTrace()\n\n\t// read in game object data\n\n\tdata, err := support.OpenFile(file)\n\tif err != nil {\n\t\tsupport.LogFatal(\"Failed to open Config file: \" + file)\n\t}\n\n\tholder, err := support.ReadData(data)\n\tif err != nil {\n\t\tsupport.LogFatal(\"Failed to read in Config file: \" + file)\n\t\treturn nil\n\t}\n\n\tm := v.(map[string]interface{})\n\ttypename, err := m[\"Type\"]\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tobj := factoryFunc(typename.(string))\n\tSerializeInPlace(obj, holder)\n\n\t// apply options to game object\n\tfor _, opt := range opts {\n\t\topt(obj)\n\t}\n\n\t// check for transform, check for dispatcher, name etc\n\n\tif obj.Name() == \"\" {\n\t\tobj.SetName(fmt.Sprint(\"obj\", len(f.ObjList)))\n\t}\n\n\t// add game object to factory\n\n\tf.ObjList = append(f.ObjList, obj)\n\treturn obj\n\t// h := types.JGameObject{id: len(f.ObjList)}\n\t// f.NameMap[obj.Name()] = h\n\t// return h\n}", "title": "" }, { "docid": "5a2824cc80f010e93dc6620ec125c7bb", "score": "0.41780108", "text": "func Optional(o *Options) {\n\to.Optional = true\n}", "title": "" }, { "docid": "10d3ce77f9d65d86d918965a87229c3e", "score": "0.41775987", "text": "func NewServerOption(bcs *conf.BootConfig) *ServerOption {\n\tcnf := &ServerOption{\n\t\tAddr: appDefaultAddr,\n\t\tName: appDefaultName,\n\t\tRestart: appDefaultRestart,\n\t\tPrefix: appDefaultPrefix,\n\t\tAppConfigHandler: appDefaultAppConfigHandler,\n\t\tPluginSymbolName: appDefaultPluginSymbolName,\n\t\tPluginSymbolSuffix: appDefaultPluginSymbolSuffix,\n\t\tStartHandlers: make([]ServerHandler, 0, 4),\n\t\tShutDownHandlers: make([]ServerHandler, 0, 4),\n\t\tBackendStoreHandler: appDefaultBackendHandler,\n\t\tStoreDbSetupHandler: appDefaultStoreDbSetupHandler,\n\t\tStoreCacheSetupHandler: appDefaultStoreCacheSetupHandler,\n\t\tIDGeneratorHandler: func(conf *conf.ApplicationConfig) IdentifierGenerator {\n\t\t\treturn DefaultIdentifierGenerator()\n\t\t},\n\t\tUserManagerHandler: func(state *ServerState) IUserManager {\n\t\t\treturn DefaultUserManager(state)\n\t\t},\n\t\tAuthManagerHandler: func(state *ServerState) IAuthManager {\n\t\t\treturn DefaultAuthManager(state)\n\t\t},\n\t\tAuthParamResolvers: make([]IAuthParamResolver, 0, 3),\n\t\tAuthParamCheckerHandler: func(state *ServerState) IAuthParamChecker {\n\t\t\treturn DefaultAuthParamChecker(state)\n\t\t},\n\t\tPermissionManagerHandler: func(state *ServerState) IPermissionManager {\n\t\t\treturn DefaultPermissionManager(state)\n\t\t},\n\t\tSessionStateManager: func(state *ServerState) ISessionStateManager {\n\t\t\treturn DefaultSessionStateManager(state)\n\t\t},\n\t\tCrypto: func(conf *conf.ApplicationConfig) ICrypto {\n\t\t\tc := conf.Security.Crypto\n\t\t\treturn DefaultCrypto(c.Protect.Secret, c.Hash.Salt)\n\t\t},\n\t\tDIProviderHandler: func(state *ServerState) IDIProvider {\n\t\t\treturn DefaultDIProvider(state)\n\t\t},\n\t\tEventManagerHandler: func(state *ServerState) IEventManager {\n\t\t\treturn DefaultEventManager(state)\n\t\t},\n\t\tDbOpProcessor: NewDbOpProcessor(),\n\t\tRespBodyBuildFunc: DefaultRespBodyBuildFunc,\n\t\tbcs: bcs,\n\t\tisTester: false,\n\t}\n\treturn cnf\n}", "title": "" }, { "docid": "8e74b8eccb25930170e4f45c04e7d88e", "score": "0.41746333", "text": "func (r *VariantRepository) Create(ctx context.Context, flagIDHex string, v flaggio.NewVariant) (string, error) {\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"MongoVariantRepository.Create\")\n\tdefer span.Finish()\n\n\tvrntModel := &variantModel{\n\t\tID: primitive.NewObjectID(),\n\t\tDescription: v.Description,\n\t\tValue: v.Value,\n\t}\n\tflagID, err := primitive.ObjectIDFromHex(flagIDHex)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfilter := bson.M{\"_id\": flagID}\n\tres, err := r.flagRepo.col.UpdateOne(ctx, filter, bson.M{\n\t\t\"$push\": bson.M{\"variants\": vrntModel},\n\t\t\"$set\": bson.M{\"updatedAt\": time.Now()},\n\t\t\"$inc\": bson.M{\"version\": 1},\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif res.ModifiedCount == 0 {\n\t\treturn \"\", errors.NotFound(\"flag\")\n\t}\n\treturn vrntModel.ID.Hex(), nil\n}", "title": "" }, { "docid": "68876cea84697f57a523e4b2353b001f", "score": "0.41738826", "text": "func WithDefault(d Getter) DefaultOption {\n\treturn DefaultOption{d}\n}", "title": "" }, { "docid": "e9dcc96af11affe3230fc623686122f2", "score": "0.4171746", "text": "func NewFactory() extension.Factory {\n\treturn extension.NewFactory(\n\t\tmetadata.Type,\n\t\tcreateDefaultConfig,\n\t\tcreateExtension,\n\t\tmetadata.ExtensionStability,\n\t)\n}", "title": "" }, { "docid": "7d923a3b74bf132c5fd767dff7c5f2ac", "score": "0.41690084", "text": "func New(opts ...GenOpt) *Generator {\n\tg := &Generator{\n\t\trng: rand.New(rand.NewSource(0)),\n\t\tconf: defaults(),\n\t\tlogger: log.NewNop(),\n\t\treordered: map[types.LayerID]types.LayerID{},\n\t}\n\tfor _, opt := range opts {\n\t\topt(g)\n\t}\n\t// TODO support multiple persist states.\n\tfor i := 0; i < g.conf.StateInstances; i++ {\n\t\tg.states = append(g.states, newState(g.logger, g.conf))\n\t}\n\treturn g\n}", "title": "" }, { "docid": "4a36d3727090a346716efc7b91ee5880", "score": "0.41687617", "text": "func SetSaveFlag(enable bool) {\n\tSaveFlag = enable\n}", "title": "" }, { "docid": "2a4b5e0a9c0102cbaa0c57217f5f5726", "score": "0.41681844", "text": "func (_OptionsFactory *OptionsFactorySession) CreateOptionsContract(_collateralType string, _collateralExp int32, _underlyingType string, _underlyingExp int32, _oTokenExchangeExp int32, _strikePrice *big.Int, _strikeExp int32, _strikeAsset string, _expiry *big.Int, _windowSize *big.Int) (*types.Transaction, error) {\n\treturn _OptionsFactory.Contract.CreateOptionsContract(&_OptionsFactory.TransactOpts, _collateralType, _collateralExp, _underlyingType, _underlyingExp, _oTokenExchangeExp, _strikePrice, _strikeExp, _strikeAsset, _expiry, _windowSize)\n}", "title": "" }, { "docid": "9c87f1bccff25e052d9665bb37874352", "score": "0.41647056", "text": "func ExampleNew() {\n\n\t// Set command line arguments for testing\n\toldArgs := os.Args\n\tos.Args = []string{\"mycommand\", \"-a\", \"42\", \"-b\", \"-q\", \"What?\", \"Towel\"}\n\n\t// Define options\n\tvar opt struct{\n\t\tAnswer\t\tint\n\t\tBabel\t\tbool\n\t\tQuestion\tstring\n\t}\n\n\t// Define argument slice\n\tvar args []string\n\n\t// Create a new command line object\n\top, err := option.New(&opt,&args)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tfmt.Printf(\"%s\\n\", op.Cmd())\n\tfmt.Printf(\"%d\\n\", opt.Answer)\n\tfmt.Printf(\"%v\\n\", opt.Babel)\n\tfmt.Printf(\"%s\\n\", opt.Question)\n\tfmt.Printf(\"%v %v\\n\", len(args), args[0])\n\tos.Args = oldArgs\n\n\t// Output:\n\t// mycommand\n\t// 42\n\t// true\n\t// What?\n\t// 1 Towel\n}", "title": "" }, { "docid": "02c11bb0249c66d221fb2821af8f8449", "score": "0.41578168", "text": "func New(sort map[string]string, page, limit string) Options {\n\treturn Options{\n\t\tsort: sort,\n\t\tpage: page,\n\t\tlimit: limit,\n\t}\n}", "title": "" }, { "docid": "25fc642acf15228aa40c5f42fe90de42", "score": "0.415688", "text": "func newOptions(opts ...Option) (opt Options) {\n\tfor _, o := range opts {\n\t\to(&opt)\n\t}\n\n\treturn opt\n}", "title": "" }, { "docid": "2431f9f5e4c3151cb18f602f53eb127a", "score": "0.41525912", "text": "func NewBool(long string, short rune, description string, defaultValue bool) *Option {\n\treturn &Option{\n\t\tLong: long,\n\t\tShort: short,\n\t\tDescription: description,\n\t\tValue: &Bool{DefaultValue: defaultValue},\n\t}\n}", "title": "" } ]
c2e5653bb578e554bce8a1ef85bfe193
LinkSetUp mocks base method
[ { "docid": "7b72b586c40b5e04c1ac4dfbc8059548", "score": "0.78040683", "text": "func (m *MockInterface) LinkSetUp(arg0 netlink.Link) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkSetUp\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" } ]
[ { "docid": "45df8332085ee7ca1542ef2613a444d9", "score": "0.6956065", "text": "func (m *MockInterface) LinkSetDown(arg0 netlink.Link) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkSetDown\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "476a3b248de2663bf8b74ac8516523d3", "score": "0.67813057", "text": "func (m *MockRuleError) Link() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Link\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "fa54efd4eeebe16c50971167ff48a8e6", "score": "0.67219657", "text": "func (m *MockInterface) LinkSetName(arg0 netlink.Link, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkSetName\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "553fe974dafc082ce6371ee4397b484e", "score": "0.66654766", "text": "func (m *MockSFClusterInterface) SetSelfLink(arg0 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetSelfLink\", arg0)\n}", "title": "" }, { "docid": "33e84df603db887e95cd8c89ca41307d", "score": "0.6482991", "text": "func (m *MockGraphAPI) Links(arg0, arg1 uuid.UUID, arg2 time.Time) (graph.LinkIterator, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Links\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(graph.LinkIterator)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "33e84df603db887e95cd8c89ca41307d", "score": "0.6482991", "text": "func (m *MockGraphAPI) Links(arg0, arg1 uuid.UUID, arg2 time.Time) (graph.LinkIterator, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Links\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(graph.LinkIterator)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ac069481cefad41b518b5903648bd0a4", "score": "0.6421108", "text": "func (m *MockGraphAPI) UpsertLink(arg0 *graph.Link) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpsertLink\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "bec49c18bb67115493bb78075914032b", "score": "0.63679266", "text": "func (_m *MockStager) AddBinDependencyLink(_param0 string, _param1 string) error {\n\tret := _m.ctrl.Call(_m, \"AddBinDependencyLink\", _param0, _param1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "c734267511afeca96374296b0fdfbbb8", "score": "0.63023406", "text": "func (f *FakeNetlink) LinkSetUp(link netlink.Link) error {\n\tf.Links[link.Attrs().Name].Attrs().Flags = f.Links[link.Attrs().Name].Attrs().Flags | net.FlagUp\n\treturn nil\n}", "title": "" }, { "docid": "895575e2bd6e8ecd3744cf4a22e046b6", "score": "0.62330747", "text": "func (m *MockInterface) LinkSetHardwareAddr(arg0 netlink.Link, arg1 net.HardwareAddr) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkSetHardwareAddr\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "5be1523d655ea44a5328e5716fd37a3a", "score": "0.613559", "text": "func (m *MockInterface) LinkSetMTU(arg0 netlink.Link, arg1 int) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkSetMTU\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "a145a9f913cfa732d18d222b8ece879a", "score": "0.6121277", "text": "func (m *MockStager) LinkDirectoryInDepDir(arg0, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkDirectoryInDepDir\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b2f88b07d0d69d379585c7d2371fb7e6", "score": "0.60693157", "text": "func (m *MockInterface) LinkSetNsFd(arg0 netlink.Link, arg1 int) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkSetNsFd\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "65dd74e84ce510ec135d183216ca5e3d", "score": "0.6008873", "text": "func (m *MockinternalServiceAPI) initNodeMountLib() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"initNodeMountLib\")\n}", "title": "" }, { "docid": "362d56375dae3bc02ebc82c5b0e4b7aa", "score": "0.58747756", "text": "func (m *MockNetLink) LinkList() ([]netlink.Link, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkList\")\n\tret0, _ := ret[0].([]netlink.Link)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "883daaf520a1a7dfb461aa92a01929a8", "score": "0.585668", "text": "func (m *MockImplement) SetupMaster() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetupMaster\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3bae20d5c148da5b9e4d66680e787810", "score": "0.58431315", "text": "func (m *MockinternalServiceAPI) initNodeFSLib() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"initNodeFSLib\")\n}", "title": "" }, { "docid": "7415106ef817f31bc0469a282755254d", "score": "0.5842289", "text": "func (m *MockinternalServiceAPI) initFCConnector() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"initFCConnector\")\n}", "title": "" }, { "docid": "0f81abaf43cd55081f78fafa5dd3dc9c", "score": "0.58066475", "text": "func (m *MockSFClusterInterface) GetSelfLink() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetSelfLink\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "adb2a7172376f4d194d0421f9d4aee42", "score": "0.5788888", "text": "func (m *MockQueryResultsPool) Init(alloc QueryResultsAllocator) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Init\", alloc)\n}", "title": "" }, { "docid": "2694417da46e67b0adc4e230c0341002", "score": "0.57600975", "text": "func (suite *BaseTestSuite) SetupTest() {\n suite.TestGraph.Open()\n suite.TestGraph.Clear()\n}", "title": "" }, { "docid": "97e333887f875666c8d006552a0a80e0", "score": "0.572145", "text": "func (m *MockInterface) LinkByName(arg0 string) (netlink.Link, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkByName\", arg0)\n\tret0, _ := ret[0].(netlink.Link)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9018cc82abfe1962e638eff78a7f9277", "score": "0.5699258", "text": "func (m *MockAggregateResultsPool) Init(alloc AggregateResultsAllocator) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Init\", alloc)\n}", "title": "" }, { "docid": "4fe5f3c57d24a36252dffb795ac7a11d", "score": "0.5695391", "text": "func (m *MockinternalServiceAPI) initNodeVolToDevMapper() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"initNodeVolToDevMapper\")\n}", "title": "" }, { "docid": "0abca402ff5208293878640cde05eebf", "score": "0.5690168", "text": "func testPageLinks(t *testing.T, setup func() (p Page, expected []Page)) {\n\tvar p Page\n\tvar expected []Page\n\n\tresolveGenerated := func(p Page) (g []Page) {\n\t\tg = make([]Page, 0)\n\t\tfor p := range p.GenerateLinks() {\n\t\t\tg = append(g, p)\n\t\t}\n\t\treturn g\n\t}\n\n\tp, expected = setup()\n\tassert.Equal(t, expected, resolveGenerated(p), \"GenerateLinks() produces all links\")\n\tassert.Equal(t, expected, resolveGenerated(p), \"GenerateLinks() is idempotent\")\n\n\tp, expected = setup()\n\tassert.Equal(t, expected, p.Links(), \"Links() returns all links\")\n\tassert.Equal(t, expected, resolveGenerated(p), \"GenerateLinks() is still idempotent\")\n}", "title": "" }, { "docid": "2abe2b73082f0ad40feff3e4d10a1ddf", "score": "0.56829935", "text": "func (m *MockRepositoryInitializeDownloadLoader) Initialize(arg0 *repo.Entry, arg1 getter.Providers) (*repo.ChartRepository, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Initialize\", arg0, arg1)\n\tret0, _ := ret[0].(*repo.ChartRepository)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2c963b05d4c760ad1b29a3e888fa5360", "score": "0.56768435", "text": "func setupLoadTest() *mockdatasource.MockDatasources {\n\treturn mockdatasource.New()\n}", "title": "" }, { "docid": "bf8d9935b4d2f8a88224f5d88cb9cf8a", "score": "0.5655474", "text": "func (m *MockRunner) Init() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Init\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "a560f6e4bdf9bc5a158c5f4c9b568172", "score": "0.5631718", "text": "func (s *Suite) SetupTest() {\n\ts.groupVersion = \"testing.k8s.io/v1beta1\"\n\n\tfile, err := ioutil.ReadFile(\"test_queries.yaml\")\n\ts.Require().NoError(err)\n\n\tvar queries prometheus.Queries\n\terr = yaml.Unmarshal(file, &queries)\n\ts.Require().NoError(err)\n\n\tconfig := Config{\n\t\t\"http://stub:9090\",\n\t\tqueries.ResourceQueries,\n\t\tqueries.EdgeQueries,\n\t}\n\n\tlinkerdMesh, err := NewLinkerdProvider(config)\n\ts.Require().NoError(err)\n\n\thandler, err := metrics.NewHandler(linkerdMesh)\n\ts.Require().NoError(err)\n\n\ts.client = &mocks.API{}\n\n\thandler.Mesh.(*Linkerd).prometheusClient = s.client\n\ts.handler = handler\n}", "title": "" }, { "docid": "8f9c5ddf6a9faad39d6b830fabbdf377", "score": "0.5631403", "text": "func (m *MockRuleEngine) Add(r Rule) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Add\", r)\n}", "title": "" }, { "docid": "8d8602b4632f2bc5e6086d58f663a7a3", "score": "0.56139225", "text": "func (m *MockFileSystem) Symlink(arg0, arg1 string) error {\n\tret := m.ctrl.Call(m, \"Symlink\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b76af2b862dd8bcdca669da117a8f5c6", "score": "0.5609874", "text": "func (m *MockConfig) OpsManagerURL() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"OpsManagerURL\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "94062ae02d04404229224c07ba0124fe", "score": "0.5588881", "text": "func (m *MockLifecycle) Append(arg0 fx.Hook) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Append\", arg0)\n}", "title": "" }, { "docid": "ba4819e92660e1d7a783905d8cf78563", "score": "0.5571072", "text": "func (m *MockLinkService) Shorten(longLink string) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Shorten\", longLink)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6bea4b44bdd13b7f0738615056aeec23", "score": "0.5563132", "text": "func (m *MockPushNote) Join(d map[string]interface{}) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Join\", d)\n}", "title": "" }, { "docid": "fe66c73c036fca19aa5ef0124a1d2e0c", "score": "0.5551715", "text": "func (m *MockNetLink) LinkByName(arg0 string) (netlink.Link, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkByName\", arg0)\n\tret0, _ := ret[0].(netlink.Link)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c2030c60046a9932c90e0d1b27e5d2ca", "score": "0.55484056", "text": "func (_m *Fpdf) AddLink() int {\n\tret := _m.Called()\n\n\tvar r0 int\n\tif rf, ok := ret.Get(0).(func() int); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(int)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "c8517c4e585875b8d453bb9dd5f3054c", "score": "0.55326813", "text": "func bindMockLink(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(MockLinkABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "a40da024605007a92da258c803a4b2e9", "score": "0.5531895", "text": "func (m *MockHandler) Prepare() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Prepare\")\n}", "title": "" }, { "docid": "ab8368fc8541898a071ab025982b3b9b", "score": "0.5525609", "text": "func CreateLinkForTests(link links.Link, mining string) Link {\n\tcreatedOn := time.Now().UTC()\n\tins, err := NewBuilder().Create().WithLink(link).WithMining(mining).CreatedOn(createdOn).Now()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn ins\n}", "title": "" }, { "docid": "0a5aac2bc6b7b6d332014258fa10ba23", "score": "0.5517914", "text": "func beforeEach() {\n\tunitTesting = true\n\texecuteError = nil\n}", "title": "" }, { "docid": "692dabb5bd68044c7e694922eab00764", "score": "0.5517567", "text": "func (m *MockIContext) Next() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Next\")\n}", "title": "" }, { "docid": "041056fac16b2e7af8bb401afd8addcd", "score": "0.5508239", "text": "func (m *MockProvider) PrepareSubmarinerClusterEnv() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PrepareSubmarinerClusterEnv\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ef7f91bcd66d5e1e77963d22542680c3", "score": "0.55048704", "text": "func (m *MockLoader) LoadBase(arg0 helmchart.Manifests, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LoadBase\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "c3708c2d3b345f09fb698227bbf59bd2", "score": "0.550025", "text": "func (m *MockTestServiceServer) mustEmbedUnimplementedTestServiceServer() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"mustEmbedUnimplementedTestServiceServer\")\n}", "title": "" }, { "docid": "ab306a0eed925886cffd517ec6aefbe6", "score": "0.54995835", "text": "func (m *MockResourceManager) UpgradeChaincode() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"UpgradeChaincode\")\n}", "title": "" }, { "docid": "32fda24083ac9dec42d30e6c001fdb72", "score": "0.54975563", "text": "func (m *MockRouteGuideServer) mustEmbedUnimplementedRouteGuideServer() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"mustEmbedUnimplementedRouteGuideServer\")\n}", "title": "" }, { "docid": "ae48e636761f3858a22266862e1642eb", "score": "0.548555", "text": "func (m *MockinternalServiceAPI) initPowerStoreClient() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"initPowerStoreClient\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b464d6051698e3733c3b52521c1a8d06", "score": "0.5479423", "text": "func (m *MockinternalServiceAPI) initISCSIConnector() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"initISCSIConnector\")\n}", "title": "" }, { "docid": "111abe87deca7fa589114ad25c88a51d", "score": "0.54728127", "text": "func testingSetUp() {\n\tsetUpOnce.Do(func() {\n\t\toptions := DefaultPoolOptions\n\t\tif address != nil {\n\t\t\toptions = options.WithAddress(*address)\n\t\t}\n\t\tif network != nil {\n\t\t\toptions = options.WithNetwork(*network)\n\t\t}\n\t\tif database != nil {\n\t\t\toptions = options.WithDatabase(*database)\n\t\t}\n\t\ttestPool = NewPoolWithOptions(options)\n\t\tcheckDatabaseEmpty()\n\t\tregisterTestingTypes()\n\t})\n}", "title": "" }, { "docid": "a5519e3e8879b6b42ca9d38dd3a86d17", "score": "0.5464193", "text": "func (m *MockInterface) LinkByIndex(arg0 int) (netlink.Link, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LinkByIndex\", arg0)\n\tret0, _ := ret[0].(netlink.Link)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "62376dd1b64f01c22736358cb2631922", "score": "0.5459647", "text": "func (m *MockOVSBridgeClient) CreateUplinkPort(arg0 string, arg1 int32, arg2 map[string]interface{}) (string, ovsconfig.Error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateUplinkPort\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(ovsconfig.Error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "690dc3a747ddefa3d5faab27ec3eb0f6", "score": "0.5448068", "text": "func (m *MockProxyAPI) Setup(ctx context.Context, obj *unstructured.Unstructured) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Setup\", ctx, obj)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "cb99ad031a1d477249412f9f4a166d62", "score": "0.54312086", "text": "func (m *MockAPI) Init() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Init\")\n}", "title": "" }, { "docid": "fcd3f355db9aa6767badf22233b11ba7", "score": "0.543078", "text": "func (m *MockExternalSourceParser) BaseUrl() string {\n\tret := m.ctrl.Call(m, \"BaseUrl\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "f0d4c12cec2102587f74f5e25390da38", "score": "0.54259855", "text": "func (m *MockProvider) BootstrapSetup(arg0 context.Context, arg1 *v1alpha1.Cluster, arg2 *types.Cluster) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BootstrapSetup\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e080d4789e45fc9f808e7fafb1ca7032", "score": "0.54007065", "text": "func (m *MockPeerRoleManager) Start() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Start\")\n}", "title": "" }, { "docid": "e7fe67677ad397127b4275429949ec6f", "score": "0.53958315", "text": "func (m *MockInterface) AddrAdd(arg0 netlink.Link, arg1 *netlink.Addr) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddrAdd\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "475ad510cc1f037775c2ec917c6dece4", "score": "0.5392202", "text": "func (m *MockAggregateValuesPool) Init(alloc AggregateValuesAllocator) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Init\", alloc)\n}", "title": "" }, { "docid": "4e71c30f81a50e4b3052cccf4498166f", "score": "0.53911424", "text": "func (m *MockMessenger) URLAdded(id uint64) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"URLAdded\", id)\n}", "title": "" }, { "docid": "54d44b74d0d2719e5cbf8bbf97f5e8cf", "score": "0.5390673", "text": "func (m *MockDynamicSource) SetDependencyHook(arg0 dependencyHook) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetDependencyHook\", arg0)\n}", "title": "" }, { "docid": "eeab95cc4b32d0df49bf97cf8c08b587", "score": "0.5386237", "text": "func (s *OssClientSuite) SetUpTest(c *C) {\n}", "title": "" }, { "docid": "2756fb8279ab50ea53473062fd4d6836", "score": "0.5379418", "text": "func (m *MockResourceManager) InstantiateChaincode() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"InstantiateChaincode\")\n}", "title": "" }, { "docid": "a9dc63b2fe25b993ba18afa314dfa7ec", "score": "0.5377219", "text": "func (mr *MockInterfaceMockRecorder) LinkSetUp(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"LinkSetUp\", reflect.TypeOf((*MockInterface)(nil).LinkSetUp), arg0)\n}", "title": "" }, { "docid": "f85059f6c4c45ed0ff43f912db640af5", "score": "0.53755707", "text": "func (m *MockUserRepo) AddGroupByURL(id uint64, source, url string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddGroupByURL\", id, source, url)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ae6143e65b421d3c7de338bfd30d2480", "score": "0.5373531", "text": "func (s *SuiteBase) TestUpsertLink(c *gc.C) {\n\t// Create a new link\n\toriginal := &graph.Link{\n\t\tURL: \"https://example.com\",\n\t\tRetrievedAt: time.Now().Add(-10 * time.Hour),\n\t}\n\n\terr := s.g.UpsertLink(original)\n\tc.Assert(err, gc.IsNil)\n\tc.Assert(original.ID, gc.Not(gc.Equals), uuid.Nil, gc.Commentf(\"expected a linkID to be assigned to the new link\"))\n\n\t// Update existing link with a newer timestamp and different URL\n\taccessedAt := time.Now().Truncate(time.Second).UTC()\n\texisting := &graph.Link{\n\t\tID: original.ID,\n\t\tURL: \"https://example.com\",\n\t\tRetrievedAt: accessedAt,\n\t}\n\terr = s.g.UpsertLink(existing)\n\tc.Assert(err, gc.IsNil)\n\tc.Assert(existing.ID, gc.Equals, original.ID, gc.Commentf(\"link ID changed while upserting\"))\n\n\tstored, err := s.g.FindLink(existing.ID)\n\tc.Assert(err, gc.IsNil)\n\tc.Assert(stored.RetrievedAt, gc.Equals, accessedAt, gc.Commentf(\"last accessed timestamp was not updated\"))\n\n\t// Attempt to insert a new link whose URL matches an existing link with\n\t// and provide an older accessedAt value\n\tsameURL := &graph.Link{\n\t\tURL: existing.URL,\n\t\tRetrievedAt: time.Now().Add(-10 * time.Hour).UTC(),\n\t}\n\terr = s.g.UpsertLink(sameURL)\n\tc.Assert(err, gc.IsNil)\n\tc.Assert(sameURL.ID, gc.Equals, existing.ID)\n\n\tstored, err = s.g.FindLink(existing.ID)\n\tc.Assert(err, gc.IsNil)\n\tc.Assert(stored.RetrievedAt, gc.Equals, accessedAt, gc.Commentf(\"last accessed timestamp was overwritten with an older value\"))\n\n\t// Create a new link and then attempt to update its URL to the same as\n\t// an existing link.\n\tdup := &graph.Link{\n\t\tURL: \"foo\",\n\t}\n\terr = s.g.UpsertLink(dup)\n\tc.Assert(err, gc.IsNil)\n\tc.Assert(dup.ID, gc.Not(gc.Equals), uuid.Nil, gc.Commentf(\"expected a linkID to be assigned to the new link\"))\n}", "title": "" }, { "docid": "cd008cb83e699a6e8274c5865eed8a51", "score": "0.5370031", "text": "func (m *MockDBAPI) Connect(arg0 mongodb.ObjectDocumentHandlerMap) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Connect\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "31b725b632f45b951a243335de31536f", "score": "0.5362923", "text": "func (s *restoreSchemaSuite) SetupTest() {\n\ts.controller, s.ctx = gomock.WithContext(context.Background(), s.T())\n\tmockTargetInfoGetter := mock.NewMockTargetInfoGetter(s.controller)\n\tmockBackend := mock.NewMockBackend(s.controller)\n\tmockTargetInfoGetter.EXPECT().\n\t\tFetchRemoteTableModels(gomock.Any(), gomock.Any()).\n\t\tAnyTimes().\n\t\tReturn(s.tableInfos, nil)\n\tmockBackend.EXPECT().Close()\n\ttheBackend := backend.MakeEngineManager(mockBackend)\n\ts.rc.engineMgr = theBackend\n\ts.rc.backend = mockBackend\n\ts.targetInfoGetter.backend = mockTargetInfoGetter\n\n\tmockDB, sqlMock, err := sqlmock.New()\n\trequire.NoError(s.T(), err)\n\tfor i := 0; i < 17; i++ {\n\t\tsqlMock.ExpectExec(\".*\").WillReturnResult(sqlmock.NewResult(int64(i), 1))\n\t}\n\ts.targetInfoGetter.db = mockDB\n\ts.rc.db = mockDB\n\ts.dbMock = sqlMock\n}", "title": "" }, { "docid": "9252559d35924b24ab6366f3d82c9e51", "score": "0.5362454", "text": "func (m *MockOperatorManager) Install() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Install\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b7f78e7c124d57a89a9dd8012193509b", "score": "0.5361692", "text": "func (m *MockPeerManager) Init(arg0 *app.App) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Init\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "26bc8b508699049ef7d33a50d4a65308", "score": "0.5354228", "text": "func (m *MockinternalServiceAPI) nodeHostSetup(initiators []string, useFC bool, maximumStartupDelay int) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"nodeHostSetup\", initiators, useFC, maximumStartupDelay)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "788f1b5c4895edcc1c5601bf7e98e3e9", "score": "0.5349012", "text": "func (m *MockListStorage) SetHead(arg0 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetHead\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1b6bb73fa18e6acebc82c370e90a9361", "score": "0.5348338", "text": "func (m *MockDelegateInterface) SetupDelegation(arg0 context.Context, arg1 string) (kubernetes.Interface, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetupDelegation\", arg0, arg1)\n\tret0, _ := ret[0].(kubernetes.Interface)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ef06eaecc2f43794df27765883212536", "score": "0.5345013", "text": "func (m *MockJobSynchroniser) Add(delta int) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Add\", delta)\n}", "title": "" }, { "docid": "27c2978031561ad903c594654e8b4bcf", "score": "0.5343045", "text": "func (m *MockInterface) NeighSet(arg0 *netlink.Neigh) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NeighSet\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "64e6c7869b77128982b5232b9bbe8a27", "score": "0.53407264", "text": "func (m *MockApt) Setup() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Setup\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "375aaa5a35890ed29b6af21e1c3a54dc", "score": "0.5335091", "text": "func (t *PipelineSuite) SetupTest() {\n\tt.mockProc = &mocks.Processor{}\n\tt.mockErrHandler = &mocks.ErrorHandler{}\n\n\tt.pipeline = NewPipeline()\n\tt.pipeline.SetProcessor(t.mockProc)\n\tt.pipeline.SetErrorHandler(t.mockErrHandler)\n\tt.addMockReader()\n\tt.addMockWriter()\n}", "title": "" }, { "docid": "a53243b343f8bed69976d3f7eb8c5a1d", "score": "0.5328681", "text": "func (m *MockImplement) SetupWorkers() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetupWorkers\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "99492b34e9ef1db4ae043f8e24ab0e62", "score": "0.5328526", "text": "func (m *MockEngine) Setup(ctx runtime.ReconcileRequestContext) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Setup\", ctx)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "53d69fd013c3fdd528d882ff202c3cf7", "score": "0.5323922", "text": "func (m *MockPublisher) Init(ctx context.Context, projectID string) error {\n\tret := m.ctrl.Call(m, \"Init\", ctx, projectID)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "df046fcf743fd5a1a5e717c0d7538d9f", "score": "0.53191125", "text": "func (m *MockManager) Keep() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Keep\")\n}", "title": "" }, { "docid": "d21b1273d1bbb2a3eefede5a3f8bafe0", "score": "0.53159964", "text": "func (m *MockRunner) Start() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Start\")\n}", "title": "" }, { "docid": "0617bfc88233674edbeecd8d85a75dbb", "score": "0.52926534", "text": "func (m *MockReceivingManager) OpenConnAndProcess() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OpenConnAndProcess\")\n}", "title": "" }, { "docid": "520637cd028df94e4c509264ae6bdc51", "score": "0.52892494", "text": "func (m *MockClient) InstallVMUplinkFlows(arg0 string, arg1, arg2 int32) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InstallVMUplinkFlows\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1f2de49aae32a0260654f7051706d2e5", "score": "0.5280723", "text": "func (m *MockResourceManager) QueryChainInfo() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"QueryChainInfo\")\n}", "title": "" }, { "docid": "dc65c6c2cfc0ac52560fba2d9f03a045", "score": "0.52755046", "text": "func (m *MockstateWrapper) ResetValidationList() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"ResetValidationList\")\n}", "title": "" }, { "docid": "dc61165ee1cc8c66ac8608156746fd2b", "score": "0.52699834", "text": "func (m *MockSearchService) Init(arg0 dao.SearchDao, arg1 rpc.UsersRPC) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Init\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1f03dcfa920c4be7994b204b2b5335df", "score": "0.52676314", "text": "func (m *MockResourceManager) JoinChannel() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"JoinChannel\")\n}", "title": "" }, { "docid": "6876653a1e4a1ab23c21c34f108d2ae9", "score": "0.5263622", "text": "func (m *MockConnector) Connect(ctx context.Context) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Connect\", ctx)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "563378dad8a015eeaaff0f18b1cc7e84", "score": "0.525971", "text": "func (_m *MockCache) Initialize() error {\n\tret := _m.ctrl.Call(_m, \"Initialize\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "856589a741ce077f29f5c1a8e5a35dcb", "score": "0.5255921", "text": "func (m *MockRemoteCommonAreaManager) Start() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Start\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "07d827659e31d1b6061db7e0364fdc30", "score": "0.5252932", "text": "func (m *MockHandler) EnsureReferencesHaveTxDetail() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EnsureReferencesHaveTxDetail\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "a62210dfb056fbee404e19c9b1784b6f", "score": "0.5252832", "text": "func (m *MockClient) Initialize(configPath, pierID string, extra []byte) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Initialize\", configPath, pierID, extra)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e4f80538673e75e2d2753a237c33500b", "score": "0.52516645", "text": "func (ts *AccTestSuite) SetupTest() {\n\talloc := make(core.GenesisAlloc)\n\twm := &MockWalletManager{\n\t\taccounts: make(map[common.Address]*ecdsa.PrivateKey),\n\t}\n\tts.wm = wm\n\n\tadminPrvKey, adminAddr, err := utils.GenerateKeyPair()\n\tts.Require().NoError(err)\n\talloc[adminAddr] = core.GenesisAccount{Balance: big.NewInt(1 * units.Ether)}\n\twm.accounts[adminAddr] = adminPrvKey\n\tts.admin = adminAddr\n\n\trequesterPrvKey, requesterAddr, err := utils.GenerateKeyPair()\n\tts.Require().NoError(err)\n\talloc[requesterAddr] = core.GenesisAccount{Balance: big.NewInt(0.5 * units.Ether)}\n\twm.accounts[requesterAddr] = requesterPrvKey\n\tts.requester = requesterAddr\n\n\tgasLimit := uint64(100 * units.GWei)\n\tblockchain := backends.NewSimulatedBackend(alloc, gasLimit)\n\trpcClient := &MockClient{rpc: blockchain}\n\n\tts.blockchain = blockchain\n\tmanager, err := NewManager(logrus.New(), wm, rpcClient)\n\tts.Require().NoError(err)\n\tts.manager = manager\n\tts.rpcClient = rpcClient\n\tts.alloc = alloc\n}", "title": "" }, { "docid": "1301603a339233757b87410d794f25f1", "score": "0.5246215", "text": "func (m *MockRepositoryInitializer) Initialize(arg0 *repo.Entry, arg1 getter.Providers) (*repo.ChartRepository, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Initialize\", arg0, arg1)\n\tret0, _ := ret[0].(*repo.ChartRepository)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0239cfb59190d9ad2aa9bd0c5a23900e", "score": "0.5239502", "text": "func (m *MockLedgerQueryer) QueryChainInfo() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"QueryChainInfo\")\n}", "title": "" }, { "docid": "62f869fd51f6331750789692105d7357", "score": "0.52372503", "text": "func (m *MockroleManager) CreateECSServiceLinkedRole() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateECSServiceLinkedRole\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "0464cfc68a6c41d581cd2c3f96a2d430", "score": "0.52301157", "text": "func (m *MockAlarm) Init() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Init\")\n}", "title": "" }, { "docid": "062eb4d088cbf375e0f6f294b0e9d7ab", "score": "0.52298146", "text": "func (m *MockOnewayOutbound) Start() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Start\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "c729426890a0bf65bcf8c0dd9fb7fddc", "score": "0.52282035", "text": "func (m *MockMetrics) Init() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Init\")\n}", "title": "" } ]
9e06eb4d4fb80c4389afdcdace42ce9b
IndexedForBlockStart returns a bool to indicate if the Entry has been successfully indexed for the given index blockStart.
[ { "docid": "c1bdf3f51e9b1aee96415aa209ca016b", "score": "0.830329", "text": "func (entry *Entry) IndexedForBlockStart(indexBlockStart xtime.UnixNano) bool {\n\tentry.reverseIndex.RLock()\n\tisIndexed := entry.reverseIndex.indexedWithRLock(indexBlockStart)\n\tentry.reverseIndex.RUnlock()\n\treturn isIndexed\n}", "title": "" } ]
[ { "docid": "5fe7a7a8a05e58706f34f69c0222922c", "score": "0.64749056", "text": "func (o *indexCheckOperation) Started() bool {\n\treturn o.run.started\n}", "title": "" }, { "docid": "aae63238f009d6dd1654020717dc4a55", "score": "0.6356142", "text": "func (entry *Entry) NeedsIndexUpdate(indexBlockStartForWrite xtime.UnixNano) bool {\n\t// first we try the low-cost path: acquire a RLock and see if the given block start\n\t// has been marked successful or that we've attempted it.\n\tentry.reverseIndex.RLock()\n\talreadyIndexedOrAttempted := entry.reverseIndex.indexedOrAttemptedWithRLock(indexBlockStartForWrite)\n\tentry.reverseIndex.RUnlock()\n\tif alreadyIndexedOrAttempted {\n\t\t// if so, the entry does not need to be indexed.\n\t\treturn false\n\t}\n\n\t// now acquire a write lock and set that we're going to attempt to do this so we don't try\n\t// multiple times.\n\tentry.reverseIndex.Lock()\n\t// NB(prateek): not defer-ing here, need to avoid the the extra ~150ns to minimize contention.\n\n\t// but first, we have to ensure no one has done so since we released the read lock\n\talreadyIndexedOrAttempted = entry.reverseIndex.indexedOrAttemptedWithRLock(indexBlockStartForWrite)\n\tif alreadyIndexedOrAttempted {\n\t\tentry.reverseIndex.Unlock()\n\t\treturn false\n\t}\n\n\tentry.reverseIndex.setAttemptWithWLock(indexBlockStartForWrite, true)\n\tentry.reverseIndex.Unlock()\n\treturn true\n}", "title": "" }, { "docid": "084fac5a3c495969896145b96a0875a6", "score": "0.6326201", "text": "func (entry *Entry) IfAlreadyIndexedMarkIndexSuccessAndFinalize(\n\tblockStart xtime.UnixNano,\n) bool {\n\tsuccessAlready := false\n\tentry.reverseIndex.Lock()\n\tfor _, state := range entry.reverseIndex.states {\n\t\tif state.success {\n\t\t\tsuccessAlready = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif successAlready {\n\t\tentry.reverseIndex.setSuccessWithWLock(blockStart)\n\t\tentry.reverseIndex.setAttemptWithWLock(blockStart, false)\n\t}\n\tentry.reverseIndex.Unlock()\n\tif successAlready {\n\t\t// indicate the index has released held reference for provided write\n\t\tentry.DecrementReaderWriterCount()\n\t}\n\treturn successAlready\n}", "title": "" }, { "docid": "d33f1c0568859742709c022b256c3d05", "score": "0.5691571", "text": "func (idx *Index) BlockStart() int64 {\n\treturn idx.blockStart\n}", "title": "" }, { "docid": "8d5d9c5715a194ec1e1afe519b5cf0cf", "score": "0.5289222", "text": "func (s Shard) IsStarted() bool {\n\treturn s.State == STARTED\n}", "title": "" }, { "docid": "1cbaf59fac9178f6c57c73a35f2b24b6", "score": "0.520343", "text": "func (c ApplyCursor) HasIndex() bool { return c.index != nil }", "title": "" }, { "docid": "3c9841cae8f40c62a5297c62e6464dba", "score": "0.51772004", "text": "func (blockID EventBlockID) IsComplete() bool {\n\treturn len(blockID.Hash) == tmhash.Size\n}", "title": "" }, { "docid": "74c8b4be9db3218505cc29dca3f101b9", "score": "0.5142531", "text": "func (ts *tableSearch) NextBlock() bool {\n\tif ts.err != nil {\n\t\treturn false\n\t}\n\tif ts.nextBlockNoop {\n\t\tts.nextBlockNoop = false\n\t\treturn true\n\t}\n\n\tts.err = ts.nextBlock()\n\tif ts.err != nil {\n\t\tif ts.err != io.EOF {\n\t\t\tts.err = fmt.Errorf(\"cannot obtain the next block to search in the table: %w\", ts.err)\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "68daa9577bd6d5f0149e789b1f2f3664", "score": "0.51125914", "text": "func (c *compactedIndex) IndexChunk(chk chunk.Chunk) (bool, error) {\n\tif chk.From > c.tableInterval.End || c.tableInterval.Start > chk.Through {\n\t\treturn false, nil\n\t}\n\n\tc.indexChunks = append(c.indexChunks, chk)\n\n\treturn true, nil\n}", "title": "" }, { "docid": "8c9682ded8905585d15e5c4428e693e5", "score": "0.50634855", "text": "func (o *Ga4ghSearchReadsRequest) HasStart() bool {\n\tif o != nil && o.Start != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "958d36ad10f95f7791c95bca72d333d5", "score": "0.50454223", "text": "func (bc *BlockChain) ContainsTransaction(t *Transaction, start, stop uint32) (bool, uint32, uint32) {\n\tfor i := start; i < stop; i++ {\n\t\tif exists, j := bc.Blocks[i].ContainsTransaction(t); exists {\n\t\t\treturn true, i, j\n\t\t}\n\t}\n\treturn false, 0, 0\n}", "title": "" }, { "docid": "a5ee083333644240973a59f36d0f6d8f", "score": "0.50138205", "text": "func (i Index) Valid() bool {\n\treturn i>>indexBitSize == 0 && i&maxIndexValue != 0\n}", "title": "" }, { "docid": "a3a8c3b6e1e99c5250d224ae58fa7835", "score": "0.5004722", "text": "func (entry *Entry) OnIndexSuccess(blockStartNanos xtime.UnixNano) {\n\tentry.reverseIndex.Lock()\n\tentry.reverseIndex.setSuccessWithWLock(blockStartNanos)\n\tentry.reverseIndex.Unlock()\n}", "title": "" }, { "docid": "9c4477905bec5b6b59b607065e7c62f8", "score": "0.5000602", "text": "func (is *IndexerService) OnStart() error {\r\n\tblockHeadersCh := make(chan interface{})\r\n\tif err := is.eventBus.Subscribe(context.Background(), subscriber, types.EventQueryNewBlockHeader, blockHeadersCh); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\ttxsCh := make(chan interface{})\r\n\tif err := is.eventBus.Subscribe(context.Background(), subscriber, types.EventQueryTx, txsCh); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tgo func() {\r\n\t\tfor {\r\n\t\t\te, ok := <-blockHeadersCh\r\n\t\t\tif !ok {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t\theader := e.(types.EventDataNewBlockHeader).Header\r\n\t\t\tbatch := NewBatch(header.NumTxs)\r\n\t\t\tfor i := int64(0); i < header.NumTxs; i++ {\r\n\t\t\t\te, ok := <-txsCh\r\n\t\t\t\tif !ok {\r\n\t\t\t\t\tis.Logger.Error(\"Failed to index all transactions due to closed transactions channel\", \"height\", header.Height, \"numTxs\", header.NumTxs, \"numProcessed\", i)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\ttxResult := e.(types.EventDataTx).TxResult\r\n\t\t\t\tbatch.Add(&txResult)\r\n\t\t\t}\r\n\t\t\tis.idr.AddBatch(batch)\r\n\t\t\tis.Logger.Info(\"Indexed block\", \"height\", header.Height)\r\n\t\t}\r\n\t}()\r\n\treturn nil\r\n}", "title": "" }, { "docid": "5c4ed8a5dfe8744b6f3f28e9a41bc667", "score": "0.49848557", "text": "func (c *Checker) IsStarted() bool {\n\tc.mutexStopStart.Lock()\n\tdefer c.mutexStopStart.Unlock()\n\treturn c.started\n}", "title": "" }, { "docid": "ab86c0c3318e20b962234ed88b2bd431", "score": "0.49587667", "text": "func (entry *Entry) IndexedBlockCount() int {\n\tentry.reverseIndex.RLock()\n\tcount := len(entry.reverseIndex.states)\n\tentry.reverseIndex.RUnlock()\n\treturn count\n}", "title": "" }, { "docid": "8b203a70e7c2e315b3b2192f56e408b1", "score": "0.49286526", "text": "func (blockID BlockID) IsComplete() bool {\n\treturn len(blockID.Hash) == sha256.Size &&\n\t\tblockID.PartSetHeader.Total > 0 &&\n\t\tlen(blockID.PartSetHeader.Hash) == sha256.Size\n}", "title": "" }, { "docid": "153bdcb8bdfd6f83e32e9bc6eb48d429", "score": "0.49165013", "text": "func (o *SLOCorrectionUpdateRequestAttributes) HasStart() bool {\n\tif o != nil && o.Start != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b28bf445cc7f08e59878b6c02e59a159", "score": "0.48841214", "text": "func (h *History) IsBegin() bool { return h.position == 0 }", "title": "" }, { "docid": "c81a8e68a9a5576b6b32a5bbe9837d4e", "score": "0.48470873", "text": "func (r *Timed) MarkedStarted() bool {\n\treturn r.Started != nil\n}", "title": "" }, { "docid": "1e3a0a783d6a6d6b8650f205aeee40e9", "score": "0.48424366", "text": "func (mr *MockNamespaceIndexMockRecorder) BlockForBlockStart(blockStart interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"BlockForBlockStart\", reflect.TypeOf((*MockNamespaceIndex)(nil).BlockForBlockStart), blockStart)\n}", "title": "" }, { "docid": "9445ce0fe493797f79430094dc020748", "score": "0.48422673", "text": "func (c *Client) Started() bool {\n\treturn c.started.Load() == true\n}", "title": "" }, { "docid": "4ce3b83f8c24fcb4be8f3b87a09635ce", "score": "0.4837486", "text": "func (g *ItemGraph) IsStartNode(e *Node) bool {\n\treturn e.Value == g.GetStart().Value\n}", "title": "" }, { "docid": "acc28635a90792cebb74ac96d02ba909", "score": "0.48283666", "text": "func indexInBlock(i int) int {\n\treturn i & blockSizeMask\n}", "title": "" }, { "docid": "9b04bd43520070fa18b53370ac98b292", "score": "0.48227367", "text": "func (tok Token) IsBlock() bool { return blockBegin < tok && tok < blockEnd }", "title": "" }, { "docid": "6be4b14f05366f78b70c598bbf3929a8", "score": "0.48194778", "text": "func (o *ParseError) HasStart() bool {\n\tif o != nil && o.Start != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dbf4cd70e937f73f0f1a4a4fbce6f822", "score": "0.4817589", "text": "func (idx *Index) IsOverflow(blockNo int64) bool {\n\treturn blockNo >= (idx.blockStart + int64(idx.blockCount))\n}", "title": "" }, { "docid": "c3538061c948baa5b6af8610faaff4dd", "score": "0.4811915", "text": "func isBlockStart(data string) bool {\n\tvar hasBracket, escaped bool\n\n\tfor _, r := range data {\n\t\tswitch r {\n\t\tcase '\"', '\\'':\n\t\t\tif escaped {\n\t\t\t\tescaped = false\n\t\t\t} else {\n\t\t\t\tescaped = true\n\t\t\t}\n\n\t\tcase '{':\n\t\t\tif !escaped {\n\t\t\t\thasBracket = true\n\t\t\t}\n\n\t\tcase '#':\n\t\t\tif !escaped {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn hasBracket && !escaped\n}", "title": "" }, { "docid": "444aadc5e902b8e3bab6861db80ee85a", "score": "0.47753996", "text": "func (f FileSetFilesSlice) VolumeExistsForBlock(blockStart xtime.UnixNano, volume int) bool {\n\tfor _, curr := range f {\n\t\tif curr.ID.BlockStart.Equal(blockStart) && curr.ID.VolumeIndex == volume {\n\t\t\treturn curr.HasCompleteCheckpointFile()\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5fbe5cc10053c0d36a121f4498dfb086", "score": "0.47592667", "text": "func (mr *MockNamespaceIndexMockRecorder) BlockStartForWriteTime(writeTime interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"BlockStartForWriteTime\", reflect.TypeOf((*MockNamespaceIndex)(nil).BlockStartForWriteTime), writeTime)\n}", "title": "" }, { "docid": "dea5effa03e2049f5e57e4a9f50fb95f", "score": "0.47475997", "text": "func (tk *timekeeper) checkAnyInitialStateIndex(bucket string) bool {\n\n\tfor _, buildInfo := range tk.indexBuildInfo {\n\t\t//if index belongs to the flushed bucket and in INITIAL state\n\t\tidx := buildInfo.indexInst\n\t\tif idx.Defn.Bucket == bucket &&\n\t\t\tidx.State == common.INDEX_STATE_INITIAL {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n\n}", "title": "" }, { "docid": "bd0b53723abedb7e37d35cae426c3c8b", "score": "0.47471076", "text": "func (subLoc *SubChunkXyz) BlockIndex() (index BlockIndex, ok bool) {\n\tok = (subLoc.X|subLoc.Z)&^ChunkHMask == 0 && subLoc.Y&^ChunkYMask == 0\n\tindex = ((BlockIndex(subLoc.X) << (ChunkHShift + ChunkYShift)) |\n\t\tBlockIndex(subLoc.Y) |\n\t\t(BlockIndex(subLoc.Z) << ChunkYShift))\n\n\treturn\n}", "title": "" }, { "docid": "f39edc70fb7ab0fc3d4e24d549136771", "score": "0.47398624", "text": "func (o *indexCheckOperation) Done(ctx context.Context) bool {\n\treturn o.run.rows == nil || o.run.rowIndex >= o.run.rows.Len()\n}", "title": "" }, { "docid": "044ff13458da1e90783acae26e3257b5", "score": "0.47028226", "text": "func (b *Block) Interupt() bool {\n\treturn dhash.StopHash()\n}", "title": "" }, { "docid": "1854e25aa3cec992504c110c62fe1350", "score": "0.46999604", "text": "func (s *Indexer) Start(ctx context.Context) error {\n\tif err := s.kvstore.Start(ctx); err != nil {\n\t\treturn err\n\t}\n\treturn s.loadFromDB()\n}", "title": "" }, { "docid": "bd2f337491f217e891c0fce66fae2821", "score": "0.4699248", "text": "func (m *Martian) IsStarted() bool {\n\treturn m.started\n}", "title": "" }, { "docid": "3c30a5fe08f91a9e112296e6f0210356", "score": "0.46903482", "text": "func (o *sqlCheckConstraintCheckOperation) Started() bool {\n\treturn o.run.started\n}", "title": "" }, { "docid": "aea2cef2a476b19ae47c85a79bf791c4", "score": "0.4672359", "text": "func (m *MockNamespaceIndex) BlockForBlockStart(blockStart time0.UnixNano) (index.Block, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BlockForBlockStart\", blockStart)\n\tret0, _ := ret[0].(index.Block)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "19d4c3f9406658108d78cfc5f9e24b71", "score": "0.4667137", "text": "func (me TxsdDatabaseClass) IsIndex() bool { return me == \"index\" }", "title": "" }, { "docid": "a8c3df97697c253dd33de557fc2ccdcc", "score": "0.46579322", "text": "func (s *Server) Started() bool {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\treturn s.started\n}", "title": "" }, { "docid": "78275c16b1b08de2be26b2d121478666", "score": "0.46408498", "text": "func (o *indexCheckOperation) Start(params runParams) error {\n\tctx := params.ctx\n\n\tcolumns, columnNames, columnTypes := getColumns(o.tableDesc, o.indexDesc)\n\n\t// Because the row results include both primary key data and secondary\n\t// key data, the row results will contain two copies of the column\n\t// data.\n\tcolumnTypes = append(columnTypes, columnTypes...)\n\n\t// Find the row indexes for all of the primary index columns.\n\tprimaryColIdxs, err := getPrimaryColIdxs(o.tableDesc, columns)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcheckQuery := createIndexCheckQuery(columnNames, o.tableDesc, o.tableName, o.indexDesc, o.asOf)\n\tplan, err := params.p.delegateQuery(ctx, \"SCRUB TABLE ... WITH OPTIONS INDEX\", checkQuery, nil, nil)\n\tif err != nil {\n\t\tlog.Errorf(ctx, \"failed to create query plan for query: %s\", checkQuery)\n\t\treturn errors.Wrapf(err, \"could not create query plan\")\n\t}\n\n\t// All columns projected in the plan generated from the query are\n\t// needed. The columns are the index columns and extra columns in the\n\t// index, twice -- for the primary and then secondary index.\n\tneeded := make([]bool, len(planColumns(plan)))\n\tfor i := range needed {\n\t\tneeded[i] = true\n\t}\n\n\t// Optimize the plan. This is required in order to populate scanNode\n\t// spans.\n\tplan, err = params.p.optimizePlan(ctx, plan, needed)\n\tif err != nil {\n\t\tplan.Close(ctx)\n\t\treturn err\n\t}\n\tdefer plan.Close(ctx)\n\n\tplanCtx := params.extendedEvalCtx.DistSQLPlanner.newPlanningCtx(ctx, params.extendedEvalCtx, params.p.txn)\n\tphysPlan, err := scrubPlanDistSQL(ctx, &planCtx, plan)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set NullEquality to true on all MergeJoinerSpecs. This changes the\n\t// behavior of the query's equality semantics in the ON predicate. The\n\t// equalities will now evaluate NULL = NULL to true, which is what we\n\t// desire when testing the equivilance of two index entries. There\n\t// might be multiple merge joiners (with hash-routing).\n\tvar foundMergeJoiner bool\n\tfor i := range physPlan.Processors {\n\t\tif physPlan.Processors[i].Spec.Core.MergeJoiner != nil {\n\t\t\tphysPlan.Processors[i].Spec.Core.MergeJoiner.NullEquality = true\n\t\t\tfoundMergeJoiner = true\n\t\t}\n\t}\n\tif !foundMergeJoiner {\n\t\treturn errors.Errorf(\"could not find MergeJoinerSpec in plan\")\n\t}\n\n\trows, err := scrubRunDistSQL(ctx, &planCtx, params.p, physPlan, columnTypes)\n\tif err != nil {\n\t\trows.Close(ctx)\n\t\treturn err\n\t}\n\n\to.run.started = true\n\to.run.rows = rows\n\to.primaryColIdxs = primaryColIdxs\n\to.columns = columns\n\treturn nil\n}", "title": "" }, { "docid": "40c4e9212638a64c835f14ed9fe8c299", "score": "0.46175933", "text": "func (m *GormIterationRepository) CanStart(ctx context.Context, i *Iteration) (bool, error) {\n\tvar count int64\n\trootItr, err := m.Root(ctx, i.SpaceID)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif i.ID == rootItr.ID {\n\t\treturn false, errors.NewBadParameterError(\"iteration\", \"Root iteration can not be started.\")\n\t}\n\tm.db.Model(&Iteration{}).Where(\"space_id=? and state=?\", i.SpaceID, IterationStateStart).Count(&count)\n\tif count != 0 {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"iteration_id\": i.ID,\n\t\t\t\"space_id\": i.SpaceID,\n\t\t}, \"one iteration from given space is already running!\")\n\t\treturn false, errors.NewBadParameterError(\"state\", \"One iteration from given space is already running\")\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "b84eb9b66e233daacf8843ad80d8ca77", "score": "0.46135202", "text": "func (m *MockNamespaceIndex) BlockStartForWriteTime(writeTime time0.UnixNano) time0.UnixNano {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BlockStartForWriteTime\", writeTime)\n\tret0, _ := ret[0].(time0.UnixNano)\n\treturn ret0\n}", "title": "" }, { "docid": "ddbd6e91016c7c97aaf87cbd07f63a23", "score": "0.46065176", "text": "func (ars *AtomicRunState) Start() bool {\n\tars.lock.Lock()\n\tdefer ars.lock.Unlock()\n\n\tif ars.stop != nil {\n\t\treturn false\n\t}\n\n\tars.stop = make(chan struct{})\n\treturn true\n}", "title": "" }, { "docid": "8d308fb025419d4cf4d38518b99b75d0", "score": "0.45988533", "text": "func RuneStart(b byte) bool { return b&0xC0 != 0x80 }", "title": "" }, { "docid": "d0cf8daa7e162971851df3d8020ab4e2", "score": "0.45956346", "text": "func (c *Client) WaitBlockIndexed(ctx context.Context, runtimeID signature.PublicKey, round uint64) error {\n\tif c.indexerBackend == nil {\n\t\treturn ErrIndexerDisabled\n\t}\n\n\treturn c.indexerBackend.WaitBlockIndexed(ctx, runtimeID, round)\n}", "title": "" }, { "docid": "df4df40ae1f7c493ee2cbef484765fe5", "score": "0.4593367", "text": "func (b *Block) IsValid(prevBlockHeader *BlockHeader, isExtraValid func([]byte) bool) bool {\n\tif b.Header.Index != prevBlockHeader.Index+1 ||\n\t\tb.Header.Time < prevBlockHeader.Time ||\n\t\t!bytes.Equal(b.Header.PrevHash, prevBlockHeader.Hash()) ||\n\t\t!bytes.Equal(b.Header.MerkleRoot, merkletree.NewMerkleTree(b.Data...).Root.Hash) ||\n\t\tisExtraValid != nil && !isExtraValid(b.Header.Extra) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ceb3488accf13049b51d9830eda02f38", "score": "0.4591937", "text": "func (entry *Entry) TryMarkIndexGarbageCollected() bool {\n\t// Since series insertions + index insertions are done separately async, it is possible for\n\t// a series to be in the index but not have data written yet, and so any series not in the\n\t// lookup yet we cannot yet consider empty.\n\te, _, err := entry.Shard.TryRetrieveSeriesAndIncrementReaderWriterCount(entry.ID)\n\tif err != nil || e == nil {\n\t\treturn false\n\t}\n\tdefer e.DecrementReaderWriterCount()\n\n\t// Consider non-empty if the entry is still being held since this could indicate\n\t// another thread holding a new series prior to writing to it.\n\tif e.ReaderWriterCount() > 1 {\n\t\treturn false\n\t}\n\n\t// Series must be empty to be GCed. This happens when the data and index are flushed to disk and\n\t// so the series no longer has in-mem data.\n\tif !e.Series.IsEmpty() {\n\t\treturn false\n\t}\n\n\t// Mark as GCed from index so the entry can be safely cleaned up elsewhere.\n\tentry.IndexGarbageCollected.Store(true)\n\n\treturn true\n}", "title": "" }, { "docid": "a5f58638ba257d3b8b1725c432bac490", "score": "0.4591643", "text": "func (o *VscanOnDemandModifyDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "592ec4965a0fba87ac93890971ed12c7", "score": "0.45888492", "text": "func (m *PositionassingmentMutation) DayStart() (r time.Time, exists bool) {\n\tv := m._DayStart\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "b9081b31341f7bd4b38d6d17046562d9", "score": "0.45838293", "text": "func (self *LinearHashIndex) findAndLock(key string, isWriteLock bool) (bool, error) {\n\t/**\n\t * Calculate the hash value for the key, and then calculate the offset of\n\t * corresponding chain pointer in hash table\n\t */\n\terr := self.readHeader(true, false)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\thash := self.dbHash(key)\n\tif self.debug {\n\t\tif isWriteLock {\n\t\t\tfmt.Printf(\"[%d] Inserting/deleting key %s into bucket %d\\n\", getGID(), key, hash)\n\t\t} else {\n\t\t\tfmt.Printf(\"[%d] reading key %s from bucket %d\\n\", getGID(), key, hash)\n\t\t}\n\t}\n\tself.chainoff = int64(hash*ptr_sz) + self.hashoff\n\tself.ptroff = self.chainoff\n\n\t/**\n\t * We lock the hash chain, the caller must unlock it. Note we lock and unlock only\n\t * the first byte\n\t */\n\tif isWriteLock {\n\t\terr = WriteLockW(self.idxFile.Fd(), self.chainoff, io.SeekStart, 1)\n\t} else {\n\t\terr = ReadLockW(self.idxFile.Fd(), self.chainoff, io.SeekStart, 1)\n\t}\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t/**\n\t * Get the offset of the first record in hash chain\n\t */\n\toffset, err := self.readPtr(self.ptroff, self.idxFile)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfor offset != 0 {\n\t\tnextOffset, err := self.readIdx(offset)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif self.idxbuf == key {\n\t\t\tbreak\n\t\t}\n\t\tself.ptroff = offset\n\t\toffset = nextOffset\n\t}\n\n\tif offset == 0 {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "d880f7389f098d9c96d03388172c6c60", "score": "0.45670164", "text": "func (fileMap *FileMap) isComplete() bool {\n\n for i := uint64(1); i <= fileMap.chunkCount; i++ {\n if len(fileMap.chunkMap[i]) == 0 {\n return false\n }\n }\n\n return true\n}", "title": "" }, { "docid": "1d624daa16f0f7aac219bcc31fd84842", "score": "0.45647112", "text": "func (o *VscanOnDemandModifyOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "21ca61301847a182c7d65ca485fd3b0f", "score": "0.45642942", "text": "func (m *LocalNodeProfileMock) GetIndexFinished() bool {\n\t// if expectation series were set then invocations count should be equal to expectations count\n\tif len(m.GetIndexMock.expectationSeries) > 0 {\n\t\treturn atomic.LoadUint64(&m.GetIndexCounter) == uint64(len(m.GetIndexMock.expectationSeries))\n\t}\n\n\t// if main expectation was set then invocations count should be greater than zero\n\tif m.GetIndexMock.mainExpectation != nil {\n\t\treturn atomic.LoadUint64(&m.GetIndexCounter) > 0\n\t}\n\n\t// if func was set then invocations count should be greater than zero\n\tif m.GetIndexFunc != nil {\n\t\treturn atomic.LoadUint64(&m.GetIndexCounter) > 0\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "0cdd4eeec0ab89aa5d197c7f95410f46", "score": "0.45483974", "text": "func (is *IndexStore) Start(path string) error {\n\terr := is.InitIndexes(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"Started index store\")\n\treturn nil\n}", "title": "" }, { "docid": "a8a523923d74112b147b54e98416b06c", "score": "0.45392424", "text": "func (se *SearchEngine) hasCompleted(searchId string, lock bool) bool {\n\n if lock {\n se.lock.RLock()\n defer se.lock.RUnlock()\n }\n\n search, found := se.activeSearches[searchId]\n\n if !found {\n return true\n }\n\n chunkMaps := make(map[string]map[uint64]bool)\n sizes := make(map[string]uint64)\n\n for _, result := range search.matches {\n\n chunkMap, found := chunkMaps[result.FileName]\n\n if !found {\n chunkMap = make(map[uint64]bool)\n chunkMaps[result.FileName] = chunkMap\n }\n\n for _, chunkId := range result.ChunkMap {\n chunkMap[chunkId] = true\n }\n\n sizes[result.FileName] = result.ChunkCount\n }\n\n count := 0\n\n FILE_LOOP:\n for name, chunkMap := range chunkMaps {\n\n size, found := sizes[name]\n\n if !found {\n continue FILE_LOOP\n }\n\n for i := uint64(1); i <= size; i++ {\n\n _, found := chunkMap[i]\n\n if !found {\n continue FILE_LOOP\n }\n }\n\n count++\n }\n\n return count >= 2\n}", "title": "" }, { "docid": "11a78403b398a54acf0a4e7a36c3fcae", "score": "0.45242167", "text": "func (o *EventRestEntry) HasStartTime() bool {\n\tif o != nil && o.StartTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8d06924323761aa515056b3740da6c77", "score": "0.4515027", "text": "func (v *View) Start(usePlugin bool) bool {\n\tif v.mainCursor() {\n\t\tif usePlugin && !PreActionCall(\"Start\", v) {\n\t\t\treturn false\n\t\t}\n\n\t\tv.Topline = 0\n\n\t\tif usePlugin {\n\t\t\treturn PostActionCall(\"Start\", v)\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "974061f4bcc2391bdf528df4c299bf25", "score": "0.4511564", "text": "func (e *GenericElem) indexOfWithLock(alignedStart int64) (int, bool) {\n\tnumValues := len(e.values)\n\t// Optimize for the common case.\n\tif numValues > 0 && e.values[numValues-1].startAtNanos == alignedStart {\n\t\treturn numValues - 1, true\n\t}\n\t// Binary search for the unusual case. We intentionally do not\n\t// use the sort.Search() function because it requires passing\n\t// in a closure.\n\tleft, right := 0, numValues\n\tfor left < right {\n\t\tmid := left + (right-left)/2 // avoid overflow\n\t\tif e.values[mid].startAtNanos < alignedStart {\n\t\t\tleft = mid + 1\n\t\t} else {\n\t\t\tright = mid\n\t\t}\n\t}\n\t// If the current timestamp is equal to or larger than the target time,\n\t// return the index as is.\n\tif left < numValues && e.values[left].startAtNanos == alignedStart {\n\t\treturn left, true\n\t}\n\treturn left, false\n}", "title": "" }, { "docid": "bdec67e91f7cd2b1c08b5f4891697511", "score": "0.45112312", "text": "func IsStartAnchor(tk html.Token) bool {\r\n\treturn tk.Type == html.StartTagToken && tk.Data == \"a\"\r\n}", "title": "" }, { "docid": "afd53d19a51e272492f40afd0b9ab61d", "score": "0.45102456", "text": "func (m *TimesheetMutation) StartedAt() (r time.Time, exists bool) {\n\tv := m.started_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "3bd0e727da7a63b900544b7ba9f2e85a", "score": "0.4508396", "text": "func (_Opslp *OpslpSession) StartBlock() (*big.Int, error) {\n\treturn _Opslp.Contract.StartBlock(&_Opslp.CallOpts)\n}", "title": "" }, { "docid": "4f223f9737af0e93679023163c2d61e7", "score": "0.45074892", "text": "func (as *Step) Start() bool {\n\tif as.StepComponent.Started != nil {\n\t\treturn false\n\t}\n\tas.StepComponent.Started = as.s.annotationNow()\n\treturn true\n}", "title": "" }, { "docid": "f82fc0219a07d42d8c76ac42e9a344f5", "score": "0.4499801", "text": "func (m *ObjectStorageMock) GetObjectIndexFinished() bool {\n\t// if expectation series were set then invocations count should be equal to expectations count\n\tif len(m.GetObjectIndexMock.expectationSeries) > 0 {\n\t\treturn atomic.LoadUint64(&m.GetObjectIndexCounter) == uint64(len(m.GetObjectIndexMock.expectationSeries))\n\t}\n\n\t// if main expectation was set then invocations count should be greater than zero\n\tif m.GetObjectIndexMock.mainExpectation != nil {\n\t\treturn atomic.LoadUint64(&m.GetObjectIndexCounter) > 0\n\t}\n\n\t// if func was set then invocations count should be greater than zero\n\tif m.GetObjectIndexFunc != nil {\n\t\treturn atomic.LoadUint64(&m.GetObjectIndexCounter) > 0\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "61584cabd33910d72bae017e64a138ef", "score": "0.4494602", "text": "func (o *VscanModifyDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "6ca3ac80c8b28342f58d2169b9ae9007", "score": "0.44857797", "text": "func (_Opslp *OpslpCallerSession) StartBlock() (*big.Int, error) {\n\treturn _Opslp.Contract.StartBlock(&_Opslp.CallOpts)\n}", "title": "" }, { "docid": "465ee4be25a41d3bbd47e5211dce2e81", "score": "0.44847453", "text": "func (me TxsdIndextermClass) IsEndofrange() bool { return me == \"endofrange\" }", "title": "" }, { "docid": "d3b96b6c2ae0554084e881c6d4b5a5e2", "score": "0.44835615", "text": "func (s *Server) Started() bool {\n\treturn s.isStarted()\n}", "title": "" }, { "docid": "9ffd2baed4a9f58392f30bfab52b3b7c", "score": "0.447357", "text": "func (f *Field) NeedsIndex() bool {\n\treturn f.ForeignKeyLookup || f.Indexed\n}", "title": "" }, { "docid": "d62eef6baae2ee0d32dea1638796c66c", "score": "0.44714016", "text": "func (section *ImageSectionHeader) Contains(rva uint32, pe *File) bool {\r\n\r\n\t// Check if the SizeOfRawData is realistic. If it's bigger than the size of\r\n\t// the whole PE file minus the start address of the section it could be\r\n\t// either truncated or the SizeOfRawData contains a misleading value.\r\n\t// In either of those cases we take the VirtualSize.\r\n\r\n\tvar size uint32\r\n\tadjustedPointer := pe.adjustFileAlignment(section.PointerToRawData)\r\n\tif uint32(len(pe.data))-adjustedPointer < section.SizeOfRawData {\r\n\t\tsize = section.VirtualSize\r\n\t} else {\r\n\t\tsize = Max(section.SizeOfRawData, section.VirtualSize)\r\n\t}\r\n\tvaAdj := pe.adjustSectionAlignment(section.VirtualAddress)\r\n\r\n\t// Check whether there's any section after the current one that starts before\r\n\t// the calculated end for the current one. If so, cut the current section's\r\n\t// size to fit in the range up to where the next section starts.\r\n\tif section.NextHeaderAddr(pe) != 0 &&\r\n\t\tsection.NextHeaderAddr(pe) > section.VirtualAddress &&\r\n\t\tvaAdj+size > section.NextHeaderAddr(pe) {\r\n\t\tsize = section.NextHeaderAddr(pe) - vaAdj\r\n\t}\r\n\r\n\treturn vaAdj <= rva && rva < vaAdj+size\r\n}", "title": "" }, { "docid": "90a0099bf669e4b30fc55a0998c4508f", "score": "0.44702595", "text": "func (t *Type) UseIndex() bool {\n\treturn t.IndexRegExpr != \"\"\n}", "title": "" }, { "docid": "7b604aaf04314820eef918ba5f2baa94", "score": "0.44696486", "text": "func (m *AlertMutation) StartedAt() (r time.Time, exists bool) {\n\tv := m.startedAt\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "645024a614d45398e75cfede44dbb8fd", "score": "0.44681486", "text": "func (b *Block) IsValid(pvb *Block) bool {\n\tvar metaData string\n\tif b.PVHash != pvb.Hash || (pvb.Index+1) != b.Index {\n\t\treturn false\n\t}\n\ttStr := strconv.FormatInt(b.Timestamp, 10)\n\tnStr := strconv.FormatInt(b.Index, 10)\n\tnoStr := strconv.FormatInt(b.Nonce, 10)\n\tmetaData = b.PVHash + tStr + b.Data + nStr\n\treturn dhash.Verification(append([]byte(metaData), []byte(noStr)...), b.Hash)\n}", "title": "" }, { "docid": "47403e593cd4a037e4a58a759e938f14", "score": "0.44666192", "text": "func (is IndexSet) HasInmemIndex() bool {\n\tfor _, idx := range is.Indexes {\n\t\tif idx.Type() == InmemIndexName {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6684d7bea3deb9900a81d7e70e86e5cf", "score": "0.4466591", "text": "func (s *commonaibenchSimulator) Finished() bool {\n\treturn s.recordIndex >= s.maxTransactions\n}", "title": "" }, { "docid": "ef670bb299e4778e24b77467a3b24d7f", "score": "0.44649684", "text": "func (o *BudgetLimitStore) GetStartOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Start, true\n}", "title": "" }, { "docid": "e869870f0d7a5c536751c04f88a3bc56", "score": "0.44617298", "text": "func (lock *Lock) IsLockedFor(key []byte, txnStartTs uint64, resp interface{}) bool {\n\tif lock == nil {\n\t\treturn false\n\t}\n\tif txnStartTs == TsMax && bytes.Compare(key, lock.Primary) != 0 {\n\t\treturn false\n\t}\n\n\tif lock.Ts <= txnStartTs {\n\t\terr := &kvrpcpb.KeyError{Locked: lock.Info(key)\t}\n\t\trespValue := reflect.ValueOf(resp)\n\t\treflect.Indirect(respValue).FieldByName(\"Error\").Set(reflect.ValueOf(err))\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1e731bdadfef86531aae4ffb1857b1ea", "score": "0.4460013", "text": "func (i *Iter) Valid() bool {\n\treturn i.index >= 0 && i.index < len(i.tombstones)\n}", "title": "" }, { "docid": "d869e59e87c5dfbf6170f77f782660d4", "score": "0.44575113", "text": "func (o *VscanModifyOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "3760b06fde10cd5269610a7f82a208ef", "score": "0.44562715", "text": "func (s *Service) Started() bool {\n\treturn s.started\n}", "title": "" }, { "docid": "0cc9eba6c38d4a10d4bbe4d30581eb2a", "score": "0.44555378", "text": "func (env *ASREnvelope) Started() bool {\n\treturn env.started\n}", "title": "" }, { "docid": "61fe42e1089aaa9aa4264dd745538dac", "score": "0.44517747", "text": "func (m *ObjectStorageMock) IterateIndexIDsFinished() bool {\n\t// if expectation series were set then invocations count should be equal to expectations count\n\tif len(m.IterateIndexIDsMock.expectationSeries) > 0 {\n\t\treturn atomic.LoadUint64(&m.IterateIndexIDsCounter) == uint64(len(m.IterateIndexIDsMock.expectationSeries))\n\t}\n\n\t// if main expectation was set then invocations count should be greater than zero\n\tif m.IterateIndexIDsMock.mainExpectation != nil {\n\t\treturn atomic.LoadUint64(&m.IterateIndexIDsCounter) > 0\n\t}\n\n\t// if func was set then invocations count should be greater than zero\n\tif m.IterateIndexIDsFunc != nil {\n\t\treturn atomic.LoadUint64(&m.IterateIndexIDsCounter) > 0\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "876c7b5cc0a1efbc08df09c81e4cdb4a", "score": "0.4451475", "text": "func (s *timingScheduler) IsStarted() bool {\n\treturn s.isStarted\n}", "title": "" }, { "docid": "b43635b9b11f9879dfc6bfbaeaf3c221", "score": "0.44458666", "text": "func (o *SLOCorrectionUpdateRequestAttributes) GetStartOk() (*int64, bool) {\n\tif o == nil || o.Start == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Start, true\n}", "title": "" }, { "docid": "2316d217b8575f88ac0f830050c0b797", "score": "0.4434119", "text": "func (master *ShardMaster) callStart(op Op) bool {\n\tindex, _, isLeader := master.rf.Start(op)\n\n\t//the raft is no longer the leader -> return failed and the client will try it again\n\tif isLeader == false {\n\t\treturn false\n\t}\n\tmaster.mu.Lock()\n\tch, ok := master.result[index]\n\n\t//if there isn't a channel used to pass the finish message than create one\n\tif !ok {\n\t\tch = make(chan Op, 1)\n\t\tmaster.result[index] = ch\n\t}\n\n\tmaster.mu.Unlock()\n\tselect {\n\tcase cmd := <-ch:\n\t\treturn compareEqual(cmd, op)\n\tcase <-time.After(800 * time.Millisecond):\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "010fe484b7c152383c6685a39ad9ca95", "score": "0.44336373", "text": "func (entry *Entry) NeedsIndexGarbageCollected() bool {\n\t// This is a cheaper check that loading the entry from the shard again\n\t// which makes it cheaper to run frequently.\n\t// It may not be as accurate, but it's fine for an approximation since\n\t// only a single series in a segment needs to return true to trigger an\n\t// index segment to be garbage collected.\n\tif entry.insertTime.Load() == 0 {\n\t\treturn false // Not inserted, does not need garbage collection.\n\t}\n\t// Check that a write is not potentially pending and the series is empty.\n\treturn entry.ReaderWriterCount() == 0 && entry.Series.IsEmpty()\n}", "title": "" }, { "docid": "f8e6417097ab9cc643f1915c1058323e", "score": "0.44292688", "text": "func (p *iteratorHandler) Valid() bool {\n\treturn leveldb_iter_valid(p.it)\n}", "title": "" }, { "docid": "be2e5c6da5d1417737554f0e1788b8df", "score": "0.4428216", "text": "func (i *Indexer) Start() error {\n\tlog.Debug().Verb(\"starting\").Object(\"indexer\")\n\treturn i.Consumer.StartConsumer(func(v interface{}) error {\n\t\tswitch v.(type) {\n\t\tcase *model.Command:\n\t\t\treturn i.recordCommand(v.(*model.Command))\n\t\tcase *model.Event:\n\t\t\treturn i.recordEvent(v.(*model.Event))\n\t\tdefault:\n\t\t\treturn nil\n\t\t}\n\t})\n}", "title": "" }, { "docid": "b7f0a1e66ad25a9645d7f23f7bd347ef", "score": "0.44259253", "text": "func (c *Context) BlockSent() bool { return c.block != nil }", "title": "" }, { "docid": "3870cee05a94b62fd7475f7deab4cf27", "score": "0.44250917", "text": "func (i Index) IsValid() bool {\n\treturn len(i.Columns) > 0\n}", "title": "" }, { "docid": "099b73c5beefeadb115f5ee57f07882a", "score": "0.44217032", "text": "func (o *Ga4ghSearchReadsRequest) GetStartOk() (string, bool) {\n\tif o == nil || o.Start == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Start, true\n}", "title": "" }, { "docid": "7c0ee3373feb176f7c3bd67fef30dd4f", "score": "0.44109353", "text": "func (fragmentIn FinitePathFragment) IsInitial() bool {\n\tinitialState := fragmentIn.s[0]\n\tSystem := *&initialState.System\n\n\treturn initialState.In(System.I)\n}", "title": "" }, { "docid": "7f43253baa0b8c726093ce5609319ce5", "score": "0.44094345", "text": "func (v UInt32SparseVec) GetIndex(r, c uint32) bool {\n\t// fmt.Printf(\"GetIndex: r = %d, c = %d\\n\", r, c)\n\t// fmt.Println(\"GetIndex: v.Colptr =\", v.Colptr)\n\t// fmt.Println(\"GetIndex: len(v.Colptr) =\", len(v.Colptr))\n\t// fmt.Println(\"GetIndex: lencheck = \", len(v.Colptr) <= int(c)+1)\n\tif len(v.Colptr) <= int(c)+1 {\n\t\treturn false\n\t}\n\n\t_, found := searchsorted32(r, v.GetRange(c))\n\t// fmt.Println(\"GetIndex: colptr = \", v.Colptr)\n\t// fmt.Println(\"GetIndex: rowidx = \", v.Rowidx)\n\t// fmt.Println(\"GetIndex: found = \", found)\n\treturn found\n}", "title": "" }, { "docid": "5df5afd7a3e7452a4caf82669977c23a", "score": "0.44014245", "text": "func (r *CellItem) Contains(key []byte) bool {\n\tstart, end := r.cell.Start, r.cell.End\n\t// len(end) == 0: max field is positive infinity\n\treturn bytes.Compare(key, start) >= 0 && (len(end) == 0 || bytes.Compare(key, end) < 0)\n}", "title": "" }, { "docid": "004ac38e1827323207c0831b9cea4e7a", "score": "0.43948278", "text": "func (repo *batchRepo) HasStarted(batchID string) (bool, error) {\n\tvar batchJob BatchJob\n\terr := repo.db.Preload(\"Events\").Where(\"batch_id = ?\", batchID).First(&batchJob).Error\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn hasStarted(batchJob.Status()), nil\n}", "title": "" }, { "docid": "73b124585c46869fb9bec344dd62b86e", "score": "0.43939227", "text": "func (c *Command) IsStarted() bool {\n\treturn true\n}", "title": "" }, { "docid": "c29c7b66a1cb237ed1caed48a242cbda", "score": "0.43932974", "text": "func (v *indexInfo) isCoveringIndex(scan *scanNode) bool {\n\tif v.index == &v.desc.PrimaryIndex {\n\t\t// The primary key index always covers all of the columns.\n\t\treturn true\n\t}\n\n\tfor i, needed := range scan.valNeededForCol {\n\t\tif needed {\n\t\t\tcolID := scan.visibleCols[i].ID\n\t\t\tif !v.index.containsColumnID(colID) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "3bf8ea12aa321c56115b4662db1d5216", "score": "0.4384062", "text": "func (ch *Chain) IsRequestProcessed(reqID isc.RequestID) bool {\n\tret, err := ch.CallView(blocklog.Contract.Name, blocklog.ViewIsRequestProcessed.Name,\n\t\tblocklog.ParamRequestID, reqID)\n\trequire.NoError(ch.Env.T, err)\n\tresultDecoder := kvdecoder.New(ret, ch.Log())\n\tisProcessed, err := resultDecoder.GetBool(blocklog.ParamRequestProcessed)\n\trequire.NoError(ch.Env.T, err)\n\treturn isProcessed\n}", "title": "" }, { "docid": "1d87641820fe98c0359b6ac7487e34bd", "score": "0.43817487", "text": "func (m MediaType) IsIndex() bool {\n\tswitch m {\n\tcase OCIImageIndex, DockerManifestList:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bb1671ab007a5abe9a563e12b7380693", "score": "0.43811616", "text": "func (drive Drive) CanStart() bool {\n\tret0 := C.g_drive_can_start(drive.native())\n\treturn util.Int2Bool(int(ret0)) /*go:.util*/\n}", "title": "" } ]
a91055ca669b95c3abeb1cdfa7a414f5
NewDefaultOptions creates the default options.
[ { "docid": "de8eea5f6876a02c59ea9264e1676ed5", "score": "0.7827456", "text": "func NewDefaultOptions() OptionsBuilder {\n\treturn &options{\n\t\tdelay: DefaultUploadDelay,\n\t\tthreads: DefaultUploadThreadNum,\n\t\tlogger: nil,\n\t\tlock: DefaultUseLock,\n\t\tnameFunc: DefaultNameFunc,\n\t\tskipFunc: DefaultSkipFunc,\n\t}\n}", "title": "" } ]
[ { "docid": "c544c71cb0883bc88faebfbd81a609a6", "score": "0.7951097", "text": "func newDefaultOptions() *Options {\n\treturn &Options{\n\t\tParseEnv: true,\n\n\t\tVarOpen: \"%(\",\n\t\tVarClose: \")s\",\n\t\tTagName: DefTagName,\n\n\t\tDefSection: parser.DefSection,\n\t\tSectionSep: SepSection,\n\t}\n}", "title": "" }, { "docid": "33f619697e3a125753a6d385358c42bf", "score": "0.78614336", "text": "func NewDefaultOptions() Options {\n\treturn Options{\n\t\tFilesInCollection: 10,\n\t\tGasPrice: \"\",\n\t\tMaxPathnameLength: 64,\n\t\tPostageAmount: 1,\n\t\tPostageDepth: 16,\n\t\tPostageLabel: \"test-label\",\n\t\tPostageWait: 5 * time.Second,\n\t\tSeed: 0,\n\t}\n}", "title": "" }, { "docid": "483cdfff4fe4a6214dbf63cf2058eb79", "score": "0.78316337", "text": "func NewDefaultOptions() Options {\n\treturn Options{\n\t\tFileSize: 1,\n\t\tGasPrice: \"\",\n\t\tPostageAmount: 1000,\n\t\tPostageDepth: 16,\n\t\tPostageLabel: \"test-label\",\n\t\tPostageWait: 5 * time.Second,\n\t\tRetries: 5,\n\t\tRetryDelay: 1 * time.Second,\n\t\tSeed: 0,\n\t\tTimeout: 5 * time.Minute,\n\t\tUploadNodePercentage: 50,\n\t}\n}", "title": "" }, { "docid": "0e9e166b88da505935d46e85c5dd9c89", "score": "0.78060156", "text": "func NewDefaultOptions(root string) OptionsBuilder {\n\tif !strings.HasSuffix(root, PathSeparator) {\n\t\troot += PathSeparator\n\t}\n\treturn &options{\n\t\troot: root,\n\t\tdata: DefaultDataDir,\n\t\ttmp: DefaultTempDir,\n\t\thashFunc: DefaultHashFunc,\n\t\tdirLevel: DefaultDirLevel,\n\t\tuseGzip: DefaultUseGzip,\n\t\tgzipLevel: DefaultGzipLevel,\n\t}\n}", "title": "" }, { "docid": "d15c756bcc300543e91559d20bc7ab08", "score": "0.7440038", "text": "func NewDefaultOptions(out, err io.Writer) *AggregatorOptions {\n\to := &AggregatorOptions{\n\t\tServerRunOptions: genericoptions.NewServerRunOptions(),\n\t\tRecommendedOptions: genericoptions.NewRecommendedOptions(\n\t\t\tdefaultEtcdPathPrefix,\n\t\t\taggregatorscheme.Codecs.LegacyCodec(v1.SchemeGroupVersion),\n\t\t),\n\t\tAPIEnablement: genericoptions.NewAPIEnablementOptions(),\n\n\t\tStdOut: out,\n\t\tStdErr: err,\n\t}\n\n\treturn o\n}", "title": "" }, { "docid": "7beeb0266ad23be207d983df62cc165d", "score": "0.7393603", "text": "func DefaultOptions() Options {\n\treturn Options{}\n}", "title": "" }, { "docid": "557284afd3157e90424005270b62dd4a", "score": "0.7192008", "text": "func DefaultOptions() Options {\n\treturn Options{\n\t\tSize: DefaultSize,\n\t}\n}", "title": "" }, { "docid": "69dc728e439a82b26041e3be31fde08d", "score": "0.71814054", "text": "func DefaultOptions() *Options {\n\treturn &Options{\n\t\tCmdLine: true,\n\t\tProfile: true,\n\t\tSymbol: true,\n\t\tTrace: true,\n\t\tHeap: true,\n\t\tBlock: true,\n\t\tGoroutine: true,\n\t\tThreadcreate: true,\n\t}\n}", "title": "" }, { "docid": "318e2ddfec6456ae15f48782b326ad48", "score": "0.71246576", "text": "func defaultOptions() Options {\n\treturn Options{\n\t\tConfigFileName: defaultConfigFileName,\n\t\tConfigFilePath: defaultConfigFilePath,\n\t\tSingleCommandAppName: defaultSingleCommandAppName,\n\t\tEnvVarNestedKeySeparator: defaultEnvVarNestedKeySeparator,\n\t}\n}", "title": "" }, { "docid": "b6770a40fe9b79cc5324c3dd873d6ecd", "score": "0.7103566", "text": "func DefaultOptions() Options {\n\treturn Options{\n\t\tTimeout: time.Hour,\n\t\tInitialHeadTimeout: time.Second * 5,\n\t\tRetries: 10,\n\t\tRetryWait: time.Second,\n\t\tRetryWaitMultiplier: 1.61803398875, // Bonus points to who gets it\n\t\tFileMode: 0755,\n\t\tBufferSize: 128 * 1024,\n\t}\n}", "title": "" }, { "docid": "c041eaf4bbc92f446550e3cc8a973061", "score": "0.7103062", "text": "func newDefaultOptions() *grocksdb.Options {\n\t// default rocksdb option, good enough for most cases, including heavy workloads.\n\t// 1GB table cache, 512MB write buffer(may use 50% more on heavy workloads).\n\t// compression: snappy as default, need to -lsnappy to enable.\n\tbbto := grocksdb.NewDefaultBlockBasedTableOptions()\n\tbbto.SetBlockCache(grocksdb.NewLRUCache(1 << 30))\n\tbbto.SetFilterPolicy(grocksdb.NewBloomFilter(10))\n\n\topts := grocksdb.NewDefaultOptions()\n\topts.SetBlockBasedTableFactory(bbto)\n\t// SetMaxOpenFiles to 4096 seems to provide a reliable performance boost\n\topts.SetMaxOpenFiles(4096)\n\topts.SetCreateIfMissing(true)\n\topts.IncreaseParallelism(runtime.NumCPU())\n\t// 1.5GB maximum memory use for writebuffer.\n\topts.OptimizeLevelStyleCompaction(512 * 1024 * 1024)\n\n\treturn opts\n}", "title": "" }, { "docid": "2fa3febaa76bd8c0d7298f5ad18a2933", "score": "0.70945686", "text": "func defaultOptions() *options {\n\treturn &options{\n\t\tDialFunc: DefaultDialFunc,\n\t\tLogFunc: DefaultLogFunc,\n\t}\n}", "title": "" }, { "docid": "1e53bb3b1b538217164ee50d30880e69", "score": "0.7091826", "text": "func DefaultOptions(baseDir string, workDir string) Options {\n\tret := Options{\n\t\tPrefix: \"xxx\",\n\t\tKubectl: \"kubectl\",\n\n\t\tBaseDir: baseDir,\n\t\tWorkDir: workDir,\n\n\t\tDocker: \"docker\",\n\t\tEtcdImage: etcdImage,\n\t\tHyperkubeImage: hyperkubeImage,\n\t\tDnsmasqImage: dnsmasqImage,\n\t\tClusterIpRange: \"10.0.0.0/24\",\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "413b1fc47d67ce995a4cd7bd5fdd8de7", "score": "0.7058698", "text": "func NewDefaultOptions(path string) *Options {\n\treturn &Options{\n\t\tPath: path,\n\t\tTransactionTimeOut: DefaultTransactionTimeOut,\n\t\tQueryTimeOut: DefaultQueryTimeOut,\n\t\tInternalQueryLimit: DefaultQueryLimit,\n\n\t\tBadgerOptions: DefaultBadgerOptions,\n\t\tBoltOptions: DefaultBoltOptions,\n\t}\n}", "title": "" }, { "docid": "14066f7072f6947b5db70eb2d6107f20", "score": "0.69909763", "text": "func DefaultOptions() Options {\n\treturn Options{\n\t\tIndent: 2,\n\t\tMaxBlankLines: 2,\n\t\tStringStyle: StringStyleSingle,\n\t\tCommentStyle: CommentStyleSlash,\n\t\tUseImplicitPlus: true,\n\t\tPrettyFieldNames: true,\n\t\tPadArrays: false,\n\t\tPadObjects: true,\n\t\tSortImports: true,\n\t}\n}", "title": "" }, { "docid": "be4f3cc258f766e2bf444d627163e635", "score": "0.6984751", "text": "func DefaultOptions() Options {\r\n\treturn DefaultServer.Options()\r\n}", "title": "" }, { "docid": "6cc7d2d7ebf4dc102403da7e5609f2ae", "score": "0.69814444", "text": "func defaultOptions() interface{} {\n\treturn &options{\n\t\tconfFile: \"\",\n\t\tconfDir: \"/etc/cmk\",\n\t\tcreateNodeLabel: defaultConfig().(*conf).LabelNode,\n\t\tcreateNodeTaint: defaultConfig().(*conf).TaintNode,\n\t}\n}", "title": "" }, { "docid": "65ad0d959958554436f0709f05bc80c2", "score": "0.69629335", "text": "func DefaultOptions() Options {\n\treturn DefaultServer.Options()\n}", "title": "" }, { "docid": "00732f03e81c704354b3466644e5d8f0", "score": "0.69436663", "text": "func defaultOptions() *pebble.Options {\n\tcomparer := *pebble.DefaultComparer\n\tcomparer.Split = func(a []byte) int {\n\t\treturn len(a)\n\t}\n\topts := &pebble.Options{\n\t\tComparer: &comparer,\n\t\tFS: vfs.NewMem(),\n\t}\n\topts.EnsureDefaults()\n\treturn opts\n}", "title": "" }, { "docid": "35da6585c3754ca629f2b2bc8c7d33ee", "score": "0.688844", "text": "func DefaultOptions() Options {\n\treturn Options{\n\t\tDir: \".\",\n\t\tAddress: \"127.0.0.1\",\n\t\tPort: 3325,\n\t\tImmudbAddress: \"127.0.0.1\",\n\t\tImmudbPort: 3322,\n\t\tDetached: false,\n\t\tMTLs: false,\n\t\tConfig: \"configs/immutc.toml\",\n\t\tPidfile: \"\",\n\t\tLogfile: \"\",\n\t}\n}", "title": "" }, { "docid": "df0fba0c84faf5b60bee8f851a82867b", "score": "0.68110824", "text": "func DefaultOptions() *Options {\n\treturn &Options{\n\t\tDescriptionComments: true,\n\t\tComments: true,\n\t}\n}", "title": "" }, { "docid": "12952c4fbabfc03ffaeebe8a79dfd3fc", "score": "0.67874604", "text": "func DefaultOptions() Options {\n\treturn Options{\n\t\tFailOnConsoleExceptions: false,\n\t\tWaitDelay: 0,\n\t\tWaitWindowStatus: \"\",\n\t\tWaitForExpression: \"\",\n\t\tUserAgent: \"\",\n\t\tExtraHTTPHeaders: nil,\n\t\tExtraLinkTags: nil,\n\t\tEmulatedMediaType: \"\",\n\t\tExtraScriptTags: nil,\n\t\tLandscape: false,\n\t\tPrintBackground: false,\n\t\tOmitBackground: false,\n\t\tScale: 1.0,\n\t\tPaperWidth: 8.5,\n\t\tPaperHeight: 11,\n\t\tMarginTop: 0.39,\n\t\tMarginBottom: 0.39,\n\t\tMarginLeft: 0.39,\n\t\tMarginRight: 0.39,\n\t\tPageRanges: \"\",\n\t\tHeaderTemplate: \"<html><head></head><body></body></html>\",\n\t\tFooterTemplate: \"<html><head></head><body></body></html>\",\n\t\tPreferCSSPageSize: false,\n\t}\n}", "title": "" }, { "docid": "f5c73c8306cc2a419bd753d0425d6709", "score": "0.67476714", "text": "func getDefaultOptions() *appOptions {\n\toptions := newAppOptions(flag.NewFlagSet(\"main\", flag.ExitOnError))\n\toptions.flagSet.Parse([]string{})\n\treturn options\n}", "title": "" }, { "docid": "bbd6ec69cf695407fb82006049b232ee", "score": "0.67043006", "text": "func DefaultOptions() *Options {\n\treturn &Options{\n\t\tRateLimit: 150,\n\t\tBulkSize: 25,\n\t\tTemplateThreads: 25,\n\t\tHeadlessBulkSize: 10,\n\t\tHeadlessTemplateThreads: 10,\n\t\tTimeout: 5,\n\t\tRetries: 1,\n\t\tMaxHostError: 30,\n\t\tResponseReadSize: 10 * 1024 * 1024,\n\t\tResponseSaveSize: 1024 * 1024,\n\t}\n}", "title": "" }, { "docid": "fb97e41b8f4cda174c944e1ebcda184a", "score": "0.662547", "text": "func DefaultTestOptions() TestOptions {\n\treturn TestOptions{\n\t\tOutput: \"out.test\",\n\t}\n}", "title": "" }, { "docid": "ea237ed4d51f96fa44a0b977ec06899e", "score": "0.65699226", "text": "func DefaultOptions() *Options {\n\treturn &Options{\n\t\tRegion: \"us-west-2\",\n\t\tAccessKey: os.Getenv(\"AWS_ACCESS_KEY_ID\"),\n\t\tAccessSecret: os.Getenv(\"AWS_SECRET_ACCESS_KEY\"),\n\t\tAccessToken: os.Getenv(\"AWS_SESSION_TOKEN\"),\n\t}\n}", "title": "" }, { "docid": "2a3b78b0430b0e3410d1a54ac023443e", "score": "0.65592664", "text": "func newOptions() *options {\n\treturn &options{\n\t\tos: sys.DefaultOS(),\n\t}\n}", "title": "" }, { "docid": "7859fb44c226c4bc843f4592067666fc", "score": "0.65224546", "text": "func defaultOptions() *options {\n\treturn &options{\n\t\tDial: client.DefaultDialFunc,\n\t\tDriverName: \"dqlite\",\n\t\tFormat: formatTabular,\n\t}\n}", "title": "" }, { "docid": "9e9b7ec3571b5c1f04cb5470294cb4de", "score": "0.650611", "text": "func GetDefaultOptions() (o *Options) {\n\topts := defaultOptions\n\topts.StoreLimits = stores.DefaultStoreLimits\n\treturn &opts\n}", "title": "" }, { "docid": "12895390916e4a76820b2ec51559be4d", "score": "0.64834976", "text": "func newEmptyOptions(eval *evalVisitor) *Options {\n\treturn &Options{\n\t\teval: eval,\n\t\thash: make(map[string]interface{}),\n\t}\n}", "title": "" }, { "docid": "9352899705bab5af40f2d00ce8c1ae8a", "score": "0.6471908", "text": "func DefaultOptions() Options {\n\treturn Options{\n\t\tEnumTableSuffix: \"_enum\",\n\t\tAssociationTableSuffix: \"_assn\",\n\t\tForeignKeySuffix: \"_id\",\n\t}\n}", "title": "" }, { "docid": "3cb83ffc54026e29c3b4d81ff6ca36c1", "score": "0.6466891", "text": "func defaultOptions() interface{} {\n\to := &options{}\n\n\ttype param struct {\n\t\tdefval string\n\t\tparsefn func(string) error\n\t}\n\n\tparams := map[string]param{\n\t\t\"JAEGER_COLLECTOR\": {\n\t\t\tdefaultJaegerCollector,\n\t\t\tfunc(v string) error { o.JaegerCollector = v; return nil },\n\t\t},\n\t\t\"JAEGER_AGENT\": {\n\t\t\tdefaultJaegerAgent,\n\t\t\tfunc(v string) error { o.JaegerAgent = v; return nil },\n\t\t},\n\t\t\"HTTP_ENDPOINT\": {\n\t\t\tdefaultHTTPEndpoint,\n\t\t\tfunc(v string) error { o.HTTPEndpoint = v; return nil },\n\t\t},\n\t\t\"PROMETHEUS_EXPORT\": {\n\t\t\tdefaultPrometheusExport,\n\t\t\tfunc(v string) error {\n\t\t\t\tenabled, err := utils.ParseEnabled(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\to.PrometheusExport = enabled\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\t\"SAMPLING_FREQUENCY\": {\n\t\t\tdefaultSampling,\n\t\t\tfunc(v string) error { return o.Sampling.Parse(v) },\n\t\t},\n\t\t\"REPORT_PERIOD\": {\n\t\t\tdefaultReportPeriod,\n\t\t\tfunc(v string) error {\n\t\t\t\td, err := time.ParseDuration(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\to.ReportPeriod = d\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t}\n\n\tfor envvar, p := range params {\n\t\tparseEnv(envvar, p.defval, p.parsefn)\n\t}\n\n\treturn o\n}", "title": "" }, { "docid": "1ea390fba44223e66d66cea4238eebf3", "score": "0.63790685", "text": "func newDefault(compilers Compilers) *Context {\n\tc := &Context{compilers, options{}}\n\t_ = defaultOptions(c)\n\treturn c\n}", "title": "" }, { "docid": "98f5e3efd4ad07635b5b6e003b9eb706", "score": "0.6321452", "text": "func DefaultClientOptions(endpoint, mtlsEndpoint, scope, userAgent string) ([]option.ClientOption, error) {\n\tvar o []option.ClientOption\n\t// Check the environment variables for the bigtable emulator.\n\t// Dial it directly and don't pass any credentials.\n\tif addr := os.Getenv(\"BIGTABLE_EMULATOR_HOST\"); addr != \"\" {\n\t\tconn, err := grpc.Dial(addr, grpc.WithInsecure())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"emulator grpc.Dial: %w\", err)\n\t\t}\n\t\to = []option.ClientOption{option.WithGRPCConn(conn)}\n\t} else {\n\t\to = []option.ClientOption{\n\t\t\tinternaloption.WithDefaultEndpoint(endpoint),\n\t\t\tinternaloption.WithDefaultMTLSEndpoint(mtlsEndpoint),\n\t\t\toption.WithScopes(scope),\n\t\t\toption.WithUserAgent(userAgent),\n\t\t}\n\t}\n\treturn o, nil\n}", "title": "" }, { "docid": "818a9bbcd740405722a1e5acae3dd062", "score": "0.6317799", "text": "func DefaultOpts() Options {\n\treturn Options{\n\t\tCacheSize: 1024,\n\t\tTTLInterval: time.Second,\n\t\tWriteRetries: 5,\n\t}\n}", "title": "" }, { "docid": "f89eb4a9f752c9c0596f9e0794da38cb", "score": "0.63003916", "text": "func DefaultSignerOptions() SignerOptions {\n\treturn SignerOptions{\n\t\tConfigMapNamespace: api.NamespacePublic,\n\t\tConfigMapName: bootstrapapi.ConfigMapClusterInfo,\n\t\tTokenSecretNamespace: api.NamespaceSystem,\n\t}\n}", "title": "" }, { "docid": "23aebd2d8f74cbe861a3cf494c3b5bec", "score": "0.62954515", "text": "func DefaultOpts() Opts {\n\treturn Opts{\n\t\tMinRunInterval: MinRunInterval,\n\t\tMaxTimeout: MaxTimeout,\n\n\t\tDefaultRunInterval: DefaultRunInterval,\n\t\tDefaultTimeout: DefaultTimeout,\n\n\t\tMaxCheckParallelism: MaxCheckParallelism,\n\t}\n}", "title": "" }, { "docid": "5e8a15542112d87cb800e89043c1abe3", "score": "0.629449", "text": "func newOptions() *Options {\n\topts := &Options{}\n\n\toptions := []Option{\n\t\tWithConcurrency(defaultConcurrency),\n\t\tWithMaxRetries(defaultMaxRetries),\n\t\tWithTTL(defaultTTL),\n\t\tWithTimeout(defaultTimeout),\n\t\tWithRetryIntervals(defaultRetryIntervals),\n\t\tWithInitialize(true),\n\t}\n\n\tfor i := range options {\n\t\toptions[i](opts)\n\t}\n\n\treturn opts\n}", "title": "" }, { "docid": "a0e416cc5fc7c83a602560d5f6adc33c", "score": "0.6293885", "text": "func DefaultOptions(o *Options) {\n\to.MaxAttempts = DefaultMaxAttempts\n\to.DelayProvider = ConstantDelay(DefaultRetryDelay)\n\to.ShouldRetryProvider = func(_ error) bool { return true }\n}", "title": "" }, { "docid": "93cec0983ceb4db196bf9a3b6f670152", "score": "0.6239761", "text": "func DefaultServerOptions() *ServerOptions {\n\treturn &ServerOptions{}\n}", "title": "" }, { "docid": "5d62e47afc5e8fda601f37c7a7dfc697", "score": "0.6228544", "text": "func DefaultVHSOptions() Options {\n\tstyle := DefaultStyleOptions()\n\tvideo := DefaultVideoOptions()\n\tvideo.Style = style\n\tscreenshot := NewScreenshotOptions(video.Input, style)\n\n\treturn Options{\n\t\tFontFamily: defaultFontFamily,\n\t\tFontSize: defaultFontSize,\n\t\tLetterSpacing: defaultLetterSpacing,\n\t\tLineHeight: defaultLineHeight,\n\t\tTypingSpeed: defaultTypingSpeed,\n\t\tShell: Shells[defaultShell],\n\t\tTheme: DefaultTheme,\n\t\tCursorBlink: defaultCursorBlink,\n\t\tVideo: video,\n\t\tScreenshot: screenshot,\n\t}\n}", "title": "" }, { "docid": "0d510f9c6461d0d7995d624ca9379931", "score": "0.621668", "text": "func DefaultOption() *Options {\n\treturn &Options{\n\t\tdbRootPath: DefaultDbRootPath,\n\t\tstoreOpts: store.DefaultOptions(),\n\t\treadTxPoolSize: DefaultReadTxPoolSize,\n\t\tTruncationFrequency: DefaultTruncationFrequency,\n\t}\n}", "title": "" }, { "docid": "34f6c48d16d6df462d428a0553210043", "score": "0.6204361", "text": "func DefaultOpts() *Opts {\n\treturn &Opts{\n\t\tRegTimeout: 3 * time.Second,\n\t\tRelayTimeout: 100 * time.Millisecond,\n\t\teventHubProvider: defaultEHProvider,\n\t\tEventHubRetryInterval: 2 * time.Second,\n\t}\n}", "title": "" }, { "docid": "2b6a5813d7cab785f2a405bc0b93b2b1", "score": "0.6186587", "text": "func DefaultNextzenOptions() *NextzenOptions {\n\n\topts := &NextzenOptions{\n\t\tAPIKey: \"\",\n\t\tStyleURL: \"\",\n\t\tTileURL: NEXTZEN_MVT_ENDPOINT,\n\t}\n\n\treturn opts\n}", "title": "" }, { "docid": "0cff5fae3412ea6058c50ae8e2c57b48", "score": "0.6181646", "text": "func CreateOptionDefaults() CreateOptions {\n\treturn CreateOptions{\n\t\tWithCreateNamespace(\"default\"),\n\t}\n}", "title": "" }, { "docid": "0cff5fae3412ea6058c50ae8e2c57b48", "score": "0.6181646", "text": "func CreateOptionDefaults() CreateOptions {\n\treturn CreateOptions{\n\t\tWithCreateNamespace(\"default\"),\n\t}\n}", "title": "" }, { "docid": "92ec7d5c1361dd99911ef809fc1be446", "score": "0.6144346", "text": "func newOptions() *options {\n\treturn &options{}\n}", "title": "" }, { "docid": "733935f7b23c6b58fb42bd57176e4647", "score": "0.61315817", "text": "func DefaultOpts() *Opts {\n\treturn &Opts{\n\t\tEventConsumerBufferSize: 100,\n\t\tEventConsumerTimeout: 100 * time.Millisecond,\n\t}\n}", "title": "" }, { "docid": "27809bd5a6eb3ead09baaba834ed151d", "score": "0.6120643", "text": "func DefaultClientOptions() *ClientOptions {\n\treturn &ClientOptions{}\n}", "title": "" }, { "docid": "8336297b353509fc54812ed09edc7c14", "score": "0.6098887", "text": "func NewOptions(opts ...Option) Options {\n\toptions := Options{\n\t\tLogger: logger.DefaultLogger,\n\t\tMeter: meter.DefaultMeter,\n\t\tTracer: tracer.DefaultTracer,\n\t}\n\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\n\treturn options\n}", "title": "" }, { "docid": "769462d183805d63a94e51208bb640bd", "score": "0.60773003", "text": "func NewDefault() Configuration {\n\tcfg := Configuration{\n\t\tEnableSyslog: false,\n\t\tEnableSSL: false,\n\t\tHttpRequestTimeout: 5,\n\t\tConnectTimeout: 5,\n\t\tClientTimeout: 50,\n\t\tClientFinTimeout: 50,\n\t\tServerTimeout: 50,\n\t\tTunnelTimeout: 3600,\n\t\tHttpKeepAliveTimeout: 60,\n\t}\n\n\treturn cfg\n}", "title": "" }, { "docid": "16f4733c59bdefa0e095b1868ff6aaa1", "score": "0.60651594", "text": "func NewOptions() Options {\n\treturn Options{\n\t\tMindepth: 0,\n\t\tMaxdepth: DefaultMaxdepth,\n\t\tFullmeta: false,\n\t}\n}", "title": "" }, { "docid": "ff16b195e7f667c84e7607742c60ee2d", "score": "0.60610193", "text": "func NewDefault() *Config {\n\tvv := defaultConfig\n\treturn &vv\n}", "title": "" }, { "docid": "ff16b195e7f667c84e7607742c60ee2d", "score": "0.60610193", "text": "func NewDefault() *Config {\n\tvv := defaultConfig\n\treturn &vv\n}", "title": "" }, { "docid": "af32b7694c35a80dee497b244bb7f626", "score": "0.6037164", "text": "func NewOptions() *Options {\n\treturn &Options{\n\t\tOverwrite: true,\n\t\tmergeFuncs: newFuncSelector(),\n\t}\n}", "title": "" }, { "docid": "4614bfc6a27e8a5d8e132fab391b3a1f", "score": "0.5995549", "text": "func NewDefaultConfig() Config {\n\treturn Config{\n\t\tName: \"avo\",\n\t\tPkg: pkg(),\n\t}\n}", "title": "" }, { "docid": "28a18b104284ba370f6f939f5db71758", "score": "0.59777135", "text": "func GetDefaultOptions() Options {\n\tnatsOptionDefaults := nats.GetDefaultOptions()\n\tinterval, _ := time.ParseDuration(\"5s\")\n\n\treturn Options{\n\t\tIndexingInterval: interval,\n\t\tNamespace: \"absinthe\",\n\n\t\tServers: natsOptionDefaults.Servers,\n\t\tNoRandomize: natsOptionDefaults.NoRandomize,\n\t\tVerbose: natsOptionDefaults.Verbose,\n\t\tPedantic: natsOptionDefaults.Pedantic,\n\t\tSecure: natsOptionDefaults.Secure,\n\t\tTLSConfig: natsOptionDefaults.TLSConfig,\n\t\tAllowReconnect: natsOptionDefaults.AllowReconnect,\n\t\tMaxReconnect: natsOptionDefaults.MaxReconnect,\n\t\tReconnectWait: natsOptionDefaults.ReconnectWait,\n\t\tTimeout: natsOptionDefaults.Timeout,\n\t\tFlusherTimeout: natsOptionDefaults.FlusherTimeout,\n\t\tPingInterval: natsOptionDefaults.PingInterval,\n\t\tMaxPingsOut: natsOptionDefaults.MaxPingsOut,\n\t\tClosedCB: natsOptionDefaults.ClosedCB,\n\t\tDisconnectedCB: natsOptionDefaults.DisconnectedCB,\n\t\tReconnectedCB: natsOptionDefaults.ReconnectedCB,\n\t\tDiscoveredServersCB: natsOptionDefaults.DiscoveredServersCB,\n\t\tAsyncErrorCB: natsOptionDefaults.AsyncErrorCB,\n\t\tReconnectBufSize: natsOptionDefaults.ReconnectBufSize,\n\t\tSubChanLen: natsOptionDefaults.SubChanLen,\n\t\tUser: natsOptionDefaults.User,\n\t\tPassword: natsOptionDefaults.Password,\n\t\tToken: natsOptionDefaults.Token,\n\t\tCustomDialer: natsOptionDefaults.CustomDialer,\n\t}\n}", "title": "" }, { "docid": "adaf5b2c2faf34925684e4da2514bf7e", "score": "0.59544885", "text": "func NewDefaultCryptoHandlerOpts() *CryptoHandlerOpts {\n\treturn &CryptoHandlerOpts{\n\t\tTransformOpts: &TransformOpts{TransformItems: []Transformable{\n\t\t\tNewFileTransformable(TfstateFilename, true, ThBkpExtension),\n\t\t\tNewFileTransformable(TfstateBkpFilename, true, ThBkpExtension)},\n\t\t\tTfvarsFilename: TfvarsFilename},\n\t\tEncProvider: ThEncryptProviderSimple,\n\t\tNamedEncKey: ThNamedEncryptionKey,\n\t\tSimpleKey: \"\",\n\t\tAllowDoubleEncrypt: true,\n\t\tExcludeWhitespaceOnly: true,\n\t\tEncMode: ThEncryptModeFull,\n\t}\n}", "title": "" }, { "docid": "c2047b61769218c75778adeed129c849", "score": "0.5953714", "text": "func defaultOptions() *bimg.Options {\n\treturn &bimg.Options{\n\t\tQuality: 85,\n\t\tCompression: 6,\n\t\tStripMetadata: true,\n\t\tType: bimg.JPEG,\n\t\tInterpretation: bimg.InterpretationSRGB,\n\t\tInterlace: true,\n\t}\n}", "title": "" }, { "docid": "52b997ff87ba221598f9fa4a0ac6b3e6", "score": "0.5949539", "text": "func WithDefaultAlgorithms() Option {\n\treturn func(opts *Registry) {\n\t\topts.algorithms = append(opts.algorithms, gzip.New())\n\t}\n}", "title": "" }, { "docid": "45eff64ab7109c011479bedd07df0949", "score": "0.59362125", "text": "func DefaultEnvOptions() *EnvOptions {\n\treturn &EnvOptions {\n\t\tEnvVars: make(map[string]string),\n\t\tPrependPath: []string{},\n\t\tAppendPath: []string{},\n\t}\n}", "title": "" }, { "docid": "9a165a4e0ddde2128cad8bc6d2c0f3e3", "score": "0.5934651", "text": "func NewDefault(opts ...DefaultOption) *Default {\n\tc := &Default{\n\t\tminSleep: 10 * time.Millisecond,\n\t\tmaxSleep: 2 * time.Second,\n\t\tdecayConstant: 2,\n\t\tattackConstant: 1,\n\t}\n\tc.Update(opts...)\n\treturn c\n}", "title": "" }, { "docid": "fa93894abe98d50c48761e27c4d47ae2", "score": "0.5904661", "text": "func newInstallOptionsWithDefaults() (*installOptions, error) {\n\tdefaults, err := l5dcharts.NewValues(false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tissuanceLifetime, err := time.ParseDuration(defaults.Identity.Issuer.IssuanceLifetime)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclockSkewAllowance, err := time.ParseDuration(defaults.Identity.Issuer.ClockSkewAllowance)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &installOptions{\n\t\tclusterDomain: defaults.Global.ClusterDomain,\n\t\tcontrolPlaneVersion: version.Version,\n\t\tcontrollerReplicas: defaults.ControllerReplicas,\n\t\tcontrollerLogLevel: defaults.ControllerLogLevel,\n\t\tprometheusImage: defaults.PrometheusImage,\n\t\thighAvailability: defaults.Global.HighAvailability,\n\t\tcontrollerUID: defaults.ControllerUID,\n\t\tdisableH2Upgrade: !defaults.EnableH2Upgrade,\n\t\tdisableHeartbeat: defaults.DisableHeartBeat,\n\t\tcniEnabled: defaults.Global.CNIEnabled,\n\t\tomitWebhookSideEffects: defaults.OmitWebhookSideEffects,\n\t\trestrictDashboardPrivileges: defaults.RestrictDashboardPrivileges,\n\t\tcontrolPlaneTracing: defaults.Global.ControlPlaneTracing,\n\t\tsmiMetricsEnabled: defaults.SMIMetrics.Enabled,\n\t\tsmiMetricsImage: defaults.SMIMetrics.Image,\n\t\tproxyConfigOptions: &proxyConfigOptions{\n\t\t\tproxyVersion: version.Version,\n\t\t\tignoreCluster: false,\n\t\t\tproxyImage: defaults.Global.Proxy.Image.Name,\n\t\t\tinitImage: defaults.Global.ProxyInit.Image.Name,\n\t\t\tinitImageVersion: version.ProxyInitVersion,\n\t\t\tdebugImage: defaults.DebugContainer.Image.Name,\n\t\t\tdebugImageVersion: version.Version,\n\t\t\tdockerRegistry: defaultDockerRegistry,\n\t\t\timagePullPolicy: defaults.Global.ImagePullPolicy,\n\t\t\tignoreInboundPorts: nil,\n\t\t\tignoreOutboundPorts: nil,\n\t\t\tproxyUID: defaults.Global.Proxy.UID,\n\t\t\tproxyLogLevel: defaults.Global.Proxy.LogLevel,\n\t\t\tproxyControlPort: uint(defaults.Global.Proxy.Ports.Control),\n\t\t\tproxyAdminPort: uint(defaults.Global.Proxy.Ports.Admin),\n\t\t\tproxyInboundPort: uint(defaults.Global.Proxy.Ports.Inbound),\n\t\t\tproxyOutboundPort: uint(defaults.Global.Proxy.Ports.Outbound),\n\t\t\tproxyCPURequest: defaults.Global.Proxy.Resources.CPU.Request,\n\t\t\tproxyMemoryRequest: defaults.Global.Proxy.Resources.Memory.Request,\n\t\t\tproxyCPULimit: defaults.Global.Proxy.Resources.CPU.Limit,\n\t\t\tproxyMemoryLimit: defaults.Global.Proxy.Resources.Memory.Limit,\n\t\t\tenableExternalProfiles: defaults.Global.Proxy.EnableExternalProfiles,\n\t\t\twaitBeforeExitSeconds: defaults.Global.Proxy.WaitBeforeExitSeconds,\n\t\t},\n\t\tidentityOptions: &installIdentityOptions{\n\t\t\ttrustDomain: defaults.Global.IdentityTrustDomain,\n\t\t\tissuanceLifetime: issuanceLifetime,\n\t\t\tclockSkewAllowance: clockSkewAllowance,\n\t\t\tidentityExternalIssuer: false,\n\t\t},\n\n\t\theartbeatSchedule: func() string {\n\t\t\t// Some of the heartbeat Prometheus queries rely on 5m resolution, which\n\t\t\t// means at least 5 minutes of data available. Start the first CronJob 10\n\t\t\t// minutes after `linkerd install` is run, to give the user 5 minutes to\n\t\t\t// install.\n\t\t\tt := time.Now().Add(10 * time.Minute).UTC()\n\t\t\treturn fmt.Sprintf(\"%d %d * * * \", t.Minute(), t.Hour())\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "12e5a037c16496592720ead9c4fae122", "score": "0.58984584", "text": "func CreateDefaultFlags(ctx *E2EContext) {\n\tflag.StringVar(&ctx.Settings.ConfigPath, \"config-path\", \"\", \"path to the e2e config file\")\n\tflag.StringVar(&ctx.Settings.ArtifactFolder, \"artifacts-folder\", \"\", \"folder where e2e test artifact should be stored\")\n\tflag.BoolVar(&ctx.Settings.UseCIArtifacts, \"kubetest.use-ci-artifacts\", false, \"use the latest build from the main branch of the Kubernetes repository\")\n\tflag.StringVar(&ctx.Settings.KubetestConfigFilePath, \"kubetest.config-file\", \"\", \"path to the kubetest configuration file\")\n\tflag.IntVar(&ctx.Settings.GinkgoNodes, \"kubetest.ginkgo-nodes\", 1, \"number of ginkgo nodes to use\")\n\tflag.IntVar(&ctx.Settings.GinkgoSlowSpecThreshold, \"kubetest.ginkgo-slowSpecThreshold\", 120, \"time in s before spec is marked as slow\")\n\tflag.BoolVar(&ctx.Settings.UseExistingCluster, \"use-existing-cluster\", false, \"if true, the test uses the current cluster instead of creating a new one (default discovery rules apply)\")\n\tflag.BoolVar(&ctx.Settings.SkipCleanup, \"skip-cleanup\", false, \"if true, the resource cleanup after tests will be skipped\")\n\tflag.StringVar(&ctx.Settings.DataFolder, \"data-folder\", \"\", \"path to the data folder\")\n\tflag.StringVar(&ctx.Settings.SourceTemplate, \"source-template\", \"./infrastructure-openstack/cluster-template.yaml\", \"path to the data folder\")\n}", "title": "" }, { "docid": "964f76492e8178adcb70f57ea72afc26", "score": "0.58897316", "text": "func newOptions() *options {\n\treturn &options{\n\t\tlogger: log.NewNopLogger(),\n\t\tclock: clock.New(),\n\t\tcertificateCacheDuration: time.Hour * 24,\n\t}\n}", "title": "" }, { "docid": "7b511390ff6374c0d40b3a8844b7f117", "score": "0.58881265", "text": "func NewOptions(opts ...Option) Options {\n\toptions := Options{\n\t\tLogger: logger.DefaultLogger,\n\t\tMeter: meter.DefaultMeter,\n\t\tTracer: tracer.DefaultTracer,\n\t\tContext: context.Background(),\n\t}\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\treturn options\n}", "title": "" }, { "docid": "41b1279c32d4e5696825b32579bbf270", "score": "0.5865153", "text": "func NewDefaultServiceURLOptions() *ServiceURLOptions {\n\tisCDN, _ := strconv.ParseBool(os.Getenv(\"AZURE_STORAGE_IS_CDN\"))\n\tisLocalEmulator, _ := strconv.ParseBool(os.Getenv(\"AZURE_STORAGE_IS_LOCAL_EMULATOR\"))\n\treturn &ServiceURLOptions{\n\t\tAccountName: os.Getenv(\"AZURE_STORAGE_ACCOUNT\"),\n\t\tSASToken: os.Getenv(\"AZURE_STORAGE_SAS_TOKEN\"),\n\t\tStorageDomain: os.Getenv(\"AZURE_STORAGE_DOMAIN\"),\n\t\tProtocol: os.Getenv(\"AZURE_STORAGE_PROTOCOL\"),\n\t\tIsCDN: isCDN,\n\t\tIsLocalEmulator: isLocalEmulator,\n\t}\n}", "title": "" }, { "docid": "5be36381cff227192b988fba89b52707", "score": "0.58648384", "text": "func NewOptions() *Options {\n\treturn &Options{\n\t\tmaxDepth: defaultMaxDepth,\n\t}\n}", "title": "" }, { "docid": "36940900b07473edea4abbc6229f97e3", "score": "0.58556074", "text": "func DefaultSlowOptions() SlowOptions {\n\treturn SlowOptions{\n\t\tMean: 50 * time.Millisecond,\n\t\tVariance: 10 * time.Millisecond,\n\t\tDistribution: \"normal\",\n\t}\n}", "title": "" }, { "docid": "c514389cd10f31142c75e2327e4b7c28", "score": "0.5851229", "text": "func Default() Options {\n\treturn Options{\n\t\tRetryTxCount: DefaultDeadlockRetryTxCount,\n\t\tRetryTxInterval: DefaultDeadlockRetryTxInterval,\n\t}\n}", "title": "" }, { "docid": "a50475933f802ba3781b4acb9baa0cc5", "score": "0.5834314", "text": "func NewOptions(opts ...Option) Options {\n\toptions := Options{\n\t\tLogger: logger.DefaultLogger,\n\t\tMeter: meter.DefaultMeter,\n\t\tTracer: tracer.DefaultTracer,\n\t\tMaxMsgSize: DefaultMaxMsgSize,\n\t}\n\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\n\treturn options\n}", "title": "" }, { "docid": "440d31ca75a431a3733b1fb91dfc3ccd", "score": "0.5819362", "text": "func DefaultOpts() []grpc.ServerOption {\n\treturn []grpc.ServerOption{\n\t\tgrpc.MaxRecvMsgSize(1024 * 1024 * 5),\n\t\tgrpc.MaxSendMsgSize(1024 * 1024 * 5),\n\t}\n}", "title": "" }, { "docid": "22f77cc65ddac8c2280aabcc3460c5fd", "score": "0.5814275", "text": "func newOptions(opts ...Option) Options {\n\topt := Options{}\n\n\tfor _, o := range opts {\n\t\to(&opt)\n\t}\n\n\treturn opt\n}", "title": "" }, { "docid": "22f77cc65ddac8c2280aabcc3460c5fd", "score": "0.5814275", "text": "func newOptions(opts ...Option) Options {\n\topt := Options{}\n\n\tfor _, o := range opts {\n\t\to(&opt)\n\t}\n\n\treturn opt\n}", "title": "" }, { "docid": "59e7cc2b735ccf03f8883d063f54fe55", "score": "0.5813948", "text": "func newOptions(opts ...Option) Options {\n\topt := Options{}\n\n\tfor _, o := range opts {\n\t\to(&opt)\n\t}\n\treturn opt\n}", "title": "" }, { "docid": "ad3599753fce7b7a8a0f4796df6c3326", "score": "0.58071434", "text": "func NewOptions() Options {\n\treturn &options{}\n}", "title": "" }, { "docid": "45760f08022d18955502c7dc324e7378", "score": "0.58023936", "text": "func NewOptions(options ...Option) Options {\n\topts := Options{\n\t\tDBPath: DefaultDBPath,\n\t\tHTTPClient: &http.Client{Timeout: DefaultTimeout},\n\t\tRIRFilesDir: DefaultFileDir,\n\t}\n\n\tfor _, o := range options {\n\t\to(&opts)\n\t}\n\n\treturn opts\n}", "title": "" }, { "docid": "b6659dbd5af44c236eded5a664977bcc", "score": "0.57819116", "text": "func New() *Options {\n\treturn &Options{}\n}", "title": "" }, { "docid": "675f6444e4ad777ec818a6c91a38c584", "score": "0.5778057", "text": "func NewDefaultCommand() *cobra.Command {\n\n\tc := &cobra.Command{\n\t\tUse: \"molamola\",\n\t\tShort: \"kustomize manages declarative configuration of Kubernetes\",\n\t\tLong: `\nkustomize manages declarative configuration of Kubernetes.\n\nSee https://github.com/yuanying/molamola\n`,\n\t}\n\n\t// c.AddCommand(\n\t// \t// TODO: Make consistent API for newCmd* functions.\n\t// \tnewCmdBuild(stdOut, fsys),\n\t// \tnewCmdDiff(stdOut, stdErr, fsys),\n\t// \tnewCmdEdit(fsys),\n\t// \tnewCmdVersion(stdOut),\n\t// )\n\tc.PersistentFlags().AddGoFlagSet(flag.CommandLine)\n\n\t// Workaround for this issue:\n\t// https://github.com/kubernetes/kubernetes/issues/17162\n\tflag.CommandLine.Parse([]string{})\n\treturn c\n}", "title": "" }, { "docid": "c3108756f96eaa9795c627cd31fc1064", "score": "0.57730174", "text": "func ClientDefaultOptions() (clientOptions *Options) {\n\treturn &Options{\n\t\tBackOffExponentFactor: 2.0,\n\t\tBackOffInitialTimeout: 2 * time.Millisecond,\n\t\tBackOffMaximumJitterInterval: 2 * time.Millisecond,\n\t\tBackOffMaxTimeout: 10 * time.Millisecond,\n\t\tDialerKeepAlive: 20 * time.Second,\n\t\tDialerTimeout: 5 * time.Second,\n\t\tRequestRetryCount: 2,\n\t\tRequestTimeout: 10 * time.Second,\n\t\tTransportExpectContinueTimeout: 3 * time.Second,\n\t\tTransportIdleTimeout: 20 * time.Second,\n\t\tTransportMaxIdleConnections: 10,\n\t\tTransportTLSHandshakeTimeout: 5 * time.Second,\n\t\tUserAgent: defaultUserAgent,\n\t}\n}", "title": "" }, { "docid": "d6f7e33907b9c462c12b4282faeb6f95", "score": "0.5771174", "text": "func NewOptions() *Options {\n\treturn &Options{\n\t\tDefaultMethod: \"display\",\n\t}\n}", "title": "" }, { "docid": "ca5a8e52f56996304a0daf4e8487e5ee", "score": "0.57690275", "text": "func DefaultTraverseOptions() TraverseOptions {\n\treturn TraverseOptions{\n\t\tMfaPrompt: &creds.DefaultMfaPrompt{},\n\t\tStore: profiles.NewDefaultStore(),\n\t\tCache: &MapCache{},\n\t}\n}", "title": "" }, { "docid": "8e5aec35f779a563c5f558e1436b92a4", "score": "0.57600796", "text": "func DefaultDialOption() []grpc.DialOption {\n\treturn []grpc.DialOption{\n\t\tgrpc.WithInsecure(),\n\t\tgrpc.WithStatsHandler(&ocgrpc.ClientHandler{}),\n\t\tgrpc.WithKeepaliveParams(keepalive.ClientParameters{\n\t\t\tTime: 10 * time.Second,\n\t\t}),\n\t}\n}", "title": "" }, { "docid": "b1d0d97e4006cf69725c9096792a528a", "score": "0.5751223", "text": "func DefaultOption() *Option {\n\treturn &Option{\n\t\tPath: \"i18n\",\n\t\tLanguage: defaultLanguage,\n\t}\n}", "title": "" }, { "docid": "bbe2e1bb67b84db5a3680a5aaf651255", "score": "0.5738935", "text": "func NewDefaults() map[string]interface{} {\n\tdefaults := make(map[string]interface{})\n\n\tdefaults[authPostgresURI] = \"postgresql://postgres:postgres@localhost:5432/test?sslmode=disable\"\n\tdefaults[authMigrationVersion] = 0\n\n\tdefaults[gatewayAddr] = \":10000\"\n\tdefaults[gatewayEndpoint] = \"/graphql\"\n\tdefaults[gatewayServePlayground] = true\n\tdefaults[gatewayPlaygroundEndpoint] = \"/playground\"\n\tdefaults[gatewayEnableIntrospection] = true\n\n\tdefaults[seedUserLogin] = \"root\"\n\tdefaults[seedUserPassword] = \"root\"\n\tdefaults[seedRoleTitle] = \"ROOT\"\n\tdefaults[seedRoleSuper] = true\n\n\tdefaults[sessionAccessTokenTTL] = 1000000\n\tdefaults[sessionRefreshTokenTTl] = 5000000\n\n\treturn defaults\n}", "title": "" }, { "docid": "1808b9af7ffdd1b185ca1381aad903d7", "score": "0.5732603", "text": "func NewDefault() elton.Handler {\n\treturn New(Config{})\n}", "title": "" }, { "docid": "02fcb1195b25be678bfb4da7e5d46971", "score": "0.57302946", "text": "func newOptions() (*Options, error) {\n\to := &Options{\n\t\tconfig: new(componentconfig.CoordinatorConfiguration),\n\t}\n\treturn o, nil\n}", "title": "" }, { "docid": "95b4ac7001f67e941907a3f8bcd3eba4", "score": "0.572304", "text": "func DefaultOpts() ListOptions {\n\tl := ListOptions{}\n\tl.Limit = -1\n\treturn l\n}", "title": "" }, { "docid": "6807fc38392e6b26b5ee4f829111ca4e", "score": "0.57202363", "text": "func (opts *Options) SetDefaults() {\n for name, _ := range opts.opt_map {\n //fmt.Printf(\"%s\\n\",name);\n opts.opt_map[name].SetDefault()\n }\n}", "title": "" }, { "docid": "109f26717274d706eb4d598d16df80e8", "score": "0.5718587", "text": "func NewOptions(opts ...Opt) *Options {\n\toptions := &Options{}\n\n\tfor _, opt := range opts {\n\t\topt(options)\n\t}\n\n\treturn options\n}", "title": "" }, { "docid": "c1222feacebf5b454f2cb2389777c161", "score": "0.57177216", "text": "func NewDefaultParser() Parser {\n\treturn &defaultParser{}\n}", "title": "" }, { "docid": "cc2898e34eb86ccc058d23841d34b3c4", "score": "0.57079", "text": "func (args Args) DefaultConfigurationOptions() themekit.Configuration {\n\taccessToken := args.AccessToken\n\tif args.AccessToken == \"\" {\n\t\taccessToken = args.Password\n\t}\n\n\treturn themekit.Configuration{\n\t\tDomain: args.Domain,\n\t\tAccessToken: accessToken,\n\t\tPassword: accessToken,\n\t\tBucketSize: args.BucketSize,\n\t\tRefillRate: args.RefillRate,\n\t\tTimeout: args.Timeout,\n\t}\n}", "title": "" }, { "docid": "b657792e1faefb0d08a26d149a940aa9", "score": "0.5707829", "text": "func NewOptions() *Options {\n\treturn &Options{}\n}", "title": "" }, { "docid": "b657792e1faefb0d08a26d149a940aa9", "score": "0.5707829", "text": "func NewOptions() *Options {\n\treturn &Options{}\n}", "title": "" }, { "docid": "b657792e1faefb0d08a26d149a940aa9", "score": "0.5707829", "text": "func NewOptions() *Options {\n\treturn &Options{}\n}", "title": "" }, { "docid": "b657792e1faefb0d08a26d149a940aa9", "score": "0.5707829", "text": "func NewOptions() *Options {\n\treturn &Options{}\n}", "title": "" }, { "docid": "b657792e1faefb0d08a26d149a940aa9", "score": "0.5707829", "text": "func NewOptions() *Options {\n\treturn &Options{}\n}", "title": "" }, { "docid": "0e654542e3c23b9053546a7606a96566", "score": "0.5698482", "text": "func DefaultDialOptions() []grpc.DialOption {\n\treturn []grpc.DialOption{\n\t\tgrpc.WithInsecure(),\n\t\tgrpc.WithStreamInterceptor(grpc_middleware.ChainStreamClient(\n\t\t\tgrpc_opentracing.StreamClientInterceptor(),\n\t\t\tgrpc_prometheus.StreamClientInterceptor,\n\t\t\tgrpc_retry.StreamClientInterceptor(),\n\t\t)),\n\t\tgrpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient(\n\t\t\tgrpc_opentracing.UnaryClientInterceptor(),\n\t\t\tgrpc_prometheus.UnaryClientInterceptor,\n\t\t\tgrpc_retry.UnaryClientInterceptor(),\n\t\t)),\n\t}\n}", "title": "" }, { "docid": "43a0a13cdd571be69fd187e320b74521", "score": "0.56773007", "text": "func NewOptions(io instrument.Options) Options {\n\treturn &opts{\n\t\tiopts: io,\n\t\tinitFn: defaultNoErrorFn,\n\t\treleaseFn: defaultNoErrorFn,\n\t\theartbeatTimeout: defaultHeartbeatTimeout,\n\t\tnowFn: time.Now,\n\t\tnewFileMode: defaultNewFileMode,\n\t\tnewDirectoryMode: defaultNewDirectoryMode,\n\t}\n}", "title": "" }, { "docid": "8e774c68ddcf8c49a1e1e551a849b566", "score": "0.56735706", "text": "func CreateDefaultFlags(ctx *E2EContext) {\n\tflag.StringVar(&ctx.Settings.ConfigPath, \"config-path\", \"\", \"path to the e2e config file\")\n\tflag.StringVar(&ctx.Settings.ArtifactFolder, \"artifacts-folder\", \"\", \"folder where e2e test artifact should be stored\")\n\tflag.BoolVar(&ctx.Settings.UseCIArtifacts, \"kubetest.use-ci-artifacts\", false, \"use the latest build from the main branch of the Kubernetes repository\")\n\tflag.StringVar(&ctx.Settings.KubetestConfigFilePath, \"kubetest.config-file\", \"\", \"path to the kubetest configuration file\")\n\tflag.IntVar(&ctx.Settings.GinkgoNodes, \"kubetest.ginkgo-nodes\", 1, \"number of ginkgo nodes to use\")\n\tflag.IntVar(&ctx.Settings.GinkgoSlowSpecThreshold, \"kubetest.ginkgo-slowSpecThreshold\", 120, \"time in s before spec is marked as slow\")\n\tflag.BoolVar(&ctx.Settings.UseExistingCluster, \"use-existing-cluster\", false, \"if true, the test uses the current cluster instead of creating a new one (default discovery rules apply)\")\n\tflag.BoolVar(&ctx.Settings.SkipCleanup, \"skip-cleanup\", false, \"if true, the resource cleanup after tests will be skipped\")\n\tflag.BoolVar(&ctx.Settings.SkipCloudFormationDeletion, \"skip-cloudformation-deletion\", false, \"if true, an AWS CloudFormation stack will not be deleted\")\n\tflag.BoolVar(&ctx.Settings.SkipCloudFormationCreation, \"skip-cloudformation-creation\", false, \"if true, an AWS CloudFormation stack will not be created\")\n\tflag.StringVar(&ctx.Settings.DataFolder, \"data-folder\", \"\", \"path to the data folder\")\n\tflag.StringVar(&ctx.Settings.SourceTemplate, \"source-template\", \"infrastructure-aws/cluster-template.yaml\", \"path to the data folder\")\n}", "title": "" } ]
5ef03857905a234a28ac344081adc806
/ String() displays the maze as a string
[ { "docid": "e741a2409d854cd67ca72a66204bae3a", "score": "0.6146499", "text": "func (pr Prim) String() string {\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\" \" + strings.Repeat(\"_\", pr.Width * 2 - 1) + \"\\n\")\n\tfor _, row := range pr.grid {\n\t\tbuffer.WriteString(\"|\")\n\t\tfor x, cell := range row {\n\t\t if cell & South != 0 {\n\t \t\tbuffer.WriteString(\" \")\n\t\t\t} else {\n\t\t\t\t// add south wall\n\t \t\tbuffer.WriteString(\"_\")\n\t\t\t}\n\t\t\tif cell & East != 0 {\n \t\t\t// specific rule to fill south holes due to east walls shifting\n\t\t\t\tif (cell | row[x+1]) & South != 0 {\n\t\t\t\t\tbuffer.WriteString(\" \")\n\t\t\t\t} else {\n\t\t\t\t\tbuffer.WriteString(\"_\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// add east wall\n\t \t\tbuffer.WriteString(\"|\")\n\t\t\t}\n\t\t}\n\t\tbuffer.WriteString(\"\\n\")\n\t}\n\treturn buffer.String()\n}", "title": "" } ]
[ { "docid": "6f3ebf807707f10e8c039740c000361e", "score": "0.88168263", "text": "func (m *Maze) String() string {\n\tvar out strings.Builder\n\tout.WriteString(\"+\")\n\n\tfor c := 0; c < m.Cols(); c++ {\n\t\tout.WriteString(\"---+\")\n\t}\n\tout.WriteString(\"\\n\")\n\n\tfor r := 0; r < m.Rows(); r++ {\n\t\ttop := \"|\"\n\t\tbottom := \"+\"\n\t\tfor c := 0; c < m.Cols(); c++ {\n\t\t\tcell := m.cells[m.Index(c, r)]\n\n\t\t\tvar body string\n\t\t\tif cell == m.player.in {\n\t\t\t\tbody = \" x \"\n\t\t\t} else {\n\t\t\t\tbody = \" \"\n\t\t\t}\n\n\t\t\tif cell == m.goal {\n\t\t\t\tbody = \" 🏳 \"\n\t\t\t} else if cell != m.player.in {\n\t\t\t\tbody = \" \"\n\t\t\t}\n\n\t\t\tvar eastBoundary string\n\t\t\tif cell.Linked(cell.East()) {\n\t\t\t\teastBoundary = \" \"\n\t\t\t} else {\n\t\t\t\teastBoundary = \"|\"\n\t\t\t}\n\t\t\ttop = top + body + eastBoundary\n\n\t\t\tvar southBoundary string\n\t\t\tif cell.Linked(cell.South()) {\n\t\t\t\tsouthBoundary = \" \"\n\t\t\t} else {\n\t\t\t\tsouthBoundary = \"---\"\n\t\t\t}\n\t\t\tcorner := \"+\"\n\t\t\tbottom = bottom + southBoundary + corner\n\t\t}\n\t\tout.WriteString(top)\n\t\tout.WriteString(\"\\n\")\n\t\tout.WriteString(bottom)\n\t\tout.WriteString(\"\\n\")\n\t}\n\treturn out.String()\n}", "title": "" }, { "docid": "4c4a73fb6e6b35446ec6ce4c938a8c1f", "score": "0.85445833", "text": "func (m *Maze) String() string {\n\trows := make([]string, m.Rows)\n\tfor row := 0; row < m.Rows; row++ {\n\t\tfor col := 0; col < m.Cols; col++ {\n\t\t\tpos := Position{Row: row, Col: col}\n\t\t\tch := '.'\n\t\t\tif pos == m.Start {\n\t\t\t\tch = 'A'\n\t\t\t} else if pos == m.End {\n\t\t\t\tch = 'x'\n\t\t\t} else if m.Wall(Position{row, col}) {\n\t\t\t\tch = 'w'\n\t\t\t}\n\t\t\trows[row] += string(ch)\n\t\t}\n\t}\n\treturn strings.Join(rows, \"\\n\")\n}", "title": "" }, { "docid": "ee389f94273d41d29446dbaa351f209a", "score": "0.7750087", "text": "func (m *Maze) ToString() string {\n\treturn string(m.ToBytes())\n}", "title": "" }, { "docid": "4ebb60cc6822c8100e5bdb8ca4d36ae6", "score": "0.7319314", "text": "func (w *World) String() string {\n\tagentMap := make([][]byte, w.height)\n\tfor i := 0; i < len(agentMap); i++ {\n\t\tagentMap[i] = make([]byte, w.width)\n\t\tfor j := 0; j < len(agentMap[i]); j++ {\n\t\t\tagentMap[i][j] = '.'\n\t\t}\n\t}\n\n\tfor _, a := range w.agents {\n\t\tr, c := a.Position()\n\t\tif r >= 0 && r < w.height && c >= 0 && c < w.width {\n\t\t \tdisplay := a.String()\n\t\t\tif len(display) > 0 {\n\t\t\t agentMap[r][c] = a.String()[0]\n\t\t\t}\n\t\t}\n\t}\n\n\tvar buf bytes.Buffer\n\tfor r := 0; r < len(agentMap); r++ {\n\t\tif r % 2 == 1 {\n\t\t\tbuf.WriteString(\" \")\n\t\t}\n\n\t\tfor c := 0; c < len(agentMap[r]); c++ {\n\t\t\tbuf.WriteByte(agentMap[r][c])\n\t\t\tbuf.WriteString(\" \")\n\t\t}\n\t\tbuf.WriteString(\"\\n\")\n\t}\n\n\treturn buf.String()\n\t\t\t\n}", "title": "" }, { "docid": "a859c113dc3b5b86873fd97c0a95e552", "score": "0.69529176", "text": "func show(maze *maze) {\n\tfor _, row := range maze.grid {\n\t\trowOut := \" \"\n\t\tfor _, point := range row {\n\t\t\tif _, iswall := maze.walls[point]; iswall {\n\t\t\t\trowOut += \"█\"\n\t\t\t} else if point == maze.location {\n\t\t\t\trowOut += \"☻\"\n\t\t\t} else if point == maze.destination {\n\t\t\t\trowOut += \"⚑\"\n\t\t\t} else {\n\t\t\t\trowOut += \" \"\n\t\t\t}\n\t\t}\n\t\tfmt.Println(rowOut)\n\t}\n}", "title": "" }, { "docid": "6645a7a512d55e4e843384fa73501151", "score": "0.68748707", "text": "func (board Board) String() string {\n\tvar str string = \"\"\n\tvar i, j int8\n\tfor i = 0; i < board.size; i++ {\n\t\tfor j = 0; j < board.size; j++ {\n\t\t\tif board.tiles[i][j] != 0 {\n\t\t\t\tstr += fmt.Sprintf(\"%3d\", board.tiles[i][j])\n\t\t\t} else {\n\t\t\t\tstr += \" \"\n\t\t\t}\n\t\t}\n\t\tstr += \"\\n\"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "cc078a3efd8f4ab892ce29e735af0651", "score": "0.6872137", "text": "func (m *T3) String() string {\n x := &m.matrix\n return fmt.Sprintf(\"%f %f %f\\n\"+\n \"%f %f %f\\n\"+\n \"%f %f %f\\n\"+\n \"%f %f %f\\n\",\n x[0], x[1], x[2],\n x[3], x[4], x[5],\n x[6], x[7], x[8],\n x[9], x[10], x[11])\n}", "title": "" }, { "docid": "f62fb1a479a734ef03e2bcf3afb06764", "score": "0.68720317", "text": "func (l *Life) String() string {\n var buf bytes.Buffer\n for y := 0; y < l.h; y++ {\n for x := 0; x < l.w; x++ {\n b := byte(' ')\n if l.a.Alive(x, y) {\n b = '*'\n }\n buf.WriteByte(b)\n }\n buf.WriteByte('\\n')\n }\n return buf.String()\n}", "title": "" }, { "docid": "23f97c9f01f9ec52eb1cce11a4db3d16", "score": "0.66393596", "text": "func (b Board) String() string {\n\t// Get the current boundaries of the map.\n\tminX, minY, maxX, maxY := b.GetBoundaries()\n\n\tstr := \"\"\n\tfor i := minX; i <= maxX; i++ {\n\t\tfor j := minY; j <= maxY; j++ {\n\t\t\tif b.GetAt(Coord{i, j}) {\n\t\t\t\tstr += \"1\"\n\t\t\t} else {\n\t\t\t\tstr += \"0\"\n\t\t\t}\n\t\t}\n\t\tstr += \"\\n\"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "c784f68ed3c125f19e43bf2e70fac844", "score": "0.6606394", "text": "func (bo *Board) String() string {\n\tvar buf bytes.Buffer\n\n\t// write header\n\tfmt.Fprint(&buf, \" \")\n\tfor i := 0; i < bo.Width(); i++ {\n\t\tfmt.Fprintf(&buf, \" %2d\", i)\n\t}\n\tfmt.Fprint(&buf, \"\\n\\n\")\n\n\t// Write each line\n\tfor i, row := range bo.Grid {\n\t\tfmt.Fprintf(&buf, \"%2d \", i)\n\t\tfor _, sq := range row {\n\t\t\tif IsGiven(sq) {\n\t\t\t\tfmt.Fprintf(&buf, \" %02d\", sq.Area)\n\t\t\t} else {\n\t\t\t\tif IsFinal(sq) {\n\t\t\t\t\tfmt.Fprintf(&buf, \" %1d\", bo.Get(sq.Final.Given).Area)\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(&buf, \" \")\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tfmt.Fprint(&buf, \"\\n\")\n\t}\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "21678241a3156680adf97dc31328959c", "score": "0.6586517", "text": "func (g* Grid) String() string {\n\ts := \"\"\n\tfor xy:=0; xy<n*n; xy++ {\n\t\tswitch g[xy] {\n\t\tcase Black:\n\t\t\ts += \"X\"\n\t\tcase White:\n\t\t\ts += \"O\"\n\t\tdefault:\n\t\t\ts += \".\"\n\t\t}\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "08f7a342299efad04bf2f5b1645ad43c", "score": "0.6554748", "text": "func (r Ray) String() string {\n\tvar b []byte\n\tb = append(b, r.Origin.String()...)\n\tb = append(b, \"; \"...)\n\tb = append(b, r.Direction.String()...)\n\treturn string(b)\n}", "title": "" }, { "docid": "3c707ab2a8f89b596dfbf15028cbee4f", "score": "0.6551223", "text": "func (g GraphMatrix) String() string {\n\treturn fmt.Sprintf(\"GraphMatrix %v, %v, size %d\", g.IndPtr, g.Indices, g.Dim())\n}", "title": "" }, { "docid": "d647f5c679e2ba6538e168608267e06b", "score": "0.6547333", "text": "func (m *Map) String() string {\n\tstr := \"TreeBidiMap\\nmap[\"\n\tit := m.Iterator()\n\tfor it.Next() {\n\t\tstr += fmt.Sprintf(\"%v:%v \", it.Key(), it.Value())\n\t}\n\treturn strings.TrimRight(str, \" \") + \"]\"\n}", "title": "" }, { "docid": "f3a236d3a8027f0c5591f39400170fca", "score": "0.6544502", "text": "func (m *Map) String() string {\n\tstr := \"\"\n\tfor row := 0; row < m.Rows; row++ {\n\t\tfor col := 0; col < m.Cols; col++ {\n\t\t\ts := m.itemGrid[row*m.Cols+col].Symbol()\n\t\t\tstr += string([]byte{s}) + \" \"\n\t\t}\n\t\tstr += \"\\n\"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "1b298797489ef8bec5e879ad572546dc", "score": "0.6541809", "text": "func (board Board) String() string {\r\n\tb := &strings.Builder{}\r\n\tfor _, line := range board {\r\n\t\tfmt.Fprintf(b, \"+-----------+\\n|\")\r\n\t\tfor _, num := range line {\r\n\t\t\tfmt.Fprintf(b, \" %s |\", num)\r\n\t\t}\r\n\t\tfmt.Fprintln(b)\r\n\t}\r\n\tfmt.Fprintln(b, \"+-----------+\")\r\n\r\n\treturn b.String()\r\n}", "title": "" }, { "docid": "68a65f9d9c633298f5cb8e20ff1f7ada", "score": "0.65292495", "text": "func (a Board) String() (s string) {\n\ts = \"\\n\"\n\tfor row := 2; row < 10; row++ {\n\t\tfor col := 1; col < 9; col++ {\n\t\t\ts = s + string(a[row*10+col])\n\t\t}\n\t\ts = s + \"\\n\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "c97b5034fdeebd7e01714e258b308452", "score": "0.6526859", "text": "func (r Rover) String() string {\n\tvar out bytes.Buffer\n\tout.WriteString(strconv.Itoa(r.x) + \" \" + strconv.Itoa(r.y) + \" \" + r.heading)\n\treturn out.String()\n}", "title": "" }, { "docid": "1ffdf435ed61e562fba4f942f31bff84", "score": "0.6497774", "text": "func (r Ray) String() string {\n\treturn fmt.Sprintf(\"Ray{Pos:%s Dir:%s}\", r.Pos, r.Dir)\n}", "title": "" }, { "docid": "a6cd83416aa5b68447c7a7aa36bfe061", "score": "0.6479936", "text": "func (m *Maze) Encode() (string, error) {\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tvar enc string\n\n\tfor x := int64(0); x < m.rows; x++ {\n\t\tfor y := int64(0); y < m.columns; y++ {\n\t\t\tc, err := m.Cell(y, x, 0)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\n\t\t\te := c.Encode()\n\t\t\tenc = enc + e\n\t\t}\n\t\tenc = enc + \"\\n\"\n\t}\n\n\treturn enc, nil\n\n}", "title": "" }, { "docid": "19f29e44c5105bc0aa4aab7a078d8f80", "score": "0.647142", "text": "func (b *Board) String() string {\n\tvar buffer bytes.Buffer\n\n\tfor i, b := range b.cells {\n\t\tif (i+1)%9 == 0 {\n\t\t\tbuffer.WriteString(fmt.Sprintf(\"%d\\n\", b))\n\t\t\tcontinue\n\t\t}\n\n\t\tbuffer.WriteString(fmt.Sprintf(\"%d \", b))\n\t}\n\n\treturn strings.TrimSpace(buffer.String())\n}", "title": "" }, { "docid": "63892e6cd9264ce6566792e828a2d863", "score": "0.6467859", "text": "func (w *World) String() string {\n\treturn fmt.Sprintf(\"Generation: %d\\n%s\\n\", w.gen, w.current)\n}", "title": "" }, { "docid": "8efdf1c312d1edb42ed6138c7a4158b3", "score": "0.6466308", "text": "func (t tile) String() string {\n\t//First unicode character,they are stacked back to back\n\tbase := '\\U0001F000'\n\tvar char rune\n\t//the adds are unicode offsets, as we can see wind dragon and natural numbers are already on the right offset by pure chance\n\tswitch t.suit {\n\tcase man:\n\t\tchar = base + windCount + dragonCount\n\tcase pin:\n\t\tchar = base + windCount + dragonCount + manCount\n\tcase circle:\n\t\tchar = base + windCount + dragonCount + manCount + pinCount\n\tcase wind:\n\t\tchar = base\n\tcase dragon:\n\t\tchar = base\n\tdefault:\n\t\tchar = base\n\t}\n\treturn string(char + rune(t.rank))\n}", "title": "" }, { "docid": "ea62eb3a26bf3e434de672676ad806a3", "score": "0.64392215", "text": "func (s Cell) String() string {\n\tp := \" \"\n\tif s.piece != nil {\n\t\tp = fmt.Sprintf(\"%s\", s.piece)\n\t}\n\treturn fmt.Sprintf(\"%4d[%s]%s\", s.num, p, s.coord)\n}", "title": "" }, { "docid": "0cd212f466847c89eba3b9999cda5d37", "score": "0.6417157", "text": "func (m Matrix) String() string {\n\ta, b, c, d, tx, ty := m[0], m[1], m[3], m[4], m[6], m[7]\n\treturn fmt.Sprintf(\"[%7.4f,%7.4f,%7.4f,%7.4f:%7.4f,%7.4f]\", a, b, c, d, tx, ty)\n}", "title": "" }, { "docid": "ad47f0eb9afcfa20c25461db435046ed", "score": "0.6411493", "text": "func (d *Drawer) String() string {\n\tvar s string\n\tfor _, row := range d.canvas {\n\t\tfor _, b := range row {\n\t\t\tif b == 0 {\n\t\t\t\ts += \" \"\n\t\t\t} else {\n\t\t\t\ts += string(b)\n\t\t\t}\n\t\t}\n\t\ts += \"\\n\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "d6210e51145b581fb7f458138747dec3", "score": "0.640946", "text": "func printMaze(maze [][]rune) {\n\tfor _, l := range maze {\n\t\tfor _, v := range l {\n\t\t\tfmt.Printf(\"%c\", v)\n\t\t}\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "a83cf175f9e286be983fc6eb56b1058e", "score": "0.6407715", "text": "func (b *Board) String() string {\n buf := &bytes.Buffer{}\n for rank := 7; rank >= 0; rank-- {\n empty := 0\n for file := 0; file <= 7; file++ {\n if piece := b.board[file+rank<<3]; piece != 0 {\n if empty > 0 {\n buf.WriteByte(byte('0' + empty))\n empty = 0\n }\n switch piece & ColorMask {\n case White:\n buf.WriteByte(\" PNBRQK\"[piece&PieceMask])\n case Black:\n buf.WriteByte(\" pnbrqk\"[piece&PieceMask])\n }\n } else {\n empty++\n }\n }\n if empty > 0 {\n buf.WriteByte(byte('0' + empty))\n }\n if rank != 0 {\n buf.WriteByte('/')\n }\n }\n switch b.color {\n case White:\n buf.WriteString(\" w \")\n case Black:\n buf.WriteString(\" b \")\n }\n switch {\n case b.moved&0x90 == 0:\n buf.WriteByte('K')\n case b.moved&0x11 == 0:\n buf.WriteByte('Q')\n case b.moved&(0x90<<14) == 0:\n buf.WriteByte('k')\n case b.moved&(0x11<<14) == 0:\n buf.WriteByte('q')\n default:\n buf.WriteByte('-')\n }\n fmt.Fprintf(buf, \" %d %d\", len(b.hist), b.Turn())\n return buf.String()\n}", "title": "" }, { "docid": "645b9e200e5564c22a13381f90595b36", "score": "0.6405581", "text": "func (pos Position) String() string {\n\treturn fmt.Sprintf(\"(%d,%d)\", pos.X, pos.Y)\n}", "title": "" }, { "docid": "9787350c957eeedf953542f54da5460b", "score": "0.639424", "text": "func (m Mat4x2) String() string {\n\tbuf := new(bytes.Buffer)\n\tw := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight)\n\tfor i := 0; i < 4; i++ {\n\t\tfor _, col := range m.Row(i) {\n\t\t\tfmt.Fprintf(w, \"%f\\t\", col)\n\t\t}\n\n\t\tfmt.Fprintln(w, \"\")\n\t}\n\tw.Flush()\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "16a3cfc4d272d7712550c8aba014dac3", "score": "0.6384483", "text": "func (m Mat4x3) String() string {\n\tbuf := new(bytes.Buffer)\n\tw := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight)\n\tfor i := 0; i < 4; i++ {\n\t\tfor _, col := range m.Row(i) {\n\t\t\tfmt.Fprintf(w, \"%f\\t\", col)\n\t\t}\n\n\t\tfmt.Fprintln(w, \"\")\n\t}\n\tw.Flush()\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "3a099c1fa191484f93ce7005c31540b3", "score": "0.6371175", "text": "func (g *FixedGrid) String() string {\n\tb := strings.Builder{}\n\tfor y := 0; y < g.Size.Y; y++ {\n\t\tfmt.Fprint(&b, string(g.values[y*g.Size.X:(y+1)*g.Size.X]), \"\\n\")\n\t}\n\ts := b.String()\n\treturn s[:len(s)-1]\n}", "title": "" }, { "docid": "e55f03642dc5e2c43cdcbb3018e6caa3", "score": "0.63702357", "text": "func (m Move) String() string {\n\treturn string([]byte{byte(m.I) + 'A', byte(m.J) + '1'})\n}", "title": "" }, { "docid": "327e30683e3d37159565f8cfe8d42c58", "score": "0.6369218", "text": "func (m *Map[K, V]) String() string {\n\tstr := \"RedBlackTree\\n\"\n\tif !m.Empty() {\n\t\toutput(m.Root, \"\", true, &str)\n\t}\n\treturn str\n}", "title": "" }, { "docid": "8d96c9c249989e15b799d2aeb5af1541", "score": "0.6368851", "text": "func (mat *T) String() string {\n\treturn fmt.Sprintf(\"%s %s %s\", mat[0].String(), mat[1].String(), mat[2].String())\n}", "title": "" }, { "docid": "8b2d4b00b52c104092c2978db440e858", "score": "0.63643306", "text": "func (m Mat3x4) String() string {\n\tbuf := new(bytes.Buffer)\n\tw := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight)\n\tfor i := 0; i < 3; i++ {\n\t\tfor _, col := range m.Row(i) {\n\t\t\tfmt.Fprintf(w, \"%f\\t\", col)\n\t\t}\n\n\t\tfmt.Fprintln(w, \"\")\n\t}\n\tw.Flush()\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "5407a12b9eaed9e7e9de845c8c8ac21b", "score": "0.6362614", "text": "func (g *Grid) String() string {\n\tb := strings.Builder{}\n\tmin, max := g.Bounds()\n\tfor y := min.Y; y <= max.Y; y++ {\n\t\tfor x := min.X; x <= max.X; x++ {\n\t\t\tp := Point{X: x, Y: y}\n\t\t\tfmt.Fprint(&b, string(g.GetPoint(p)))\n\t\t}\n\t\tfmt.Fprint(&b, \"\\n\")\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "13cbdbe3d95be4cd424a2c40e1c99e10", "score": "0.63574165", "text": "func (l *Life) String() string {\n\tvar buf bytes.Buffer\n\tfor y := 0; y < l.h; y++ {\n\t\tfor x := 0; x < l.w; x++ {\n\t\t\tb := byte(' ')\n\t\t\tif l.a.Alive(x, y) {\n\t\t\t\tb = '*'\n\t\t\t}\n\t\t\tbuf.WriteByte(b)\n\t\t}\n\t\tbuf.WriteByte('\\n')\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "af2b5f7fae27df3b59488eadd554c684", "score": "0.635725", "text": "func (m Mat2x3) String() string {\n\tbuf := new(bytes.Buffer)\n\tw := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight)\n\tfor i := 0; i < 2; i++ {\n\t\tfor _, col := range m.Row(i) {\n\t\t\tfmt.Fprintf(w, \"%f\\t\", col)\n\t\t}\n\n\t\tfmt.Fprintln(w, \"\")\n\t}\n\tw.Flush()\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "a0d6dc01b897f0fab7a4c4e2d3001e92", "score": "0.6351393", "text": "func (p Position) String() string {\n\treturn fmt.Sprintf(\"(%d, %d)\", p.Line, p.Col)\n}", "title": "" }, { "docid": "5b78d14306e01c632b7d870e196b40af", "score": "0.63496256", "text": "func (m Mat2x4) String() string {\n\tbuf := new(bytes.Buffer)\n\tw := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight)\n\tfor i := 0; i < 2; i++ {\n\t\tfor _, col := range m.Row(i) {\n\t\t\tfmt.Fprintf(w, \"%f\\t\", col)\n\t\t}\n\n\t\tfmt.Fprintln(w, \"\")\n\t}\n\tw.Flush()\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "acfb8565690be7a0536400374e0cf0fe", "score": "0.6338805", "text": "func (m Mat3x2) String() string {\n\tbuf := new(bytes.Buffer)\n\tw := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight)\n\tfor i := 0; i < 3; i++ {\n\t\tfor _, col := range m.Row(i) {\n\t\t\tfmt.Fprintf(w, \"%f\\t\", col)\n\t\t}\n\n\t\tfmt.Fprintln(w, \"\")\n\t}\n\tw.Flush()\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "364e3de1d731334257857f69423285b5", "score": "0.63348544", "text": "func (c coordinate) String() string {\n\treturn fmt.Sprintf(\"%v°%v'\\\"%v %c\", c.d, c.m, c.s, c.h)\n}", "title": "" }, { "docid": "35753c4b45f5ef86a03514878fc0bda8", "score": "0.6325547", "text": "func (c *SudokuCell) String() string {\n\treturn fmt.Sprintf(\"%d at %s\", c.value, c.position.String())\n}", "title": "" }, { "docid": "c0c6e3d077f04e5e408ab3ff0f96dc62", "score": "0.63245386", "text": "func (g *Grid) String() string {\n\tstr := fmt.Sprint(\"+\")\n\tfor j := 0; j < g.columns; j++ {\n\t\tstr += fmt.Sprint(\"---+\")\n\t}\n\tstr += fmt.Sprintln()\n\n\tfor i := 0; i < g.rows; i++ {\n\t\tstr += fmt.Sprint(\"|\")\n\t\tfor j := 0; j < g.columns; j++ {\n\t\t\tstr += fmt.Sprint(\" \")\n\t\t\tif g.cells[i][j].isLinked(g.cells[i][j].e) {\n\t\t\t\tstr += fmt.Sprint(\" \")\n\t\t\t} else {\n\t\t\t\tstr += fmt.Sprint(\"|\")\n\t\t\t}\n\t\t}\n\t\tstr += fmt.Sprintln()\n\t\tstr += fmt.Sprint(\"+\")\n\t\tfor j := 0; j < g.columns; j++ {\n\t\t\tif g.cells[i][j].isLinked(g.cells[i][j].s) {\n\t\t\t\tstr += fmt.Sprint(\" +\")\n\t\t\t} else {\n\t\t\t\tstr += fmt.Sprint(\"---+\")\n\t\t\t}\n\t\t}\n\t\tstr += fmt.Sprintln()\n\t}\n\treturn str\n}", "title": "" }, { "docid": "6e5d41fb968863332ca30aae4bfd26a4", "score": "0.6320743", "text": "func (b Board) String() string {\n\tvar fillStrs = make([][][]string, len(b))\n\tfor i, br := range b {\n\t\tfillStrs[i] = make ([][]string, len(br))\n\t\tfor j, hex := range br {\n\t\t\tfillStrs[i][j] = hex.FillStr()\n\t\t}\n\t}\n\tncols := len(b[0])\n\tvar sb strings.Builder\n\tsb.WriteString(\"\\n\")\n\tsb.WriteString(strings.Repeat(\" _____ \", ncols / 2))\n\tsb.WriteString(\"\\n\")\n\tfor row := 0; row < len(b) + 1; row++ {\n\t\tlmx := 4\n\t\tif row == len(b) {\n\t\t lmx = 2\n\t\t}\n\t\tfor l := 0; l < lmx; l++ {\n\t\t\tif l == 0 || l == 3 {\n\t\t\t\tsb.WriteString(\" \")\n\t\t\t}\n\t\t\tfor c := 0; c < ncols; c++ {\n\t\t\t\txr, xl := row, l\n\t\t\t\tif c & 1 == 1 {\n\t\t\t\t\txl = l - 2\n\t\t\t\t\tif xl < 0 {\n\t\t\t\t\t xl += 4\n\t\t\t\t\t xr -= 1\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (xr < 0 || xr >= len(b) ) {\n\t\t\t\t\tsb.WriteString(emptyHex[xl + 1])\n\t\t\t\t} else {\n\t\t\t\t\tfs := fillStrs[xr][c][xl + 1]\n\t\t\t\t\tif c < ncols - 1 {\n\t\t\t\t\t fs = fs[:len(fs) - 1]\n\t\t\t\t\t}\n\t\t\t\t\tsb.WriteString(fs)\n\t\t\t\t}\n\t\t\t}\n\t\t\tsb.WriteString(\"\\n\")\n\t\t}\n\t}\n\treturn sb.String()\n}", "title": "" }, { "docid": "6c1f37870b76df1cdd73ba54c1472f68", "score": "0.63049245", "text": "func (b Board) String() string {\n\tsb := strings.Builder{}\n\n\tfor idx, i := 0, 1; idx < BoardSize; i, idx = i+1, idx+1 {\n\t\tsb.WriteString(fmt.Sprintf(\"|%d\", b.b[idx]))\n\t\tif i == BoardSide {\n\t\t\tsb.WriteString(\"|\\n\")\n\t\t\ti = 0\n\t\t}\n\t}\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "c1e0e265f00aff4991a3884ee30d746e", "score": "0.6296156", "text": "func (ren *Render) String() string {\n\tvar buf bytes.Buffer // A Buffer needs no initialization.\n\tw := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', 0)\n\tfmt.Fprintf(w, \"Dimension:\\t%v\\n\", ren.Image.Bounds())\n\tfmt.Fprintf(w, \"Function:\\t%s\\n\", util.FunctionName(ren.F))\n\tfmt.Fprintf(w, \"Factor:\\t%f\\n\", ren.Factor)\n\tfmt.Fprintf(w, \"Exposure:\\t%f\\n\", ren.Exposure)\n\tfmt.Fprintf(w, \"Points:\\t%d\\n\", ren.Points)\n\tw.Flush()\n\treturn string(buf.Bytes())\n}", "title": "" }, { "docid": "d49f19ce1a227396eb65bfde13ac63f0", "score": "0.6295818", "text": "func (m *Mat) String() string {\n\tif m.c*m.l == 0 {\n\t\treturn \"\\n\"\n\t}\n\tvar b strings.Builder\n\tfor l := 0; l < m.l; l++ {\n\t\tfmt.Fprintf(&b, \"%s\\n\", m.stringL(l))\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "daa4f88a140baffd05f4b8aab362204a", "score": "0.6291052", "text": "func (sq *Square) String() string {\n\tpl := point.PointList(sq.Points)\n\treturn fmt.Sprintf(\"[%d, %d]:\\n%s\", sq.X, sq.Y, (&pl).String())\n}", "title": "" }, { "docid": "8dcd437939242f6903395e1cb36bb829", "score": "0.6285538", "text": "func (gmap *Map) String() string {\n\tvar oIDs []uint32\n\tfor y := range gmap.tiles {\n\t\tfor x := range gmap.tiles[y] {\n\t\t\tfor z := range gmap.tiles[y][x] {\n\t\t\t\tfor _, o := range gmap.tiles[y][x][z].objects {\n\t\t\t\t\toIDs = append(oIDs, o.GetID())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"{name: \\\"%s\\\", height: %d, width: %d, depth: %d, owners: %d, objects: %v}\", gmap.name, gmap.height, gmap.width, gmap.depth, len(gmap.owners), oIDs)\n}", "title": "" }, { "docid": "809c4c363f35e0de3e666c7b3be6b00a", "score": "0.6270673", "text": "func (v Vertex) String() string {\n\treturn fmt.Sprintf(\"(%d, %d)\", v.X, v.Y)\n}", "title": "" }, { "docid": "06653e195551197aa4f464019e17508f", "score": "0.6260843", "text": "func (s *Sudoku) String() string {\n\tb := bytes.Buffer{}\n\n\tfor row := 0; row < len(s.board); row++ {\n\n\t\tif row != 0 && (row%3 == 0) {\n\t\t\tb.WriteString(\"- - - + - - - + - - -\\n\")\n\t\t}\n\n\t\tfor col := 0; col < len(s.board[row]); col++ {\n\t\t\tval := s.board[row][col]\n\t\t\t//fmt.Printf(\"(%d, %d) = %d\\n\", row, col, val)\n\n\t\t\tif col != 0 && (col%3 == 0) {\n\t\t\t\tb.WriteString(\"| \")\n\t\t\t}\n\n\t\t\t// Append the value of the cell, or a blank space if it is empty (val==0)\n\t\t\tif val == 0 {\n\t\t\t\tb.WriteString(\" \")\n\t\t\t} else {\n\t\t\t\tb.WriteString(fmt.Sprintf(\"%d \", val))\n\t\t\t}\n\t\t}\n\n\t\tif row != 8 {\n\t\t\tb.WriteString(\"\\n\")\n\t\t}\n\t}\n\n\treturn b.String()\n}", "title": "" }, { "docid": "5276dd11d117be36a466a704c70e9eec", "score": "0.62597185", "text": "func (t *TreeNode) String() string {\n\n\tvar BT_HEIGHT = t.Height()\n\tvar BT_WIDTH = 80 // arbitrary number of cols per matrix output.\n\n\tvar tree func(*TreeNode, []byte, bool, int, int) int\n\ttree = func(t *TreeNode, canvas []byte, is_left bool, offset int, depth int) int {\n\t\tif t == nil {\n\t\t\treturn 0\n\t\t}\n\t\tval := fmt.Sprintf(\"%d\", t.Val)\n\n\t\tvar left = tree(t.Left, canvas, true, offset, depth+1)\n\t\tvar right = tree(t.Right, canvas, false, offset+left+len(val), depth+1)\n\n\t\tfor i := 0; i < len(val); i++ {\n\t\t\tcanvas[(BT_WIDTH*depth)+(offset+left+i)] = val[i]\n\t\t}\n\n\t\tvar row = (depth - 1) * BT_WIDTH\n\t\tif depth > 0 && is_left {\n\n\t\t\tfor i := 0; i < len(val)+right; i++ {\n\t\t\t\tcanvas[row+(offset+left+len(val)/2+i)] = '-'\n\t\t\t}\n\t\t\tcanvas[row+(offset+left+len(val)/2)] = '.'\n\t\t}\n\n\t\tif depth > 0 && !is_left {\n\t\t\tfor i := 0; i < left+len(val); i++ {\n\t\t\t\tcanvas[row+(offset-len(val)/2+i)] = '-'\n\t\t\t}\n\t\t\tcanvas[row+(offset+left+len(val)/2)] = '.'\n\t\t}\n\n\t\treturn left + len(val) + right\n\t}\n\n\tif t == nil {\n\t\treturn \"\"\n\t}\n\n\tvar b = make([]byte, BT_HEIGHT*BT_WIDTH)\n\tfor i := 0; i < len(b); i++ {\n\t\tb[i] = ' '\n\t}\n\ttree(t, b, false, 0, 0)\n\n\tvar canvas bytes.Buffer\n\tfor i := 0; i < len(b); i += BT_WIDTH {\n\t\tcanvas.Write(b[i : i+BT_WIDTH])\n\t\tcanvas.WriteByte(10)\n\t}\n\n\treturn canvas.String()\n\n}", "title": "" }, { "docid": "b24fa0bb67f7d0dd56656b160fc49a77", "score": "0.6257686", "text": "func (p Pos) String() string {\n\tif p.IsZero() {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%s/%08x:%d\", p.Generation, p.Index, p.Offset)\n}", "title": "" }, { "docid": "9334f254d18944bcfbce43b8d9da9c2c", "score": "0.62554365", "text": "func (g *DistanceGrid) String() string {\n\treturn g.Grid.(*NormalGrid).stringWithContentsFunc(g.contentsOf)\n}", "title": "" }, { "docid": "b103fb6363f5d7a48bb7bdd5f57748a4", "score": "0.6252606", "text": "func (m Mesh) String() string {\n\tvar s string\n\ts += \"Mesh: \\n\"\n\n\tfor i := 0; i < len(m.Triangles); i++ {\n\t\ts += fmt.Sprintf(\"%v\\n\", m.Triangles[i])\n\t}\n\treturn s\n}", "title": "" }, { "docid": "48281fd79840dc6a1b1ddebda1aaf3b1", "score": "0.62524366", "text": "func (p Pos) String() string {\n\tl, c, o := p.Line(), p.Column(), p.Offset()\n\tswitch {\n\tcase l <= 0 || c <= 0 || o < 0:\n\t\treturn `?`\n\tcase l > 1 && o > 0:\n\t\treturn fmt.Sprintf(\"%d:%d (byte %d)\", l, c, o)\n\tcase o > 0:\n\t\treturn fmt.Sprintf(\"rune %d (byte %d)\", c, o)\n\tdefault:\n\t\treturn fmt.Sprintf(\"rune %d\", c)\n\t}\n}", "title": "" }, { "docid": "c88b05e33a2dca5759be5b225c25105e", "score": "0.6247338", "text": "func (pos *LexPos) String() string {\n\treturn fmt.Sprintf(\"%d:%d\", pos.Line, pos.Column)\n}", "title": "" }, { "docid": "945397c8b9b6718bb995d3907aec0236", "score": "0.62455904", "text": "func (b Board) String() (s string) {\n\tfor i := range b.cell {\n\t\tfor j := range b.cell[i] {\n\t\t\ts += fmt.Sprintf(\"%d \", b.cell[i][j])\n\t\t}\n\t\ts += fmt.Sprintln()\n\t}\n\treturn\n}", "title": "" }, { "docid": "9857fff4fd89ca9fc13c848f076fa216", "score": "0.62431073", "text": "func (t *TreeNode) String() string {\n\tp := placeholder(t.Depth())\n\n\tvalues(t, p, 0, 0, false)\n\tlines(p)\n\n\ts := \"\"\n\tfor _, x := range p {\n\t\ts += fmt.Sprintf(\"%s\\n\", strings.Join(x, \"\"))\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "031b01ff266cec54f77319445150a494", "score": "0.6242348", "text": "func (s *Sudoku) String() string {\n\t// get the maximum width for our values.\n\t// usually, this should be 1, but if we could not find\n\t// a solution, it will show all possibilities\n\twidth := 0\n\tfor _, field := range s.fields {\n\t\tif width < len(s.grid[field]) {\n\t\t\twidth = len(s.grid[field])\n\t\t}\n\t}\n\tline := strings.Repeat(\"-\", ((width+1)*3)+1)\n\tline = fmt.Sprintf(\"%v+%v+%v\", line, line, line)\n\tvar print string\n\tfor idx, field := range s.fields {\n\t\tswitch {\n\t\tcase idx == 0:\n\t\t\tprint += \" \"\n\t\tcase (idx % 27) == 0:\n\t\t\tprint += \"\\n\" + line + \"\\n \"\n\t\tcase (idx % 9) == 0:\n\t\t\tprint += \"\\n \"\n\t\tcase (idx % 3) == 0:\n\t\t\tprint += \"| \"\n\t\t}\n\t\tvalue := string(s.grid[field])\n\t\t// print points instead of zeroes for readability\n\t\tif value == \"0\" {\n\t\t\tvalue = \".\"\n\t\t}\n\t\t// center the value if needed\n\t\tif len(value) < width {\n\t\t\tvalue = fmt.Sprintf(\"%[1]*s\", -width, fmt.Sprintf(\"%[1]*s\", (width+len(value))/2, value))\n\t\t}\n\t\tprint += value + \" \"\n\n\t}\n\treturn print\n}", "title": "" }, { "docid": "bca8b79f1a7ee219a3fb4fcba1575745", "score": "0.6235103", "text": "func (s *State) String() string {\n\tstr := \"\"\n\n\t// Stringify the top tubes\n\tfor j := 0; j < 7; j++ {\n\t\tidx := 6 - j\n\t\tfor i := 0; i < 6; i++ {\n\t\t\tt := s.Top[i]\n\t\t\tif t.Capacity == idx {\n\t\t\t\tstr += \" _ \"\n\t\t\t} else if t.Capacity < idx {\n\t\t\t\tstr += \" \"\n\t\t\t} else if t.Length > idx {\n\t\t\t\tstr += \"|\" + strconv.Itoa(t.Cells[idx]) + \"|\"\n\t\t\t} else {\n\t\t\t\tstr += \"| |\"\n\t\t\t}\n\t\t}\n\t\tstr += \"\\n\"\n\t}\n\n\tstr += \"------------------\\n\"\n\n\t// Stringify the bottom tubes\n\tfor idx := 0; idx < 7; idx++ {\n\t\tfor i := 0; i < 6; i++ {\n\t\t\tt := s.Bottom[i]\n\t\t\tbaseIdx := t.Capacity - (idx + 1)\n\t\t\tif t.Capacity == idx {\n\t\t\t\tstr += \" _ \"\n\t\t\t} else if t.Capacity < idx {\n\t\t\t\tstr += \" \"\n\t\t\t} else if t.Length > baseIdx {\n\t\t\t\tstr += \"|\" + strconv.Itoa(t.Cells[baseIdx]) + \"|\"\n\t\t\t} else {\n\t\t\t\tstr += \"| |\"\n\t\t\t}\n\t\t}\n\t\tif idx != 6 {\n\t\t\tstr += \"\\n\"\n\t\t}\n\t}\n\n\treturn str\n}", "title": "" }, { "docid": "6fdc41ebedd763285959591c02c64987", "score": "0.6232095", "text": "func (l *Life) String() string {\n\tvar buf bytes.Buffer\n\tfor y := 0; y < l.h; y++ {\n\t\tfor x := 0; x < l.w; x++ {\n\t\t\tb := ' '\n\t\t\t// █\n\t\t\t// ░\n\t\t\t// ▒\n\t\t\t// ▓\n\t\t\t//b = '💙'\n\t\t\t//b = '💚'\n\t\t\t//b = '💗'\n\t\t\tswitch l.a.WhatIs(x, y) {\n\t\t\tcase 1:\n\t\t\t\tb = '▓'\n\t\t\tcase 2:\n\t\t\t\tb = '▒'\n\t\t\tcase 3:\n\t\t\t\tb = '█'\n\t\t\t}\n\n\t\t\tbuf.WriteRune(b)\n\t\t}\n\t\tbuf.WriteByte('\\n')\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "04d79f0f8697d1541e190728d10cf987", "score": "0.6230951", "text": "func (i *Node) String() string {\n\treturn \"NODE:\\tX: \" + strconv.FormatInt(int64(i.x), 10) + \"\\tY: \" + strconv.FormatInt(int64(i.y), 10) + \"\\n\"\n}", "title": "" }, { "docid": "9a5b3a01741ec58d3c5b97d94b301c83", "score": "0.6223916", "text": "func (m *MerkleTree) String() string {\n\ts := \"\"\n\tfor _, l := range m.Leafs {\n\t\ts += fmt.Sprint(l)\n\t\ts += \"\\n\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "b27c28c7d8073a5e3e803113835ec331", "score": "0.6222912", "text": "func (m Mat4) String() string {\n\tbuf := new(bytes.Buffer)\n\tw := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight)\n\tfor i := 0; i < 4; i++ {\n\t\tfor _, col := range m.Row(i) {\n\t\t\tfmt.Fprintf(w, \"%f\\t\", col)\n\t\t}\n\n\t\tfmt.Fprintln(w, \"\")\n\t}\n\tw.Flush()\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "a0bc15c96aed84899ef306b41296c423", "score": "0.6219796", "text": "func (c CursorPosition) String() string {\n\treturn \"\\x1b[\" + strconv.Itoa(c.X) + \";\" + strconv.Itoa(c.Y) + \"H\"\n}", "title": "" }, { "docid": "9029d175a196a752be896bb13f84653b", "score": "0.62032783", "text": "func (g Grid) String() string {\n\tresult := \"[\\n\"\n\tfor _, row := range g.State {\n\t\t// Remove spaces\n\t\tresult += strings.Replace(fmt.Sprintf(\"%v\\n\", row), \" \", \"\", -1)\n\t}\n\tresult += \"\\n]\"\n\treturn result\n}", "title": "" }, { "docid": "0eea910334d7dc37dd7d2bdadba5654d", "score": "0.6199738", "text": "func (G Game) String() string {\n\tcastles := [][]string{{\"K\", \"Q\"}, {\"k\", \"q\"}}\n\trights := \"\"\n\tfor c := piece.White; c <= piece.Black; c++ {\n\t\tfor s := position.ShortSide; s <= position.LongSide; s++ {\n\t\t\tif G.Position.CastlingRights[c][s] {\n\t\t\t\trights += castles[c][s]\n\t\t\t}\n\t\t}\n\t}\n\tenpass := \"None\"\n\tif G.Position.EnPassant <= square.LastSquare {\n\t\tenpass = fmt.Sprint(G.Position.EnPassant)\n\t}\n\tstr := \" +---+---+---+---+---+---+---+---+\\n\"\n\tfor i := 63; i >= 0; i-- {\n\t\tp := G.Position.OnSquare(square.Square(i))\n\t\tif i%8 == 7 {\n\t\t\tstr += fmt.Sprint(\" \", (i/8)+1, \" \")\n\t\t}\n\t\tstr += \"| \" + fmt.Sprint(p) + \" \"\n\t\tif i%8 == 0 {\n\t\t\tstr += \"|\"\n\t\t\tswitch i / 8 {\n\t\t\tcase 7:\n\t\t\t\tstr += fmt.Sprint(\" Active Color: \", []string{\"White\", \"Black\"}[G.ActiveColor()])\n\t\t\tcase 5:\n\t\t\t\tstr += fmt.Sprint(\" En Passant: \", enpass)\n\t\t\tcase 4:\n\t\t\t\tstr += fmt.Sprint(\" Castling Rights: \", rights)\n\t\t\tcase 3:\n\t\t\t\tstr += fmt.Sprint(\" 50 Move Rule: \", G.Position.FiftyMoveCount)\n\t\t\tcase 1:\n\t\t\t\tstr += fmt.Sprint(\" White's Clock: \", G.control[0].clock, \" (\", G.control[0].movesLeft, \" moves)\")\n\t\t\tcase 0:\n\t\t\t\tstr += fmt.Sprint(\" Black's Clock: \", G.control[1].clock, \" (\", G.control[1].movesLeft, \" moves)\")\n\t\t\t}\n\t\t\tstr += \"\\n +---+---+---+---+---+---+---+---+\\n\"\n\n\t\t}\n\t}\n\tstr += \" A B C D E F G H\\n\"\n\treturn str\n}", "title": "" }, { "docid": "6912e061b877f3579d0ee5467fc50166", "score": "0.6196313", "text": "func (pos Position) String() string {\n\tif !pos.IsValid() {\n\t\treturn \"-\"\n\t}\n\ts := fmt.Sprintf(\"%d\", pos.Line)\n\tif pos.Column != 0 {\n\t\ts += fmt.Sprintf(\":%d\", pos.Column)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "a196bc2ba28cfeb326509f0a0283e7eb", "score": "0.6191727", "text": "func (b *Board) String() string {\n\tfen := \"\"\n\tfor r := 7; r >= 0; r-- {\n\t\tfor f := 0; f < numOfSquaresInRow; f++ {\n\t\t\tsq := getSquare(File(f), Rank(r))\n\t\t\tp := b.piece(sq)\n\t\t\tif p != NoPiece {\n\t\t\t\tfen += p.getFENChar()\n\t\t\t} else {\n\t\t\t\tfen += \"1\"\n\t\t\t}\n\t\t}\n\t\tif r != 0 {\n\t\t\tfen += \"/\"\n\t\t}\n\t}\n\tfor i := 8; i > 1; i-- {\n\t\trepeatStr := strings.Repeat(\"1\", i)\n\t\tcountStr := strconv.Itoa(i)\n\t\tfen = strings.Replace(fen, repeatStr, countStr, -1)\n\t}\n\treturn fen\n}", "title": "" }, { "docid": "17fcdc2fa4d07a8aaf63f7df0350bbc9", "score": "0.618918", "text": "func (la *Lattice) String() string {\n\tstr := \"\"\n\tfor i, nodes := range la.list {\n\t\tstr += fmt.Sprintf(\"[%v] :\\n\", i)\n\t\tfor _, node := range nodes {\n\t\t\tstr += fmt.Sprintf(\"%v\\n\", node)\n\t\t}\n\t\tstr += \"\\n\"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "86f7c9ecd74fd0e050dfcfaa1988a362", "score": "0.61832356", "text": "func (pos *Position) String() string {\n\tif !pos.IsValid() {\n\t\treturn \"-\"\n\t}\n\ts := fmt.Sprintf(\"%d\", pos.Line)\n\tif pos.Column != 0 {\n\t\ts += fmt.Sprintf(\":%d\", pos.Column)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "e528950d580a9e197343c30ba38b3363", "score": "0.61818653", "text": "func (game *OXGame) String() string {\n\tvar r string\n\n\tfor i := range game.board {\n\t\tr += fmt.Sprint(game.board[i])\n\t\tif i%3 == 2 {\n\t\t\tr += \"\\n\"\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "c534db2be297b1e581da575b0318b9ca", "score": "0.6176724", "text": "func (t *Tree) String() string {\n\treturn fmt.Sprintf(\"Tree(center:%d, size:%d, left:%d, right:%d)\",\n\t\tt.center, t.size(), t.left.size(), t.right.size())\n}", "title": "" }, { "docid": "21f3263f4cfbe7b4ac82430181f2cb78", "score": "0.616628", "text": "func (game *Game) String() (nice string) {\n\t// this prepends an internal representation of the game to the output\n\tnice += fmt.Sprintf(\"%+v\\n\", *game) // dereference game to avoid recursion\n\n\tnice += fmt.Sprintf(\"Current position:\\n\")\n\tnice += boardString(game.board)\n\n\t// copy game.board to oldBoard\n\toldBoard := make(map[int]int, len(game.board))\n\tfor pos, color := range game.board {\n\t\toldBoard[pos] = color\n\t}\n\n\t// display the past couple positions we have memorized\n\t// this code is so complicated because game.differences is a slice representing a ring buffer\n\t// whose beginning depends on the slice's length\n\thistorySize := config.Int[\"history_size\"]\n\tfor i := 0; i < historySize-1; i++ {\n\t\tgame.applyDiff(oldBoard, i)\n\t\tnice += fmt.Sprintf(\"Position %d:\\n\", i+1)\n\t\tnice += boardString(oldBoard)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a003726f9f3c29b402ffbe0d39aeb3cc", "score": "0.61656964", "text": "func (rb *RoaringBitmap) String() string {\n\t// inspired by https://github.com/fzandona/goroar/blob/master/roaringbitmap.go\n\tvar buffer bytes.Buffer\n\tstart := []byte(\"{\")\n\tbuffer.Write(start)\n\ti := rb.Iterator()\n\tfor i.HasNext() {\n\t\tbuffer.WriteString(strconv.Itoa(int(i.Next())))\n\t\tif i.HasNext() { // todo: optimize\n\t\t\tbuffer.WriteString(\",\")\n\t\t}\n\t}\n\tbuffer.WriteString(\"}\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "e3e4969e85d29654b07909deeb71127a", "score": "0.6165576", "text": "func (g Game) String() string {\n\ts := \"\"\n\tfor i, n := range g {\n\t\ts += strconv.Itoa(n)\n\t\tif i%3 == 2 && i%9 != 8 {\n\t\t\ts += \" \"\n\t\t}\n\t\tif i != 80 {\n\t\t\tif i%9 == 8 {\n\t\t\t\ts += \"\\n\"\n\t\t\t}\n\t\t\tif i%27 == 26 {\n\t\t\t\ts += \"\\n\"\n\t\t\t}\n\t\t}\n\t}\n\treturn s\n}", "title": "" }, { "docid": "0f51ab98ac4ee561f6a6a9e9a15ee24b", "score": "0.61574435", "text": "func (c Cube) String() string {\n\tn := c.n\n\ttab := strings.Repeat(\" \", n) + \" \"\n\tstr := strings.Builder{}\n\tstr.WriteRune('\\n')\n\tfor i := 0; i < n; i++ {\n\t\tstr.WriteString(tab)\n\t\twriteSideLine(&str, &c.Sides[U], i)\n\t\tstr.WriteRune('\\n')\n\t}\n\tfor i := 0; i < n; i++ {\n\t\twriteSideLine(&str, &c.Sides[L], i)\n\t\tstr.WriteRune(' ')\n\t\twriteSideLine(&str, &c.Sides[F], i)\n\t\tstr.WriteRune(' ')\n\t\twriteSideLine(&str, &c.Sides[R], i)\n\t\tstr.WriteRune(' ')\n\t\twriteSideLine(&str, &c.Sides[B], i)\n\t\tstr.WriteRune('\\n')\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tstr.WriteString(tab)\n\t\twriteSideLine(&str, &c.Sides[D], i)\n\t\tstr.WriteRune('\\n')\n\t}\n\tstr.WriteRune('\\n')\n\treturn str.String()\n}", "title": "" }, { "docid": "b4606b79601ed6ebbaacdd432deb2234", "score": "0.6155261", "text": "func (la *lattice) String() string {\n\tstr := \"\"\n\tfor i, nodes := range la.list {\n\t\tstr += fmt.Sprintf(\"[%v] :\\n\", i)\n\t\tfor _, node := range nodes {\n\t\t\tstr += fmt.Sprintf(\"%v\\n\", node)\n\t\t}\n\t\tstr += \"\\n\"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "b80220ade4418a346783737756087315", "score": "0.61448324", "text": "func (i Instances) String() string {\n\treturn i.Tiles().String()\n}", "title": "" }, { "docid": "6e0513127ed0fdbdd0d8595193f31593", "score": "0.6129158", "text": "func (gs *GameState) String() string {\n\ts := fmt.Sprintln(\"Next turn: \", gs.PlayerTurn, \"\\nLast move: \", gs.LastMove)\n\treturn fmt.Sprint(s, gs.BoardPosition)\n}", "title": "" }, { "docid": "fe143484d46c16300f24496ac3c17445", "score": "0.6122838", "text": "func (m *Maze) Print() {\n\t// Draw the top wall of the maze.\n\tline := \"+\"\n\tfor x := 0; x < m.w; x++ {\n\t\tline += span(\"-\", \"+\")\n\t}\n\tfmt.Println(line)\n\n\t// Print such that origin is in lower left of printout.\n\tfor y := m.h - 1; y >= 0; y-- {\n\t\tline1 := \"|\"\n\t\tline2 := \"+\"\n\t\tfor x := 0; x < m.w; x++ {\n\t\t\tswitch m.hasWall(x, y, EAST) {\n\t\t\tcase true:\n\t\t\t\tline1 += span(\" \", \"|\")\n\t\t\tdefault:\n\t\t\t\tline1 += span(\" \", \" \")\n\t\t\t}\n\t\t\tswitch m.hasWall(x, y, SOUTH) {\n\t\t\tcase true:\n\t\t\t\tline2 += span(\"-\", \"+\")\n\t\t\tdefault:\n\t\t\t\tline2 += span(\" \", \"+\")\n\t\t\t}\n\t\t}\n\t\tfmt.Println(line1)\n\t\tfmt.Println(line2)\n\t}\n}", "title": "" }, { "docid": "c00cc8b6b39cf7be35ef5fc9d2ffcc6c", "score": "0.6121544", "text": "func (a *Area) String() string {\n\tvar result bytes.Buffer\n\tresult.WriteString(\"(\")\n\tfor _, l := range a.Locations {\n\t\tfor _, v := range l.Visitors {\n\t\t\tresult.WriteString(fmt.Sprintf(\"%s\", string(v.Name[0])))\n\t\t}\n\t\tif len(l.Visitors) < a.fleas {\n\t\t\tresult.WriteString(strings.Repeat(\".\", a.fleas-len(l.Visitors)))\n\t\t}\n\t\tresult.WriteString(\" <-> \")\n\t}\n\tresult.WriteString(\")\")\n\treturn result.String()\n}", "title": "" }, { "docid": "2a05a04c638c545c4f816acb212c5320", "score": "0.612149", "text": "func (r Rect) String() string {\n\treturn fmt.Sprintf(\"(%d, %d) - (%d x %d)\", r.Left, r.Top, r.Width, r.Height)\n}", "title": "" }, { "docid": "2a05a04c638c545c4f816acb212c5320", "score": "0.612149", "text": "func (r Rect) String() string {\n\treturn fmt.Sprintf(\"(%d, %d) - (%d x %d)\", r.Left, r.Top, r.Width, r.Height)\n}", "title": "" }, { "docid": "e7bdb6cc420fe88ff11ca9928d2092be", "score": "0.6117789", "text": "func (c *Exporter) ExportMaze(maze *data.Maze) string {\n\tw := maze.Width()\n\th := maze.Height()\n\n\tcharsCount := utf8.RuneCountInString(c.wall)\n\tspace := strings.Repeat(\" \", charsCount)\n\n\tlines := make([][]string, h*2+1)\n\tfor i := range lines {\n\t\tline := make([]string, w*2+1)\n\t\tfor j := range line {\n\t\t\tline[j] = c.wall\n\t\t}\n\t\tlines[i] = line\n\t}\n\n\tfor y := 0; y < h; y++ {\n\t\tsy := y*2 + 1\n\t\tfor x := 0; x < w; x++ {\n\t\t\tsx := x*2 + 1\n\t\t\tlines[sy][sx] = space\n\n\t\t\tcell := maze.Cell(x, y)\n\t\t\tif y == 0 && !cell.TopWall {\n\t\t\t\tlines[sy-1][sx] = space\n\t\t\t}\n\t\t\tif x == 0 && !cell.LeftWall {\n\t\t\t\tlines[sy][sx-1] = space\n\t\t\t}\n\t\t\tif !cell.BottomWall {\n\t\t\t\tlines[sy+1][sx] = space\n\t\t\t}\n\t\t\tif !cell.RightWall {\n\t\t\t\tlines[sy][sx+1] = space\n\t\t\t}\n\t\t}\n\t}\n\n\tif in := maze.Entrance(); in != nil {\n\t\tmarkDoor(lines, in, repeatStringToLength(c.in, charsCount))\n\t}\n\tif out := maze.Exit(); out != nil {\n\t\tmarkDoor(lines, out, repeatStringToLength(c.out, charsCount))\n\t}\n\n\tstr := make([]string, len(lines))\n\tfor y, line := range lines {\n\t\tstr[y] = strings.Join(line, \"\")\n\t}\n\n\treturn strings.Join(str, \"\\n\")\n}", "title": "" }, { "docid": "ee1fb3caddbf6831ea8e23fbc787a8bc", "score": "0.611702", "text": "func (pos *Position) String() string {\n\tb := pos.board.String()\n\tt := pos.turn.String()\n\tc := pos.castleRights.String()\n\tsq := \"-\"\n\tif pos.enPassantSquare != NoSquare {\n\t\tsq = pos.enPassantSquare.String()\n\t}\n\treturn fmt.Sprintf(\"%s %s %s %s %d %d\", b, t, c, sq, pos.halfMoveClock, pos.moveCount)\n}", "title": "" }, { "docid": "a593ccbf8a58fc94f8d0113b098d36b9", "score": "0.6116638", "text": "func (scheme *asciiScheme) String() string {\n\tvar asciiScheme string\n\n\tfor column := 0; column < len(scheme.graph); column++ {\n\t\tvar currentLength int\n\t\tfor row := 0; row < len(scheme.graph[column]); row++ {\n\t\t\tswitch scheme.graph[column][row] {\n\t\t\tcase \"╠\", \"╣\", \"╫\", \"║\", \"╝\", \"╩\", \"╚\":\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\tif currentLength < len(scheme.graph[column][row]) {\n\t\t\t\t\tcurrentLength = len(scheme.graph[column][row])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif currentLength <= 1 {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor i := 0; i < currentLength; i++ {\n\t\t\tscheme.insertColumn(uint64(column))\n\t\t}\n\t\tfor _, pos := range scheme.eventsPosition {\n\t\t\tif pos[0] == uint64(column) {\n\t\t\t\tfor i := 1; i < currentLength; i++ {\n\t\t\t\t\tscheme.graph[column+i][pos[1]] = \"&\"\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\n\tfor row := 0; row < int(scheme.lengthColumn); row++ {\n\t\tfor column := 0; column < len(scheme.graph); column++ {\n\t\t\tif scheme.graph[column][row] == \"&\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsymbol := scheme.graph[column][row]\n\t\t\tif len(symbol) == 0 {\n\t\t\t\tsymbol = \" \"\n\t\t\t}\n\n\t\t\tasciiScheme += symbol\n\t\t}\n\t\tasciiScheme += \"\\n\"\n\t}\n\n\treturn asciiScheme\n}", "title": "" }, { "docid": "12c2d615d4d947fc621b27c64ecd98ea", "score": "0.6106989", "text": "func (solution Solution) String() string {\n\t// TODO(ndunn): support more than 52 pieces\n\talphabet := strings.Split(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\", \"\")\n\tpieces := make([][]string, solution.Original.Rows)\n\tfor row := 0; row < solution.Original.Rows; row++ {\n\t\tpieces[row] = make([]string, solution.Original.Cols)\n\t\tfor col := 0; col < solution.Original.Cols; col++ {\n\t\t\tpieces[row][col] = \"_\"\n\t\t}\n\t}\n\n\tpieceIndex := -1\n\t// Figure out which pieces fill up which spaces in the grid\n\tfor loc, piece := range solution.Pieces {\n\t\tpieceIndex++\n\t\tpieceIndex = pieceIndex % len(pieces)\n\t\tpieceLetter := alphabet[pieceIndex]\n\t\t// The locations of the extent are relative to upper left hand corner of the piece\n\t\tfor _, relLoc := range piece.Extent() {\n\t\t\tabsLoc := relLoc.Add(loc)\n\t\t\tpieces[absLoc.Row][absLoc.Col] = pieceLetter\n\t\t}\n\t}\n\n\tresult := \" [\"\n\t// column headers\n\tfor i := 0; i < solution.Original.Cols; i++ {\n\t\tif i%3 == 0 {\n\t\t\tresult += \"|\"\n\t\t} else {\n\t\t\tresult += \" \"\n\t\t}\n\t}\n\tresult += \"\\n\"\n\n\tfor i, row := range pieces {\n\t\t// Remove spaces\n\t\tif i%4 == 0 {\n\t\t\tresult += fmt.Sprintf(\"%2d\", i+1) + strings.Replace(fmt.Sprintf(\"%v\\n\", row), \" \", \"\", -1)\n\t\t} else {\n\t\t\tresult += \" \" + strings.Replace(fmt.Sprintf(\"%v\\n\", row), \" \", \"\", -1)\n\t\t}\n\t}\n\tresult += \"\\n]\"\n\treturn result\n}", "title": "" }, { "docid": "104c2ca521f8999c116e1a4b0edf86bb", "score": "0.61036247", "text": "func (path *pathT) String() string {\n\ts := \"[\"\n\tpvs := []*interiorNodeS(*path)\n\tstrs := make([]string, 0, 2)\n\tfor _, pv := range pvs {\n\t\tstrs = append(strs, fmt.Sprintf(\"%p\", pv))\n\t}\n\ts += strings.Join(strs, \" \")\n\ts += \"]\"\n\n\treturn s\n}", "title": "" }, { "docid": "7d6c4235828c726792ce854379de0474", "score": "0.60993004", "text": "func (node *Node) String() string {\n\treturn fmt.Sprintf(\"{height: %v}\", node.height)\n}", "title": "" }, { "docid": "402624c3bc8a57420c099102b299cc09", "score": "0.6088514", "text": "func printScreen(maze []string) {\n\tfor _, line := range maze {\n\t\tfmt.Println(line)\n\t}\n}", "title": "" }, { "docid": "93c08e28e7fe59089afcec725f547224", "score": "0.6078721", "text": "func (m *Move) ToString() string {\n\treturn string(m.Piece) + m.Begin.ToString() + \"-\" + m.End.ToString()\n}", "title": "" }, { "docid": "d5b8481b7c7bbcbeb5d745ead8d6dec7", "score": "0.60747355", "text": "func (h Heap) String() string {\n\treturn h.printTree(0, 0)\n}", "title": "" }, { "docid": "3b9827bfb5cba2e001cea5e4a9200ee0", "score": "0.6071246", "text": "func (board Board) String() string {\n\tvar boardString string\n\tfor _, row := range board {\n\t\tboardString += fmt.Sprintf(\"%v\\r\\n\", row)\n\t}\n\treturn boardString\n}", "title": "" }, { "docid": "af3579755f735b054802a00b6d352f4f", "score": "0.606986", "text": "func (m Mat3) String() string {\n\tbuf := new(bytes.Buffer)\n\tw := tabwriter.NewWriter(buf, 4, 4, 1, ' ', tabwriter.AlignRight)\n\tfor i := 0; i < 3; i++ {\n\t\tfor _, col := range m.Row(i) {\n\t\t\tfmt.Fprintf(w, \"%f\\t\", col)\n\t\t}\n\n\t\tfmt.Fprintln(w, \"\")\n\t}\n\tw.Flush()\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "beb1a910e708ab916971c928a4258c3c", "score": "0.6069093", "text": "func (l *Leaf) String() string {\n\tif l == nil || l.Center() == nil {\n\t\treturn \".\"\n\t}\n\tc := l.Center()\n\treturn fmt.Sprintf(\"L: [%.1f, %.1f, %.1f]\", c.X(), c.Y(), c.Z())\n}", "title": "" }, { "docid": "74bc0159466544c680f7dd0457910392", "score": "0.6068844", "text": "func (b Board) ToString() string {\n\trows := make([]string, N, N)\n\trow := make([]string, N, N)\n\tfor rowIdx, posrow := range b.pos {\n\t\tfor colIdx, colValue := range posrow {\n\t\t\tswitch colValue {\n\t\t\tcase Empty:\n\t\t\t\trow[colIdx] = \".\"\n\t\t\tcase Black:\n\t\t\t\trow[colIdx] = \"X\"\n\t\t\tcase White:\n\t\t\t\trow[colIdx] = \"O\"\n\t\t\t}\n\t\t}\n\t\trows[rowIdx] = strings.Join(row, \"\")\n\t}\n\treturn strings.Join(rows, \"\")\n}", "title": "" } ]
1d3a779056bb82484b5d59bfbce8a669
IDEQ applies the EQ predicate on the ID field.
[ { "docid": "96e048095240375c56fac8dec32343ec", "score": "0.7209343", "text": "func IDEQ(id string) predicate.OfflineSession {\n\treturn predicate.OfflineSession(sql.FieldEQ(FieldID, id))\n}", "title": "" } ]
[ { "docid": "00dcc19514e7d76bc901bec7cf024fc9", "score": "0.7600384", "text": "func IDEQ(id int) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0b07dd5f12a1e88326223806fdc8de00", "score": "0.74975044", "text": "func IDEQ(id uint) predicate.Agent {\n\treturn predicate.Agent(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "dbc8ec1cc385f29aebb8f628e1e71bda", "score": "0.74718934", "text": "func IDEQ(id sid.ID) predicate.Token {\n\treturn predicate.Token(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "e06e579dbbff052d7c68f6e1e28de36a", "score": "0.7460866", "text": "func IDEQ(id int) predicate.Manner {\n\treturn predicate.Manner(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "e622b578c19617bf243481892eacc65f", "score": "0.7448754", "text": "func IDEQ(id int) predicate.Rent {\n\treturn predicate.Rent(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "47882bcbc734a3fc4019f9d68ec047e7", "score": "0.74357074", "text": "func IDEQ(id int) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8fa3694e9a3f55c726f2220e9a607c5b", "score": "0.7396806", "text": "func IDEQ(id string) predicate.Step {\n\treturn predicate.Step(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "778fdffe7f3d3ce6a973474604688bb0", "score": "0.73855704", "text": "func IDEQ(id uuid.UUID) predicate.Block {\n\treturn predicate.Block(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "1a507f7b1dbc6666d90fc2e8fe10e1da", "score": "0.7375274", "text": "func IDEQ(id int) predicate.Property {\n\treturn predicate.Property(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "71888af870472765a231307b0eac366e", "score": "0.73740536", "text": "func IDEQ(id int) predicate.Post {\n\treturn predicate.Post(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "fb7d30d0c353ce1a5d82088dcb9a20bd", "score": "0.73691", "text": "func IDEQ(id int) predicate.MarketInfo {\n\treturn predicate.MarketInfo(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "ed7ef3bc63d50073ef64429ad8bdadbd", "score": "0.7367634", "text": "func IDEQ(id uuid.UUID) predicate.Opt {\n\treturn predicate.Opt(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "7acf9a39e81ed5856cf26713553502a8", "score": "0.7354091", "text": "func IDEQ(id int) predicate.Blob {\n\treturn predicate.Blob(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "3cf21e24272e3d4c8e709e218153c489", "score": "0.7345197", "text": "func IDEQ(id int) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "a3bbc3eba115f26dba791428e648a398", "score": "0.7339424", "text": "func IDEQ(id int) predicate.Bulk {\n\treturn predicate.Bulk(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "2857eaaf79efb414fca4178ff51992e6", "score": "0.7333256", "text": "func IDEQ(id int) predicate.Conversion {\n\treturn predicate.Conversion(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "85821fcbf8572d65c9dccad50d0be163", "score": "0.73319566", "text": "func IDEQ(id int) predicate.AppointmentResults {\n\treturn predicate.AppointmentResults(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "bee4befe639f4757c597fe9dd7f8c015", "score": "0.7331029", "text": "func IDEQ(id int) predicate.Task {\n\treturn predicate.Task(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "a323f8406593aeb3aa965f030068274a", "score": "0.73271304", "text": "func IDEQ(id int) predicate.Pet {\n\treturn predicate.Pet(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "f73cf9d68dd585235c7d80d8519d22c2", "score": "0.7313384", "text": "func IDEQ(id int) predicate.OutcomeOverview {\n\treturn predicate.OutcomeOverview(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8d02017700152f5a6978c99b19de2903", "score": "0.7309309", "text": "func IDEQ(id int) predicate.Building {\n\treturn predicate.Building(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "d362d208ee54ce19f50940a62bfd91dc", "score": "0.72892386", "text": "func IDEQ(id uuid.UUID) predicate.Input {\n\treturn predicate.Input(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "611457194f5f27d27166ed30e37ad412", "score": "0.72886306", "text": "func IDEQ(id uuid.UUID) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "347205019c93ef4cb40478ca6cbbc7bc", "score": "0.7287604", "text": "func IDEQ(id int) predicate.Job {\n\treturn predicate.Job(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "88ef981afbe0e1ef4075e9d3859fbf32", "score": "0.7278483", "text": "func IDEQ(id int) predicate.Repairinvoice {\n\treturn predicate.Repairinvoice(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "edd059b7548f6c1b7184028a5e073907", "score": "0.7270164", "text": "func IDEQ(id int) predicate.ProfileUKM {\n\treturn predicate.ProfileUKM(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "d87b69901d1a6e58ce8c57eefc265fd3", "score": "0.7238937", "text": "func IDEQ(id uuid.UUID) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "2e4b837a4dbc93e97ff011e3bc942c4f", "score": "0.72266954", "text": "func IDEQ(id int64) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "40242282a7a0885b20fd3a6e36fe149f", "score": "0.72201246", "text": "func IDEQ(id int) predicate.Road {\n\treturn predicate.Road(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "731bb0f5157cbc11234a163e2f4a568b", "score": "0.72198784", "text": "func IDEQ(id uuid.UUID) predicate.Ref {\n\treturn predicate.Ref(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "46695f2f3fb1509b496ed0d16497bd4f", "score": "0.72183645", "text": "func IDEQ(id int) predicate.Announcement {\n\treturn predicate.Announcement(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "6268bfef7bd4e7f316551921d41d6c5e", "score": "0.7218118", "text": "func IDEQ(id uuid.UUID) predicate.Session {\n\treturn predicate.Session(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "98c46d4103476e59cde2165cf6e50b15", "score": "0.720831", "text": "func IDEQ(id int) predicate.IP {\n\treturn predicate.IP(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "d6ad2d583474270be1f505b694ef9e8a", "score": "0.7197809", "text": "func IDEQ(id string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "ecfe7fb59c94a0a3214a4ad692b1a2ee", "score": "0.7193202", "text": "func IDEQ(id int) predicate.Media {\n\treturn predicate.Media(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "7db19dff7fc3d188d8290605c6d77ca2", "score": "0.718816", "text": "func IDEQ(id int) predicate.Token {\n\treturn predicate.Token(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t},\n\t)\n}", "title": "" }, { "docid": "bd23252f3b39c9e3ab755e29f8e9a1ec", "score": "0.71821415", "text": "func IDEQ(id int) predicate.User {\n\treturn predicate.User(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "bd23252f3b39c9e3ab755e29f8e9a1ec", "score": "0.71821415", "text": "func IDEQ(id int) predicate.User {\n\treturn predicate.User(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "11a2a359b0ae1773318e027fb0896f19", "score": "0.71783966", "text": "func IDEQ(id int) predicate.OnlineSession {\n\treturn predicate.OnlineSession(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "c23b96d4ffed93d4f4a80ca108ba8517", "score": "0.71762305", "text": "func IDEQ(id int) predicate.ResultsDefinition {\n\treturn predicate.ResultsDefinition(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "a2d3cad7b2e1b4fe7bcba7e77f00bebf", "score": "0.7174264", "text": "func IDEQ(id string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\tid, _ := strconv.Atoi(id)\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t},\n\t)\n}", "title": "" }, { "docid": "303aa5d16a852a29c741f96e0fa2db04", "score": "0.7163564", "text": "func IDEQ(id int) predicate.MetaSchema {\n\treturn predicate.MetaSchema(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t},\n\t)\n}", "title": "" }, { "docid": "7f90e9de6ab840c4f1efc82e1f9f6c64", "score": "0.7162956", "text": "func IDEQ(id int) predicate.ValidMessage {\n\treturn predicate.ValidMessage(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "aa1a4df925dacb8bac8a652683bf763e", "score": "0.716262", "text": "func IDEQ(id int) predicate.FlowInstance {\n\treturn predicate.FlowInstance(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "ee365914738845e5fd17e64fecbc28a6", "score": "0.71604496", "text": "func IDEQ(id int) predicate.AllocationStrategy {\n\treturn predicate.AllocationStrategy(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "bd64d93cce38da34680179a73e2e3c1e", "score": "0.715928", "text": "func IDEQ(id int) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "bd64d93cce38da34680179a73e2e3c1e", "score": "0.715928", "text": "func IDEQ(id int) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "13df07b1a64310930840fb4b468e9d8a", "score": "0.71565664", "text": "func IDEQ(id int) predicate.OrderItem {\n\treturn predicate.OrderItem(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "cdf984e0f6b4d150e03129745404d2af", "score": "0.7146796", "text": "func IDEQ(id int) predicate.GameServer {\n\treturn predicate.GameServer(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "728ab46c2a63f7561e1e2f61364b6696", "score": "0.71422815", "text": "func IDEQ(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "728ab46c2a63f7561e1e2f61364b6696", "score": "0.71422815", "text": "func IDEQ(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "728ab46c2a63f7561e1e2f61364b6696", "score": "0.71422815", "text": "func IDEQ(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "728ab46c2a63f7561e1e2f61364b6696", "score": "0.71422815", "text": "func IDEQ(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "728ab46c2a63f7561e1e2f61364b6696", "score": "0.71422815", "text": "func IDEQ(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b28d051d81421bbf731195c3fb495599", "score": "0.71380144", "text": "func IDEQ(id int) predicate.CarRepairrecord {\n\treturn predicate.CarRepairrecord(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "548d0f3218afa13fc5c3a05820da8b9d", "score": "0.71179634", "text": "func IDEQ(id int) predicate.BaselineClass {\n\treturn predicate.BaselineClass(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "7e9609deccbba39477f4783eac854326", "score": "0.71124154", "text": "func IDEQ(id int) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8fb2d7b98de67c8b65b9fbb06eb38956", "score": "0.71123534", "text": "func IDEQ(id int) predicate.Equipmenttype {\n\treturn predicate.Equipmenttype(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "59d95600a3191a1ffc9fe32933f58b4f", "score": "0.70991665", "text": "func IDEQ(id int) predicate.Province {\n\treturn predicate.Province(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "e92ba2ec911f9f1438f5678421b28022", "score": "0.7096318", "text": "func IDEQ(id int) predicate.Medicalfile {\n\treturn predicate.Medicalfile(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b51d46e174c7c7e6c6566cc013cfb649", "score": "0.7076082", "text": "func IDEQ(id int64) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "2f849848227d82748418e2f0ab00d4c3", "score": "0.70641625", "text": "func IDEQ(id int) predicate.Surgeryappointment {\n\treturn predicate.Surgeryappointment(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "6ce0697c5b660198c35d33f9b933b1d5", "score": "0.7058486", "text": "func IDEQ(id int) predicate.K8sEvent {\n\treturn predicate.K8sEvent(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "7bf115a2397647663bf6a87bc307b7a8", "score": "0.7054344", "text": "func IDEQ(id int) predicate.DeviceRequest {\n\treturn predicate.DeviceRequest(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "1b49cca181c42721c464eb739a6c6370", "score": "0.7045252", "text": "func IDEQ(id int) predicate.TradeCorrection {\n\treturn predicate.TradeCorrection(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "12a79bfc7a4565bdf429b9e8108c6918", "score": "0.7038983", "text": "func IDEQ(id int) predicate.Babystatus {\n\treturn predicate.Babystatus(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "c1c0af8032cb36e98f883d84e61840ef", "score": "0.7014475", "text": "func IDEQ(id uuid.UUID) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "544e5771b061433b3f5950f341c48d21", "score": "0.69955146", "text": "func IDEQ(id int) predicate.Menugroup {\n\treturn predicate.Menugroup(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "d353488966cc61e620eccbb5f3b1339f", "score": "0.695759", "text": "func IDEQ(id int) predicate.QueueItem {\n\treturn predicate.QueueItem(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "54f33a568fcb2ea5229bed4d02f71d13", "score": "0.69575804", "text": "func IDEQ(id uuid.UUID) predicate.Permission {\n\treturn predicate.Permission(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8f65ff5f766afe1fc924beebe88cef91", "score": "0.69308436", "text": "func (qs ConstraintQuerySet) IDEq(ID uint) ConstraintQuerySet {\n\treturn qs.w(qs.db.Where(\"id = ?\", ID))\n}", "title": "" }, { "docid": "97ff868bd2e0ff289b3508b500c9c59c", "score": "0.6911619", "text": "func IDEQ(id int) predicate.Salary {\n\treturn predicate.Salary(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "1d917877bf91ed4f5afb2d8dfe2ecfb3", "score": "0.69113326", "text": "func (qs ControlQS) IDEq(v int32) ControlQS {\n\treturn qs.filter(`\"id\" =`, v)\n}", "title": "" }, { "docid": "19e62a894c080a0c799b33537b439513", "score": "0.69021714", "text": "func IDEQ(id int) predicate.ProcedureType {\n\treturn predicate.ProcedureType(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4b3b09e9a668fd66ccc16ec033c13ba6", "score": "0.6886925", "text": "func IDEQ(id int) predicate.Watchlist {\n\treturn predicate.Watchlist(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4fa143039de9aa87e925114a1fa05f32", "score": "0.687514", "text": "func IDEQ(id int) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4fa143039de9aa87e925114a1fa05f32", "score": "0.687514", "text": "func IDEQ(id int) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "6947665f435a79baa025ad3f25b03d92", "score": "0.6867126", "text": "func IDEQ(id int) predicate.Ethnicity {\n\treturn predicate.Ethnicity(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "fc01eb98e0bd7ba8278e3443c07a1de7", "score": "0.6858626", "text": "func IDEQ(id int) predicate.CoveredPerson {\n\treturn predicate.CoveredPerson(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "c29437110deff0798f1fe398477c7eca", "score": "0.68345517", "text": "func IDEQ(id int) predicate.BaselineMeasureDenom {\n\treturn predicate.BaselineMeasureDenom(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "7a8a5c03cafd5e41ad9c173bedfd8d22", "score": "0.6825244", "text": "func IDEQ(id string) predicate.OrderLineItem {\n\treturn predicate.OrderLineItem(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "31389786780d49c2051595ee881d2218", "score": "0.6767721", "text": "func (qs InstantprofileQS) IDEq(v int32) InstantprofileQS {\n\treturn qs.filter(`\"id\" =`, v)\n}", "title": "" }, { "docid": "134caab0f21d5565bf492a02e1501fff", "score": "0.6757728", "text": "func IDEQ(id int) predicate.Transactionfactoritemtmp {\n\treturn predicate.Transactionfactoritemtmp(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b28df111a4c5d3d0bb4a6e7d2606f921", "score": "0.6753157", "text": "func IDEQ(id int) predicate.Patientofphysician {\n\treturn predicate.Patientofphysician(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0099f7eed50028f4d1123ecd5c0aef7f", "score": "0.6706132", "text": "func IDEQ(id int) predicate.RoomStatus {\n\treturn predicate.RoomStatus(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "c7387c2feafe2062e853cef10da7782f", "score": "0.67051744", "text": "func (qs SysDBQuerySet) IDEq(ID uint64) SysDBQuerySet {\n\treturn qs.w(qs.db.Where(\"id = ?\", ID))\n}", "title": "" }, { "docid": "c959305218e86604e0089267fad666fb", "score": "0.66079706", "text": "func (qs GroupQuerySet) IDEq(ID uint) GroupQuerySet {\n\treturn qs.w(qs.db.Where(\"id = ?\", ID))\n}", "title": "" }, { "docid": "19f7fb26044be38e02f0ae6dcef837da", "score": "0.6584058", "text": "func IDEQ(id int) predicate.GroupBandwidth {\n\treturn predicate.GroupBandwidth(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "de997eb961aa405ac0d37a7b07fbf159", "score": "0.656722", "text": "func (qs DaytypeQS) IDEq(v int32) DaytypeQS {\n\treturn qs.filter(`\"id\" =`, v)\n}", "title": "" }, { "docid": "12ab179795142a84e95e44f313eec89f", "score": "0.6513624", "text": "func IDEQ(id int) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "5d0cc87c3943c02fcbe9c8e8a2910dd0", "score": "0.6380598", "text": "func IDEQ(id int) predicate.Watchlisthistory {\n\treturn predicate.Watchlisthistory(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "dcdb23755604217b31167c6b040160b9", "score": "0.63297397", "text": "func AccountIDEQ(v uuid.UUID) predicate.Block {\n\treturn predicate.Block(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldAccountID), v))\n\t})\n}", "title": "" }, { "docid": "51f5a17a5ab73f481d3757891e364445", "score": "0.6310274", "text": "func (qs DaytypeQS) IDGe(v int32) DaytypeQS {\n\treturn qs.filter(`\"id\" >=`, v)\n}", "title": "" }, { "docid": "a48ccab954b08303571df9b07cdefa26", "score": "0.6285308", "text": "func (qs ControlQS) IDGe(v int32) ControlQS {\n\treturn qs.filter(`\"id\" >=`, v)\n}", "title": "" }, { "docid": "f8cd715c39dec0a954f3c847f68f60df", "score": "0.6283675", "text": "func IDEQ(id int) predicate.DuplicateNumberMessage {\n\treturn predicate.DuplicateNumberMessage(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0436f604d25f236465521f149a0eaffc", "score": "0.6189091", "text": "func RentIDEQ(v string) predicate.Rent {\n\treturn predicate.Rent(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldRentID), v))\n\t})\n}", "title": "" }, { "docid": "5af1c12e72abd72eb279a72760ade834", "score": "0.59835976", "text": "func MandantidEQ(v string) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldMandantid), v))\n\t})\n}", "title": "" }, { "docid": "e1c35930404ed5fde47a959977ab7430", "score": "0.5969854", "text": "func (qs InstantprofileQS) IDGe(v int32) InstantprofileQS {\n\treturn qs.filter(`\"id\" >=`, v)\n}", "title": "" }, { "docid": "f79e535f1b7c7566be009eacb667667f", "score": "0.5951277", "text": "func ClientidEQ(v string) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldClientid), v))\n\t})\n}", "title": "" }, { "docid": "d38e8570a53850ec8633d83b9a18a4e7", "score": "0.592106", "text": "func IDNEQ(id int) predicate.OutcomeOverview {\n\treturn predicate.OutcomeOverview(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldID), id))\n\t})\n}", "title": "" } ]
615cb5f4c16679e154c36cf26613aba6
AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler. Check the length with: len(mockedRkeK8sSystemImageController.AddFeatureHandlerCalls())
[ { "docid": "7766dfa48fb3f0f02d8428c285076569", "score": "0.8714356", "text": "func (mock *RkeK8sSystemImageControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.RkeK8sSystemImageHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.RkeK8sSystemImageHandlerFunc\n\t}\n\tlockRkeK8sSystemImageControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockRkeK8sSystemImageControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" } ]
[ { "docid": "37e09fed76ec484ead6d87d32806b44a", "score": "0.8671383", "text": "func (mock *RkeK8sSystemImageInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.RkeK8sSystemImageHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.RkeK8sSystemImageHandlerFunc\n\t}\n\tlockRkeK8sSystemImageInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockRkeK8sSystemImageInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3751650d9c221f9605ecf6e1dade4476", "score": "0.8100127", "text": "func (mock *ConfigMapControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v11.ConfigMapHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v11.ConfigMapHandlerFunc\n\t}\n\tlockConfigMapControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockConfigMapControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b23bbef168fe3a8d861662b91d540192", "score": "0.8094299", "text": "func (mock *ClusterTemplateRevisionControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.ClusterTemplateRevisionHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.ClusterTemplateRevisionHandlerFunc\n\t}\n\tlockClusterTemplateRevisionControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockClusterTemplateRevisionControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1e3daa8869366ab913e6d9879790aaa3", "score": "0.80676675", "text": "func (mock *APIServiceControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v11.APIServiceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v11.APIServiceHandlerFunc\n\t}\n\tlockAPIServiceControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockAPIServiceControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3c208e916d39beaa0fa2eca4644aa511", "score": "0.8064396", "text": "func (mock *ClusterTemplateControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.ClusterTemplateHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.ClusterTemplateHandlerFunc\n\t}\n\tlockClusterTemplateControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockClusterTemplateControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "bb274b97823fe53b89920a4bc13f0593", "score": "0.80516994", "text": "func (mock *ClusterTemplateRevisionInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.ClusterTemplateRevisionHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.ClusterTemplateRevisionHandlerFunc\n\t}\n\tlockClusterTemplateRevisionInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockClusterTemplateRevisionInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "6da4ed2cc371791bdb0784eb0d7a59a4", "score": "0.804527", "text": "func (mock *ConfigMapInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v11.ConfigMapHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v11.ConfigMapHandlerFunc\n\t}\n\tlockConfigMapInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockConfigMapInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "380906f10f5e417fe7fbcb761ab12b0c", "score": "0.8042384", "text": "func (mock *SSHAuthControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.SSHAuthHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.SSHAuthHandlerFunc\n\t}\n\tlockSSHAuthControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockSSHAuthControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "5a54d517f7040a7f2f3de5bd3ff103be", "score": "0.8038348", "text": "func (mock *ClusterTemplateInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.ClusterTemplateHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.ClusterTemplateHandlerFunc\n\t}\n\tlockClusterTemplateInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockClusterTemplateInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "18ea45cbdcc8c76351d4efdff6e5fe4c", "score": "0.79914445", "text": "func (mock *NamespaceControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v11.NamespaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v11.NamespaceHandlerFunc\n\t}\n\tlockNamespaceControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockNamespaceControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "583fc478b3a678254b867ac003b0408c", "score": "0.7969109", "text": "func (mock *APIServiceInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v11.APIServiceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v11.APIServiceHandlerFunc\n\t}\n\tlockAPIServiceInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockAPIServiceInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8b3b9811b394c458407d22a3c09bb7be", "score": "0.79569066", "text": "func (mock *SSHAuthInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.SSHAuthHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.SSHAuthHandlerFunc\n\t}\n\tlockSSHAuthInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockSSHAuthInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ce5136902854f91fcbb8ee0e6ee2b60c", "score": "0.7920549", "text": "func (mock *FleetWorkspaceControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.FleetWorkspaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.FleetWorkspaceHandlerFunc\n\t}\n\tlockFleetWorkspaceControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockFleetWorkspaceControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "87f160846ce55573ae81d1624fb8e150", "score": "0.7888646", "text": "func (mock *NamespaceInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v11.NamespaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v11.NamespaceHandlerFunc\n\t}\n\tlockNamespaceInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockNamespaceInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "16124aa313b36c7518201d6f6fae4abc", "score": "0.78729796", "text": "func (mock *FleetWorkspaceInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.FleetWorkspaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.FleetWorkspaceHandlerFunc\n\t}\n\tlockFleetWorkspaceInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockFleetWorkspaceInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8389b882dab53fa232783fc3f316c9cd", "score": "0.7855187", "text": "func (mock *ClusterAlertRuleControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.ClusterAlertRuleHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.ClusterAlertRuleHandlerFunc\n\t}\n\tlockClusterAlertRuleControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockClusterAlertRuleControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "62919eb7477211e02240ac9826ec674f", "score": "0.78259945", "text": "func (mock *UserAttributeControllerMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.UserAttributeHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.UserAttributeHandlerFunc\n\t}\n\tlockUserAttributeControllerMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockUserAttributeControllerMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f62517bc01913448be1ee4c0f597c406", "score": "0.78093374", "text": "func (mock *ClusterAlertRuleInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.ClusterAlertRuleHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.ClusterAlertRuleHandlerFunc\n\t}\n\tlockClusterAlertRuleInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockClusterAlertRuleInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "753538de2543cc813a89ffb898eb1980", "score": "0.7719034", "text": "func (mock *UserAttributeInterfaceMock) AddFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tSync v31.UserAttributeHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tSync v31.UserAttributeHandlerFunc\n\t}\n\tlockUserAttributeInterfaceMockAddFeatureHandler.RLock()\n\tcalls = mock.calls.AddFeatureHandler\n\tlockUserAttributeInterfaceMockAddFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "bccc8f9f17712736bbf714a8f6c0efd7", "score": "0.76866215", "text": "func (mock *RkeK8sSystemImageControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v31.RkeK8sSystemImageHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.RkeK8sSystemImageHandlerFunc\n\t}\n\tlockRkeK8sSystemImageControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockRkeK8sSystemImageControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "cb34e98ccc0b83f02de8c9f6f0887253", "score": "0.76664513", "text": "func (mock *RkeK8sSystemImageControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v31.RkeK8sSystemImageHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v31.RkeK8sSystemImageHandlerFunc\n\t}\n\tlockRkeK8sSystemImageControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockRkeK8sSystemImageControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e8cac39ef895f5b3f7c76a9eeaf86b93", "score": "0.7604991", "text": "func (mock *RkeK8sSystemImageInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v31.RkeK8sSystemImageHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.RkeK8sSystemImageHandlerFunc\n\t}\n\tlockRkeK8sSystemImageInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockRkeK8sSystemImageInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "6bcf085055f5ab6c761bb0036bbd28d2", "score": "0.76042247", "text": "func (mock *RkeK8sSystemImageInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v31.RkeK8sSystemImageHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v31.RkeK8sSystemImageHandlerFunc\n\t}\n\tlockRkeK8sSystemImageInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockRkeK8sSystemImageInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "90b070bd8825d9f4fa7aab00f57c3d82", "score": "0.73331136", "text": "func (mock *ClusterTemplateRevisionControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v31.ClusterTemplateRevisionHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.ClusterTemplateRevisionHandlerFunc\n\t}\n\tlockClusterTemplateRevisionControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockClusterTemplateRevisionControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1a3f16a51efceefee6d7190e46ef89b0", "score": "0.7296276", "text": "func (mock *ClusterTemplateControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v31.ClusterTemplateHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.ClusterTemplateHandlerFunc\n\t}\n\tlockClusterTemplateControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockClusterTemplateControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "d762a917e2c3714d27fef56df55b226d", "score": "0.7227017", "text": "func (mock *APIServiceControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v11.APIServiceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v11.APIServiceHandlerFunc\n\t}\n\tlockAPIServiceControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockAPIServiceControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "64b7871f8192de4883ad4a3e86a3baf5", "score": "0.72025234", "text": "func (mock *ClusterTemplateRevisionInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v31.ClusterTemplateRevisionHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.ClusterTemplateRevisionHandlerFunc\n\t}\n\tlockClusterTemplateRevisionInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockClusterTemplateRevisionInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "fbd74e9333be51534f4e239fdb45aadd", "score": "0.71968615", "text": "func (mock *ConfigMapControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v11.ConfigMapHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v11.ConfigMapHandlerFunc\n\t}\n\tlockConfigMapControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockConfigMapControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "28b2263d33f9f941f5fbd743afa3a823", "score": "0.71936244", "text": "func (mock *ClusterTemplateInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v31.ClusterTemplateHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.ClusterTemplateHandlerFunc\n\t}\n\tlockClusterTemplateInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockClusterTemplateInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e7b8ebd9fa1170ec65181b3de410dd29", "score": "0.7130357", "text": "func (mock *SSHAuthControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v31.SSHAuthHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.SSHAuthHandlerFunc\n\t}\n\tlockSSHAuthControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockSSHAuthControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "38e8eadd5a95fc7917c44593d2437fc0", "score": "0.71165", "text": "func (mock *APIServiceInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v11.APIServiceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v11.APIServiceHandlerFunc\n\t}\n\tlockAPIServiceInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockAPIServiceInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2153fc1b20a229ffbab1d678ab6e9ec6", "score": "0.7116086", "text": "func (mock *ClusterTemplateRevisionControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v31.ClusterTemplateRevisionHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v31.ClusterTemplateRevisionHandlerFunc\n\t}\n\tlockClusterTemplateRevisionControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockClusterTemplateRevisionControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "4800fb26c08d4b84e2b5f3c60e79e0f3", "score": "0.7094887", "text": "func (mock *ConfigMapInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v11.ConfigMapHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v11.ConfigMapHandlerFunc\n\t}\n\tlockConfigMapInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockConfigMapInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "dc794246ce0006b871b05242826c44ff", "score": "0.7089427", "text": "func (mock *UserAttributeControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v31.UserAttributeHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.UserAttributeHandlerFunc\n\t}\n\tlockUserAttributeControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockUserAttributeControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "610d3986f27a95ab1fcf0955cdca7bb4", "score": "0.70830166", "text": "func (mock *ClusterAlertRuleControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v31.ClusterAlertRuleHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.ClusterAlertRuleHandlerFunc\n\t}\n\tlockClusterAlertRuleControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockClusterAlertRuleControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f9db35406af55dc98d3e9314b764ece8", "score": "0.70560575", "text": "func (mock *ClusterTemplateRevisionInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v31.ClusterTemplateRevisionHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v31.ClusterTemplateRevisionHandlerFunc\n\t}\n\tlockClusterTemplateRevisionInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockClusterTemplateRevisionInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "5c66e765dd10ffc9078b4f72f4b9a7f7", "score": "0.7054017", "text": "func (mock *NamespaceControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v11.NamespaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v11.NamespaceHandlerFunc\n\t}\n\tlockNamespaceControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockNamespaceControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "5264a3ef43f0756855bfe63a6e3cdd84", "score": "0.7036354", "text": "func (mock *FleetWorkspaceControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tHandler v31.FleetWorkspaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.FleetWorkspaceHandlerFunc\n\t}\n\tlockFleetWorkspaceControllerMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockFleetWorkspaceControllerMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "355b03ec32500bcc701936cf1d4b621b", "score": "0.7030631", "text": "func (mock *APIServiceControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v11.APIServiceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v11.APIServiceHandlerFunc\n\t}\n\tlockAPIServiceControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockAPIServiceControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e5ee4a0aa940fc6829c676819aa9aa8a", "score": "0.702587", "text": "func (mock *FleetWorkspaceControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v31.FleetWorkspaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v31.FleetWorkspaceHandlerFunc\n\t}\n\tlockFleetWorkspaceControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockFleetWorkspaceControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "521bb69a8f8a6b70a8c8439a3ede2723", "score": "0.7004335", "text": "func (mock *SSHAuthInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v31.SSHAuthHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.SSHAuthHandlerFunc\n\t}\n\tlockSSHAuthInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockSSHAuthInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "47ed58def2196bf6a9b72a7ce91b7e08", "score": "0.69861925", "text": "func (mock *ClusterTemplateControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v31.ClusterTemplateHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v31.ClusterTemplateHandlerFunc\n\t}\n\tlockClusterTemplateControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockClusterTemplateControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "cb0b68bf3e3f18f6b8f220101cb95fa2", "score": "0.69699603", "text": "func (mock *RkeK8sSystemImageInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v31.RkeK8sSystemImageLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v31.RkeK8sSystemImageLifecycle\n\t}\n\tlockRkeK8sSystemImageInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockRkeK8sSystemImageInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "724b158985f560937bac36b85f650dcd", "score": "0.69692576", "text": "func (mock *ConfigMapControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v11.ConfigMapHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v11.ConfigMapHandlerFunc\n\t}\n\tlockConfigMapControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockConfigMapControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "20cdc5880eb25e23fd5233fd0b103d33", "score": "0.69688857", "text": "func (mock *UserAttributeInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v31.UserAttributeHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.UserAttributeHandlerFunc\n\t}\n\tlockUserAttributeInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockUserAttributeInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "5e317e46d6ac2df3417fb0994a0e7052", "score": "0.69666684", "text": "func (mock *ClusterAlertRuleInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v31.ClusterAlertRuleHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.ClusterAlertRuleHandlerFunc\n\t}\n\tlockClusterAlertRuleInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockClusterAlertRuleInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1f5dc17351b8fdda784659c7c6a2fa46", "score": "0.69656146", "text": "func (mock *FleetWorkspaceInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v31.FleetWorkspaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v31.FleetWorkspaceHandlerFunc\n\t}\n\tlockFleetWorkspaceInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockFleetWorkspaceInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "0663ba537e7463db821cd1690cb8d054", "score": "0.69464993", "text": "func (mock *NamespaceInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v11.NamespaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v11.NamespaceHandlerFunc\n\t}\n\tlockNamespaceInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockNamespaceInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "40159ec791861769938fcccbd54761d9", "score": "0.6936449", "text": "func (mock *ClusterTemplateInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v31.ClusterTemplateHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v31.ClusterTemplateHandlerFunc\n\t}\n\tlockClusterTemplateInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockClusterTemplateInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2a8942125c71dced299e68244391448e", "score": "0.69312376", "text": "func (mock *APIServiceInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v11.APIServiceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v11.APIServiceHandlerFunc\n\t}\n\tlockAPIServiceInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockAPIServiceInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f2d12dbcb154fceeadd189eb16780155", "score": "0.69204926", "text": "func (mock *ConfigMapInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v11.ConfigMapHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v11.ConfigMapHandlerFunc\n\t}\n\tlockConfigMapInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockConfigMapInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1afbbcea66c362c48eb176e4f3087a87", "score": "0.69161904", "text": "func (mock *FleetWorkspaceInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tSync v31.FleetWorkspaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.FleetWorkspaceHandlerFunc\n\t}\n\tlockFleetWorkspaceInterfaceMockAddClusterScopedFeatureHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureHandler\n\tlockFleetWorkspaceInterfaceMockAddClusterScopedFeatureHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e35c2f50bfa824f63dd43440b7acc7ed", "score": "0.68785566", "text": "func (mock *SSHAuthControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v31.SSHAuthHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v31.SSHAuthHandlerFunc\n\t}\n\tlockSSHAuthControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockSSHAuthControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "7aca365978609fd5c45fc9a02e072882", "score": "0.6735242", "text": "func (mock *SSHAuthInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v31.SSHAuthHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v31.SSHAuthHandlerFunc\n\t}\n\tlockSSHAuthInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockSSHAuthInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e2fb792e7faa342ca460c2229d0faa2c", "score": "0.6723051", "text": "func (mock *ClusterAlertRuleControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v31.ClusterAlertRuleHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v31.ClusterAlertRuleHandlerFunc\n\t}\n\tlockClusterAlertRuleControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockClusterAlertRuleControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "56603fd721be944126cceb1e0cdabc0a", "score": "0.66604805", "text": "func (mock *UserAttributeControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v31.UserAttributeHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v31.UserAttributeHandlerFunc\n\t}\n\tlockUserAttributeControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockUserAttributeControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8e73c1daac9fef8fc7a16032ce2cbd77", "score": "0.66477734", "text": "func (mock *ClusterAlertRuleInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v31.ClusterAlertRuleHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v31.ClusterAlertRuleHandlerFunc\n\t}\n\tlockClusterAlertRuleInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockClusterAlertRuleInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "bb8a1d972192561e224f5dd7c20e674c", "score": "0.6647092", "text": "func (mock *RkeK8sSystemImageControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v31.RkeK8sSystemImageHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.RkeK8sSystemImageHandlerFunc\n\t}\n\tlockRkeK8sSystemImageControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockRkeK8sSystemImageControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "006bce4492bf1d56f7d7db65a5cd0656", "score": "0.66364366", "text": "func (mock *NamespaceControllerMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler v11.NamespaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler v11.NamespaceHandlerFunc\n\t}\n\tlockNamespaceControllerMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockNamespaceControllerMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "d8efbee51daad3ef6b68b8a323757768", "score": "0.65554386", "text": "func (mock *NamespaceInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v11.NamespaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v11.NamespaceHandlerFunc\n\t}\n\tlockNamespaceInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockNamespaceInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2e0c28df0f5c4a18f8fe91f2a43965fd", "score": "0.65548986", "text": "func (mock *ConfigMapInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v11.ConfigMapLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v11.ConfigMapLifecycle\n\t}\n\tlockConfigMapInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockConfigMapInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "445d2d0ec929624793c033f05a2d7cc0", "score": "0.65481025", "text": "func (mock *RkeK8sSystemImageInterfaceMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tSync v31.RkeK8sSystemImageHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.RkeK8sSystemImageHandlerFunc\n\t}\n\tlockRkeK8sSystemImageInterfaceMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockRkeK8sSystemImageInterfaceMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ce2ec60b2bcad691d820b699fdfab004", "score": "0.65240955", "text": "func (mock *UserAttributeInterfaceMock) AddHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tSync v31.UserAttributeHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tSync v31.UserAttributeHandlerFunc\n\t}\n\tlockUserAttributeInterfaceMockAddHandler.RLock()\n\tcalls = mock.calls.AddHandler\n\tlockUserAttributeInterfaceMockAddHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "52ffda5762514e9f61a596304410ce82", "score": "0.64918935", "text": "func (mock *ExternalServiceControllerMock) AddGenericHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler generic.Handler\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler generic.Handler\n\t}\n\tlockExternalServiceControllerMockAddGenericHandler.RLock()\n\tcalls = mock.calls.AddGenericHandler\n\tlockExternalServiceControllerMockAddGenericHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "39c65402809c71ce9d47793d8729c2e0", "score": "0.6460046", "text": "func (mock *ClusterTemplateInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v31.ClusterTemplateLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v31.ClusterTemplateLifecycle\n\t}\n\tlockClusterTemplateInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockClusterTemplateInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e5294ba92c83095026ec58a8e6cb208d", "score": "0.6447332", "text": "func (mock *ClusterTemplateRevisionInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v31.ClusterTemplateRevisionLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v31.ClusterTemplateRevisionLifecycle\n\t}\n\tlockClusterTemplateRevisionInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockClusterTemplateRevisionInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "5e7daff7b306aeef919314547b7b7fbb", "score": "0.6428751", "text": "func (mock *GitCommitControllerMock) AddGenericHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler generic.Handler\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler generic.Handler\n\t}\n\tlockGitCommitControllerMockAddGenericHandler.RLock()\n\tcalls = mock.calls.AddGenericHandler\n\tlockGitCommitControllerMockAddGenericHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "412bd9ff83c37ef04e4940ea7eb62246", "score": "0.6405799", "text": "func (mock *SSHAuthInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v31.SSHAuthLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v31.SSHAuthLifecycle\n\t}\n\tlockSSHAuthInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockSSHAuthInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "eb2cea822158ff448d3855efd82a9bb7", "score": "0.63789344", "text": "func (mock *APIServiceInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v11.APIServiceLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v11.APIServiceLifecycle\n\t}\n\tlockAPIServiceInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockAPIServiceInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "50e2e076667c9179242c489b0c87932c", "score": "0.6349103", "text": "func (mock *FleetWorkspaceInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v31.FleetWorkspaceLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v31.FleetWorkspaceLifecycle\n\t}\n\tlockFleetWorkspaceInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockFleetWorkspaceInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "215da6c06d67543020010a684c5b85d3", "score": "0.62669677", "text": "func (mock *NamespaceInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v11.NamespaceLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v11.NamespaceLifecycle\n\t}\n\tlockNamespaceInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockNamespaceInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b32eab950ed689e00b2840c9347ff913", "score": "0.6252359", "text": "func (mock *LinuxNetworkingMock) ipvsAddFWMarkServiceCalls() []struct {\n\tSvcs []*ipvs.Service\n\tFwMark uint32\n\tProtocol uint16\n\tPort uint16\n\tPersistent bool\n\tPersistentTimeout int32\n\tScheduler string\n\tFlags schedFlags\n} {\n\tvar calls []struct {\n\t\tSvcs []*ipvs.Service\n\t\tFwMark uint32\n\t\tProtocol uint16\n\t\tPort uint16\n\t\tPersistent bool\n\t\tPersistentTimeout int32\n\t\tScheduler string\n\t\tFlags schedFlags\n\t}\n\tmock.lockipvsAddFWMarkService.RLock()\n\tcalls = mock.calls.ipvsAddFWMarkService\n\tmock.lockipvsAddFWMarkService.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a58e73304c5d88ed23cc3bc2601c88a2", "score": "0.6240222", "text": "func (mock *ClusterAlertRuleInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v31.ClusterAlertRuleLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v31.ClusterAlertRuleLifecycle\n\t}\n\tlockClusterAlertRuleInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockClusterAlertRuleInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c7dac56ced9d39e431b6f122cbb1931d", "score": "0.62340677", "text": "func (mock *ExternalServiceControllerMock) AddGenericRemoveHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler generic.Handler\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler generic.Handler\n\t}\n\tlockExternalServiceControllerMockAddGenericRemoveHandler.RLock()\n\tcalls = mock.calls.AddGenericRemoveHandler\n\tlockExternalServiceControllerMockAddGenericRemoveHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b9e5f61b5d0be4396c9de9d1e5138111", "score": "0.6224917", "text": "func (mock *RkeK8sSystemImageInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tLifecycle v31.RkeK8sSystemImageLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tLifecycle v31.RkeK8sSystemImageLifecycle\n\t}\n\tlockRkeK8sSystemImageInterfaceMockAddClusterScopedFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureLifecycle\n\tlockRkeK8sSystemImageInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1c333272aba2a0b30f1b971f9293c523", "score": "0.6223399", "text": "func (mock *ThreeScaleInterfaceMock) AddAuthenticationProviderCalls() []struct {\n\tData map[string]string\n\tAccessToken string\n} {\n\tvar calls []struct {\n\t\tData map[string]string\n\t\tAccessToken string\n\t}\n\tlockThreeScaleInterfaceMockAddAuthenticationProvider.RLock()\n\tcalls = mock.calls.AddAuthenticationProvider\n\tlockThreeScaleInterfaceMockAddAuthenticationProvider.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b17cf493267ac7e29c4807a0e33f9aa0", "score": "0.61862963", "text": "func (mock *ClusterTemplateRevisionControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v31.ClusterTemplateRevisionHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.ClusterTemplateRevisionHandlerFunc\n\t}\n\tlockClusterTemplateRevisionControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockClusterTemplateRevisionControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a9d8ec688f5ac4bb068bf221c4e838da", "score": "0.61770386", "text": "func (mock *APIServiceControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v11.APIServiceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v11.APIServiceHandlerFunc\n\t}\n\tlockAPIServiceControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockAPIServiceControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "4c827f59b8b6aa681deb7de3eef149ef", "score": "0.61542773", "text": "func (mock *UserAttributeInterfaceMock) AddFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tLifecycle v31.UserAttributeLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tLifecycle v31.UserAttributeLifecycle\n\t}\n\tlockUserAttributeInterfaceMockAddFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddFeatureLifecycle\n\tlockUserAttributeInterfaceMockAddFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "684495e489be7b982155ca68e8b21f99", "score": "0.613676", "text": "func (mock *GitCommitControllerMock) AddGenericRemoveHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tHandler generic.Handler\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tHandler generic.Handler\n\t}\n\tlockGitCommitControllerMockAddGenericRemoveHandler.RLock()\n\tcalls = mock.calls.AddGenericRemoveHandler\n\tlockGitCommitControllerMockAddGenericRemoveHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1e65535154e1aa165d6b7a4ea60bed0d", "score": "0.6129117", "text": "func (mock *ClusterTemplateControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v31.ClusterTemplateHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.ClusterTemplateHandlerFunc\n\t}\n\tlockClusterTemplateControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockClusterTemplateControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e5248e71af82895d3bf45eaae2052c01", "score": "0.6099242", "text": "func (mock *ConfigMapControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v11.ConfigMapHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v11.ConfigMapHandlerFunc\n\t}\n\tlockConfigMapControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockConfigMapControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "35d434d1b5782c04ffa7907f3be89a97", "score": "0.6073106", "text": "func (mock *APIServiceInterfaceMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tSync v11.APIServiceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tSync v11.APIServiceHandlerFunc\n\t}\n\tlockAPIServiceInterfaceMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockAPIServiceInterfaceMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c4f054d8ee9305b36849424725defc7d", "score": "0.605329", "text": "func (mock *ClusterTemplateRevisionInterfaceMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tSync v31.ClusterTemplateRevisionHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.ClusterTemplateRevisionHandlerFunc\n\t}\n\tlockClusterTemplateRevisionInterfaceMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockClusterTemplateRevisionInterfaceMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "adea483ff1d932551346ac675fb0cd2e", "score": "0.6036399", "text": "func (mock *ClusterTemplateInterfaceMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tSync v31.ClusterTemplateHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.ClusterTemplateHandlerFunc\n\t}\n\tlockClusterTemplateInterfaceMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockClusterTemplateInterfaceMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "13b6c7a83d97c17c43805880cee840a6", "score": "0.6015623", "text": "func (mock *FleetWorkspaceControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v31.FleetWorkspaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.FleetWorkspaceHandlerFunc\n\t}\n\tlockFleetWorkspaceControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockFleetWorkspaceControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "d6854df4cc8dd381e95318ac2337ae2b", "score": "0.6010379", "text": "func (mock *ConfigMapInterfaceMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tSync v11.ConfigMapHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tSync v11.ConfigMapHandlerFunc\n\t}\n\tlockConfigMapInterfaceMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockConfigMapInterfaceMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "fbc01463466ed8d8722920f2e9d9aca8", "score": "0.5964401", "text": "func (mock *UserAttributeControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v31.UserAttributeHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.UserAttributeHandlerFunc\n\t}\n\tlockUserAttributeControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockUserAttributeControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1f9a5f328176c3b94a492faf326e76a5", "score": "0.5962183", "text": "func (mock *SSHAuthControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v31.SSHAuthHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.SSHAuthHandlerFunc\n\t}\n\tlockSSHAuthControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockSSHAuthControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "934da751af27eb0015b35decc0cfe511", "score": "0.5952469", "text": "func (mock *LinuxNetworkingMock) ipvsAddServiceCalls() []struct {\n\tSvcs []*ipvs.Service\n\tVip net.IP\n\tProtocol uint16\n\tPort uint16\n\tPersistent bool\n\tPersistentTimeout int32\n\tScheduler string\n\tFlags schedFlags\n} {\n\tvar calls []struct {\n\t\tSvcs []*ipvs.Service\n\t\tVip net.IP\n\t\tProtocol uint16\n\t\tPort uint16\n\t\tPersistent bool\n\t\tPersistentTimeout int32\n\t\tScheduler string\n\t\tFlags schedFlags\n\t}\n\tmock.lockipvsAddService.RLock()\n\tcalls = mock.calls.ipvsAddService\n\tmock.lockipvsAddService.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "0a4794e319febfe3f0116ac645e58c8b", "score": "0.5901871", "text": "func (mock *FleetWorkspaceInterfaceMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tSync v31.FleetWorkspaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.FleetWorkspaceHandlerFunc\n\t}\n\tlockFleetWorkspaceInterfaceMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockFleetWorkspaceInterfaceMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "64c806e6274af10e0029f85a0d068910", "score": "0.5856762", "text": "func (mock *ClusterAlertRuleControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v31.ClusterAlertRuleHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v31.ClusterAlertRuleHandlerFunc\n\t}\n\tlockClusterAlertRuleControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockClusterAlertRuleControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3fdb5d46d07cd0beb735908039f02925", "score": "0.58441347", "text": "func (mock *UserAttributeInterfaceMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tSync v31.UserAttributeHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.UserAttributeHandlerFunc\n\t}\n\tlockUserAttributeInterfaceMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockUserAttributeInterfaceMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "924b113f8c25cdd37538697873410c44", "score": "0.5831288", "text": "func (mock *ClusterTemplateRevisionInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tLifecycle v31.ClusterTemplateRevisionLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tLifecycle v31.ClusterTemplateRevisionLifecycle\n\t}\n\tlockClusterTemplateRevisionInterfaceMockAddClusterScopedFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureLifecycle\n\tlockClusterTemplateRevisionInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "0c9e5c9a0f8cfd12c1abc7436783c137", "score": "0.5830162", "text": "func (mock *ClusterTemplateInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tLifecycle v31.ClusterTemplateLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tLifecycle v31.ClusterTemplateLifecycle\n\t}\n\tlockClusterTemplateInterfaceMockAddClusterScopedFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureLifecycle\n\tlockClusterTemplateInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "605e43be385a196aeb32803cc5c99422", "score": "0.5828888", "text": "func (mock *LinuxNetworkingMock) ipvsAddServerCalls() []struct {\n\tIpvsSvc *ipvs.Service\n\tIpvsDst *ipvs.Destination\n} {\n\tvar calls []struct {\n\t\tIpvsSvc *ipvs.Service\n\t\tIpvsDst *ipvs.Destination\n\t}\n\tmock.lockipvsAddServer.RLock()\n\tcalls = mock.calls.ipvsAddServer\n\tmock.lockipvsAddServer.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "dcaf3572bb3e1aec659530e191cfce51", "score": "0.5817811", "text": "func (mock *NamespaceControllerMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tHandler v11.NamespaceHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tHandler v11.NamespaceHandlerFunc\n\t}\n\tlockNamespaceControllerMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockNamespaceControllerMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8b00c1a30d1cc788d0df167d8151d17f", "score": "0.58135825", "text": "func (mock *ConfigMapInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct {\n\tCtx context.Context\n\tEnabled func() bool\n\tName string\n\tClusterName string\n\tLifecycle v11.ConfigMapLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tEnabled func() bool\n\t\tName string\n\t\tClusterName string\n\t\tLifecycle v11.ConfigMapLifecycle\n\t}\n\tlockConfigMapInterfaceMockAddClusterScopedFeatureLifecycle.RLock()\n\tcalls = mock.calls.AddClusterScopedFeatureLifecycle\n\tlockConfigMapInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "7d687f56bf1967497f6940b1c4cc514d", "score": "0.58102643", "text": "func (mock *SSHAuthInterfaceMock) AddClusterScopedHandlerCalls() []struct {\n\tCtx context.Context\n\tName string\n\tClusterName string\n\tSync v31.SSHAuthHandlerFunc\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tClusterName string\n\t\tSync v31.SSHAuthHandlerFunc\n\t}\n\tlockSSHAuthInterfaceMockAddClusterScopedHandler.RLock()\n\tcalls = mock.calls.AddClusterScopedHandler\n\tlockSSHAuthInterfaceMockAddClusterScopedHandler.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "277383d845ff4c0ef35077158e84ef17", "score": "0.5761393", "text": "func (mock *RkeK8sSystemImageInterfaceMock) AddLifecycleCalls() []struct {\n\tCtx context.Context\n\tName string\n\tLifecycle v31.RkeK8sSystemImageLifecycle\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tName string\n\t\tLifecycle v31.RkeK8sSystemImageLifecycle\n\t}\n\tlockRkeK8sSystemImageInterfaceMockAddLifecycle.RLock()\n\tcalls = mock.calls.AddLifecycle\n\tlockRkeK8sSystemImageInterfaceMockAddLifecycle.RUnlock()\n\treturn calls\n}", "title": "" } ]
c88b46ab8e3064f45481a4f09d8fb352
ToKey is a free data retrieval call binding the contract method 0x0c44ec81. Solidity: function toKey(chain bytes, seq bytes) constant returns(bytes)
[ { "docid": "cb92cba10a5a669c3195d4244ab31fff", "score": "0.7729896", "text": "func (_ETGate *ETGateSession) ToKey(chain []byte, seq []byte) ([]byte, error) {\n\treturn _ETGate.Contract.ToKey(&_ETGate.CallOpts, chain, seq)\n}", "title": "" } ]
[ { "docid": "5d2568fac9c74db34d6dbf7cc617e8e4", "score": "0.81530136", "text": "func (_ETGate *ETGateCaller) ToKey(opts *bind.CallOpts, chain []byte, seq []byte) ([]byte, error) {\n\tvar (\n\t\tret0 = new([]byte)\n\t)\n\tout := ret0\n\terr := _ETGate.contract.Call(opts, out, \"toKey\", chain, seq)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "2ec321aa9ee83d7ffd73d171f9a324fb", "score": "0.78338313", "text": "func (_ETGate *ETGateCallerSession) ToKey(chain []byte, seq []byte) ([]byte, error) {\n\treturn _ETGate.Contract.ToKey(&_ETGate.CallOpts, chain, seq)\n}", "title": "" }, { "docid": "bd2b57297364560ea7ca927c75945fe8", "score": "0.6569711", "text": "func toKey(in string) (*[32]byte, error) {\n\tc := &[32]byte{}\n\tbin := []byte(cryptopasta.Hash(\"\", []byte(in)))\n\n\tif len(bin) < 32 {\n\t\treturn c, fmt.Errorf(\"encryption key must be at least 32 bytes long\")\n\t}\n\n\tfor i := range c {\n\t\tc[i] = bin[i]\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "82f04fcb629733ac39db5ec46f619375", "score": "0.65507233", "text": "func toKey(s string) (*[32]byte, error) {\n\tif len(s) < 32 {\n\t\treturn nil, fmt.Errorf(\"key too short for encryption/signing operation, want at least 32 chars.\")\n\t}\n\tdata := &[32]byte{}\n\tcopy([]byte(s), data[:])\n\treturn data, nil\n}", "title": "" }, { "docid": "2e977db8ec1f6b8a96539bc351c0d9a2", "score": "0.64707565", "text": "func (e RC4HMAC) StringToKey(secret string, salt string, s2kparams string) ([]byte, error) {\n\treturn rfc4757.StringToKey(secret)\n}", "title": "" }, { "docid": "d382b46b363f57786361d30547504bc4", "score": "0.6396818", "text": "func (e Aes128CtsHmacSha96) StringToKey(secret string, salt string, s2kparams string) ([]byte, error) {\n\treturn rfc3962.StringToKey(secret, salt, s2kparams, e)\n}", "title": "" }, { "docid": "f10c8cfff45d775b604649a47d41bfe3", "score": "0.6142881", "text": "func (pro *Provider) IDtoKey(uID uint) ([]byte, error) {\n\n\tif !(uID < uint(len(pro.DBIndex))) {\n\t\tfmt.Println(\"Invalid input\")\n\t\treturn nil, errors.New(\"invalid input\")\n\t}\n\tif pro.DBIndex[uID] == \"\" {\n\t\tfmt.Println(\"ID not exist\")\n\t\treturn nil, errors.New(\"ID not exist\")\n\t}\n\n\tkeyByte, err := hex.DecodeString(pro.DBIndex[uID])\n\tif err != nil {\n\t\tfmt.Println(\"decode string error: \", err)\n\t\treturn nil, err\n\t}\n\n\treturn keyByte, nil\n}", "title": "" }, { "docid": "338ce4bfe2d71b62922bf599d0ee89eb", "score": "0.598206", "text": "func (idk *EthereumIdentityKey) GetKey() [32]byte {\n\treturn idk.Key\n}", "title": "" }, { "docid": "15610797cadc1f90277cae41ff8fbb5a", "score": "0.59444785", "text": "func ToKey(v ...interface{}) []byte {\n\tvar r []byte\n\tfor _, vv := range v {\n\t\tb := MustTob(vv)\n\t\tr = append(r, b...)\n\t\tif _, ok := vv.(string); ok {\n\t\t\tr = append(r, '\\x00')\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "0b2cd48ecfe3b644756b3b5a7b064034", "score": "0.5928582", "text": "func StringToKey(secret, salt, s2kparams string, e etype.EType) ([]byte, error) {\n\ti, err := S2KparamsToItertions(s2kparams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn StringToKeyIter(secret, salt, i, e)\n}", "title": "" }, { "docid": "d9731d9656b632e02981c3bb94415e04", "score": "0.58764166", "text": "func (m MACAddr) Key() string {\n\treturn string(m[:])\n}", "title": "" }, { "docid": "306016354b3e120685fec8482da7b6b3", "score": "0.5766917", "text": "func PassToKey(pass string) []byte {\n\tvar t, i, n uint\n\n\tbuf := make([]byte, ANAMELEN)\n\tkey := make([]byte, DESKEYLEN)\n\n\tp := []byte(pass)\n\tn = uint(len(p))\n\n\tif n >= ANAMELEN {\n\t\tn = ANAMELEN - 1\n\t}\n\n\tcopy(buf, []byte(\" \"))\n\n\tcopy(buf, p)\n\tbuf[n] = 0\n\n\tfor {\n\t\tfor i = uint(0); i < DESKEYLEN; i++ {\n\t\t\tkey[i] = (buf[t+i] >> i) + (buf[t+i+1] << (8 - (i + 1)))\n\t\t}\n\t\tif n <= 8 {\n\t\t\treturn key\n\t\t}\n\t\tn -= 8\n\t\tt += 8\n\t\tif n < 8 {\n\t\t\tt -= 8 - n\n\t\t\tn = 8\n\t\t}\n\t\tDesEncrypt(key, buf[t:t+8])\n\t}\n}", "title": "" }, { "docid": "4e11140d998b62f7357ae1740908c2a6", "score": "0.57589513", "text": "func (bc *binCollator) Key(str string) []byte {\n\treturn []byte(str)\n}", "title": "" }, { "docid": "33113a868d7c0fa06e959225203e9195", "score": "0.5665381", "text": "func hd2to1(k2 *hdkeychain.ExtendedKey) *hdkeychain.ExtendedKey {\n\tk, _ := hdkeychain.NewKeyFromString(k2.String(), ucutil.ActiveNet)\n\treturn k\n}", "title": "" }, { "docid": "c254478f76e921b09709028ab9da1d84", "score": "0.56619054", "text": "func toNextKey(t time.Time, id uuid.UUID) string {\n\tvar b [8 + 16]byte\n\tbinary.LittleEndian.PutUint64(b[0:8], uint64(t.UnixMicro()))\n\tcopy(b[8:8+16], id[:])\n\treturn base64.URLEncoding.EncodeToString(b[:])\n}", "title": "" }, { "docid": "089b57ea2875e64106033613f3953af5", "score": "0.5642233", "text": "func (e Aes128CtsHmacSha96) RandomToKey(b []byte) []byte {\n\treturn rfc3961.RandomToKey(b)\n}", "title": "" }, { "docid": "411799105d9f58350e71336c06e48cdd", "score": "0.56292963", "text": "func hd1to2(k *hdkeychain.ExtendedKey, params hdkeychain.NetworkParams) *hdkeychain.ExtendedKey {\n\tk2, _ := hdkeychain.NewKeyFromString(k.String(), params)\n\treturn k2\n}", "title": "" }, { "docid": "59642c4eb6457df9b547c19656220e79", "score": "0.56144506", "text": "func (e RC4HMAC) RandomToKey(b []byte) []byte {\n\tr := bytes.NewReader(b)\n\th := md4.New()\n\tio.Copy(h, r)\n\treturn h.Sum(nil)\n}", "title": "" }, { "docid": "e1c6dce4f2a469f2aabbad8ad49c9666", "score": "0.5580722", "text": "func GetStakingSequenceKey(sequence string) []byte {\n\treturn append(StakingSequenceKey, []byte(sequence)...)\n}", "title": "" }, { "docid": "ad7514e664b5ee64d4bb9edf5447c9bf", "score": "0.55660087", "text": "func (n *mpMpnsIntCryptoFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "d48c73338d1c30071968edc2a9bbc221", "score": "0.55568135", "text": "func (key AES128Key) MarshalTo(data []byte) (int, error) { return marshalBinaryBytesTo(data, key[:]) }", "title": "" }, { "docid": "74beda590d740112dea0961cdec65596", "score": "0.55437136", "text": "func ToAccount(mnemonic string) (string, string, error) {\n\tseed := bip39.NewSeed(mnemonic, \"\")\n\tseedForMultiVAC := seed[:32]\n\treader := bytes.NewReader(seedForMultiVAC)\n\tpub, prv, err := ed25519.GenerateKey(reader)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treturn hex.EncodeToString(pub), hex.EncodeToString(prv), nil\n\n}", "title": "" }, { "docid": "1b5f80f287456b93e08ad64e188f6bb7", "score": "0.5539432", "text": "func FromCoinflipSequence(sequence string) (key []byte, err error) {\n\tif len(sequence) != CoinflipSeqRequiredLength {\n\t\treturn nil, fmt.Errorf(\"given sequence is %d long, must be %d\", len(sequence), CoinflipSeqRequiredLength)\n\t}\n\tprivKey, err := coinflipsKey(sequence)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot read sequence: %v\", err)\n\t}\n\treturn privKey, nil\n}", "title": "" }, { "docid": "9b9a59fe4181eb1f091d545e24d9e942", "score": "0.5534775", "text": "func asKey(data []byte) (*[32]byte, error) {\n\tif len(data) != 32 {\n\t\treturn nil, errors.New(\"Expected a 32 byte key\")\n\t}\n\n\tvar key [32]byte\n\tcopy(key[:], data[0:32])\n\treturn &key, nil\n}", "title": "" }, { "docid": "dc5151c81086080ca1fcee2443cffd7e", "score": "0.55276537", "text": "func kdfChainKey(ck chainKey) (chainKey, MessageKey, error) {\n\thash := hmac.New(sha256.New, ck)\n\t_, err := hash.Write([]byte{0})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tck = chainKey(hash.Sum(nil))\n\n\thash.Reset()\n\t_, err = hash.Write([]byte{1})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tmk := MessageKey(hash.Sum(nil))\n\n\treturn ck, mk, nil\n}", "title": "" }, { "docid": "33e35c38bfcdb4a3ccfd479c737465d0", "score": "0.55048525", "text": "func (p *Protocol) GetKey(name string) ([]byte, error) {\n\tif p.Debug {\n\t\tlog.Printf(\">> get key \\\"%s\\\"\", name)\n\t}\n\t// select SS entry\n\t_, code, err := p.execute(stkAppSsEntrySelect, len(name), hex.EncodeToString([]byte(name)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif code == ApduNotFound {\n\t\treturn nil, fmt.Errorf(\"entry \\\"%s\\\" not found\", name)\n\t}\n\t_, code, err = p.response(code)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif code != ApduOk {\n\t\treturn nil, fmt.Errorf(\"APDU error: %x, selecting entry failed\", code)\n\t}\n\n\t// get public key from selected entry\n\targs, err := p.encode([]Tag{{0xd0, []byte{0x00}}})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, code, err = p.execute(stkAppKeyGet, len(args)/2, args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, code, err := p.response(code)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif code != ApduOk {\n\t\treturn nil, fmt.Errorf(\"APDU error: %x, getting key failed\", code)\n\t}\n\n\ttags, err := p.decode(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpubkey, err := p.findTag(tags, 0xc3)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// return the public key and remove the static 0x04 from the beginning\n\t// the 0x04 is caused by the SIM returning the key in uncompressed SEC format, so it is 0x04, then X bytes, then Y bytes\n\treturn pubkey[1:], nil\n}", "title": "" }, { "docid": "2652dfc0d407569bec700629ead205fb", "score": "0.550129", "text": "func getVerifyKeysKey(ty int32) []byte {\n\treturn []byte(fmt.Sprintf(verifyKeys+\"%d\", ty))\n}", "title": "" }, { "docid": "9b06044409b46380a75af580ef1fd003", "score": "0.5495866", "text": "func GetKey() []byte {\n return jwtKey\n}", "title": "" }, { "docid": "eb42c07b7f09663f2a491cff42524ad8", "score": "0.54708266", "text": "func GetKey() [32]byte {\n\n\treturn sha256.Sum256([]byte(utils.Gen32()))\n}", "title": "" }, { "docid": "f166d33952585a969c8372616df3632a", "score": "0.5457947", "text": "func toBytes(key interface{}, encoder codec.EncodeDecoder) ([]byte, error) {\n\tif key == nil {\n\t\treturn nil, nil\n\t}\n\tif k, ok := key.([]byte); ok {\n\t\treturn k, nil\n\t}\n\tif k, ok := key.(string); ok {\n\t\treturn []byte(k), nil\n\t}\n\n\treturn encoder.Encode(key)\n}", "title": "" }, { "docid": "23a5eecb38976ebd97949858fdabf317", "score": "0.5437365", "text": "func name2key(name string) string {\n\th := md5.New()\n\tio.WriteString(h, name)\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "4527e6dbb7d4c39a4d0f201e071c2a12", "score": "0.5434796", "text": "func ToKey(v Value) Value {\n\tif k, ok := v.(Keyer); ok {\n\t\treturn key{\n\t\t\tVal: k.Key(),\n\t\t\tNode: v.IsNode(),\n\t\t}\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1708714e421a743fb2e8c4be3dfca008", "score": "0.538823", "text": "func toKey(metric *metricpb.Metric, mr *monitoredres.MonitoredResource) uint64 {\n\t// Per the package comments on hash, writing to a hash will never return an error, and we don't care how many bytes there were.\n\tbuf := make([]byte, 8)\n\thash := fnv.New64()\n\tbinary.BigEndian.PutUint64(buf, stableMapHash(metric.Labels))\n\t_, _ = hash.Write(buf)\n\tbinary.BigEndian.PutUint64(buf, stableMapHash(mr.Labels))\n\t_, _ = hash.Write(buf)\n\t_, _ = hash.Write([]byte(metric.Type))\n\t_, _ = hash.Write([]byte(mr.Type))\n\treturn hash.Sum64()\n}", "title": "" }, { "docid": "9a24d3525bfc4a3e7e11a3f64c5ee12b", "score": "0.53867817", "text": "func ToPubKey(pubKey string) (ic.PubKey, error) {\n\traw, err := base64.StdEncoding.DecodeString(pubKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ic.UnmarshalPublicKey(raw)\n}", "title": "" }, { "docid": "67ba4d519b529381e8042741ab5cbe0e", "score": "0.538508", "text": "func key(invoiceID uint64) []byte {\r\n\tbz := sdk.Uint64ToBigEndian(invoiceID)\r\n\treturn append(InvoicesKeyPrefix, bz...)\r\n}", "title": "" }, { "docid": "847d9dc949bebf260969ee1e9f30e58c", "score": "0.5367605", "text": "func (o LinkedIntegrationRuntimeKeyOutput) Key() SecureStringOutput {\n\treturn o.ApplyT(func(v LinkedIntegrationRuntimeKey) SecureString { return v.Key }).(SecureStringOutput)\n}", "title": "" }, { "docid": "e74835cc3333bbc8844329128239e47a", "score": "0.53644675", "text": "func HexToKey(hexKey string, params KeyParams) (priv *ecdsa.PrivateKey, err error) {\n\tb, err := hex.DecodeString(hexKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tg := params.G()\n\tpriv = new(ecdsa.PrivateKey)\n\tpriv.PublicKey.Curve = params.Curve()\n\tpriv.D = new(big.Int).SetBytes(b)\n\tpriv.PublicKey.X, priv.PublicKey.Y = params.Curve().ScalarMult(g.X, g.Y, b)\n\treturn\n}", "title": "" }, { "docid": "fcd4642c82f527e374d04e8123399b26", "score": "0.5362279", "text": "func Evp2Key(password string, keyLen int) (key []byte) {\n\tconst md5Len = 16\n\n\tcnt := (keyLen-1)/md5Len + 1\n\tm := make([]byte, cnt*md5Len)\n\tcopy(m, md5sum([]byte(password)))\n\n\t// Repeatedly call md5 until bytes generated is enough.\n\t// Each call to md5 uses data: prev md5 sum + password.\n\td := make([]byte, md5Len+len(password))\n\tfor start, i := 0, 1; i < cnt; i++ {\n\t\tstart += md5Len\n\t\tcopy(d, m[start-md5Len:start])\n\t\tcopy(d[md5Len:], password)\n\t\tcopy(m[start:], md5sum(d))\n\t}\n\treturn m[:keyLen]\n}", "title": "" }, { "docid": "79bf70dc0eb720a1b3a762e83dad04f5", "score": "0.5359967", "text": "func (cmp *Cmp) KeyBytes() []byte { return cmp.Key }", "title": "" }, { "docid": "b0c0458d6e63ec3d4c58b72184b92cea", "score": "0.53480655", "text": "func MakeKey(objType byte, keyBytes ...[]byte) []byte {\n\tvar buf bytes.Buffer\n\tbuf.WriteByte(objType)\n\tfor _, b := range keyBytes {\n\t\tbuf.Write(b)\n\t}\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "b9ff0011ce9d61aae0306a16e66a4d33", "score": "0.53446513", "text": "func (i *Input) GetKey() string {\n\treturn fmt.Sprintf(\"%d:%d:%d\", i.BlockIndex, i.TxIndex, i.OutputIndex)\n}", "title": "" }, { "docid": "4b03e93f46e9fdbee8c4d64789aac46f", "score": "0.5329496", "text": "func (n *dppIntCreditFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "39ab0eb97d1c128db81766c3434ba64a", "score": "0.5324047", "text": "func (n *dprIntCreditFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "9a143e2a9763cf6ce3709d3a15c160f6", "score": "0.5316227", "text": "func getKey() []byte{\n\treturn []byte(\"INSERT KEY HERE\")\n}", "title": "" }, { "docid": "750099b50df5ad970a3325e832b3b165", "score": "0.53133917", "text": "func WordsToKey(words string) (lktypes.SecretKey, error) {\n\tkey, err := xcrypto.WordsToBytes(words)\n\tif err != nil {\n\t\treturn lktypes.SecretKey{}, types.ErrInnerServer\n\t}\n\treturn key, nil\n}", "title": "" }, { "docid": "3533d8501664650f6437b62e7d8ab8d4", "score": "0.531288", "text": "func (it *chainIter[K, V, H]) key() K {\n\treturn it.b.key[it.ib]\n}", "title": "" }, { "docid": "ff32af085fc3c4eb761d80e2f279295c", "score": "0.5312184", "text": "func (c Currency) Key() string {\n\thasher := ripemd160.New()\n\n\tbuffer, err := serial.Serialize(c, serial.JSON)\n\tif err != nil {\n\t\tlog.Fatal(\"hash serialize failed\", \"err\", err)\n\t}\n\t_, err = hasher.Write(buffer)\n\tif err != nil {\n\t\tlog.Fatal(\"hasher failed\", \"err\", err)\n\t}\n\tbuffer = hasher.Sum(nil)\n\n\treturn hex.EncodeToString(buffer)\n}", "title": "" }, { "docid": "72cfce403b0cd77e9344714ad5d88be2", "score": "0.53121096", "text": "func (n *pbPbcIntCreditUnderflowFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "5ea864bf2cb37901dd33b8a25522d698", "score": "0.53061587", "text": "func (mapping *DNSMapping) GetKey() []byte {\n\treturn []byte(mapping.Name + mapping.IP.String())\n}", "title": "" }, { "docid": "6243bc0d0064cfe31e26db42aebb2d9d", "score": "0.52943116", "text": "func (k *KeyConverter) GetKey(num int) string {\n\tnum = num + k.Offset\n\n\tbase := len(k.Alphabet)\n\n\tif num == 0 {\n\t\treturn k.Alphabet[:1]\n\t}\n\n\ts := []string{}\n\tfor num > 0 {\n\t\tindex := num % base\n\t\ts = append(s, k.Alphabet[index:index+1])\n\t\tnum = num / base\n\t}\n\n\tfor i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {\n\t\ts[i], s[j] = s[j], s[i]\n\t}\n\treturn strings.Join(s, \"\")\n}", "title": "" }, { "docid": "9ad83a5ddc2d3eaa233c231f12cc24de", "score": "0.52923644", "text": "func GetKey() *fernet.Key {\n\tmintLock.RLock()\n\tdefer mintLock.RUnlock()\n\treturn key\n\n}", "title": "" }, { "docid": "a274f83e9f102e9d077c89fac73bbf45", "score": "0.52749294", "text": "func (rs *Contract) QueryChaincodeEncryptionKey(ctx contractapi.TransactionContextInterface, chaincodeId string) (string, error) {\n\t// NOTE: This is a (momentary) short-cut over the FPC and FPC Lite specification in `docs/design/fabric-v2+/fpc-registration.puml` and `docs/design/fabric-v2+/fpc-key-dist.puml`. See also `common/enclave/cc_data.cpp` and `protos/fpc/fpc.proto`\n\t// TODO: remove short cut (see also RegisterEnclave and RegisterCCKeys (Post-MVP)\n\n\t// retrieve the enclave id\n\titer, err := ctx.GetStub().GetStateByPartialCompositeKey(\"namespaces/credentials\", []string{chaincodeId})\n\tif iter != nil {\n\t\tdefer iter.Close()\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// pick the first one from the list\n\tq, err := iter.Next()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t_, res, err := ctx.GetStub().SplitCompositeKey(q.Key)\n\tif err != nil {\n\t\tlogger.Debugf(\"no split\")\n\t\treturn \"\", err\n\t}\n\tenclaveId := res[1]\n\n\t// recreate composite key of credentials\n\tk, err := ctx.GetStub().CreateCompositeKey(\"namespaces/credentials\", []string{chaincodeId, enclaveId})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// get credentials from state\n\tcredentialsBase64, err := ctx.GetStub().GetState(k)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// retrieve chaincode ek from credentials\n\tcredentials, err := utils.UnmarshalCredentials(string(credentialsBase64))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar attestedData protos.AttestedData\n\tif err := credentials.SerializedAttestedData.UnmarshalTo(&attestedData); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tchaincodeEKBytes := attestedData.GetChaincodeEk()\n\n\t// b64 encoded chaincode key\n\tb64ChaincodeEK := base64.StdEncoding.EncodeToString(chaincodeEKBytes)\n\tlogger.Debugf(\"QueryChaincodeEncryptionKey: EK: '%s' / EK b64: '%s'\", string(chaincodeEKBytes), b64ChaincodeEK)\n\n\treturn b64ChaincodeEK, nil\n}", "title": "" }, { "docid": "b16a2d7fe45a395fa9fc294e6a1fb71c", "score": "0.5271376", "text": "func (n *dppIntSramsEccFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "08fd7e9bbda8d016e066f08375070111", "score": "0.52652985", "text": "func As(key Key, providerName string) (Key, error) {\n\treturn FromPriKey(providerName, key.PriKey())\n}", "title": "" }, { "docid": "7b8ca65a72d1bad9336d9f52ec01e507", "score": "0.5263307", "text": "func (n *dprIntSramsEccFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "c340352e6d58a6acb2d1c8582d9609e1", "score": "0.5259997", "text": "func (s *Service) getReceiveKey(oid int64, ty int8, mid int64) string {\n\treturn fmt.Sprintf(\"%d_%d_%d\", oid, ty, mid)\n}", "title": "" }, { "docid": "90616f6cd13d70f3e70a6dbe2c97e2c7", "score": "0.52536696", "text": "func SequenceKey(sequenceID int64) []byte {\n\treturn []byte(fmt.Sprintf(\"%s:%d\", mSequencePrefix, sequenceID))\n}", "title": "" }, { "docid": "cbdb09e39b2b1c4b596b620437952c63", "score": "0.5252363", "text": "func (k AuthKey) GetEncKey() []byte {\n\treturn k[:KeyLength]\n}", "title": "" }, { "docid": "e96a10b7847058ed178bfbdbf3153e84", "score": "0.524421", "text": "func hexToKeybytes(hex []byte) []byte {\n\tif hasTerm(hex) {\n\t\thex = hex[:len(hex)-1]\n\t}\n\tif len(hex)&1 != 0 {\n\t\tpanic(\"can't convert hex key of odd length\")\n\t}\n\tkey := make([]byte, len(hex)/2)\n\tdecodeNibbles(hex, key)\n\treturn key\n}", "title": "" }, { "docid": "e96a10b7847058ed178bfbdbf3153e84", "score": "0.524421", "text": "func hexToKeybytes(hex []byte) []byte {\n\tif hasTerm(hex) {\n\t\thex = hex[:len(hex)-1]\n\t}\n\tif len(hex)&1 != 0 {\n\t\tpanic(\"can't convert hex key of odd length\")\n\t}\n\tkey := make([]byte, len(hex)/2)\n\tdecodeNibbles(hex, key)\n\treturn key\n}", "title": "" }, { "docid": "ea3cc63808035a232e529979462fde05", "score": "0.5221997", "text": "func (csp *impl) GetKey(ski []byte) (k bccsp.Key, err error) {\n\tpubKey, isPriv, err := csp.getECKey(ski)\n\tif err == nil {\n\t\tif isPriv {\n\t\t\treturn &ecdsaPrivateKey{ski, ecdsaPublicKey{ski, pubKey}}, nil\n\t\t} else {\n\t\t\treturn &ecdsaPublicKey{ski, pubKey}, nil\n\t\t}\n\t}\n\treturn csp.BCCSP.GetKey(ski)\n}", "title": "" }, { "docid": "37329cd3d5d5352f797b51e33f7319b1", "score": "0.52179474", "text": "func (n *intEccDescFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "90f169ee0fa722e946922296a8845e12", "score": "0.5209414", "text": "func DeriveKey(context string, material []byte, out []byte) {\n\th := NewDeriveKey(context)\n\t_, _ = h.Write(material)\n\t_, _ = io.ReadFull(h.XOF(), out)\n}", "title": "" }, { "docid": "9f0435c210d0b5beb53335f02a84e81b", "score": "0.5204126", "text": "func (k AuthKey) GetEncKey() []byte {\n\treturn k[:authKeyLength/2]\n}", "title": "" }, { "docid": "9cf7b1dffe3031fd43576505d6428379", "score": "0.5203149", "text": "func (n *intSpareFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "a253ce4b2a865417c75d3c2969ce86f4", "score": "0.5199003", "text": "func (n *dprIntFifoFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "a9af5dfe91055deb18d0800b24433cc8", "score": "0.5197813", "text": "func (enc *EncryptionService) getKeyFromRoom(roomID string) ([]model_proxy.KeyRecord, error) {\n\tlocal, err := enc.key.IsLocal(roomID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error deftermining locality ok key %v\", err)\n\t}\n\n\tvar keys []model_proxy.KeyRecord\n\tif local {\n\t\t//fmt.Println(\"[message] use LOCAL key for\", roomID)\n\t\tkeys, err = enc.key.GetKeyLocal(roomID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting key locally %v\", err)\n\t\t}\n\t} else {\n\t\t//fmt.Println(\"[message] use REMOTE key for room\", roomID)\n\t\tkeys, err = enc.key.GetKeyRemote(roomID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting key remotely %v\", err)\n\t\t}\n\t}\n\n\treturn keys, nil\n}", "title": "" }, { "docid": "75741f7bb80683c3e50ef60cd7b512f3", "score": "0.51925105", "text": "func ResolveChain(first *BroadeningDelegationWithKey, rest []*BroadeningDelegation, to *EntitySecret, keyType int) *DecryptionKey {\n\tkey := wkdibe.NonDelegableKeyGen(to.Descriptor.Params, to.Key, make(wkdibe.AttributeList))\n\tfor i := len(rest) - 1; i >= 0; i-- {\n\t\tdelegation := rest[i]\n\t\tperm := delegation.Delegation.Key.Permissions\n\t\tattrs := perm.AttributeSet(keyType)\n\t\tattrs[MaxURIDepth+TimeDepth] = first.Hierarchy.HashToZp()\n\t\tsubkey := wkdibe.NonDelegableQualifyKey(delegation.To.Params, key, attrs)\n\t\tnextKeyBytes, ok := core.HybridDecrypt(delegation.Delegation.Key.Ciphertext, delegation.Delegation.Message, subkey, &delegation.Delegation.IV)\n\t\tif !ok {\n\t\t\treturn nil\n\t\t}\n\t\tok = key.Unmarshal(nextKeyBytes, LayeredMarshalCompressed, LayeredMarshalChecked)\n\t\tif !ok {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tperm := first.Key.Key.Permissions\n\tattrs := perm.AttributeSet(keyType)\n\tattrs[MaxURIDepth+TimeDepth] = first.Hierarchy.HashToZp()\n\tsubkey := wkdibe.NonDelegableQualifyKey(first.To.Params, key, attrs)\n\tfinalKeyBytes, ok := core.HybridDecrypt(first.Key.Key.Ciphertext, first.Key.Message, subkey, &first.Key.IV)\n\tif !ok {\n\t\treturn nil\n\t}\n\tok = key.Unmarshal(finalKeyBytes, LayeredMarshalCompressed, LayeredMarshalChecked)\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn &DecryptionKey{\n\t\tHierarchy: first.Hierarchy,\n\t\tKey: key,\n\t\tPermissions: perm,\n\t\tKeyType: keyType,\n\t}\n}", "title": "" }, { "docid": "d86f9bb6d8c953243d4e23564d2989df", "score": "0.5189924", "text": "func toPublicKey(s string, kind nkeys.PrefixByte) (string, error) {\n\tif s == jwt.AnyAccount {\n\t\treturn s, nil\n\t}\n\tkp, err := store.ResolveKey(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif kp == nil {\n\t\treturn \"\", fmt.Errorf(\"%q is not a valid %s key\", s, kind)\n\t}\n\tif err := nkeys.CompatibleKeyPair(kp, kind); err != nil {\n\t\treturn \"\", fmt.Errorf(\"%q is not a valid %s key\", s, kind)\n\t}\n\treturn kp.PublicKey()\n}", "title": "" }, { "docid": "a06ce17420d5c9c2b42c177763831185", "score": "0.51828897", "text": "func (es *SampleStorage) indexToKey(i int) Key {\n\t// TODO(Tobias): Simply use the sqlite4 encoding once it is available.\n\t// The only requirement for the created key is that it respects the\n\t// integer sorting.\n\tbuf := new(bytes.Buffer)\n\tbinary.Write(buf, binary.BigEndian, int64(i))\n\treturn MakeKey(es.prefix, keyDataPrefix, Key(buf.Bytes()))\n}", "title": "" }, { "docid": "a3e89c3c9253c4a66887e2f8d09e03f9", "score": "0.51827466", "text": "func (o KeyToPathOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KeyToPath) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a3e89c3c9253c4a66887e2f8d09e03f9", "score": "0.51827466", "text": "func (o KeyToPathOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KeyToPath) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "80248d7333a055716bd6d22051393007", "score": "0.5177269", "text": "func KeyWithTs(key []byte, ts uint64) []byte {\n\tout := make([]byte, len(key)+8)\n\tcopy(out, key)\n\tbinary.BigEndian.PutUint64(out[len(key):], math.MaxUint64-ts)\n\treturn out\n}", "title": "" }, { "docid": "faadae58e6b94fcfa88d67a983e04907", "score": "0.5171376", "text": "func (key AES128Key) String() string { return strings.ToUpper(hex.EncodeToString(key[:])) }", "title": "" }, { "docid": "262578808fc7cc78b381731e67539d67", "score": "0.51709545", "text": "func (klc LookupClient) getKey(keyid []byte) ([]byte, error) {\n\tmethod := \"PublicService.LookupKey\"\n\tclient, err := klc.ClientFactory(ServiceURL, klc.ServiceGuardCA)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, err := client.JSONRPCRequest(method, struct{ KeyID string }{KeyID: hex.EncodeToString(keyid)})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, ok := data[\"Key\"]; ok {\n\t\tkeyMarshalled, err := base64.StdEncoding.DecodeString(data[\"Key\"].(string))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn keyMarshalled, nil\n\t}\n\treturn nil, ErrParams\n}", "title": "" }, { "docid": "abd181fa7259ae23ca562720983d476a", "score": "0.5170568", "text": "func (d *DefaultClientIdentity) ID2Key(id string) (string, error) {\n\treturn id, nil\n}", "title": "" }, { "docid": "6923f45f1233c65a088517ba7253e7cc", "score": "0.51680315", "text": "func (rs *Contract) GetKeyExport(ctx contractapi.TransactionContextInterface, chaincodeId, enclaveId string) (string, error) {\n\t//input chaincodeId string, enclaveId string\n\t//return *ExportMessage or error\n\t// TODO implement me (Post-MVP)\n\treturn \"\", fmt.Errorf(\"not implemented yet\")\n}", "title": "" }, { "docid": "c64b96a0f31ba0386c1cb8cc3d14894a", "score": "0.5167448", "text": "func (n *dbWaIntDbFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "6ae177b67a41de72fa63d0a2ac2a5281", "score": "0.5159374", "text": "func GetKey(entityType string, keyPart ...string) []byte {\n\tallparts := []string{}\n\tallparts = append(allparts, entityType)\n\tallparts = append(allparts, keyPart...)\n\treturn []byte(strings.Join(allparts, \"_\"))\n}", "title": "" }, { "docid": "cad8e8c53a5ed1ff8787dc20578b3970", "score": "0.51587945", "text": "func getRewardKey(l types.LayerID, account types.Address, smesherID types.NodeID) []byte {\n\tstr := string(getRewardKeyPrefix(account)) + \"_\" + smesherID.String() + \"_\" + strconv.FormatUint(l.Uint64(), 10)\n\treturn []byte(str)\n}", "title": "" }, { "docid": "954c8565435a818d487e7ba4c873dee3", "score": "0.5142082", "text": "func (n *mdHensIntEccFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "223288b7d17505d89da40b24b235a17c", "score": "0.5140334", "text": "func (n *dppIntFifoFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "15bbef766fd9d6e85919cf2fb2ac0a20", "score": "0.5137027", "text": "func keyFor(keys []model_proxy.KeyRecord, timestamp time.Time) []byte {\n\tvar key []byte\n\tfound := false\n\tfor _, k := range keys {\n\t\tif k.ValidFrom.Before(timestamp) && (k.ValidTo.IsZero() || k.ValidTo.After(timestamp)) {\n\t\t\tkey = k.Key\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\treturn nil\n\t}\n\treturn key\n}", "title": "" }, { "docid": "96dbf73275ad2a8dcbd9be4979ea3d40", "score": "0.5136478", "text": "func (n *mcMchIntMcFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "f77f81b1ac407527b64e4e09ad14e3e7", "score": "0.51326406", "text": "func (d *DefaultClientIdentity) Key2ID(key string) (string, error) {\n\treturn key, nil\n}", "title": "" }, { "docid": "cc2bfe975030cdcee5aeaf302a8fa4d1", "score": "0.5127305", "text": "func makekey() (key []byte, err error) {\n\tkey = make([]byte, keySize/8)\n\n\tif _, err = rand.Read(key); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn key, nil\n}", "title": "" }, { "docid": "1b202913310d5b2a35bb5caf16422fa1", "score": "0.51242363", "text": "func (n *pbPbcHbmIntEccHbmRbFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "67f0e4ca44620d97908a4a272983b39a", "score": "0.5117433", "text": "func keyToSlice(key wgtypes.Key) []byte {\n\tb := make([]byte, wgtypes.KeyLen)\n\tfor n, k := range key {\n\t\tb[n] = k\n\t}\n\treturn b\n}", "title": "" }, { "docid": "e4f25751e79d5fbf997b44fd439a4356", "score": "0.51124895", "text": "func (n *pbPbcIntRplFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "69ae173948afc3213851e9da773ad9a8", "score": "0.50999546", "text": "func toBytes(key interface{}, codec codec.MarshalUnmarshaler) ([]byte, error) {\n\tif key == nil {\n\t\treturn nil, nil\n\t}\n\tswitch t := key.(type) {\n\tcase []byte:\n\t\treturn t, nil\n\tcase string:\n\t\treturn []byte(t), nil\n\tcase int:\n\t\treturn numbertob(int64(t))\n\tcase uint:\n\t\treturn numbertob(uint64(t))\n\tcase int8, int16, int32, int64, uint8, uint16, uint32, uint64:\n\t\treturn numbertob(t)\n\tdefault:\n\t\treturn codec.Marshal(key)\n\t}\n}", "title": "" }, { "docid": "69ae173948afc3213851e9da773ad9a8", "score": "0.50999546", "text": "func toBytes(key interface{}, codec codec.MarshalUnmarshaler) ([]byte, error) {\n\tif key == nil {\n\t\treturn nil, nil\n\t}\n\tswitch t := key.(type) {\n\tcase []byte:\n\t\treturn t, nil\n\tcase string:\n\t\treturn []byte(t), nil\n\tcase int:\n\t\treturn numbertob(int64(t))\n\tcase uint:\n\t\treturn numbertob(uint64(t))\n\tcase int8, int16, int32, int64, uint8, uint16, uint32, uint64:\n\t\treturn numbertob(t)\n\tdefault:\n\t\treturn codec.Marshal(key)\n\t}\n}", "title": "" }, { "docid": "e612f800364014b018215c9ffb144e66", "score": "0.50859344", "text": "func (n *dprIntFlopFifoFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "6f9c0d05a18fac81e8fa99602e8961e3", "score": "0.5082084", "text": "func exportKey(uml string) string {\n\t// DEFLATE\n\tvar b bytes.Buffer\n\tw, _ := flate.NewWriter(&b, flate.BestCompression)\n\t_, _ = io.WriteString(w, uml)\n\t_ = w.Close()\n\tcompressed := b.Bytes()\n\n\t// BASE64\n\tinputLength := len(compressed)\n\tfor i := 0; i < 3-inputLength%3; i++ {\n\t\tcompressed = append(compressed, byte(0))\n\t}\n\n\tb = bytes.Buffer{}\n\tfor i := 0; i < inputLength; i += 3 {\n\t\tb1, b2, b3, b4 := compressed[i], compressed[i+1], compressed[i+2], byte(0)\n\n\t\tb4 = b3 & 0x3f\n\t\tb3 = ((b2 & 0xf) << 2) | (b3 >> 6)\n\t\tb2 = ((b1 & 0x3) << 4) | (b2 >> 4)\n\t\tb1 = b1 >> 2\n\n\t\tfor _, n := range []byte{b1, b2, b3, b4} {\n\t\t\t// PlantUML uses a special base64 dictionary.\n\t\t\tconst base64 = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\"\n\t\t\tb.WriteByte(base64[n])\n\t\t}\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "565acc567c6867c7f0b3495c19e1ba54", "score": "0.50759596", "text": "func (n *sgeTeIntInfoFns) MetaToKey(meta *api.ObjectMeta) interface{} {\n\tvar key uint64\n\tfmt.Sscanf(meta.Name, \"%s\", &key)\n\treturn &key\n}", "title": "" }, { "docid": "b100337a1e9cf8eabdd726a4ccae2c19", "score": "0.5072053", "text": "func (s *xorKeySpace) Key(id []byte) Key {\n\thash := sha256.Sum256(id)\n\tkey := hash[:]\n\treturn Key{\n\t\tSpace: s,\n\t\tOriginal: id,\n\t\tBytes: key,\n\t}\n}", "title": "" }, { "docid": "62454e1af10d7c626ce3a03c9aefbd51", "score": "0.50699776", "text": "func Key() storj.Key {\n\tvar key storj.Key\n\tRead(key[:])\n\treturn key\n}", "title": "" }, { "docid": "f839052724327da43ec33cb11b004a30", "score": "0.50668496", "text": "func (f stringLikeFunc) key() Key {\n\treturn f.k\n}", "title": "" }, { "docid": "17c812e30897152fb3e5783c7499a5f2", "score": "0.5066828", "text": "func (diane Diane) Key() string {\n\treturn diane.NumeroSiren\n}", "title": "" }, { "docid": "567017576d6669c0ea7ef862c95f2068", "score": "0.50552243", "text": "func (bldr TxBuilder) Keybase() crkeys.Keybase { return bldr.keybase }", "title": "" }, { "docid": "d657569dd597385428e1b2570a256d14", "score": "0.5052849", "text": "func (w *SCWallet) generateKey() (public []byte, private []byte, err error) {\n\n\tkeypair := new([64]byte)\n\t// the secret part of the keypair is the top 32 bytes of the sha512 hash\n\tcopy(keypair[:32], w.GetSeed()[:32])\n\t// the crypto library puts the pubkey in the lower 32 bytes and returns the same 32 bytes.\n\tpub := ed25519.GetPublicKey(keypair)\n\n\treturn pub[:], keypair[:], err\n}", "title": "" } ]
3e27f8ba44b5885e49fb9c6413250c6b
HasCreationTime returns a boolean if a field has been set.
[ { "docid": "63406fa706f54cee56bfcbcfc1297874", "score": "0.8280566", "text": "func (o *VirtualizationVmwareVirtualMachineSnapshot) HasCreationTime() bool {\n\tif o != nil && o.CreationTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "069a6a8fca171333636bbeae0bb7ec17", "score": "0.82235533", "text": "func (o *CondAlarm) HasCreationTime() bool {\n\tif o != nil && o.CreationTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8d0f8b6858d2630f26a306e6a5833b3d", "score": "0.7640296", "text": "func (o *VmTemplate) HasCreationDate() bool {\n\tif o != nil && o.CreationDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "88d0c4ed2285a59b908c1c0293fcba65", "score": "0.73330224", "text": "func (o *CloudWorkloadSecurityAgentRuleAttributes) HasCreationDate() bool {\n\treturn o != nil && o.CreationDate != nil\n}", "title": "" }, { "docid": "a8a3ee121b7deed02ff64c5c06efe1cd", "score": "0.7126288", "text": "func (o *ServiceSpecificationDto) HasCreationDate() bool {\n\tif o != nil && !IsNil(o.CreationDate) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "53a7af5e288c54759804e2cd15cfdea9", "score": "0.71221477", "text": "func (o *KubernetesObjectMetaAllOf) HasCreationTimestamp() bool {\n\tif o != nil && o.CreationTimestamp != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9e1488ce2e7f61f4e3a2462e7a982fd2", "score": "0.70702606", "text": "func (o *NFT) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "44cca6f2189415f908766076bd9f1310", "score": "0.70399255", "text": "func (o *User) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e532aba81aff3c1b7ab8e1b9629aceb4", "score": "0.7021565", "text": "func (o *InlineResponse200101) HasCreatedTime() bool {\n\tif o != nil && o.CreatedTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "970885adb017d8e03fea188362a21057", "score": "0.6971287", "text": "func (o *IdentityUserCredential) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c7231bf48340b4803dc58bc8704ebd10", "score": "0.6928627", "text": "func (o *OnenoteEntitySchemaObjectModel) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b0c1900a6ce8b05d28138e612f886b6e", "score": "0.6872654", "text": "func (o *MicrosoftGraphWindowsInformationProtectionPolicy) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "70d0f0f15a876b6168e0e20a9e3b49af", "score": "0.6867189", "text": "func (o *MicrosoftGraphManagedAppRegistration) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a9732b3b54715321f6134ce65d344dc0", "score": "0.6861694", "text": "func (o *MicrosoftGraphSite) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1f1ab300713eaa808c8d8350c4de403d", "score": "0.6857818", "text": "func (o *MicrosoftGraphAppleDeviceFeaturesConfigurationBase) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "24ce5cb5d59988047b7a7e640cec4a0f", "score": "0.6838358", "text": "func (o *JsonMDNAUserObject) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b1f72b9d001a9cdd3962d563cd7991b8", "score": "0.6837507", "text": "func (o *ViewWorkingHour) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d944980ca25c9ce384928ce33ad29352", "score": "0.68360627", "text": "func (o *UserPreferenceAllOf) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8acadb4c8e3d58ff5f2d24cf2ed085b1", "score": "0.6833486", "text": "func (o *AccessCredential) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c52dfd5465d8635d9b490e0d94cc9953", "score": "0.6820309", "text": "func (o *Ga4ghSurgery) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f64416ce2debd8cef9ec9c00c2a3530d", "score": "0.68194896", "text": "func (o *Ga4ghExtraction) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c653fd52387e947dc49e4ff460256ac4", "score": "0.6795916", "text": "func (o *MicrosoftGraphRestrictedSignIn) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b234b0cc2958aba4798557565808b656", "score": "0.6727969", "text": "func (o *MicrosoftGraphIosGeneralDeviceConfiguration) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "61f9182606430c43bd6746d723c96e7e", "score": "0.6705243", "text": "func (o *ViewWorkingHour) HasDateCreated() bool {\n\tif o != nil && o.DateCreated != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "07d70f489b966dcd891903307e61ce54", "score": "0.6701607", "text": "func (o *MetricsProvider) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0c8da81c61de5e7d7d22815ee98d94a3", "score": "0.6664823", "text": "func (o *PipelineSchedule) HasCreatedOn() bool {\n\tif o != nil && o.CreatedOn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "66823bf3a800ed0c486775e77dc06ecd", "score": "0.6657179", "text": "func (o *Organization) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ce28eee16ee3f7ca09ab59b7b47c4517", "score": "0.66429275", "text": "func (o *MicrosoftGraphIosVppEBook) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d123c42fdf872094a15c795ed1be7555", "score": "0.6629385", "text": "func (v *TaskInfo) IsSetCreatedTimeNanos() bool {\n\treturn v != nil && v.CreatedTimeNanos != nil\n}", "title": "" }, { "docid": "9d94df564054adee408dd0ce44bd1e0e", "score": "0.66273123", "text": "func (o *Collection) HasCreatedAt() bool {\n\tif o != nil && !IsNil(o.CreatedAt) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3f5259fe42178b7bb6237caa1d55329d", "score": "0.65964335", "text": "func (o *ResourceUpdateWeb) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "32b1e254608d57704cf49313f52f3c05", "score": "0.65801674", "text": "func (o *EsmeSession) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f9dc6bc780bf792d491ac2e50da6a681", "score": "0.65524465", "text": "func (o *CdnSite) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3bf47d1af27e8875599783f9c948b53b", "score": "0.65350264", "text": "func (o *Page) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ba32354895e13b8a69d3105798e74c8d", "score": "0.6527394", "text": "func (o *SummaryAthlete) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4c5152eeaabc6a22f9fad105ec2ec629", "score": "0.6511817", "text": "func (o *InlineObject50) HasStartTime() bool {\n\tif o != nil && o.StartTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8d6cb97834ab20d358619b5c535897d8", "score": "0.6480322", "text": "func (o *DowntimeResponseAttributes) HasCreated() bool {\n\treturn o != nil && o.Created != nil\n}", "title": "" }, { "docid": "e6902143425f7ca2d7c9de73eb87f318", "score": "0.6464446", "text": "func (o *DashboardAllOfMeta) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4108cdcbb756a63bbd5f57ae6e63d79b", "score": "0.64627767", "text": "func (o *NotebookAuthor) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6ed96dfc0073ed5117509ea3e0315031", "score": "0.645784", "text": "func (o *VirtualizationVmwareVirtualMachineSnapshot) GetCreationTimeOk() (*time.Time, bool) {\n\tif o == nil || o.CreationTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreationTime, true\n}", "title": "" }, { "docid": "ba99d226edf25ef653f326a8a206d6de", "score": "0.6446819", "text": "func (o *AllocationDetails) HasCreatedDate() bool {\n\tif o != nil && !IsNil(o.CreatedDate) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0c7d383f5a53956b1ef029815e4a15fb", "score": "0.6440404", "text": "func (o *Repository) HasCreatedOn() bool {\n\tif o != nil && o.CreatedOn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d7f86c034b404fc261cc5329faebf10a", "score": "0.64254904", "text": "func (o *Ga4ghVariantCalling) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "318b245b7c90fd69c9983564f27d4587", "score": "0.6420362", "text": "func (o *KubernetesReplicaSet) HasCreateTimestamp() bool {\n\tif o != nil && o.CreateTimestamp != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d4f452dfe33559db3a8847b919c11909", "score": "0.6388457", "text": "func (o *MicrosoftGraphManagedIosLobApp) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "96049b20a86e7393cbe1916995379a00", "score": "0.6368699", "text": "func (o *UserSessionUserAction) HasStartTime() bool {\n\tif o != nil && o.StartTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8ddbf43ded8fa37727fe8c53cc1f3b14", "score": "0.6365896", "text": "func (o *Ga4ghCelltransplant) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d9493ddea7ccbb5d3f909ba01bb79fbe", "score": "0.63554496", "text": "func (v *HistoryTreeInfo) IsSetCreatedTimeNanos() bool {\n\treturn v != nil && v.CreatedTimeNanos != nil\n}", "title": "" }, { "docid": "a7d73303321685862543dae4ce9f4433", "score": "0.6348157", "text": "func (o *V1ImageMetadata) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "023e68c60131f53db762ca3bfd086d18", "score": "0.63440293", "text": "func (o *Issue) HasCreatedOn() bool {\n\tif o != nil && o.CreatedOn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d1ae7eb84a70db5ee0ea52576c2895c2", "score": "0.6342832", "text": "func (o *Ga4ghAlignment) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cde7542613ff6fe058b0708f7d5c6818", "score": "0.633384", "text": "func (o *AllocationSummary) HasCreatedDate() bool {\n\tif o != nil && !IsNil(o.CreatedDate) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b75465e5bea488e7cdc0d635142f9376", "score": "0.6329427", "text": "func (o *ProjectDeploymentRuleRequest) HasStartTime() bool {\n\tif o != nil && o.StartTime.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "254f14ab68d7e52ec7545c762f92b9b8", "score": "0.6326267", "text": "func (o *System) HasSystemCreateTime() bool {\n\tif o != nil && o.SystemCreateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5d5fd918bb0518f01e1ef2c526d6ed69", "score": "0.6325186", "text": "func (o *CondAlarm) GetCreationTimeOk() (*time.Time, bool) {\n\tif o == nil || o.CreationTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreationTime, true\n}", "title": "" }, { "docid": "50e9868cf773aea6912fbb588b026f73", "score": "0.6307341", "text": "func (o *ConnectorNode) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8e6b303ad3d4d0c8d4a80b609ed4debc", "score": "0.6302602", "text": "func (o *VM) HasTime() bool {\n\tif o != nil && o.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "44770c18697ace66cca916d5c80923ef", "score": "0.63019055", "text": "func (o *HistoryEntity) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7a8c72cf99a73f5a06321328ae6e8627", "score": "0.6288092", "text": "func (o *DeploymentReleaseAllOf) HasCreatedOn() bool {\n\tif o != nil && o.CreatedOn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1fecdb22098b470538938f1f800d8fe8", "score": "0.62800163", "text": "func (o *MicrosoftGraphIosVppApp) HasCreatedDateTime() bool {\n\tif o != nil && o.CreatedDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1c3dc0d35d93bff0588f902859c46dd2", "score": "0.6279093", "text": "func (o *CreateMetricRulesetResponse) HasCreated() bool {\n\tif o != nil && !isNil(o.Created) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9429182a574e0cfe652d89b03ee22b38", "score": "0.62574965", "text": "func (o *SloCreate) HasTimeframe() bool {\n\tif o != nil && o.Timeframe != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a3459f21c3705a8e71710311aedc31dd", "score": "0.62541074", "text": "func (o *MicrosoftGraphSite) HasCreatedByUser() bool {\n\tif o != nil && o.CreatedByUser != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a8927668277f6680c79c2e6bce9d76f9", "score": "0.6247909", "text": "func (o *ApiKey) HasCreatedAt() bool {\n\tif o != nil && !IsNil(o.CreatedAt) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cbbf51b6c1f338fe48124ea2deb05ffe", "score": "0.62474304", "text": "func (o *Network) HasCreatedOn() bool {\n\tif o != nil && o.CreatedOn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4e7eb4557843637b37a502211cb550bd", "score": "0.62444067", "text": "func (o *ProjectFeatureOrder) HasTime() bool {\n\tif o != nil && o.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c2c29a40fdce81dcacc38de14b1c6a5f", "score": "0.6240912", "text": "func (o *Budget) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5e66e492109889ac3e50d1e55f67033b", "score": "0.6219834", "text": "func (o *ProviderAgentResourceEvent) HasCreatedOn() bool {\n\tif o != nil && o.CreatedOn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "083b5231e99cd2273f667045735d9fb8", "score": "0.6215667", "text": "func (o *KubernetesMaintenanceWindow) HasTime() bool {\n\tif o != nil && o.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2fc4c863f8e454f555712b0cf1d4ab90", "score": "0.6200763", "text": "func (o *Comment) HasCreatedAt() bool {\n\tif o != nil && !IsNil(o.CreatedAt) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "12c75828c01d677e39fa63dd65a1e748", "score": "0.61880463", "text": "func (o *InlineResponse20045Card) HasDateCreated() bool {\n\tif o != nil && o.DateCreated != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0a48801efad967305b5180d753b625ff", "score": "0.61865294", "text": "func (o *MicrosoftGraphPhoto) HasTakenDateTime() bool {\n\tif o != nil && o.TakenDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "230b45a9b13f3a02124b5fc143ead1fa", "score": "0.6171688", "text": "func (v *ResetPointInfo) IsSetCreatedTimeNano() bool {\n\treturn v != nil && v.CreatedTimeNano != nil\n}", "title": "" }, { "docid": "a62da3403fbfef59657891f21c21ea39", "score": "0.6169542", "text": "func (o *V0037JobResponseProperties) HasStartTime() bool {\n\tif o != nil && o.StartTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9eaa5a95b29386573c4071bf5efb07d4", "score": "0.6168153", "text": "func (o *Category) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "baf0b98516ef36185e5d5fa177e5d11b", "score": "0.6162459", "text": "func (o *Attributes) GetCreationDateOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.CreationDate, true\n}", "title": "" }, { "docid": "7057fd31f3cc56a51fd356979ea07657", "score": "0.6161263", "text": "func (o *FormatTest) HasDateTime() bool {\n\tif o != nil && o.DateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "31fa428f82fbd9021bf99fe8f99fa96b", "score": "0.6151901", "text": "func (o *Development) HasDatetime() bool {\n\tif o != nil && o.Datetime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "561ce335a883b054a6bf88566b26b61c", "score": "0.61511093", "text": "func (o *CustomBitlinkHistory) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e18fcca2c2b2019d24c2f34ba7853277", "score": "0.6147982", "text": "func (o *ServiceAccountListItemAllOf) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cf467b7ee02969110bb3cb17e45e437f", "score": "0.61240995", "text": "func (o *InlineResponse200Account) HasCreatedAt() bool {\n\tif o != nil && o.CreatedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5f94bec2ce7fe45014f1ba69da0cf207", "score": "0.6105554", "text": "func (o *ParameterContextUpdateRequestDTO) HasSubmissionTime() bool {\n\tif o != nil && o.SubmissionTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b146768c3f064d03f38efbbfa6dd2e15", "score": "0.6086129", "text": "func (o *V0037JobResponseProperties) HasResizeTime() bool {\n\tif o != nil && o.ResizeTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bd1d5ce82d39b59d99a829a3647baf91", "score": "0.6057347", "text": "func (o *IdentityVerificationCreateRequestUser) HasDateOfBirth() bool {\n\tif o != nil && o.DateOfBirth != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0b55b4ca419bf4c65e07db008a408e53", "score": "0.60496527", "text": "func (m *UserMutation) CreateTime() (r time.Time, exists bool) {\n\tv := m.create_time\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "d5ba60161193ccc9a9103e19114b8cfc", "score": "0.6047734", "text": "func (o *Ga4ghOutcome) HasCreated() bool {\n\tif o != nil && o.Created != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bd9ad6638a4f86bba0e2b38d17230291", "score": "0.60358495", "text": "func (m *PostMutation) CreateTime() (r time.Time, exists bool) {\n\tv := m.create_time\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "57bbb9ec6f204bc06638e17dd783f2b3", "score": "0.6025588", "text": "func (o *StockTranscripts) HasTime() bool {\n\tif o != nil && o.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4e945a369dd9101899288168c68e677b", "score": "0.60246116", "text": "func (o *ApiKeyResponse) HasCreatedAt() bool {\n\tif o != nil && !IsNil(o.CreatedAt) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "680cac0794513edc24185be70dde43bc", "score": "0.60169256", "text": "func (o *TimeseriesWidgetDefinition) HasTime() bool {\n\tif o != nil && o.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fc34da1125ce6f6a008b1c313af0e6b7", "score": "0.6014473", "text": "func (o *PeoplePermissions) HasViewTime() bool {\n\tif o != nil && o.ViewTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fdb642ad268a6fdb785e2e1c9c7bea62", "score": "0.6000244", "text": "func (o *ViewNewTaskDefaults) HasStartDate() bool {\n\tif o != nil && o.StartDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "be28ebe2517a8bf3d36cee563b54f091", "score": "0.5998834", "text": "func (w *Widget) HasTime() bool {\n\tif w != nil && w.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bf9df35d834665e9d13cade56cbcd85f", "score": "0.5994447", "text": "func (o *VmTemplate) GetCreationDateOk() (*time.Time, bool) {\n\tif o == nil || o.CreationDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreationDate, true\n}", "title": "" }, { "docid": "32a8bcc75d0285c957aae58c67f58fc1", "score": "0.599117", "text": "func (o *SyntheticsTestDetails) HasCreator() bool {\n\tif o != nil && o.Creator != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1c122454d7c17736a8f8be3b44fd83db", "score": "0.59719336", "text": "func (e *Event) HasTime() bool {\n\tif e != nil && e.Time != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4def37985eb69c6357a559bf97b15761", "score": "0.5969909", "text": "func (o *InlineObject3) HasDateTime() bool {\n\tif o != nil && o.DateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "851c2320a53c704a65ec370df736b5d3", "score": "0.595967", "text": "func (s *QueryStatisticsForDescribeQuery) SetCreationTime(v time.Time) *QueryStatisticsForDescribeQuery {\n\ts.CreationTime = &v\n\treturn s\n}", "title": "" }, { "docid": "eb210a6b28f07b7964962de7eef7f561", "score": "0.59558153", "text": "func (o *OrderResponseShippingContact) HasCreatedAt() bool {\n\tif o != nil && !IsNil(o.CreatedAt) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8db86293fef1d4c72ca5b126c052cd19", "score": "0.5950308", "text": "func (m *Monitor) HasCreator() bool {\n\tif m != nil && m.Creator != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fc735b46ac55c1654ba44285e4e71a12", "score": "0.5948327", "text": "func (s *Query) SetCreationTime(v time.Time) *Query {\n\ts.CreationTime = &v\n\treturn s\n}", "title": "" } ]
c6f5efc88bd81a2460faa567e9d85d46
Uint64sUintsF creates a new slice with the results of calling the provided function on every element in the given array. If the given function returns an error, the element will be ignored.
[ { "docid": "003c810904fd9501e05e51c4bb1d789c", "score": "0.77358806", "text": "func Uint64sUintsF(s []uint64, f func(s uint64) (uint, error)) uints.Uints {\n\tm := uints.Uints(make([]uint, 0, len(s)))\n\tvar (\n\t\tx uint\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" } ]
[ { "docid": "4aa94d95d10e91acae4156d5330ca8af", "score": "0.74973476", "text": "func Uint64sInt64sF(s []uint64, f func(s uint64) (int64, error)) int64s.Int64s {\n\tm := int64s.Int64s(make([]int64, 0, len(s)))\n\tvar (\n\t\tx int64\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "fd93d92cf6c733e06da44c7f408893db", "score": "0.72167706", "text": "func Uint64sIntsF(s []uint64, f func(s uint64) (int, error)) ints.Ints {\n\tm := ints.Ints(make([]int, 0, len(s)))\n\tvar (\n\t\tx int\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "b08b8b4a480f2dde6d4bf40afaa60633", "score": "0.71457654", "text": "func Uint64sUintptrsF(s []uint64, f func(s uint64) (uintptr, error)) uintptrs.Uintptrs {\n\tm := uintptrs.Uintptrs(make([]uintptr, 0, len(s)))\n\tvar (\n\t\tx uintptr\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "b8c7cc3228c3b1f6e95aae5249c61271", "score": "0.7113697", "text": "func Uint64sInterfacesF(s []uint64, f func(s uint64) (interface{}, error)) interfaces.Interfaces {\n\tm := interfaces.Interfaces(make([]interface{}, 0, len(s)))\n\tvar (\n\t\tx interface{}\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "4380bd28e150a8c8bef4611b2d63f433", "score": "0.7074241", "text": "func Uint64sBytesF(s []uint64, f func(s uint64) (byte, error)) bytes.Bytes {\n\tm := bytes.Bytes(make([]byte, 0, len(s)))\n\tvar (\n\t\tx byte\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "1165553e694020730db5550c93fe9459", "score": "0.69945705", "text": "func Uint64sUints(s []uint64, f func(s uint64) uint) uints.Uints {\n\tm := uints.Uints(make([]uint, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "8b897fe13406647661e23efd25830dbc", "score": "0.69843256", "text": "func Uint64sRunesF(s []uint64, f func(s uint64) (rune, error)) runes.Runes {\n\tm := runes.Runes(make([]rune, 0, len(s)))\n\tvar (\n\t\tx rune\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "498a06e312e941aa40e8621e89cb7205", "score": "0.6846436", "text": "func Uint64sUint32sF(s []uint64, f func(s uint64) (uint32, error)) uint32s.Uint32s {\n\tm := uint32s.Uint32s(make([]uint32, 0, len(s)))\n\tvar (\n\t\tx uint32\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "e791b5ac78d90c50ae64c463f5ad60d5", "score": "0.6825203", "text": "func Uint64sUint8sF(s []uint64, f func(s uint64) (uint8, error)) uint8s.Uint8s {\n\tm := uint8s.Uint8s(make([]uint8, 0, len(s)))\n\tvar (\n\t\tx uint8\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "36851a1d540740a5b1930a04d0f6cb84", "score": "0.68054366", "text": "func Uint64sFloat64sF(s []uint64, f func(s uint64) (float64, error)) float64s.Float64s {\n\tm := float64s.Float64s(make([]float64, 0, len(s)))\n\tvar (\n\t\tx float64\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "c6b03cf0817e533717886046ad5cda74", "score": "0.6634638", "text": "func Uint64sInt8sF(s []uint64, f func(s uint64) (int8, error)) int8s.Int8s {\n\tm := int8s.Int8s(make([]int8, 0, len(s)))\n\tvar (\n\t\tx int8\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "c52305a41a84e732b10d5207e4bb81a8", "score": "0.66326153", "text": "func Uint64sBoolsF(s []uint64, f func(s uint64) (bool, error)) bools.Bools {\n\tm := bools.Bools(make([]bool, 0, len(s)))\n\tvar (\n\t\tx bool\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "d2d62fb359a6a13fda39448648d24d83", "score": "0.6621394", "text": "func Uint64sInt64s(s []uint64, f func(s uint64) int64) int64s.Int64s {\n\tm := int64s.Int64s(make([]int64, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "3b236bd83717b121e30e6abb44bde7c2", "score": "0.65936184", "text": "func Uint64sComplex64sF(s []uint64, f func(s uint64) (complex64, error)) complex64s.Complex64s {\n\tm := complex64s.Complex64s(make([]complex64, 0, len(s)))\n\tvar (\n\t\tx complex64\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "4ea4dcb66ae2d1d26fbbf1a666278edd", "score": "0.6572399", "text": "func Uint64sUintsE(s []uint64, f func(s uint64) (uint, error)) (uints.Uints, error) {\n\tm := uints.Uints(make([]uint, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "7a1fbf7c110da23283290e41418eaffc", "score": "0.65482324", "text": "func Uint64sUint16sF(s []uint64, f func(s uint64) (uint16, error)) uint16s.Uint16s {\n\tm := uint16s.Uint16s(make([]uint16, 0, len(s)))\n\tvar (\n\t\tx uint16\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "24ada75191a8577ec864a126ebd58b3e", "score": "0.6541053", "text": "func Uint64sStringsF(s []uint64, f func(s uint64) (string, error)) strings.Strings {\n\tm := strings.Strings(make([]string, 0, len(s)))\n\tvar (\n\t\tx string\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "d1df23ea77e8f7c379d2d35d38126cb7", "score": "0.6528134", "text": "func Uint64sInts(s []uint64, f func(s uint64) int) ints.Ints {\n\tm := ints.Ints(make([]int, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "a05ff417f41045604bfd3271263a6f55", "score": "0.64473873", "text": "func Uint64sFloat64s(s []uint64, f func(s uint64) float64) float64s.Float64s {\n\tm := float64s.Float64s(make([]float64, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "a3daf8bd3e6bea1c8cbef458689a8902", "score": "0.64180624", "text": "func Uint64sInt16sF(s []uint64, f func(s uint64) (int16, error)) int16s.Int16s {\n\tm := int16s.Int16s(make([]int16, 0, len(s)))\n\tvar (\n\t\tx int16\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "369dbf4bdf529647a85ad3687b1ac65a", "score": "0.6362143", "text": "func Uint64sBytes(s []uint64, f func(s uint64) byte) bytes.Bytes {\n\tm := bytes.Bytes(make([]byte, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "f916d5a0bba1c0b1af61e13b21c9e334", "score": "0.63316935", "text": "func Uint64sInt32sF(s []uint64, f func(s uint64) (int32, error)) int32s.Int32s {\n\tm := int32s.Int32s(make([]int32, 0, len(s)))\n\tvar (\n\t\tx int32\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "d1ed515b455248a379e381bd06643a40", "score": "0.6327525", "text": "func Uint64sInterfaces(s []uint64, f func(s uint64) interface{}) interfaces.Interfaces {\n\tm := interfaces.Interfaces(make([]interface{}, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "df67854fe0ded4da9aaa64368d150d87", "score": "0.6302311", "text": "func Uint64sUintptrs(s []uint64, f func(s uint64) uintptr) uintptrs.Uintptrs {\n\tm := uintptrs.Uintptrs(make([]uintptr, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "6feedb0b4dac602cb516ee8455b1834c", "score": "0.6276157", "text": "func Uint64sInt64sE(s []uint64, f func(s uint64) (int64, error)) (int64s.Int64s, error) {\n\tm := int64s.Int64s(make([]int64, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "1c1758c03945a720d1907ae4a80ff5eb", "score": "0.62586755", "text": "func (a arrayUInt64) MapUInt64(f func(uint64) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "2229f4e365167f1d5f558eed652880e1", "score": "0.62261325", "text": "func FilterUint64(f func(uint64, int) bool, input []uint64) (output []uint64) {\n\toutput = make([]uint64, 0)\n\tfor idx, data := range input {\n\t\tif f(data, idx) {\n\t\t\toutput = append(output, data)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "961a1a30a5544b7a8341446961e7a52f", "score": "0.61982834", "text": "func (a arrayInt64) MapUInt64(f func(int64) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "5a19e7136a62f6afd76f65aee0c6a63c", "score": "0.6180417", "text": "func (a arrayFloat64) MapUInt64(f func(float64) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "928164e4dd95da13edabaeb2340cf7c8", "score": "0.61646235", "text": "func Uint64sRunes(s []uint64, f func(s uint64) rune) runes.Runes {\n\tm := runes.Runes(make([]rune, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "d9ca56fca6431374343d8e2a409e4f90", "score": "0.6148254", "text": "func ToSliceByUint64(items []uint64) []interface{} {\n\tvar result = make([]interface{}, 0, len(items))\n\tfor _, item := range items {\n\t\tresult = append(result, item)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "64303a99b175b2235e66ae707bf20339", "score": "0.6129775", "text": "func (a arrayUInt8) MapUInt64(f func(uint8) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "3c7f7d19b2317adea3fa1c0d481bddd9", "score": "0.6100791", "text": "func (a arrayInt8) MapUInt64(f func(int8) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "1baface352d8881b230cb3b8aaca0be6", "score": "0.6093734", "text": "func Uint64sIntsE(s []uint64, f func(s uint64) (int, error)) (ints.Ints, error) {\n\tm := ints.Ints(make([]int, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "9cf2c0af6ea76f479bc6a593a636567c", "score": "0.6090671", "text": "func Uint64sUint8s(s []uint64, f func(s uint64) uint8) uint8s.Uint8s {\n\tm := uint8s.Uint8s(make([]uint8, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "380b70778def0ce170e1f7baddd9601b", "score": "0.6051029", "text": "func Float64s(slice []float64, fn func(v float64) bool) []float64 {\n\tb := slice[:0]\n\tfor _, v := range slice {\n\t\tif fn(v) {\n\t\t\tb = append(b, v)\n\t\t}\n\t}\n\treturn b\n}", "title": "" }, { "docid": "e7a83fd32c5618ebc1fe32b3584667b1", "score": "0.6047596", "text": "func (a arrayUInt) MapUInt64(f func(uint) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "885c1b353f71a0ba47c0140383ce352b", "score": "0.6044545", "text": "func Uint64sUint32s(s []uint64, f func(s uint64) uint32) uint32s.Uint32s {\n\tm := uint32s.Uint32s(make([]uint32, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "2a04a2ba17e1a484a15267977d4bd123", "score": "0.60399836", "text": "func Uint64sComplex128sF(s []uint64, f func(s uint64) (complex128, error)) complex128s.Complex128s {\n\tm := complex128s.Complex128s(make([]complex128, 0, len(s)))\n\tvar (\n\t\tx complex128\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "f92e8b7ad7688eb40b0dc15c0383f371", "score": "0.60116184", "text": "func (a arrayUintPtr) MapUInt64(f func(uintptr) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "ecc4c95b61415083e22266925f3a7e18", "score": "0.5969899", "text": "func Uint64sFloat64sE(s []uint64, f func(s uint64) (float64, error)) (float64s.Float64s, error) {\n\tm := float64s.Float64s(make([]float64, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "674bca40dd52e5c8f0d87ff2a0c901e2", "score": "0.5967024", "text": "func (a arrayUInt64) MapFloat64(f func(uint64) float64) arrayFloat64 {\n\tvar r = make(arrayFloat64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayFloat64(r)\n}", "title": "" }, { "docid": "d398eaefa7d27e23a6e82a06e1222b72", "score": "0.59579456", "text": "func (a arrayUInt32) MapUInt64(f func(uint32) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "aa87c8040e452f8388b2f4d190e623c2", "score": "0.59577924", "text": "func Uint64sBytesE(s []uint64, f func(s uint64) (byte, error)) (bytes.Bytes, error) {\n\tm := bytes.Bytes(make([]byte, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "0a90eae2f7a06504ede5e7173be4dbc2", "score": "0.594659", "text": "func Uint64Slice(args ...[]uint64) []uint64 {\n\tfor _, arg := range args {\n\t\tif arg != nil {\n\t\t\treturn arg\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a15573b945c067f5b96c66f79999efd2", "score": "0.5943781", "text": "func (a arrayUInt) MapFloat64(f func(uint) float64) arrayFloat64 {\n\tvar r = make(arrayFloat64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayFloat64(r)\n}", "title": "" }, { "docid": "7c731693b4aefaaf7c3229dfb4677151", "score": "0.59388644", "text": "func Uint64s(key string, vs []uint64) Field {\n\treturn Array(key,uint64s(vs))\n}", "title": "" }, { "docid": "92ddb22f9899eccb792082bdda3cfac4", "score": "0.5932543", "text": "func Uint64sStrings(s []uint64, f func(s uint64) string) strings.Strings {\n\tm := strings.Strings(make([]string, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "48d1d626611906d40fe3fed0713f4ba2", "score": "0.59250253", "text": "func (a arrayComplex64) MapUInt64(f func(complex64) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "196e17a908208536874700b7f43cfc40", "score": "0.5922611", "text": "func (a arrayInt) MapUInt64(f func(int) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "e3443a8a5fe51a38c1a7284aacb5a890", "score": "0.59084135", "text": "func (a arrayFloat32) MapUInt64(f func(float32) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "17abc0fe32e9711daafbbb6d4e8440fe", "score": "0.59025985", "text": "func Uint64sUint16s(s []uint64, f func(s uint64) uint16) uint16s.Uint16s {\n\tm := uint16s.Uint16s(make([]uint16, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "121e73fa2108ce7f5ea1154af506cb2b", "score": "0.5897367", "text": "func (a arrayByte) MapUInt64(f func(byte) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "747fedec83daca2b331847fe77ff2d0b", "score": "0.5866909", "text": "func Uint64sFloat32sF(s []uint64, f func(s uint64) (float32, error)) float32s.Float32s {\n\tm := float32s.Float32s(make([]float32, 0, len(s)))\n\tvar (\n\t\tx float32\n\t\terr error\n\t)\n\tfor _, v := range s {\n\t\tx, err = f(v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tm = append(m, x)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "ce3bc1c283d37fffde3b176be668a0d4", "score": "0.58585095", "text": "func forEachInSlice(slice []uint64, fn func(uint64)) {\n\tfor _, val := range slice {\n\t\tfn(val)\n\t}\n}", "title": "" }, { "docid": "5359f2adaec65d7187630dc6946f6acb", "score": "0.5851379", "text": "func (a arrayInt32) MapUInt64(f func(int32) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "2bd9d71bb97a0317ba97bebe3fed2d1c", "score": "0.5824821", "text": "func (a arrayString) MapUInt64(f func(string) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "d920a0797c58a84f4f55f9627925ff4c", "score": "0.58108455", "text": "func FromStdUint64Slice(s []uint64) []Uint64 {\n\treturn *((*[]Uint64)(unsafe.Pointer(&s)))\n}", "title": "" }, { "docid": "36684424f38bba8d0d872b38cb4edaa8", "score": "0.57922375", "text": "func Uint64sInt8s(s []uint64, f func(s uint64) int8) int8s.Int8s {\n\tm := int8s.Int8s(make([]int8, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "0350cae1c40936f545bdbc9b7dbd70fb", "score": "0.57630074", "text": "func Uint64sUint8sE(s []uint64, f func(s uint64) (uint8, error)) (uint8s.Uint8s, error) {\n\tm := uint8s.Uint8s(make([]uint8, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "5ac5f3eed805033599e58fa2e2f9f661", "score": "0.5751179", "text": "func Uint64sBools(s []uint64, f func(s uint64) bool) bools.Bools {\n\tm := bools.Bools(make([]bool, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "619b9f38ce240e0d5063cbc80048c218", "score": "0.5749027", "text": "func (a arrayUInt64) MapUInt(f func(uint64) uint) arrayUInt {\n\tvar r = make(arrayUInt, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt(r)\n}", "title": "" }, { "docid": "daaafa44086c07ea1fb2996248c8e43e", "score": "0.5747918", "text": "func Uint64sComplex64s(s []uint64, f func(s uint64) complex64) complex64s.Complex64s {\n\tm := complex64s.Complex64s(make([]complex64, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "99c665147dc0a1fd8e5ab967c74e6689", "score": "0.5732166", "text": "func Uint64sInterfacesE(s []uint64, f func(s uint64) (interface{}, error)) (interfaces.Interfaces, error) {\n\tm := interfaces.Interfaces(make([]interface{}, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "8fa1ed2ffce117ab5b041eb5516c63a3", "score": "0.5727876", "text": "func Uint64sRunesE(s []uint64, f func(s uint64) (rune, error)) (runes.Runes, error) {\n\tm := runes.Runes(make([]rune, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "a32c52ce9e1986db72bc1209949df3a0", "score": "0.5723021", "text": "func (a arrayUInt8) MapFloat64(f func(uint8) float64) arrayFloat64 {\n\tvar r = make(arrayFloat64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayFloat64(r)\n}", "title": "" }, { "docid": "5a3c7f302d98a51163030256f04bbce7", "score": "0.5721617", "text": "func (a arrayInt16) MapUInt64(f func(int16) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "81df90e2cd09e3705a08f2edeb7fa93d", "score": "0.57123786", "text": "func Uint64sUintptrsE(s []uint64, f func(s uint64) (uintptr, error)) (uintptrs.Uintptrs, error) {\n\tm := uintptrs.Uintptrs(make([]uintptr, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "10a55e92af6bd0061b4c60f76a54cf7a", "score": "0.57070154", "text": "func (a arrayUintPtr) MapFloat64(f func(uintptr) float64) arrayFloat64 {\n\tvar r = make(arrayFloat64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayFloat64(r)\n}", "title": "" }, { "docid": "f18a7ec0a2c72b3f8ed228eae58114b8", "score": "0.5706202", "text": "func (a arrayUInt16) MapUInt64(f func(uint16) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "9e37b28988ab069a01d2a247e80d0f3a", "score": "0.57051814", "text": "func ToStdUint64Slice(s []Uint64) []uint64 {\n\treturn *((*[]uint64)(unsafe.Pointer(&s)))\n}", "title": "" }, { "docid": "c9d30aeba445c045f4e0fa3530b1f643", "score": "0.5704998", "text": "func Uint64sUint32sE(s []uint64, f func(s uint64) (uint32, error)) (uint32s.Uint32s, error) {\n\tm := uint32s.Uint32s(make([]uint32, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "28fc7a106397afa6f6e4a43603872478", "score": "0.5694994", "text": "func (a arrayUInt64) MapInt64(f func(uint64) int64) arrayInt64 {\n\tvar r = make(arrayInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayInt64(r)\n}", "title": "" }, { "docid": "053afa3a9b2ae622315b1122b9bcda5e", "score": "0.5694801", "text": "func Uint64s(a []uint64) { Uint64Slice(a).Sort() }", "title": "" }, { "docid": "0d3031591b8ac2a1d83acbee64669a49", "score": "0.5688221", "text": "func (a arrayInt64) MapUInt(f func(int64) uint) arrayUInt {\n\tvar r = make(arrayUInt, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt(r)\n}", "title": "" }, { "docid": "a935f55d8ebea6f509ad2964398bb245", "score": "0.56853336", "text": "func (a arrayBool) MapUInt64(f func(bool) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "02acf16c0c4c09e8049db4ae6a2b4223", "score": "0.5681797", "text": "func (a arrayUInt64) Each(f func(uint64)) {\n\tfor _, e := range a { f(e) }\n}", "title": "" }, { "docid": "45270a75729ab17d3ae371f3988a6078", "score": "0.5666474", "text": "func Uint64Slice(n int, min, max uint64, sorted bool, rand *rand.Rand) []uint64 {\n\ta := make([]uint64, rand.Intn(n))\n\tfor i := range a {\n\t\ta[i] = min + uint64(rand.Int63n(int64(max-min)))\n\t}\n\n\tif sorted {\n\t\tsort.Sort(uint64Slice(a))\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "bac24ad957a4d17c7dfe7b81f11e6f0b", "score": "0.56483203", "text": "func Uint64s(key string, val []uint64) Field {\n\treturn Field{Key: key, Val: Uint64sValue(val)}\n}", "title": "" }, { "docid": "aff5cd584417aa53cb25b45fb5217e24", "score": "0.5644294", "text": "func (a arrayUInt) MapInt64(f func(uint) int64) arrayInt64 {\n\tvar r = make(arrayInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayInt64(r)\n}", "title": "" }, { "docid": "1641fb74a06bb8618cf6a9ab5479c84f", "score": "0.56387913", "text": "func (a arrayComplex128) MapUInt64(f func(complex128) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" }, { "docid": "c9c84aba176f38f661fcfbf38a69ae64", "score": "0.56378126", "text": "func GetUint64s(bs []byte, vs []uint64) {\n\tbsLen := len(vs) * size64bitsInBytes\n\tchunks := bsLen / n\n\tbsOffset := 0\n\tfor i := 0; i < chunks; i++ {\n\t\tindex := bsOffset / size64bitsInBytes\n\t\tcopy((*(*[n]byte)(unsafe.Pointer(&vs[index])))[:n], bs[bsOffset:bsOffset+n])\n\t\tbsOffset += n\n\t}\n\tvsLimit := bsLen % n\n\tif vsLimit == 0 {\n\t\treturn\n\t}\n\tindex := bsOffset / size64bitsInBytes\n\tcopy((*(*[n]byte)(unsafe.Pointer(&vs[index])))[:vsLimit], bs[bsOffset:bsOffset+vsLimit])\n}", "title": "" }, { "docid": "51b3bae6d51af7ca68fb791cc58ac5b6", "score": "0.5634486", "text": "func Uint64sStringsE(s []uint64, f func(s uint64) (string, error)) (strings.Strings, error) {\n\tm := strings.Strings(make([]string, len(s)))\n\tvar err error\n\tfor i, v := range s {\n\t\tm[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "6d519b9bf9a72cd3f4dad97b36f79d0f", "score": "0.5619423", "text": "func Uint64sInt16s(s []uint64, f func(s uint64) int16) int16s.Int16s {\n\tm := int16s.Int16s(make([]int16, len(s)))\n\tfor i, v := range s {\n\t\tm[i] = f(v)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "3f664f232f2a08af3368282fa9ed04f1", "score": "0.5608283", "text": "func Uint64SetSlice(m map[uint64]struct{}) []uint64 {\n\ta := make([]uint64, 0, len(m))\n\tfor v := range m {\n\t\ta = append(a, v)\n\t}\n\tsort.Sort(uint64Slice(a))\n\treturn a\n}", "title": "" }, { "docid": "752bc5d64642b03877a46d65d1aa6be6", "score": "0.56063026", "text": "func (a arrayInt8) ReduceUInt64(f func(int8, int, ArrayInt8) uint64, initial uint64) uint64 {\n\tvar r uint64 = initial\n\tfor i, e := range a { \n\t\tr = f(e, i, a)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "27d368c558de96dfb85cb5f87b2e3958", "score": "0.5604427", "text": "func (a arrayFloat64) MapUInt(f func(float64) uint) arrayUInt {\n\tvar r = make(arrayUInt, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt(r)\n}", "title": "" }, { "docid": "6feb9e4184e44ebf68c48a6a220d727d", "score": "0.56022596", "text": "func (a arrayUInt8) ReduceUInt64(f func(uint8, int, ArrayUInt8) uint64, initial uint64) uint64 {\n\tvar r uint64 = initial\n\tfor i, e := range a { \n\t\tr = f(e, i, a)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "e3b8537f51621750dfa9a62d3df01b16", "score": "0.5600511", "text": "func (a arrayUintPtr) ReduceUInt64(f func(uintptr, int, ArrayUintPtr) uint64, initial uint64) uint64 {\n\tvar r uint64 = initial\n\tfor i, e := range a { \n\t\tr = f(e, i, a)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "80fdc3740d88cbda1186d6f06362a224", "score": "0.55900854", "text": "func Int64SliceToUint64Slice(vals []int64) []uint64 {\n\treturn *(*[]uint64)(unsafe.Pointer(&reflect.SliceHeader{\n\t\tData: uintptr(unsafe.Pointer(&vals[0])),\n\t\tLen: len(vals),\n\t\tCap: cap(vals),\n\t}))\n}", "title": "" }, { "docid": "805b3ccb8231b18874d3ab0cf4851339", "score": "0.5587055", "text": "func (a arrayFloat64) ReduceUInt64(f func(float64, int, ArrayFloat64) uint64, initial uint64) uint64 {\n\tvar r uint64 = initial\n\tfor i, e := range a { \n\t\tr = f(e, i, a)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "3c2b56112ff20d51f63739a1ddf06da8", "score": "0.5583571", "text": "func (a arrayUInt8) MapInt64(f func(uint8) int64) arrayInt64 {\n\tvar r = make(arrayInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayInt64(r)\n}", "title": "" }, { "docid": "67a7832ffe59c3ff070d4a0a111bc917", "score": "0.55792594", "text": "func sliceUint64(N uint64, start, stop uint8) uint64 {\n\tmask := uint64((1 << (start + 1)) - (1 << stop))\n\tr := N & mask\n\tif stop > 0 {\n\t\tr >>= stop\n\t}\n\treturn r\n}", "title": "" }, { "docid": "a912f410fa6a03a4362dca57d12ee88e", "score": "0.5571257", "text": "func (a arrayInt64) ReduceUInt64(f func(int64, int, ArrayInt64) uint64, initial uint64) uint64 {\n\tvar r uint64 = initial\n\tfor i, e := range a { \n\t\tr = f(e, i, a)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "308c089c32d3e2dc65359a6f4ff0e12b", "score": "0.5560863", "text": "func Float64Slice(src []float64) []*float64 {\n\tdst := make([]*float64, len(src))\n\tfor i := range src {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}", "title": "" }, { "docid": "56947e7a7cd2a5443eacb0ab5ffbf8e7", "score": "0.5559952", "text": "func FuncSliceUint32Length[T any, S ~*[]T](r IO, x S, f func(*T)) {\n\tcount := uint32(len(*x))\n\tr.Uint32(&count)\n\tFuncSliceOfLen(r, count, x, f)\n}", "title": "" }, { "docid": "ff2781455462dc0eebea63559df699d0", "score": "0.5557502", "text": "func FuncIOSliceUint32Length[T any, S ~*[]T](r IO, x S, f func(IO, *T)) {\n\tcount := uint32(len(*x))\n\tr.Uint32(&count)\n\tFuncIOSliceOfLen(r, count, x, f)\n}", "title": "" }, { "docid": "1985bdb8f4cd027bfc32d768021bca23", "score": "0.55532384", "text": "func (a arrayUInt64) ReduceUInt64(f func(uint64, int, ArrayUInt64) uint64, initial uint64) uint64 {\n\tvar r uint64 = initial\n\tfor i, e := range a { \n\t\tr = f(e, i, a)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "89213b586f2e0ca77bb427e95ca46cce", "score": "0.5548488", "text": "func (a arrayUInt) ReduceUInt64(f func(uint, int, ArrayUInt) uint64, initial uint64) uint64 {\n\tvar r uint64 = initial\n\tfor i, e := range a { \n\t\tr = f(e, i, a)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "ee18c3892ae4c764ebe335732b0bf627", "score": "0.5547", "text": "func (a arrayRune) MapUInt64(f func(rune) uint64) arrayUInt64 {\n\tvar r = make(arrayUInt64, len(a))\n\tfor i, e := range a { r[i] = f(e) }\n\treturn arrayUInt64(r)\n}", "title": "" } ]
ff7dca366dae3aba14e4ce2354f4a4e0
NewServer this function work to get a new instance of this router
[ { "docid": "9de0e2c0e1a6f2b7716573e170d4674c", "score": "0.6598712", "text": "func NewServer(port string) {\n\n\trouter := fasthttprouter.New()\n\trouter.GET(\"/login/:username/:pass\", get.Login)\n\trouter.POST(\"/signup/:username/:pass\", post.SignUp)\n\n\tlog.Print(\"server running on port \" + port)\n\tlog.Fatal(fasthttp.ListenAndServe(port, router.Handler))\n}", "title": "" } ]
[ { "docid": "3b5adaef814cc2ab91ec8e85e3a01b70", "score": "0.7682744", "text": "func (m *MyServer) newRouter() {\n\tm.rtr = mux.NewRouter()\n}", "title": "" }, { "docid": "c8a69ba43ec293aba3e89e1a3855ecdc", "score": "0.7663904", "text": "func newServer() *server {\n\ts := &server{router: http.NewServeMux()}\n\ts.routes() // assigns routes defined in routes.go to router\n\treturn s\n}", "title": "" }, { "docid": "9befd812920829baf5c3fd34691e275a", "score": "0.72712797", "text": "func newServer() (*server, error) {\n\tvar s server\n\tvar err error\n\n\t// Create a tcp listener for the web server\n\ts.listener, err = net.Listen(\"tcp\", \"localhost:8080\")\n\tif err != nil {\n\t\treturn &s, fmt.Errorf(\"error: failed to create net.listener: %v\", err)\n\t}\n\n\t// Create a new mux for route handling\n\ts.mux = http.NewServeMux()\n\t// Also add that new mux as the default mux for our http.Server type\n\ts.server.Handler = s.mux\n\ts.server.ReadTimeout = time.Duration(time.Second * 5)\n\ts.server.IdleTimeout = time.Duration(time.Second * 5)\n\n\t// Statically define the languages to use\n\ts.languages = []language{\n\t\t{Language: \"SE\", Saying: \"tjenare\"},\n\t\t{Language: \"NO\", Saying: \"heisann\"},\n\t}\n\n\treturn &s, nil\n}", "title": "" }, { "docid": "9d30d37fceb8f3411eaee13f1b08e935", "score": "0.7246277", "text": "func NewServer() Server {\n\trouter := gin.Default()\n\tstorage := storage.NewStorage()\n\n\ts := server{\n\t\t// storage: storage.NewStorage(),\n\t\tengine: router,\n\t}\n\n\tapiMW := router.Group(\"/api\")\n\n\tapiMW.GET(\"/rooms\", handlers.GetAllRooms(storage))\n\tapiMW.GET(\"/rooms/:roomid\", handlers.GetRoomByRoomID(storage))\n\tapiMW.POST(\"/rooms\", handlers.AddNewRoom(storage))\n\n\tapiMW.GET(\"/roomtypes\", handlers.GetAllRoomTypes(storage))\n\tapiMW.POST(\"/roomtypes\", handlers.AddNewRoomType(storage))\n\n\treturn &s\n}", "title": "" }, { "docid": "564a9a3a4d247ce8219ae7913a86efe9", "score": "0.7188479", "text": "func newServer(conf *Config, st store.Store) *server {\n\ts := &server{\n\t\tconfig: conf,\n\t\tstore: st,\n\t}\n\tif err := s.configureLogger(); err != nil {\n\t\tpanic(err)\n\t}\n\ts.configureRouter()\n\treturn s\n}", "title": "" }, { "docid": "a332a0c94ddd6e67532791e0bd3ab8c4", "score": "0.714635", "text": "func New(routes ...routes) *Server {\n\treturn &Server{\n\t\troutes: routes,\n\t\tstop: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "cb466d05b890c2f321fa665d01dd91b1", "score": "0.7090396", "text": "func New() *http.Server {\n\tr := newRouter()\n\treturn &http.Server{\n\t\tAddr: port,\n\t\tHandler: r,\n\t}\n}", "title": "" }, { "docid": "343393604a2bec6e2dbf10a23386d42e", "score": "0.70881844", "text": "func NewServer() *negroni.Negroni {\n\n formatter := render.New(render.Options{\n IndentJSON: true,\n })\n\n n := negroni.Classic()\n mx := mux.NewRouter()\n\n initRoutes(mx, formatter)\n\n n.UseHandler(mx)\n return n\n}", "title": "" }, { "docid": "feb4d90a23345dc73be0a35af685c85c", "score": "0.70795876", "text": "func NewServer(r *network.Router, pkey abstract.Scalar) *Server {\n\tc := &Server{\n\t\tprivate: pkey,\n\t\tstatusReporterStruct: newStatusReporterStruct(),\n\t\tRouter: r,\n\t\tprotocols: newProtocolStorage(),\n\t\tstarted: time.Now(),\n\t}\n\tc.overlay = NewOverlay(c)\n\tc.websocket = NewWebSocket(r.ServerIdentity)\n\tc.serviceManager = newServiceManager(c, c.overlay)\n\tc.statusReporterStruct.RegisterStatusReporter(\"Status\", c)\n\tfor name, inst := range protocols.instantiators {\n\t\tlog.Lvl4(\"Registering global protocol\", name)\n\t\tc.ProtocolRegister(name, inst)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "d7b377ee69c58b282349d00cede6f3b4", "score": "0.7054851", "text": "func NewRouter(srv *SherryServer.ShryServer, documentRoot string)(*mux.Router, error) {\n router := mux.NewRouter()\n\n // excel Service\n excel, _ := excelSrv.NewExcelsrv(srv)\n excel.AddRouter(router)\n // word Service\n word, err := wordSrv.NewWordTemplate(srv,\"\") // \"\" is file path\n if err != nil {\n return nil, err\n }\n word.AddRouter(router)\n \n //logger\n router.Use(SherryServer.ZapLogger(srv.Logger))\n\n // health check\n systemName := os.Getenv(\"SystemName\")\n m := serverstatus.NewServerStatus(systemName)\n router.HandleFunc(\"/healthz\", m.Healthz).Methods(\"GET\")\n\n // Static File server\n staticfileserver := SherryServer.StaticFileServer{documentRoot, \"index.html\"}\n router.PathPrefix(\"/\").Handler(staticfileserver)\n\n return router, nil\n}", "title": "" }, { "docid": "19b4a9653311a8356eb1c8df24a9ead2", "score": "0.7033929", "text": "func newServer() *server {\n\tserver := &server{\n\t\tMessageManager: transport.NewMessageManager(),\n\t}\n\treturn server\n}", "title": "" }, { "docid": "ad71b77f7aeffa4c5d6153b346be51ae", "score": "0.7012007", "text": "func NewServer(network *Network) *Server {\n\ts := &Server{\n\t\trouter: httprouter.New(),\n\t\tnetwork: network,\n\t}\n\n\ts.OPTIONS(\"/\", s.Options)\n\ts.GET(\"/\", s.GetNetwork)\n\ts.POST(\"/start\", s.StartNetwork)\n\ts.POST(\"/stop\", s.StopNetwork)\n\ts.POST(\"/mocker/start\", s.StartMocker)\n\ts.POST(\"/mocker/stop\", s.StopMocker)\n\ts.GET(\"/mocker\", s.GetMockers)\n\ts.POST(\"/reset\", s.ResetNetwork)\n\ts.GET(\"/events\", s.StreamNetworkEvents)\n\ts.GET(\"/snapshot\", s.CreateSnapshot)\n\ts.POST(\"/snapshot\", s.LoadSnapshot)\n\ts.POST(\"/nodes\", s.CreateNode)\n\ts.GET(\"/nodes\", s.GetNodes)\n\ts.GET(\"/nodes/:nodeid\", s.GetNode)\n\ts.POST(\"/nodes/:nodeid/start\", s.StartNode)\n\ts.POST(\"/nodes/:nodeid/stop\", s.StopNode)\n\ts.POST(\"/nodes/:nodeid/conn/:peerid\", s.ConnectNode)\n\ts.DELETE(\"/nodes/:nodeid/conn/:peerid\", s.DisconnectNode)\n\ts.GET(\"/nodes/:nodeid/rpc\", s.NodeRPC)\n\n\treturn s\n}", "title": "" }, { "docid": "26e2e8030b646c32ccea3f01d93778f0", "score": "0.6957041", "text": "func NewRouter(td todo.Service) *Server {\n\ts := &Server{\n\t\tTodo: td,\n\t}\n\n\tr := chi.NewRouter()\n\n\tr.Use(accessControl)\n\n\tr.Route(\"/go-ach\", func(r chi.Router) {\n\t\th := handlers.TodoHandler{Service: s.Todo}\n\t\tr.Mount(\"/v1\", h.Router())\n\t})\n\n\ts.router = r\n\n\treturn s\n}", "title": "" }, { "docid": "5c3898d9281e4f0096e7e8ecd2720349", "score": "0.695397", "text": "func NewServer(data *Config) MyServer {\n\tmyserver := MyServer{}\n\tmyserver.client = &http.Client{}\n\tmyserver.data = *data\n\tmyserver.newRouter()\n\tmyserver.configureServer()\n\tmyserver.gracefulTimeout = 5 * time.Second\n\tmyserver.stopped = false\n\tmyserver.configureHandlers()\n\treturn myserver\n}", "title": "" }, { "docid": "61261d82f6a9628713f41727594e1548", "score": "0.694501", "text": "func NewServer(addr string) *Server {\n return nil\n}", "title": "" }, { "docid": "9abcc1e39dbdad9eb92543f875e065f0", "score": "0.69257706", "text": "func newRouter(s *Server) *httprouter.Router {\n\tr := httprouter.New()\n\n\tr.GET(\"/announce\", makeHandler(s.serveAnnounce))\n\tr.GET(\"/check\", makeHandler(s.serveCheck))\n\tr.GET(\"/scrape\", makeHandler(s.serveScrape))\n\n\treturn r\n}", "title": "" }, { "docid": "f0a210fd87fc5e779627c3cb8468be2d", "score": "0.6910059", "text": "func NewServer() *Server {\n\tserver := &Server{\n\t\tRouter: mux.NewRouter(),\n\t}\n\tserver.routes()\n\treturn server\n}", "title": "" }, { "docid": "5accc71bad02e5dad46026375af85177", "score": "0.69048107", "text": "func newServer(c *ServerConfig) (*server, error) {\n\ts := &server{\n\t\tconfig: c,\n\n\t\tresult: make(chan *Token, 1),\n\t\terr: make(chan error, 1),\n\t}\n\n\terr := c.Validate()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not validate new server\")\n\t}\n\n\terr = s.bind(c)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not open a port\")\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "1b74c61f813d99d690a4f7b3c322910c", "score": "0.6897572", "text": "func NewServer(database string) Server {\n\tr := gin.Default()\n\t// config := cors.DefaultConfig()\n\t// config.AllowOrigins = []string{\"http://chulachon.com\", \"http://www.chulachon.com\"}\n\t// r.Use(cors.New(config))\n\tr.Use(cors.Default())\n\tr.POST(\"/register\", register)\n\tr.POST(\"/login\", login)\n\tstaff := r.Group(\"/staff\")\n\tstaff.Use(middleware.TokenAuthMiddleware())\n\tstaff.POST(\"/ungraded\", getUnGraded)\n\tstaff.POST(\"/graded\", getGraded)\n\tstaff.POST(\"/update\", update)\n\tserver := Server{rounter: r, database: database}\n\treturn server\n}", "title": "" }, { "docid": "712d96ec2cb887ee2ad070cc6981c352", "score": "0.68962455", "text": "func New() *Server {\n\ts := chi.NewRouter()\n\n\tmws := []func(http.Handler) http.Handler{\n\t\tmiddleware.RequestID,\n\t\tmiddleware.RealIP,\n\t\tmiddleware.Recoverer,\n\t\tNewCORS(),\n\t\tmiddlewares.LoggerMiddleware,\n\t\tmiddlewares.AuthenticationMiddleware,\n\t}\n\n\tfor _, mw := range mws {\n\t\ts.Use(mw)\n\t}\n\n\ts.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif _, err := w.Write([]byte(\"Hello World!\")); err != nil {\n\t\t\tw.WriteHeader(500)\n\t\t}\n\t})\n\n\ts.HandleFunc(\"/list\", endpoints.List)\n\ts.HandleFunc(\"/update\", endpoints.Update)\n\n\treturn &Server{\n\t\trouter: s,\n\t}\n}", "title": "" }, { "docid": "37475efb7ede1eea04912bf64634c030", "score": "0.68951267", "text": "func newRouter() *http.ServeMux {\n\trouter := http.NewServeMux()\n\trouter.HandleFunc(\"/hal/ping\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, \"PONG\")\n\t})\n\n\trouter.HandleFunc(\"/hal/time\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"Server time is: %s\\n\", time.Now().UTC())\n\t})\n\n\treturn router\n}", "title": "" }, { "docid": "c789193fe6aec3fe712f8936f4fd23ee", "score": "0.6884063", "text": "func New(port string, as railway.AuthService, cs railway.ClientService, us railway.UserService) *Server {\n\tmw := NewMiddleware(us)\n\tac := NewAuthController(mw, as, us)\n\tcc := NewClientController(mw, cs, us)\n\tuc := NewUserController(mw, us)\n\tmasterHandler := NewMasterHandler(ac, cc, uc)\n\n\ts := &http.Server{\n\t\tAddr: port,\n\t\tHandler: masterHandler,\n\t}\n\treturn &Server{\n\t\tServer: s,\n\t}\n}", "title": "" }, { "docid": "4b851ac49e39b3c21e01a0173f54881f", "score": "0.6878728", "text": "func New() *Server {\n\tr := mux.NewRouter()\n\t//r.Use(mux.CORSMethodMiddleware(r))\n\taddr := \"0.0.0.0:8000\"\n\ts := Server{r, addr}\n\ts.SetupComponents()\n\treturn &s\n}", "title": "" }, { "docid": "b2deef53a3b41dd638af6761c8cda0e9", "score": "0.6875499", "text": "func NewRouter() *http.Server {\n\tlog.Printf(\"The app is running under: http://%s:%s/\", util.Config.Hostname, util.Config.Port)\n\n\trouter := mux.NewRouter()\n\n\trouter.Handle(\"/\", http.FileServer(http.Dir(\"./static\")))\n\trouter.HandleFunc(\"/api/new\", submitNewLinkHandler)\n\trouter.Handle(\"/{.*}/{.*}\", http.FileServer(http.Dir(\"./static\")))\n\trouter.HandleFunc(\"/{[a-zA-Z0-9\\\\-_]*}\", redirectHandler)\n\n\trouter.Use(LoggingMiddleware)\n\trouter.NotFoundHandler = Handle404()\n\n\treturn &http.Server{\n\t\tHandler: router,\n\t\tAddr: fmt.Sprintf(\":%s\", util.Config.Port),\n\t\t// Good practice: enforce timeouts for servers you create!\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 5 * time.Second,\n\t}\n}", "title": "" }, { "docid": "176933df2c80cd1395de41e227a8ef0a", "score": "0.6874812", "text": "func (app *App) NewServer() *mux.Router {\n\tr := mux.NewRouter()\n\tr.Handle(\"\", appHandler(app.rootHandler))\n\tr.Handle(\"/\", appHandler(app.rootHandler))\n\n\tfor _, v := range app.apiVersionPrefixes() {\n\t\td := r.PathPrefix(fmt.Sprintf(\"/%s\", v)).Subrouter()\n\t\tapp.versionSubRouter(d, v)\n\t}\n\n\tr.Handle(\"/{path:.*}\", appHandler(app.notFoundHandler))\n\n\treturn r\n}", "title": "" }, { "docid": "ac38ecc2e44f93f938cbad4dd626ae73", "score": "0.6850763", "text": "func newServer(t *testing.T) *server {\n\ts := newServerStopped(t)\n\ts.Start()\n\n\treturn s\n}", "title": "" }, { "docid": "66858a8725ee4417e0711d5e3d06f6da", "score": "0.6812584", "text": "func New() *Server {\n\ts := &Server{\n\t\tRouter: mux.NewRouter(),\n\t}\n\ts.SetupRoutes()\n\treturn s\n}", "title": "" }, { "docid": "92db0b657f47ee7a115124d8439b5553", "score": "0.68094414", "text": "func New(sto store.Service) *Server {\n\ts := &Server{sto: sto}\n\n\trouter := mux.NewRouter()\n\n\trouter.Handle(\"/auth\", handlers.LoggingHandler(os.Stdout, allowedMethods(\n\t\t[]string{\"POST\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"POST\": http.HandlerFunc(s.auth),\n\t\t})))\n\n\trouter.Handle(\"/user\", handlers.LoggingHandler(os.Stdout, allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"POST\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"GET\": http.HandlerFunc(s.getUsers),\n\t\t\t\"POST\": http.HandlerFunc(s.createUser), // created\n\t\t})))\n\n\trouter.Handle(\"/user/{id}\", handlers.LoggingHandler(os.Stdout, allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"PUT\", \"PATCH\", \"DELETE\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"GET\": http.HandlerFunc(s.getUser), // created\n\t\t\t//\"PUT\": http.HandlerFunc(s.putUser),\n\t\t\t\"PATCH\": http.HandlerFunc(s.patchUser),\n\t\t\t\"DELETE\": http.HandlerFunc(s.deleteUser),\n\t\t})))\n\n\trouter.Handle(\"/valid/user\", handlers.LoggingHandler(os.Stdout, allowedMethods(\n\t\t[]string{\"POST\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"POST\": http.HandlerFunc(s.checkUsername),\n\t\t})))\n\n\trouter.Handle(\"/resource\", allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"POST\"},\n\t\thandlers.MethodHandler{\n\t\t\t// get resources will have query params since this should be reusable\n\t\t\t\"GET\": http.HandlerFunc(s.getResources),\n\t\t\t\"POST\": http.HandlerFunc(s.createResource),\n\t\t}))\n\n\trouter.Handle(\"/resource/{id}\", allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"PUT\", \"PATCH\", \"DELETE\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"GET\": http.HandlerFunc(s.getResource),\n\t\t\t\"PUT\": http.HandlerFunc(s.putResource),\n\t\t\t\"PATCH\": http.HandlerFunc(s.patchResource),\n\t\t\t\"DELETE\": http.HandlerFunc(s.deleteResource),\n\t\t}))\n\n\ts.handler = limitBody(defaultHeaders(router))\n\n\treturn s\n}", "title": "" }, { "docid": "8e1e65201e77c0c1ae54ec3d73d81dfd", "score": "0.68043625", "text": "func New(d Displayer) *HTTPServer {\n\n\tr := mux.NewRouter()\n\n\treturn &HTTPServer{\n\t\thttp: &http.Server{\n\t\t\tAddr: \":8001\",\n\t\t\tHandler: r,\n\t\t},\n\t\trouter: r,\n\t\tdisplay: d,\n\t}\n}", "title": "" }, { "docid": "bfb6be1f3ff6a86a11d014eebcf2e625", "score": "0.68001133", "text": "func newServer(name, desc string, cfg *GlobalConfig) *Server {\n\treturn &Server{\n\t\tName: name,\n\t\tDescription: desc,\n\t\tServerConfig: cfg,\n\t}\n}", "title": "" }, { "docid": "af1fd18c93825ea55491b905261ae123", "score": "0.6784676", "text": "func NewServer(ctx context.Context, addr string, back *thereum.Thereum) *Server {\n\trtr := mux.NewRouter()\n\tsrv := &Server{\n\t\tServer: http.Server{\n\t\t\tAddr: addr,\n\t\t\tWriteTimeout: time.Second * 20, // TODO: read from config\n\t\t\tReadTimeout: time.Second * 10,\n\t\t\tIdleTimeout: time.Second * 100,\n\t\t\tHandler: rtr,\n\t\t\t// TLSConfig: ,\n\t\t},\n\t\trouter: rtr,\n\t\tmuxer: newMuxer(),\n\t\tctx: ctx,\n\t}\n\t// install the universal rpc handler to the router\n\tsrv.router.HandleFunc(\"/\", srv.rpcHandler())\n\tsrv.router.HandleFunc(\"/requestETH\", srv.faucetHandler())\n\n\tsrv.router.HandleFunc(\"/ens\", srv.ENSHandler)\n\tsrv.back = back\n\treturn srv\n}", "title": "" }, { "docid": "bc7ed8816e9242c9a25dead486b834a4", "score": "0.6767154", "text": "func NewServer(basePath string, router *mux.Router, opts ...Option) *Server {\n\tsrv := &Server{\n\t\tlog: goka.DefaultLogger(),\n\t\tbasePath: basePath,\n\t\tloader: &templates.EmbedLoader{},\n\t\tsources: make(map[string]goka.Getter),\n\t\thumanizer: DefaultHumanizer(),\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(srv)\n\t}\n\n\tsub := router.PathPrefix(basePath).Subrouter()\n\tsub.HandleFunc(\"/\", srv.index)\n\tsub.HandleFunc(\"/{name}\", srv.source)\n\tsub.HandleFunc(\"/{name}/{key:.*}\", srv.key)\n\n\treturn srv\n}", "title": "" }, { "docid": "05625cd238430f7cb47c627f027f5dce", "score": "0.6752449", "text": "func New(addr string) (instance *Instance) {\n\tinstance = &Instance{mux: coap.NewServeMux(), addr: addr, clients: make(map[string]*Client)}\n\n\tlog.Debugf(\"New lwm2m server: %s\", instance.addr)\n\n\tinstance.mux.Handle(\"/rd\", coap.HandlerFunc(instance.registrationHandler))\n\n\treturn instance\n}", "title": "" }, { "docid": "16df1df5ef0413247c8da75ed5a7afb2", "score": "0.67392635", "text": "func New(endpoint string) *Server {\n\tlistener, err := Listener()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trouter := newRouter(endpoint)\n\treturn &Server{endpoint, router, listener}\n}", "title": "" }, { "docid": "ea871b6934373d05dc6a289471bb39b1", "score": "0.67389387", "text": "func NewServer(en *chi.Mux, r *router.Router, c config.Config) *Server {\n\treturn &Server{\n\t\trouter: r,\n\t\tengine: en,\n\t\tconfig: c,\n\t}\n}", "title": "" }, { "docid": "0bc1db889fcb10124879db78acccf51f", "score": "0.6721303", "text": "func New(config *ServerConfig) (Server, error) {\n\tif config.Router == nil {\n\t\tconfig.Router = mux.NewRouter()\n\t}\n\n\ts := &server{config: config}\n\n\t// register routes\n\ts.registerRoutes()\n\n\treturn s, nil\n}", "title": "" }, { "docid": "0942f33b2936e5222f98915303defa6e", "score": "0.67105544", "text": "func newServer() *server {\n\tserver := server{\n\t\tchannels: make(map[string]*channel),\n\t\tsystemChannel: make(chan systemMessage),\n\t}\n\n\tserver.newChannel(\"general\")\n\n\treturn &server\n}", "title": "" }, { "docid": "c574efd088f3cc4890b441dfb140f1aa", "score": "0.6709063", "text": "func NewServer(db *Database) *Server {\n\trouter := echo.New()\n\tserver := &Server{\n\t\trouter: router,\n\t\tdb: db,\n\t}\n\n\tserver.setupRoutes()\n\treturn server\n}", "title": "" }, { "docid": "e65e87a1a1695018db6eb797284b1184", "score": "0.6704687", "text": "func New() *Server {\n\treturn &Server{\n\t\tRouter: mux.NewRouter().StrictSlash(true),\n\t}\n}", "title": "" }, { "docid": "fd9d60dfef8df28d743c556ffd44cb8a", "score": "0.66964066", "text": "func NewServer() *Server {\n\tclient := jsonplaceholder.NewClient()\n\tclient.EnableMockMode(false)\n\n\ts := &Server{}\n\tr := gin.Default()\n\ts.router = r\n\ts.client = client\n\n\tr.GET(\"/\", func(c *gin.Context) {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"version\": \"0.1\",\n\t\t})\n\t})\n\n\tr.GET(\"/todos/:id\", func(c *gin.Context) {\n\t\ttodo, err := client.FetchTodo(c.Param(\"id\"))\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\t\"error\": err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(http.StatusOK, todo)\n\t})\n\n\treturn s\n}", "title": "" }, { "docid": "61519ebc8d3c4c9ae28c59b32ee0c044", "score": "0.66924095", "text": "func NewServer(store *str.Store) *Server {\n\tnewServer := new(Server)\n\tnewServer.blackList = []string{}\n\tnewServer.store = store\n\tnewServer.initRoutes()\n\tnewServer.initLogFile()\n\treturn newServer\n}", "title": "" }, { "docid": "93838cb37285ccb388e54768ede44178", "score": "0.6689503", "text": "func newserver() *server {\n\treturn &server {\n\t\tpmap: make(map[proto.NodeId]peer),\n\t\tpmtx: sync.RWMutex{},\n\t\tnidLock: make(map[proto.NodeId]bool),\n\t\tnlmtx: sync.RWMutex{}, \n\t\tjoin: make(chan peer),\n\t\tleave: make(chan peer),\n\t\tseed: 0,\n\t}\n}", "title": "" }, { "docid": "f3fef83724bdf2125f6478171216dcf8", "score": "0.6677727", "text": "func newServer(opts *ServeOptions) (srv *server, err error) {\n\tlogp := \"newServer\"\n\n\tsrv = &server{\n\t\topts: &libhttp.ServerOptions{\n\t\t\tOptions: memfs.Options{\n\t\t\t\tRoot: opts.Root,\n\t\t\t\tExcludes: defExcludes,\n\t\t\t\tDevelopment: debug.Value > 0,\n\t\t\t},\n\t\t\tMemfs: opts.Mfs,\n\t\t\tAddress: opts.Address,\n\t\t},\n\t}\n\n\tsrv.http, err = libhttp.NewServer(srv.opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", logp, err)\n\t}\n\n\tepInSearch := &libhttp.Endpoint{\n\t\tMethod: libhttp.RequestMethodGet,\n\t\tPath: \"/_internal/search\",\n\t\tRequestType: libhttp.RequestTypeQuery,\n\t\tResponseType: libhttp.ResponseTypeHTML,\n\t\tCall: srv.onSearch,\n\t}\n\n\terr = srv.http.RegisterEndpoint(epInSearch)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", logp, err)\n\t}\n\n\tsrv.htmlg, err = newHTMLGenerator(opts.Mfs, opts.HtmlTemplate, srv.opts.Development)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", logp, err)\n\t}\n\n\tif srv.opts.Development {\n\t\tsrv.watcher, err = newWatcher(srv.htmlg, &opts.ConvertOptions)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s: %w\", logp, err)\n\t\t}\n\n\t\tsrv.htmlg.convertFileMarkups(srv.watcher.fileMarkups)\n\t}\n\n\treturn srv, nil\n}", "title": "" }, { "docid": "f853cbd55a4d86d60e144e0e4b2fb409", "score": "0.6669179", "text": "func newServer(c *V1Alpha1Client) *server {\n\treturn &server{\n\t\tclient: c.RESTClient(),\n\t}\n}", "title": "" }, { "docid": "81a752853ffdca3e34dcdc5705441754", "score": "0.66573185", "text": "func NewServer() *RaftServer {\n\tsyncOnce.Do((func() {\n\t\tconf := config.GetConfig()\n\t\ts := &RaftServer{peerClients: make(map[string]*rpc.Client)}\n\t\tfmt.Println(\"Raft Server\", conf.RaftPort)\n\t\t// rpc.Register(s)\n\t\trpc.HandleHTTP()\n\t\tl, err := net.Listen(\"tcp\", \":\"+conf.RaftPort)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlog.Println(\"Raft Server running on port: \", conf.RaftPort)\n\t\tgo http.Serve(l, nil)\n\t\traftServerInstance = s\n\t}))\n\treturn raftServerInstance\n}", "title": "" }, { "docid": "f893ea2e3b912b9a50af8c82e3b3f2b3", "score": "0.6652886", "text": "func NewServer(manager manager.BuildManager, secret string) Server {\n\tr := chi.NewRouter()\n\tr.Use(middleware.Recoverer)\n\tr.Use(middleware.NoCache)\n\tr.Use(authorization(secret))\n\tr.Post(\"/nodes/:machine\", HandleJoin())\n\tr.Delete(\"/nodes/:machine\", HandleLeave())\n\tr.Post(\"/ping\", HandlePing())\n\tr.Post(\"/stage\", HandleRequest(manager))\n\tr.Post(\"/stage/{stage}\", HandleAccept(manager))\n\tr.Get(\"/stage/{stage}\", HandleInfo(manager))\n\tr.Put(\"/stage/{stage}\", HandleUpdateStage(manager))\n\tr.Put(\"/step/{step}\", HandleUpdateStep(manager))\n\tr.Post(\"/build/{build}/watch\", HandleWatch(manager))\n\tr.Post(\"/step/{step}/logs/batch\", HandleLogBatch(manager))\n\tr.Post(\"/step/{step}/logs/upload\", HandleLogUpload(manager))\n\treturn Server(r)\n}", "title": "" }, { "docid": "7ea3a472ad613130ad108f5b112b999d", "score": "0.66510147", "text": "func NewServer(addr string) *Server {\n\treturn &Server{\n\t\taddr: addr,\n\t\tapis: make([]*API, 0),\n\t\trouter: httprouter.New(),\n\t}\n}", "title": "" }, { "docid": "b6343157416ebf3ccc95a251262410f6", "score": "0.66431296", "text": "func NewServer() *httptest.Server {\n\treturn httptest.NewServer(\n\t\thttp.HandlerFunc(router),\n\t)\n}", "title": "" }, { "docid": "cd71a00ce148e3ecd5108d172d8e44cd", "score": "0.6638203", "text": "func NewServer(db *gorm.DB, coll ChanColl, router *Router, jwtKey string) *Server {\n\treturn &Server{\n\t\tdb: db,\n\t\tchans: coll,\n\t\tupgrader: websocket.Upgrader{\n\t\t\tSubprotocols: []string{\n\t\t\t\t\"tomatorpc-v1\",\n\t\t\t},\n\t\t},\n\t\trouter: router,\n\t\tjwtKey: jwtKey,\n\t}\n}", "title": "" }, { "docid": "f89a5269a10cf5ac7646e24e70a12896", "score": "0.6635439", "text": "func NewServer(basePath string, router *mux.Router, opts ...Option) *Server {\n\tsrv := &Server{\n\t\tlog: goka.DefaultLogger(),\n\t\tbasePath: basePath,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(srv)\n\t}\n\n\tsub := router.PathPrefix(basePath).Subrouter()\n\tsub.HandleFunc(\"/\", srv.index)\n\tsub.HandleFunc(\"/processor/{idx}\", srv.renderProcessor)\n\tsub.HandleFunc(\"/view/{idx}\", srv.renderView)\n\tsub.HandleFunc(\"/data/{type}/{idx}\", srv.renderData)\n\n\treturn srv\n}", "title": "" }, { "docid": "c49a14dc26a92a5c8b1dfbddf50c995e", "score": "0.6622711", "text": "func NewServer(cfg *Config) *Server {\n\ts := &Server{\n\t\tcfg: cfg,\n\t\tprotocol: protocol.P{},\n\t}\n\ts.router = router(s)\n\treturn s\n}", "title": "" }, { "docid": "f0ccf0419d1f5843178d6689e212c568", "score": "0.6611766", "text": "func newServer(cSession *gocql.Session) *Server {\n\tr := chi.NewRouter()\n\n\tr.Use(render.SetContentType(render.ContentTypeJSON))\n\n\tzeatsService := newService(&Config{CassandraSession: cSession})\n\tsetupRoutes(r, zeatsService)\n\n\tserver := &Server{\n\t\thttpServer: &http.Server{Addr: config.Vals().Port, Handler: r},\n\t\trouter: r,\n\t}\n\n\treturn server\n}", "title": "" }, { "docid": "1e59c894746ceee0bbf17cf816b292f1", "score": "0.6610033", "text": "func newServer(kv *raft.KV) *gin.Engine {\n\tgin.SetMode(gin.ReleaseMode)\n\tr := gin.New()\n\tr.Use(cors.Default())\n\tr.Use(checkLeader(kv))\n\tr.GET(\"/status\", func(c *gin.Context) {\n\t\tc.Status(http.StatusOK)\n\t\treturn\n\t})\n\tr.GET(\"/doc\", getDoc(kv))\n\tr.PUT(\"/doc\", putDoc(kv))\n\treturn r\n}", "title": "" }, { "docid": "1880fd6dd8938fda92b62147d21e7129", "score": "0.6598093", "text": "func New(c http.ServerInfo, m Master) (*Server, error) {\n\tsvr, err := http.NewServer(c, m.Auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts := &Server{\n\t\tm: m,\n\t\ts: svr,\n\t}\n\ts.s.Handle(s.inspectSystem, \"GET\", \"/system/inspect\")\n\ts.s.Handle(s.updateSystem, \"PUT\", \"/system/update\")\n\n\ts.s.Handle(s.getAvailablePort, \"GET\", \"/ports/available\")\n\ts.s.Handle(s.reportInstance, \"PUT\", \"/services/{serviceName}/instances/{instanceName}/report\")\n\ts.s.Handle(s.startInstance, \"PUT\", \"/services/{serviceName}/instances/{instanceName}/start\")\n\ts.s.Handle(s.stopInstance, \"PUT\", \"/services/{serviceName}/instances/{instanceName}/stop\")\n\treturn s, s.s.Start()\n}", "title": "" }, { "docid": "d285fe53b8f2ade4f8116bcd04034b0c", "score": "0.6588862", "text": "func NewServer(store *Store, homeTempl *template.Template) *Server {\n\tglobalCh := make(chan Message)\n\thub := NewHub(globalCh)\n\n\tserver := &Server{\n\t\tstore: *store,\n\t\thub: *hub,\n\t}\n\n\t// Start the clients hub, wait for any message.\n\tgo hub.Start()\n\n\t// Listen on /ws to handle WebSocket messages.\n\thttp.HandleFunc(\"/ws\", server.wsHandler(getWsUpgrader(), hub))\n\n\t// Serve HTML on root url\n\thttp.HandleFunc(\"/\", server.home(homeTempl))\n\n\treturn server\n}", "title": "" }, { "docid": "a661fe9af8eff384c2d3696bcf3f3902", "score": "0.6588653", "text": "func New(c lib.RelayerConfig, done chan bool) (*Server, error) {\n\tsrv := &Server{\n\t\tdone: done,\n\t}\n\n\tsrv.Reload(&c)\n\n\treturn srv, nil\n}", "title": "" }, { "docid": "08a4e3b51c0cbe2b52014d176d53cbfe", "score": "0.6579707", "text": "func NewServer(store *db.Store) *Server {\n\tserver := &Server{store : store}\n\tr := gin.New()\n\n\tp := ginprometheus.NewPrometheus(\"gin\")\n\n\tp.Use(r)\n\n\t// r.Run(\":29090\")\n\n\t\n\tr.POST(\"/users\", token.TokenAuthMiddleware(), server.createUser)\n\tr.DELETE(\"/user/:id\", token.TokenAuthMiddleware(), server.deleteUser)\n\tr.POST(\"/register\", server.register)\n\tr.POST(\"/login\", token.TokenAuthMiddleware(), server.login)\n\tr.POST(\"/logout\", token.TokenAuthMiddleware(), server.logout)\n\tr.POST(\"/refresh\", token.TokenAuthMiddleware(), server.refresh)\n\t\n\tserver.router = r\n\treturn server\n}", "title": "" }, { "docid": "34ad3b4bc301d4e73fedc8b476ae2271", "score": "0.65788573", "text": "func NewServer(host, route string, headers map[string]string) *Server {\n\ts := &Server{\n\t\tHost: host,\n\t\tRoute: route,\n\t\tMethods: make(map[string]MethodWithContext),\n\t\tHeaders: headers,\n\t}\n\n\ts.Methods[\"jrpc2.register\"] = MethodWithContext{Method: s.RegisterRPC}\n\n\treturn s\n}", "title": "" }, { "docid": "204f88a568d4e2a327b7da42f71edb97", "score": "0.65775853", "text": "func NewServer(m *sync.Mutex, sc *ServiceCollection) *Server {\n\treturn &Server{\n\t\trouter: http.NewServeMux(),\n\t\tmutex: m,\n\t\tservices: sc,\n\t}\n}", "title": "" }, { "docid": "88b7a41f0909177f76ed639ba6904bc4", "score": "0.65730894", "text": "func New(cfg *config.Config) *Server {\n\n\treturn &Server{\n\t\trouter: mux.NewRouter(),\n\t\tconfig: cfg,\n\t\tshutdownReq: make(chan bool),\n\t}\n}", "title": "" }, { "docid": "84409f40f1abeb4b35866ed2490e14b6", "score": "0.657214", "text": "func newServer(port int, handler http.Handler, timeout time.Duration, logger *log.Logger) *server {\n\treturn &server{\n\t\ts: &http.Server{\n\t\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\t\tHandler: handler,\n\t\t\tErrorLog: logger,\n\t\t},\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "b2398618f090605556ad2fb4a4d996e7", "score": "0.65708834", "text": "func NewServer(o *config.Options, s *state.MasterState) *Server {\n\thttpLogger := logger.New()\n\thttpLogger.SetFormatter(&logger.TextFormatter{ForceColors: true})\n\tlogW := log.New(httpLogger.Writer(), \"\", 0)\n\n\trouter := http.NewServeMux()\n\trouter.Handle(\"/api/v1\", Operator(s))\n\trouter.Handle(\"/master/api/v1\", Operator(s))\n\trouter.Handle(\"/api/v1/operator\", Operator(s))\n\trouter.Handle(\"/master/api/v1/operator\", Operator(s))\n\trouter.Handle(\"/api/v1/scheduler\", Scheduler(o, s))\n\trouter.Handle(\"/master/api/v1/scheduler\", Scheduler(o, s))\n\n\tserver := http.Server{\n\t\tAddr: o.GetAddress(),\n\t\tHandler: logging(logW)(profiling(validateReq(router))),\n\t\tErrorLog: logW,\n\t}\n\n\tServer := &Server{\n\t\tserver: &server,\n\t\tlistenAddr: o.GetAddress(),\n\t}\n\n\treturn Server\n}", "title": "" }, { "docid": "5983463d9c708eb9226641c837c66e91", "score": "0.6565888", "text": "func New(paths *path.Paths, ssl SSL, nf util.NotFound, serverPath, port, serverHeader, indexPath string, redirectHTTP bool) (Server, error) {\n\treturn Server{\n\t\tpaths: paths,\n\t\tserverPath: serverPath,\n\t\tport: port,\n\t\tssl: ssl,\n\t\tnf: nf,\n\t\tserverHeader: serverHeader,\n\t\tindexPath: indexPath,\n\n\t\tredirectHTTP: redirectHTTP,\n\t\tidentifier: path.NewClientID(),\n\t}, nil\n}", "title": "" }, { "docid": "952f00e13fcd6ebc945a0778d2b91954", "score": "0.65642536", "text": "func NewServer(ip string, port uint16, endpoint string) (s Server) {\n return &server{\n conns: make([]*edge, 0),\n done: make(chan error, 1),\n ip: []byte(ip),\n node_: NewNode(ip, endpoint),\n port: port,\n RWMutex: new(sync.RWMutex),\n }\n}", "title": "" }, { "docid": "39f6e1d995d942ed7f4154171f422c03", "score": "0.6556524", "text": "func NewServer(appEnv *cfenv.App) *negroni.Negroni {\n\tformatter := render.New(render.Options{\n\t\tIndentJSON: true,\n\t})\n\n\tn := negroni.Classic()\n\tmx := mux.NewRouter()\n\n\tpositionDispatcher := buildDispatcher(\"positions\", appEnv)\n\ttelemetryDispatcher := buildDispatcher(\"telemetry\", appEnv)\n\talertDispatcher := buildDispatcher(\"alerts\", appEnv)\n\n\tinitRoutes(mx, formatter, telemetryDispatcher, alertDispatcher, positionDispatcher)\n\n\tn.UseHandler(mx)\n\treturn n\n}", "title": "" }, { "docid": "147fc2287fd5bdeb7a9fc58828b506b5", "score": "0.6552088", "text": "func NewServer(idx *indexer.Index, in chan *internal.ScrapeRequest, dir string, debug bool) (*Server, error) {\n\n\tsvr := &Server{\n\t\trouter: chi.NewRouter(),\n\t\tindex: idx,\n\t\tchannel: in,\n\t\ttemplateDir: dir,\n\t\tdebug: debug,\n\t}\n\tsvr.routes()\n\terr := svr.loadTemplates()\n\treturn svr, err\n\n}", "title": "" }, { "docid": "29ff40e71b9504263adaf5bab2ce3e47", "score": "0.6546372", "text": "func NewServer(us user.Service, rs room.Service, hub *SSEHub) *Server {\n\ts := &Server{\n\t\tUser: us,\n\t\tRoom: rs,\n\t\tHub: hub,\n\t}\n\n\tcorsHandler := cors.New(cors.Options{\n\t\tAllowedOrigins: []string{\"*\"},\n\t\tAllowedMethods: []string{\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\"},\n\t\tAllowedHeaders: []string{\"Accept\", \"Authorization\", \"Content-Type\", \"X-CSRF-Token\"},\n\t})\n\tam := newAuthMiddleware(us)\n\n\tr := chi.NewRouter()\n\tr.Use(chiware.AllowContentType(\"application/json\"))\n\tr.Use(corsHandler.Handler)\n\n\tr.Method(\"GET\", \"/\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tresponse := struct {\n\t\t\tMessage string `json:\"message\"`\n\t\t}{Message: \"Welcome to Message Rooms\"}\n\n\t\tif err := json.NewEncoder(w).Encode(response); err != nil {\n\t\t\t_, _ = w.Write([]byte(err.Error()))\n\t\t}\n\t}))\n\n\tr.Route(\"/sse\", func(r chi.Router) {\n\t\t// Authentication middleware\n\t\tr.Use(am.Register)\n\t\tr.Get(\"/connect\", http.HandlerFunc(s.Hub.HandleSSE))\n\t})\n\n\tr.Route(\"/user\", func(r chi.Router) {\n\t\th := NewUserHandler(us, am)\n\t\tr.Mount(\"/v1\", h.Route())\n\t})\n\n\tr.Route(\"/rooms\", func(r chi.Router) {\n\t\tr.Use(am.Register)\n\t\th := newRoomHandler(rs)\n\t\tr.Mount(\"/v1\", h.Route())\n\t})\n\n\tr.Method(\"GET\", \"/metrics\", promhttp.Handler())\n\n\ts.router = r\n\n\treturn s\n}", "title": "" }, { "docid": "2f88cb5d2f9c8615362b81ff4e33ee11", "score": "0.6537282", "text": "func NewServer() *Server {\n\n\ts := &Server{}\n\n\tintraApp := intra.NewApp()\n\tpublicApp := public.NewApp()\n\n\ts.IntraApp = intraApp\n\ts.PublicApp = publicApp\n\n\treturn s\n}", "title": "" }, { "docid": "532d870d7725d98197117e1883a10de6", "score": "0.6534144", "text": "func NewServer(index *quadtree.Quadtree) *Server {\n\treturn &Server{index: index}\n}", "title": "" }, { "docid": "cc038373753164811e8856473835e988", "score": "0.65295565", "text": "func New(cfg *Config) (*Server, error) {\n\tl, err := net.Listen(\"tcp\", cfg.Addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar (\n\t\tr = mux.NewRouter()\n\t\ts = &Server{\n\t\t\tqueueDir: cfg.QueueDir,\n\t\t\tlistener: l,\n\t\t\trouter: mux.NewRouter(),\n\t\t\tstore: sessions.NewCookieStore([]byte(cfg.SecretKey)),\n\t\t\ttemplateSet: pongo2.NewSet(\"\", &b0xLoader{}),\n\t\t\tlog: logrus.WithField(\"context\", \"server\"),\n\t\t\tconn: cfg.Conn,\n\t\t\tqueue: cfg.Queue,\n\t\t\tstoppedCh: make(chan bool),\n\t\t}\n\t\tserver = http.Server{\n\t\t\tHandler: r,\n\t\t}\n\t)\n\ts.router.HandleFunc(\"/\", s.index)\n\ts.router.HandleFunc(\"/login\", s.login)\n\ts.router.HandleFunc(\"/logout\", s.requireUser(s.logout))\n\ts.router.HandleFunc(\"/upload\", s.requireUser(s.upload))\n\ts.router.HandleFunc(\"/upload/ajax\", s.requireUser(s.uploadAjax))\n\ts.router.HandleFunc(\"/admin/buckets\", s.requireAdmin(s.buckets))\n\ts.router.HandleFunc(\"/admin/buckets/new\", s.requireAdmin(s.editBucket))\n\ts.router.HandleFunc(\"/admin/buckets/{id:[0-9]+}/edit\", s.requireAdmin(s.editBucket))\n\ts.router.HandleFunc(\"/admin/buckets/{id:[0-9]+}/delete\", s.requireAdmin(s.deleteBucket))\n\ts.router.HandleFunc(\"/photos/{id:[0-9]+}\", s.viewPhoto)\n\tr.PathPrefix(\"/static\").Handler(http.FileServer(HTTP))\n\tr.PathPrefix(\"/\").Handler(s)\n\tgo func() {\n\t\tdefer close(s.stoppedCh)\n\t\tdefer s.log.Info(\"server has stopped\")\n\t\ts.log.Info(\"starting server...\")\n\t\tif err := server.Serve(l); err != nil {\n\t\t\ts.log.Error(err.Error())\n\t\t}\n\t}()\n\treturn s, nil\n}", "title": "" }, { "docid": "5ece6853bc5898bbb5e9388e11aac216", "score": "0.6526184", "text": "func (s *Server) createServer(router http.Handler) *http.Server {\n\tserver := &http.Server{\n\t\tAddr: s.Address,\n\t\tHandler: router,\n\t\tReadTimeout: 1 * time.Minute,\n\t\tReadHeaderTimeout: 5 * time.Second,\n\t\tWriteTimeout: 30 * time.Second,\n\t}\n\n\treturn server\n}", "title": "" }, { "docid": "a15a014f55acba46bac1f633d7dc8535", "score": "0.6524972", "text": "func NewServer() Server {\n\tvar addr string\n\tport := viper.GetString(\"host.port\")\n\ttxID := uuid.New().String()\n\tapiHandler := router.NewRouter().Router(viper.GetBool(\"host.enable_cors\"))\n\n\t// allow port to be set as localhost:8001 in env during development to avoid \"accept incoming network connection\" request on restarts\n\tif strings.Contains(port, \":\") {\n\t\taddr = port\n\t} else {\n\t\taddr = \":\" + port\n\t}\n\n\tsrv := http.Server{\n\t\tAddr: addr,\n\t\tHandler: apiHandler,\n\t}\n\n\treturn &server{\n\t\tsvr: &srv,\n\t\tlogger: logging.NewLogger(),\n\t\ttxID: txID,\n\t}\n}", "title": "" }, { "docid": "fd9860973c94d1d6dabe4b4ac23b0660", "score": "0.65212166", "text": "func NewServer() *Server {\n\tr := mux.NewRouter()\n\tmessages := []*Message{}\n\toperators := make(map[int]*Operator)\n\trooms := make(map[int]*Room)\n\tdbinfo := fmt.Sprintf(\"user=%s password=%s dbname=%s sslmode=disable\", db.DB_USER, db.DB_PASSWORD, db.DB_NAME)\n\tdb, err := sql.Open(\"postgres\", dbinfo)\n\taddCh := make(chan *Client)\n\tdelCh := make(chan *Client)\n\taddOCh := make(chan *Operator)\n\tdelOCh := make(chan *Operator)\n\taddRoomCh := make(chan map[Client]Operator)\n\tdelRoomCh := make(chan *Client)\n\tsendAllCh := make(chan *Message)\n\tdoneCh := make(chan bool)\n\terrCh := make(chan error)\n\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\treturn &Server{\n\t\tr,\n\t\tmessages,\n\t\toperators,\n\t\trooms,\n\t\tdb,\n\t\taddCh,\n\t\tdelCh,\n\t\taddOCh,\n\t\tdelOCh,\n\t\taddRoomCh,\n\t\tdelRoomCh,\n\t\tsendAllCh,\n\t\tdoneCh,\n\t\terrCh,\n\t}\n}", "title": "" }, { "docid": "727e96721677d0c267c322fec4f8cd48", "score": "0.6520025", "text": "func newServer(\n\tpeerID ident.PeerID,\n\tpreFetch uint,\n\trevs revisions.Store,\n\tqueues *queueSet,\n\tchannels amqputil.ChannelPool,\n\tlogger twelf.Logger,\n\ttracer opentracing.Tracer,\n) (command.Server, error) {\n\ts := &server{\n\t\tpeerID: peerID,\n\t\tpreFetch: preFetch,\n\t\trevisions: revs,\n\t\tqueues: queues,\n\t\tchannels: channels,\n\t\tlogger: logger,\n\t\ttracer: tracer,\n\n\t\tdeliveries: make(chan amqp.Delivery, preFetch),\n\t\tamqpClosed: make(chan *amqp.Error, 1),\n\n\t\thandlers: map[string]rinq.CommandHandler{},\n\t}\n\n\ts.sm = service.NewStateMachine(s.run, s.finalize)\n\ts.Service = s.sm\n\n\tif err := s.initialize(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgo s.sm.Run()\n\n\treturn s, nil\n}", "title": "" }, { "docid": "487ad1e84258336c8486c94b884e0893", "score": "0.65150714", "text": "func New(c *config.Config, dal *data.DAL, entry *log.Entry) *Server {\n\trouter := mux.NewRouter().StrictSlash(true)\n\taddr := c.Host + \":\" + c.Port\n\tserver := &http.Server{\n\t\tAddr: addr,\n\t}\n\n\ts := &Server{\n\t\tRouter: router,\n\t\tServer: server,\n\t\taddr: addr,\n\t\tDal: dal,\n\t\tlog: entry,\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "4267784164495fc5b22677c4427de48a", "score": "0.65128046", "text": "func NewServer(store storageInterface) *Server {\n\tssx := new(Server)\n\tssx.store = store\n\n\trouter := mux.NewRouter()\n\trouter.Handle(\"/rest/v0/activities\", http.HandlerFunc(ssx.activityHandler)).Methods(http.MethodPost)\n\trouter.Handle(\"/rest/v0/activities/{id}\", http.HandlerFunc(ssx.statusHandler)).Methods(http.MethodGet)\n\n\tssx.Handler = router\n\n\treturn ssx\n}", "title": "" }, { "docid": "4aca6fda7a97685e9ce96dc7e13cfa0f", "score": "0.65080035", "text": "func New() *Server {\n\tm := &Server{\n\t\t//addr: addr,\n\t\t//allowedForwarding: []net.IPNet{},\n\t\t//allowedRequests: []string{\"A\", \"AAAA\", \"NS\", \"MX\", \"SOA\", \"TXT\", \"CAA\", \"ANY\", \"CNAME\", \"MB\", \"MG\", \"MR\", \"WKS\", \"PTR\", \"HINFO\", \"MINFO\", \"SPF\"},\n\t\tLog: make(chan string, 500),\n\t\tstop: make(chan bool),\n\t\tserverTCP: &dns.Server{},\n\t\tserverUDP: &dns.Server{},\n\t\tmasterCache: master.New(),\n\t\tforwarderCache: forwarder.New(),\n\t\tlimiterCache: limiter.New(),\n\t\tChannels: NewChannelManager(),\n\t\tSettings: &Settings{},\n\t}\n\treturn m\n}", "title": "" }, { "docid": "86d547ab3dfd27de5d7bbc75a1049b7b", "score": "0.6505456", "text": "func NewServer() Server {\n\treturn &server{make(boolChan, 1), 0, DefaultResolver, DefaultLogger, DefaultRuler}\n}", "title": "" }, { "docid": "d8e83885c752bd92ad6ded42e82cd1a1", "score": "0.65015143", "text": "func NewServer(conf *conf.Server, pubsub *tips.Tips) *Server {\n\trouter := gin.New()\n\n\tctx, cancel := context.WithCancel(context.Background())\n\ts := &Server{\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\trouter: router,\n\t\tpubsub: pubsub,\n\t\tcertFile: conf.Cert,\n\t\tkeyFile: conf.Key,\n\t\thttpServer: &http.Server{Handler: router},\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "1ff475c8e9fbcda3a87825276285ff50", "score": "0.650068", "text": "func New(addr string, scrp *scrapper.Scrapper) (*Server, error) {\n\tvar (\n\t\terr error\n\t\tsrv = &Server{}\n\t)\n\n\tsrv.httpServer = &http.Server{\n\t\tAddr: addr,\n\t\tHandler: srv.routes(),\n\t}\n\n\tsrv.templates, err = template.New(\"\").ParseFS(templatesContents, \"templates/*\")\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed to parse templates\")\n\t}\n\n\tsrv.driverPool = &sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\twd, err := scrp.Start()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithMessage(err, \"failed to start browser\")\n\t\t\t}\n\n\t\t\treturn wd\n\t\t},\n\t}\n\n\treturn srv, nil\n}", "title": "" }, { "docid": "09aa8031e5b9da3867acf7ce08cd74fe", "score": "0.64860433", "text": "func New() *Server {\n\treturn &Server{\n\t}\n}", "title": "" }, { "docid": "52e41826457c1768c8546f25018535b9", "score": "0.6479187", "text": "func NewRouter(srv *Server, ops *RouterOps) *Router {\n\trt := &Router{\n\t\tsrv: srv,\n\t}\n\tif ops != nil {\n\t\tif remote, err := url.Parse(ops.Proxy); err == nil {\n\t\t\trt.proxy = httputil.NewSingleHostReverseProxy(remote)\n\t\t\trt.proxy.Transport = &http.Transport{\n\t\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t\t}\n\t\t}\n\t\tif regex, err := regexp.Compile(ops.Pattern); err == nil {\n\t\t\trt.regex = regex\n\t\t}\n\t}\n\treturn rt\n}", "title": "" }, { "docid": "79ff8387a6e581925438aa597e073ffc", "score": "0.6476363", "text": "func NewServer(address string, sdkRouter *sdkrouter.Router) *Server {\n\tr := mux.NewRouter()\n\tapi.InstallRoutes(r, sdkRouter)\n\tr.Use(monitor.ErrorLoggingMiddleware)\n\tr.Use(defaultHeadersMiddleware(map[string]string{\n\t\t\"Server\": \"api.lbry.tv\",\n\t\t\"Access-Control-Allow-Origin\": \"*\",\n\t\t\"Access-Control-Allow-Headers\": \"content-type\", // Needed this to get any request to work\n\t}))\n\n\treturn &Server{\n\t\taddress: address,\n\t\tstopWait: 15 * time.Second,\n\t\tstopChan: make(chan os.Signal),\n\t\tlistener: &http.Server{\n\t\t\tAddr: address,\n\t\t\tHandler: r,\n\t\t\t// We need this for long uploads\n\t\t\tWriteTimeout: 0,\n\t\t\t// prev WriteTimeout was (sdkrouter.RPCTimeout + (1 * time.Second)).\n\t\t\t// It must be longer than rpc timeout to allow those timeouts to be handled\n\t\t\tIdleTimeout: 0,\n\t\t\tReadHeaderTimeout: 10 * time.Second,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "84c50b98e272c7d6695ab535eb2f8839", "score": "0.6472057", "text": "func NewServer(setting model.ServerSettings, db DatabaseComposer, options ...func(*Server) error) (model.Server, error) {\n\ts := Server{}\n\n\tappStorage, userStorage, tokenStorage, tokenService, err := db.Compose()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.AppStrg = appStorage\n\ts.UserStrg = userStorage\n\n\tms, err := mailService(setting.MailService, setting.EmailTemplates, setting.EmailTemplatesPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//env variable could rewrite this option\n\thostName := os.Getenv(\"HOST_NAME\")\n\tif len(hostName) == 0 {\n\t\thostName = setting.Host\n\t}\n\n\tstaticFiles := html.StaticFilesPath{\n\t\tStylesPath: path.Join(setting.StaticFolderPath, \"css\"),\n\t\tScriptsPath: path.Join(setting.StaticFolderPath, \"js\"),\n\t\tPagesPath: setting.StaticFolderPath,\n\t\tImagesPath: path.Join(setting.StaticFolderPath, \"img\"),\n\t}\n\n\trouterSettings := web.RouterSetting{\n\t\tAppStorage: appStorage,\n\t\tUserStorage: userStorage,\n\t\tTokenStorage: tokenStorage,\n\t\tTokenService: tokenService,\n\t\tEmailService: ms,\n\t\tWebRouterSettings: []func(*html.Router) error{\n\t\t\thtml.StaticPathOptions(staticFiles),\n\t\t\thtml.HostOption(hostName),\n\t\t},\n\t\tAPIRouterSettings: []func(*api.Router) error{\n\t\t\tapi.HostOption(hostName),\n\t\t},\n\t}\n\tr, err := web.NewRouter(routerSettings)\n\ts.MainRouter = r.(*web.Router)\n\n\tfor _, option := range options {\n\t\tif err := option(&s); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &s, nil\n\n}", "title": "" }, { "docid": "9493d172f961ff3fb6f9afae799d73eb", "score": "0.64666843", "text": "func NewServer(options ...func(s *Server) error) (*Server, error) {\n\tr := chi.NewRouter()\n\tr.Use(\n\t\trender.SetContentType(render.ContentTypeJSON),\n\t\tmiddleware.Logger,\n\t\tmiddleware.RedirectSlashes,\n\t\tmiddleware.Recoverer,\n\t)\n\n\ts := &Server{\n\t\tRouter: r,\n\t\tnatsTimeout: 100 * time.Millisecond,\n\t}\n\ts.routesHandler = s\n\n\tfor _, o := range options {\n\t\tif err := o(s); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err := s.routes(s.Router); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to install routes\")\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "c1762d74161b812a1b2bf5dd8ed69083", "score": "0.6464489", "text": "func newRouter(opts ...Option) Router {\n\t// TODO: we need to add default GW entry here\n\t// Should default GW be part of router options?\n\n\t// get default options\n\toptions := DefaultOptions()\n\n\t// apply requested options\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\n\treturn &router{\n\t\topts: options,\n\t\texit: make(chan struct{}),\n\t\twg: &sync.WaitGroup{},\n\t}\n}", "title": "" }, { "docid": "c3f9c1ec4bb4c51d3d563a420395badf", "score": "0.6464463", "text": "func NewServer(host, port string) *Server {\n\n\ts := &Server{\n\t\thost: host,\n\t\tport: port,\n\t\trouter: mux.NewRouter(),\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "0ab081fac83f7bec9b83e67eeef00fdf", "score": "0.6460529", "text": "func NewServer() *negroni.Negroni {\n\tn := negroni.Classic()\n\trouter := mux.NewRouter()\n\n\tinitRouter(router)\n\n\tn.UseHandler(router)\n\n\treturn n\n}", "title": "" }, { "docid": "5bd9c6589be2d5a3449c49a65ad0e06d", "score": "0.6459132", "text": "func New(options ...Option) (*Server, error) {\n\tsrv := &Server{\n\t\tlogger: NoopLogger,\n\t}\n\n\tfor _, opt := range options {\n\t\tif err := opt(srv); err != nil {\n\t\t\treturn &Server{}, err\n\t\t}\n\t}\n\tsrv.routes()\n\n\treturn srv, nil\n}", "title": "" }, { "docid": "d81fa35a98536c05ac5040643a7efc1b", "score": "0.6455753", "text": "func NewServer() *Server {\n\treturn &Server{\n\t\trooms: make(map[string]*room),\n\t}\n}", "title": "" }, { "docid": "6661d42cc44f27526c999782ba15da9c", "score": "0.6454587", "text": "func NewServer(Port string) *http.Server {\n\trouter = InitRouting()\n\treturn &http.Server{\n\t\tAddr: \":\" + Port,\n\t\tHandler: router,\n\t}\n}", "title": "" }, { "docid": "b0aa259a78b3f2019db08f9fff880cf0", "score": "0.64529425", "text": "func NewServer() *negroni.Negroni {\n\n\tformatter := render.New(render.Options{\n\t\tIndentJSON: true,\n\t})\n\n\tn := negroni.Classic()\n\tmx := mux.NewRouter()\n\n\tinitRoutes(mx, formatter)\n\n\tn.UseHandler(mx)\n\treturn n\n}", "title": "" }, { "docid": "b0aa259a78b3f2019db08f9fff880cf0", "score": "0.64529425", "text": "func NewServer() *negroni.Negroni {\n\n\tformatter := render.New(render.Options{\n\t\tIndentJSON: true,\n\t})\n\n\tn := negroni.Classic()\n\tmx := mux.NewRouter()\n\n\tinitRoutes(mx, formatter)\n\n\tn.UseHandler(mx)\n\treturn n\n}", "title": "" }, { "docid": "b0aa259a78b3f2019db08f9fff880cf0", "score": "0.64529425", "text": "func NewServer() *negroni.Negroni {\n\n\tformatter := render.New(render.Options{\n\t\tIndentJSON: true,\n\t})\n\n\tn := negroni.Classic()\n\tmx := mux.NewRouter()\n\n\tinitRoutes(mx, formatter)\n\n\tn.UseHandler(mx)\n\treturn n\n}", "title": "" }, { "docid": "b73d1b99daec83bd28bbb182894010cd", "score": "0.64481914", "text": "func NewServer(syscall *bridge.SyscallService) *Server {\n\treturn &Server{\n\t\tmethods: parseMethods(syscall),\n\t\tsyscall: syscall,\n\t\tvsyscall: reflect.ValueOf(syscall),\n\t}\n}", "title": "" }, { "docid": "b0d5a2699d6e4a87655e44daa4f08f3e", "score": "0.64459604", "text": "func NewServer(g *gin.Engine, port string) *SRV {\n\treturn &SRV{Engine: g, port: \"8080\"}\n}", "title": "" }, { "docid": "685d0750f6380642b5675212460ebb97", "score": "0.64457256", "text": "func NewServer() *negroni.Negroni {\n\tformatter := render.New(render.Options{IndentJSON: true})\n\n\tn := negroni.Classic()\n\tmx := mux.NewRouter()\n\n\tinitRoutes(mx, formatter)\n\n\tn.UseHandler(mx)\n\treturn n\n}", "title": "" }, { "docid": "25428c0c7e3a1e845ef488bc302ca9b0", "score": "0.6445058", "text": "func NewServer(l *logrus.Logger, addr string, aPayURL *url.URL, gPayURL *url.URL) *http.Server {\n\tr := newRouter(l, aPayURL, gPayURL)\n\n\treturn &http.Server{\n\t\tAddr: addr,\n\t\tHandler: r,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tIdleTimeout: 15 * time.Second,\n\t}\n}", "title": "" }, { "docid": "f3940ea78df83b19a84a734235f1dfa9", "score": "0.644493", "text": "func New(cfg *config.Config) *Server {\n\tif cfg.Bind == \"\" {\n\t\tcfg.Bind = \":53\"\n\t}\n\n\tserver := &Server{\n\t\taddr: cfg.Bind,\n\t\ttlsAddr: cfg.BindTLS,\n\t\tdohAddr: cfg.BindDOH,\n\t\tdoqAddr: cfg.BindDOQ,\n\t\ttlsCertificate: cfg.TLSCertificate,\n\t\ttlsPrivateKey: cfg.TLSPrivateKey,\n\t}\n\n\tserver.chainPool.New = func() interface{} {\n\t\treturn middleware.NewChain(middleware.Handlers())\n\t}\n\n\treturn server\n}", "title": "" }, { "docid": "5f44efbcad7a35d1ca1c7124d2a507d3", "score": "0.64430326", "text": "func New(c *Config) *http.Server {\n\t// you can use config to overrid any values\n\tr := mux.NewRouter()\n\tinitializeRoutes(r)\n\treturn &http.Server{\n\t\tAddr: fmt.Sprintf(\"%s:%d\", \"127.0.0.1\", 9999),\n\t\tHandler: r,\n\t\tReadHeaderTimeout: 60 * time.Second,\n\t\tWriteTimeout: 60 * time.Second,\n\t\tReadTimeout: 60 * time.Second,\n\t\tIdleTimeout: 60 * time.Second,\n\t}\n}", "title": "" } ]
35c95a711788493f4b3cd5ba091ece90
SetContentDisposition sets the ContentDisposition field's value.
[ { "docid": "db946d58e9f8978d05c6c78107ea1faf", "score": "0.7099255", "text": "func (s *CopyObjectInput) SetContentDisposition(v string) *CopyObjectInput {\n\ts.ContentDisposition = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "ce90008d7383c10b48648aaac1077c85", "score": "0.7266875", "text": "func ContentDisposition(fileName, dispositionType string) (header string) {\n\tif dispositionType == \"\" {\n\t\tdispositionType = \"attachment\"\n\t}\n\tif fileName == \"\" {\n\t\treturn dispositionType\n\t}\n\n\theader = fmt.Sprintf(`%s; filename=\"%s\"`, dispositionType, url.QueryEscape(fileName))\n\tfallbackName := url.PathEscape(fileName)\n\tif len(fallbackName) != len(fileName) {\n\t\theader = fmt.Sprintf(`%s; filename*=UTF-8''%s`, header, fallbackName)\n\t}\n\treturn\n}", "title": "" }, { "docid": "78e8d6d0f000d4612c58a1245b7ac536", "score": "0.71841866", "text": "func (s *HeadObjectOutput) SetContentDisposition(v string) *HeadObjectOutput {\n\ts.ContentDisposition = &v\n\treturn s\n}", "title": "" }, { "docid": "ddede0b53ed741d8e48b202d401b8d31", "score": "0.7085972", "text": "func (s *PutObjectInput) SetContentDisposition(v string) *PutObjectInput {\n\ts.ContentDisposition = &v\n\treturn s\n}", "title": "" }, { "docid": "a60b854ac0b347f086adaf69d6fbd90f", "score": "0.7077171", "text": "func (s *CreateMultipartUploadInput) SetContentDisposition(v string) *CreateMultipartUploadInput {\n\ts.ContentDisposition = &v\n\treturn s\n}", "title": "" }, { "docid": "dc069b9102f62f21933b2b7337f211a2", "score": "0.696555", "text": "func (s *GetObjectOutput) SetContentDisposition(v string) *GetObjectOutput {\n\ts.ContentDisposition = &v\n\treturn s\n}", "title": "" }, { "docid": "6bf6e0e9194bc88d5c65358e452e648c", "score": "0.64146835", "text": "func (r *BucketObject) ContentDisposition() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"contentDisposition\"])\n}", "title": "" }, { "docid": "9f7b68c093075b56819a93db193d0ae9", "score": "0.63711286", "text": "func (s3 *S3) ContentDisposition() string {\n\treturn s3.contentDisposition\n}", "title": "" }, { "docid": "ed467ff9a95ecff1cbf7882978d4dfb7", "score": "0.6215531", "text": "func (f *FileMeta) ResponseContentDisposition() string {\n\treturn fmt.Sprintf(\"attachment; filename=\\\"%s\\\"\", f.Name)\n}", "title": "" }, { "docid": "6ffb0ca2ccdb058987c526cbe4370c6b", "score": "0.616035", "text": "func (s *GetObjectInput) SetResponseContentDisposition(v string) *GetObjectInput {\n\ts.ResponseContentDisposition = &v\n\treturn s\n}", "title": "" }, { "docid": "9c339127e5de09f1a9034889e90488b2", "score": "0.6034339", "text": "func (response *Response) SetContentTypeAttachment(filename string) {\n\tresponse.Header().Set(\"Content-Type\", \"application/x-unknown\")\n\tresponse.Header().Set(\"Content-Disposition\", \"attachment;filename=\"+filename)\n}", "title": "" }, { "docid": "1dcd4269d0d97a8f523539f98bdb9033", "score": "0.5318016", "text": "func (a *Media_VideosApiService) DeleteVideoDisposition(ctx context.Context, dispositionId int64) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/media/videos/{video_id}/dispositions/{disposition_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"disposition_id\"+\"}\", fmt.Sprintf(\"%v\", dispositionId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ }\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\t localVarHttpResponse, err := a.client.callAPI(r)\n\t if err != nil || localVarHttpResponse == nil {\n\t\t return localVarHttpResponse, err\n\t }\n\t defer localVarHttpResponse.Body.Close()\n\t if localVarHttpResponse.StatusCode >= 300 {\n\t\treturn localVarHttpResponse, reportError(localVarHttpResponse.Status)\n\t }\n\n\treturn localVarHttpResponse, err\n}", "title": "" }, { "docid": "229608196a865a6cb6721d1577c50616", "score": "0.53100026", "text": "func (m *AttachmentBase) SetContentType(value *string)() {\n err := m.GetBackingStore().Set(\"contentType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cd521d7d419997ac0280fe2dd006d540", "score": "0.52766365", "text": "func (c *ContentDisposition) Add(key, value string) *ContentDisposition {\n\tc.kv = append(c.kv, kv{Key: key, Value: value})\n\treturn c\n}", "title": "" }, { "docid": "375d8f739fd00ecf49509191fd4a8c9b", "score": "0.5258835", "text": "func (o JobConfigurationLoadResponseOutput) WriteDisposition() pulumi.StringOutput {\n\treturn o.ApplyT(func(v JobConfigurationLoadResponse) string { return v.WriteDisposition }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "98cec55cedd1c5eb8a46c88f03df6a9f", "score": "0.5241494", "text": "func (o JobConfigurationTableCopyResponseOutput) WriteDisposition() pulumi.StringOutput {\n\treturn o.ApplyT(func(v JobConfigurationTableCopyResponse) string { return v.WriteDisposition }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b16681721d815da715c2fa60fb16e029", "score": "0.5176445", "text": "func (c *Resource) SetContentType(ctype string) {\n\tc.Response.Header().Set(\"Content-Type\", ctype)\n}", "title": "" }, { "docid": "40e03edd89e8dfb24c1590139944f673", "score": "0.51297075", "text": "func (o JobConfigurationLoadResponsePtrOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationLoadResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.WriteDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9567e28d630b1345748ef281737ead50", "score": "0.5090403", "text": "func (o JobConfigurationTableCopyResponsePtrOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationTableCopyResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.WriteDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3ad61938a03fd79775f6d46a41e010df", "score": "0.5009982", "text": "func (o JobConfigurationQueryResponseOutput) WriteDisposition() pulumi.StringOutput {\n\treturn o.ApplyT(func(v JobConfigurationQueryResponse) string { return v.WriteDisposition }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "eff76de28464a50f8f555c9114028921", "score": "0.498794", "text": "func (r *Request) SetContentType(value string) {\n\tif r.Header == nil {\n\t\tr.Header = make(http.Header)\n\t}\n\n\tr.Header.Set(\"Content-Type\", value)\n}", "title": "" }, { "docid": "9bc9e25c9e0f0a48d4da5fd2d3556e1a", "score": "0.49780953", "text": "func (s SIPHeader) SetContentType(ct string) {\n\ts.SetFirstHeader(\"content-type\", ct)\n}", "title": "" }, { "docid": "5bd5b208054f0de61a3a0735e42c2bf6", "score": "0.49100214", "text": "func (o JobConfigurationLoadOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobConfigurationLoad) *string { return v.WriteDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "20abc4fd382f909d84e6df693dbb4091", "score": "0.49008828", "text": "func SetContentType(w http.ResponseWriter, contentType string) {\n\tw.Header().Set(\"Content-Type\", contentType)\n}", "title": "" }, { "docid": "8e53b63d7c50a69a5b3e991b5b38ec5c", "score": "0.4867303", "text": "func ServeSetHeaders(w http.ResponseWriter, opts *ServeHeaderOptions) {\n\theader := w.Header()\n\n\tcontentType := typesniffer.ApplicationOctetStream\n\tif opts.ContentType != \"\" {\n\t\tif opts.ContentTypeCharset != \"\" {\n\t\t\tcontentType = opts.ContentType + \"; charset=\" + strings.ToLower(opts.ContentTypeCharset)\n\t\t} else {\n\t\t\tcontentType = opts.ContentType\n\t\t}\n\t}\n\theader.Set(\"Content-Type\", contentType)\n\theader.Set(\"X-Content-Type-Options\", \"nosniff\")\n\n\tif opts.ContentLength != nil {\n\t\theader.Set(\"Content-Length\", strconv.FormatInt(*opts.ContentLength, 10))\n\t}\n\n\tif opts.Filename != \"\" {\n\t\tdisposition := opts.Disposition\n\t\tif disposition == \"\" {\n\t\t\tdisposition = \"attachment\"\n\t\t}\n\n\t\tbackslashEscapedName := strings.ReplaceAll(strings.ReplaceAll(opts.Filename, `\\`, `\\\\`), `\"`, `\\\"`) // \\ -> \\\\, \" -> \\\"\n\t\theader.Set(\"Content-Disposition\", fmt.Sprintf(`%s; filename=\"%s\"; filename*=UTF-8''%s`, disposition, backslashEscapedName, url.PathEscape(opts.Filename)))\n\t\theader.Set(\"Access-Control-Expose-Headers\", \"Content-Disposition\")\n\t}\n\n\tduration := opts.CacheDuration\n\tif duration == 0 {\n\t\tduration = 5 * time.Minute\n\t}\n\thttpcache.SetCacheControlInHeader(header, duration)\n\n\tif !opts.LastModified.IsZero() {\n\t\theader.Set(\"Last-Modified\", opts.LastModified.UTC().Format(http.TimeFormat))\n\t}\n}", "title": "" }, { "docid": "ec81a5dde23c436b7ce8e880d719f872", "score": "0.4834471", "text": "func (o JobConfigurationQueryResponsePtrOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationQueryResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.WriteDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f0abed47b136ed471e283e983a1457ab", "score": "0.48319495", "text": "func (o JobCopyOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobCopy) *string { return v.WriteDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3868b0d402fe7262c787ba0e9d2e75c5", "score": "0.48127878", "text": "func (w *Writer) SetContentType(t ContentType) error {\n\tif w.ContentType() == t {\n\t\treturn nil\n\t}\n\tif !w.bufferEmpty() {\n\t\tif err := w.Flush(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tw.record[0] = byte(t)\n\treturn nil\n}", "title": "" }, { "docid": "28be52e40be3bcd1fc1dbbde92689bae", "score": "0.4802142", "text": "func (ctx *Context) SetContentType(s []string) {\n\tctx.mu.Lock()\n\th := ctx.ResponseWriter.Header()\n\tif ss := h[ContentType]; len(ss) == 0 {\n\t\th[ContentType] = s\n\t}\n\tctx.mu.Unlock()\n}", "title": "" }, { "docid": "0acea9f5d223ed92dcf780487552fbbd", "score": "0.4773939", "text": "func (o JobCopyPtrOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobCopy) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.WriteDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "de5b4c28c191c4323f1ee50e85328442", "score": "0.47685915", "text": "func (o JobConfigurationLoadPtrOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationLoad) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.WriteDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "48363066d820545827d90d9283412ec8", "score": "0.4758293", "text": "func (o JobLoadOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobLoad) *string { return v.WriteDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "71e6d7a38229f1b7ae74eee2c38d64f2", "score": "0.475421", "text": "func NewMessageDisposition() *MessageDisposition {\n\tmd := &MessageDisposition{\n\t\ttag: TagMessageDisposition,\n\t\tFormatVersion: FormatVersion,\n\t\tTestProductionCode: EnvironmentProduction,\n\t\tMessageDuplicationCode: MessageDuplicationOriginal,\n\t}\n\treturn md\n}", "title": "" }, { "docid": "e0e22f02d9ee802eec37e86018f11098", "score": "0.47513124", "text": "func (file *GridFile) SetContentType(ctype string) {\n\tfile.assertMode(gfsWriting)\n\tfile.m.Lock()\n\tfile.doc.ContentType = ctype\n\tfile.m.Unlock()\n}", "title": "" }, { "docid": "8f7a1288a596ee96adac84e6554e3b6d", "score": "0.47190624", "text": "func (o JobConfigurationTableCopyOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobConfigurationTableCopy) *string { return v.WriteDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "83ece782950d6b30733caa5e146e92d5", "score": "0.4695902", "text": "func (res *response) Download(path string, fileName string) bool {\n if res.header.CanSendHeader() == true {\n res.header.Set(\"Content-Disposition\", \"attachment; filename=\\\"\"+fileName+\"\\\"\")\n return res.SendFile(path, false)\n }\n log.Print(\"Cannot Send header after being flushed\")\n res.End()\n return false\n\n}", "title": "" }, { "docid": "864a8cf1645a6a839f832df2aa4481e0", "score": "0.46925876", "text": "func (o *UpdateSymfileParams) SetContentType(contentType *string) {\n\to.ContentType = contentType\n}", "title": "" }, { "docid": "a50cd115e4796c1f599adda0daa74978", "score": "0.46836066", "text": "func (o JobConfigurationTableCopyPtrOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationTableCopy) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.WriteDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e60a7d475a8b46f7f9d0c606163a6344", "score": "0.4653868", "text": "func (h *internalHTTP) SetFilenameDisplay(fd log.FilenameDisplay) {\n\th.fileDisplay = fd\n}", "title": "" }, { "docid": "00ac8563f9fe2aaa69cfb92c500013b5", "score": "0.46364796", "text": "func (o JobLoadPtrOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobLoad) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.WriteDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "802b83c1a4fc4b7358c850b3d4cc900f", "score": "0.46072972", "text": "func (o JobConfigurationQueryOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobConfigurationQuery) *string { return v.WriteDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ef7f5e0c813747d485d9fd2198337b74", "score": "0.457563", "text": "func (r *Req) SetContentType(contentType string) *Req {\n\tr.request.Header.Set(\"Content-Type\", contentType)\n\treturn r\n}", "title": "" }, { "docid": "97eccca2fdfd6544ebcc3277a2d1236f", "score": "0.45608938", "text": "func SetResponseContentType(w http.ResponseWriter, contentType string) {\n\tw.Header().Set(\"Content-Type\", contentType)\n}", "title": "" }, { "docid": "c4f01a1d6ff425846592f22be52a320b", "score": "0.4556236", "text": "func (this *Response) ContentType(contentType string) {\n\tthis.Set(\"Content-Type\", contentType)\n}", "title": "" }, { "docid": "b8dbf82ee9c145c0e85b16179e3d550f", "score": "0.45532617", "text": "func (o JobQueryOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobQuery) *string { return v.WriteDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4594c16cc06beebbe9d8892971fc47a7", "score": "0.4517323", "text": "func (o JobConfigurationTableCopyResponseOutput) CreateDisposition() pulumi.StringOutput {\n\treturn o.ApplyT(func(v JobConfigurationTableCopyResponse) string { return v.CreateDisposition }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d57e393d63aaad27eef1ff797f06e03b", "score": "0.4513245", "text": "func (o JobConfigurationQueryPtrOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationQuery) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.WriteDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e5a25ca98a2beefe4cc7a6da18330b08", "score": "0.4507351", "text": "func SetContentType(contentType string) 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\tw.Header().Add(\"Content-Type\", contentType)\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "a3c5457ead91524fe25549d9645668d3", "score": "0.44878364", "text": "func (o JobQueryPtrOutput) WriteDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobQuery) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.WriteDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dd747b5dc498130f87174f4cdb1a421f", "score": "0.4476179", "text": "func (r *Response) SetContentType(contentType string) *Response {\n\tr.Headers.Set(HeaderContentType, contentType)\n\treturn r\n}", "title": "" }, { "docid": "facddc32a1e515359b8457e07b7a7c9d", "score": "0.4466526", "text": "func (r Responder) ContentType(ctt string) {\n\tif r.ResponseWriter.Header().Get(\"Content-Type\") == \"\" {\n\t\tr.ResponseWriter.Header().Set(\"Content-Type\", ctt)\n\t}\n}", "title": "" }, { "docid": "57b6696fd058be90df6809402afabea1", "score": "0.44635132", "text": "func SetLastModifiedHeader(w http.ResponseWriter, modTime time.Time) {\n\tif modTime.IsZero() || modTime.Equal(time.Unix(0, 0)) {\n\t\t// the time does not appear to be valid. Don't put it in the response\n\t\treturn\n\t}\n\n\t// RFC 2616 - Section 14.29 - Last-Modified:\n\t// An origin server MUST NOT send a Last-Modified date which is later than the\n\t// server's time of message origination. In such cases, where the resource's last\n\t// modification would indicate some time in the future, the server MUST replace\n\t// that date with the message origination date.\n\tnow := currentTime()\n\tif modTime.After(now) {\n\t\tmodTime = now\n\t}\n\n\tw.Header().Set(\"Last-Modified\", modTime.UTC().Format(http.TimeFormat))\n}", "title": "" }, { "docid": "da6ba04623c165e0d9ea14a98038f2ce", "score": "0.44490996", "text": "func (o JobConfigurationLoadResponseOutput) CreateDisposition() pulumi.StringOutput {\n\treturn o.ApplyT(func(v JobConfigurationLoadResponse) string { return v.CreateDisposition }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e7e00d2bbdb1e6b06772cc35c868f773", "score": "0.4434991", "text": "func (g *Gorilla) SetContentType() {\n\tg.ctx.Response.Header().Set(\"Content-Type\", g.HTMLContentType())\n}", "title": "" }, { "docid": "671958065d6ef5765def07ddc48272e7", "score": "0.43985912", "text": "func (fast *Fasthttp) SetContentType() {\n\tfast.ctx.Response.Header.Set(\"Content-Type\", fast.HTMLContentType())\n}", "title": "" }, { "docid": "42fe787d9a9296b1fbbd97133d17ba6f", "score": "0.4346205", "text": "func (p *Part) FileName() string {\n\tif p.dispositionParams == nil {\n\t\tp.parseContentDisposition()\n\t}\n\tfilename := p.dispositionParams[\"filename\"]\n\tif filename == \"\" {\n\t\treturn \"\"\n\t}\n\t// RFC 7578, Section 4.2 requires that if a filename is provided, the\n\t// directory path information must not be used.\n\treturn filepath.Base(filename)\n}", "title": "" }, { "docid": "21e7adf342c2f35fa33a73947dfa6977", "score": "0.43438512", "text": "func (o JobConfigurationLoadResponsePtrOutput) CreateDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationLoadResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.CreateDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "02f4e9270ef9e84efe18437d3768f24a", "score": "0.43399101", "text": "func (o JobConfigurationTableCopyResponsePtrOutput) CreateDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationTableCopyResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.CreateDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0ceefaed4aa5e15d88dddb80e74fd3eb", "score": "0.43185192", "text": "func (resp *Response) SetContent(data []byte, contentType string) {\n\tresp.Response.Header.Set(\"Content-Type\", contentType)\n\tresp.Response.Header.Del(\"Content-Encoding\")\n\tresp.Modified = true\n\n\tif len(data) > 1000 {\n\t\tencoding := httputil.NegotiateContentEncoding(resp.Request.Request, []string{\"br\", \"gzip\"})\n\t\tbuf := new(bytes.Buffer)\n\t\tvar compressor io.WriteCloser\n\t\tvar err error\n\t\tswitch encoding {\n\t\tcase \"br\":\n\t\t\tcompressor = brotli.NewWriterOptions(buf, brotli.WriterOptions{Quality: getConfig().BrotliLevel})\n\t\tcase \"gzip\":\n\t\t\tcompressor, err = gzip.NewWriterLevel(buf, getConfig().GZIPLevel)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error creating gzip compressor:\", err)\n\t\t\t\tcompressor = nil\n\t\t\t}\n\t\t}\n\t\tif compressor != nil {\n\t\t\tcompressor.Write(data)\n\t\t\tif err := compressor.Close(); err == nil {\n\t\t\t\tresp.Response.Body = io.NopCloser(buf)\n\t\t\t\tresp.Response.Header.Set(\"Content-Encoding\", encoding)\n\t\t\t\tresp.Response.ContentLength = -1\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tresp.Response.ContentLength = int64(len(data))\n\tresp.Response.Body = io.NopCloser(bytes.NewReader(data))\n}", "title": "" }, { "docid": "154ba056cdec393566a592b76fca6d71", "score": "0.4306517", "text": "func SetHeader(resp *echo.Response, pragma *Pragma) {\n\theader := resp.Header()\n\tfor key, value := range pragma.ResponseHeaders() {\n\t\theader.Set(key, value)\n\t}\n}", "title": "" }, { "docid": "47c6c232cf7fd2f889befb6f22222eb9", "score": "0.42765883", "text": "func (o JobConfigurationQueryResponseOutput) CreateDisposition() pulumi.StringOutput {\n\treturn o.ApplyT(func(v JobConfigurationQueryResponse) string { return v.CreateDisposition }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "eed809c56e89cff83298169bfb505198", "score": "0.42619887", "text": "func (c *Context) File(code int, name string, val []byte) {\n\tc.Status(code)\n\n\tc.Writer.Header().Set(\"Content-Type\", \"application/octet-stream\")\n\tc.Writer.Header().Set(\"Content-Disposition\", \"attachment;filename=\\\"\"+name+\"\\\"\")\n\tc.Writer.Write(val)\n}", "title": "" }, { "docid": "45bb1644b27b0cbe4852366f84d4dc01", "score": "0.4245938", "text": "func (f *FileMeta) ResponseContentType() string {\n\tif f.ContentType == \"\" {\n\t\treturn \"application/octet-stream\"\n\t}\n\treturn f.ContentType\n}", "title": "" }, { "docid": "38aca94a61520fc558978e51d7edf893", "score": "0.42381558", "text": "func (o *GetOutputResourceParams) WithSuppressContentDisposition(SuppressContentDisposition *bool) *GetOutputResourceParams {\n\to.SuppressContentDisposition = SuppressContentDisposition\n\treturn o\n}", "title": "" }, { "docid": "c7f6565d1c193e2e1b08c700c8e26574", "score": "0.42257616", "text": "func (m *File) SetMimeType(value *string)() {\n m.mimeType = value\n}", "title": "" }, { "docid": "7cf2bf8f1f85e3e990ac3e0737e2f8b5", "score": "0.41935512", "text": "func (_m *AppFunctionContext) SetResponseContentType(_a0 string) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "d7e67ab0c9a37eb2f9a19d015ed7616f", "score": "0.41891825", "text": "func (c *TypeClient) SetContentType(contentType string) *TypeClient {\n\tc.Request.Header.Set(\"Content-Type\", contentType)\n\treturn c\n}", "title": "" }, { "docid": "686a7560842debceb215749196f642be", "score": "0.41857386", "text": "func (s SIPHeader) SetContentLength(size int) {\n\ts.SetFirstHeader(\"content-length\", strconv.Itoa(size))\n}", "title": "" }, { "docid": "efff52cfcce985637dae6a8bbf149b31", "score": "0.41804823", "text": "func (bee *Beego) SetContentType() {\n\tbee.ctx.ResponseWriter.Header().Set(\"Content-Type\", bee.HTMLContentType())\n}", "title": "" }, { "docid": "96dbfeac79944d86282c16858bbb22dd", "score": "0.41535887", "text": "func (m *ContentInfo) SetContentFormat(value *string)() {\n err := m.GetBackingStore().Set(\"contentFormat\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7cbdc251099b9e61469fab667b01cfbd", "score": "0.41160968", "text": "func setPosixDelete(handle windows.Handle) error {\n\tvar iosb ioStatusBlock\n\tflags := fileDispositionInformationEx{\n\t\tFlags: fileDispositionPosixSemantics | fileDispositionIgnoreReadonlyAttribute,\n\t}\n\t// class FileDispositionInformationEx, // 64\n\t// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ne-wdm-_file_information_class\n\tr0, _, err := ntSetInformationProc.Call(uintptr(handle), uintptr(unsafe.Pointer(&iosb)), uintptr(unsafe.Pointer(&flags)), unsafe.Sizeof(flags), uintptr(64))\n\tif r0 == 0 {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"cannot set file disposition information: NT_STATUS: 0x%X, error: %w\", r0, err)\n}", "title": "" }, { "docid": "66628c296a210d8c2fc1e10eb3b08748", "score": "0.41153675", "text": "func (o JobConfigurationQueryResponsePtrOutput) CreateDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationQueryResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.CreateDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fecc8e4e2865aa47f467340036c7f2a4", "score": "0.41041225", "text": "func (req *Request) SetHeader(key, value string) {\n\treq.Req.Header.DisableNormalizing()\n\treq.Req.Header.Set(key, value)\n}", "title": "" }, { "docid": "6d79cdd53a643c2c13c9e1aafa131cc7", "score": "0.40971458", "text": "func (fuo *FileUpdateOne) SetContentType(s string) *FileUpdateOne {\n\tfuo.content_type = &s\n\treturn fuo\n}", "title": "" }, { "docid": "8a9d946dc76dc41f9f6aeb8f61e735f2", "score": "0.40917704", "text": "func (o JobConfigurationLoadOutput) CreateDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobConfigurationLoad) *string { return v.CreateDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d1234dc30cf14cf6f2c65e542b72fb96", "score": "0.4085571", "text": "func (w *HttpResponse) setLastModified(modtime time.Time) {\n if !isZeroTime(modtime) {\n w.Header().Set(\"Last-Modified\", modtime.UTC().Format(http.TimeFormat))\n }\n}", "title": "" }, { "docid": "58156143213a49ae4e79ba64b47fe0c9", "score": "0.4072818", "text": "func (c *BaseController) setHttpContentType(ext string) {\n\tc.Ctx.Output.ContentType(ext)\n}", "title": "" }, { "docid": "74c80cfcfc0359b305746d25a4c1279d", "score": "0.40635976", "text": "func WithContentType(contentType string) RequestOption {\n\treturn WithSetHeader(\"Content-Type\", contentType)\n}", "title": "" }, { "docid": "7bf24b55a46e524bbe606dd679874a2a", "score": "0.40627265", "text": "func SetHeaders(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(header.XContentTypeOptions, \"nosniff\")\n\t\tw.Header().Set(header.XXSSProtection, \"1; mode=block\")\n\t\tw.Header().Set(header.XFrameOptions, \"deny\")\n\t\t// w.Header().Set(header.ContentSecurityPolicy, \"img-src https: data:; font-src https: data:; media-src https:;\")\n\t\tw.Header().Set(header.CacheControl, \"no-cache, no-store, must-revalidate\")\n\t\th.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "d6921b201b6bf9ebe26eb26e11089fd7", "score": "0.40574896", "text": "func SetDefaultMimeType(defaultMimeType string, req *http.Request) {\n\treq.Header.Set(\"Accept\", req.Header.Get(\"Accept\")+\",\"+defaultMimeType)\n}", "title": "" }, { "docid": "bd9988ee53360a659743363c76ca2070", "score": "0.4045358", "text": "func (o JobLoadOutput) CreateDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobLoad) *string { return v.CreateDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f13372a64dccc192871fdc222684ea08", "score": "0.40368298", "text": "func (o JobCopyOutput) CreateDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobCopy) *string { return v.CreateDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bf3154fc422a8ac546f99dd438bf3ade", "score": "0.4032234", "text": "func (m *SharingLink) SetPreventsDownload(value *bool)() {\n m.preventsDownload = value\n}", "title": "" }, { "docid": "b81cdebe0320c526ef83397389398157", "score": "0.40239802", "text": "func CallDispositionPDefault() *CallDisposition {\n\tv := CallDispositionVDefault\n\treturn &v\n}", "title": "" }, { "docid": "7258b52f13e4197912fe0112ea1a0203", "score": "0.40132004", "text": "func Set(s string) buffalo.MiddlewareFunc {\n\treturn func(next buffalo.Handler) buffalo.Handler {\n\t\treturn func(c buffalo.Context) error {\n\t\t\tc.Request().Header.Set(\"Content-Type\", s)\n\t\t\treturn next(c)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f02dc330e234a1b3a95857bb1b440a88", "score": "0.40088025", "text": "func ContentType(h http.Handler, contentType string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", contentType)\n\t\th.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "d2e8c8a4b5a69c970b628cdfc8273b16", "score": "0.40022677", "text": "func SetContentType(contentType string) RequestFunc {\n\treturn func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context {\n\t\tpub.ContentType = contentType\n\t\treturn ctx\n\t}\n}", "title": "" }, { "docid": "2b907e4e2aa9b37e55761f7257276e0b", "score": "0.39977822", "text": "func (fp *FilePath) SetMimeType() error {\n\t// Read a file\n\tkind, err := filetype.MatchFile(fp.Realpath())\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tfp.MimeType = kind.MIME.Type\n\tfp.MimeSubType = kind.MIME.Subtype\n\n\treturn nil\n}", "title": "" }, { "docid": "799ae37f98df48b5b242b8069c33794a", "score": "0.3994038", "text": "func (md Metadata) Set(key, val string) {\n\tmd[textproto.CanonicalMIMEHeaderKey(key)] = val\n}", "title": "" }, { "docid": "4296abd3b8605eccb709b3643d58adb5", "score": "0.39785302", "text": "func (c *Mcontext) FileAttachment(filepath, filename string) {\n\tc.Writer.Header().Set(\"Content-Disposition\", fmt.Sprintf(\"attachment; filename=\\\"%s\\\"\", filename))\n\thttp.ServeFile(c.Writer, c.Request, filepath)\n}", "title": "" }, { "docid": "6db7396e78f096343cf59ed7ed1ac45c", "score": "0.39782196", "text": "func CallDispositionPForward() *CallDisposition {\n\tv := CallDispositionVForward\n\treturn &v\n}", "title": "" }, { "docid": "fdfdd57d0ec9b4e144efb6a08e8df264", "score": "0.3964606", "text": "func (o JobConfigurationTableCopyOutput) CreateDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobConfigurationTableCopy) *string { return v.CreateDisposition }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f38d414732c8942d968ff7f232c2719d", "score": "0.39550766", "text": "func (r *Responder) Content(w http.ResponseWriter, status int, v []byte, contentType string) error {\n\tw.WriteHeader(status)\n\tw.Header().Set(ContentType, contentType)\n\t_, err := w.Write(v)\n\treturn err\n}", "title": "" }, { "docid": "7a9f54bb8e82e3cf15b01259ee41abff", "score": "0.39528102", "text": "func (this *Response) Download(file string) {\n\tname := path.Base(file)\n\tthis.Set(\"Content-Disposition\", \"attachment; filename=\\\"\"+name+\"\\\"\")\n\tthis.SendFile(file)\n}", "title": "" }, { "docid": "421a409d6a3d9f5f253287dc138ac806", "score": "0.3947409", "text": "func (o *ReplaceChangeaspecificNumberParams) SetContentType(contentType string) {\n\to.ContentType = contentType\n}", "title": "" }, { "docid": "7c65de4af2da6020182dacb1000d92d5", "score": "0.3946978", "text": "func (resp Object) Send(writer http.ResponseWriter) (err error) {\n\twriter.Header().Add(HdrContentLength, strconv.FormatInt(resp.ContentLength, 10))\n\tif resp.ContentType != \"\" {\n\t\twriter.Header().Add(HdrContentType, resp.ContentType)\n\t}\n\t// .Add() canonicalizes ETag to 'Etag'\n\twriter.Header()[HdrETag] = resp.ETag.HeaderValue()\n\twriter.Header().Add(HdrLastModified, resp.LastModified)\n\tif resp.CacheControl != \"\" {\n\t\twriter.Header().Add(HdrCacheControl, resp.CacheControl)\n\t}\n\tfor key, value := range resp.UserDefined {\n\t\twriter.Header().Add(AmzMetaPrefix+key, value)\n\t}\n\tif resp.VersionID != \"\" {\n\t\twriter.Header().Add(AmzVersionID, resp.VersionID)\n\t}\n\n\tif resp.File != nil {\n\t\tif _, err = io.Copy(writer, resp.File); err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = resp.File.Close()\n\t}\n\treturn\n}", "title": "" }, { "docid": "7a2635d3c25440367f476d643d94bcc1", "score": "0.3945121", "text": "func (tc *TestCase) SetContentType(ct string) {\n\tswitch strings.ToLower(ct) {\n\tcase \"json\":\n\t\tct = \"application/json\"\n\tdefault:\n\t\tct = \"application/json\"\n\t}\n\ttc.ContentType = ct\n}", "title": "" }, { "docid": "638c011e3d588866160a847a56126dd2", "score": "0.39418957", "text": "func (o *SoftwareHclMeta) SetContentType(v string) {\n\to.ContentType = &v\n}", "title": "" }, { "docid": "807bea4e0d72c582e33ce940a5349b2b", "score": "0.39276594", "text": "func (o JobConfigurationLoadPtrOutput) CreateDisposition() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobConfigurationLoad) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CreateDisposition\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0637b60b2bfa9759b8e9345065afa662", "score": "0.3917398", "text": "func (c *Context) FileAttachment(filepath, filename string) {\n\tc.Header(\"content-disposition\", fmt.Sprintf(\"attachment; filename=\\\"%s\\\"\", filename))\n\thttp.ServeFile(c.Writer, c.Request, filepath)\n}", "title": "" }, { "docid": "fe9053419fbc8e1f972450d295fe994a", "score": "0.3910535", "text": "func (c *Context) Attachment(srcFile, outName string) {\n\tc.dispositionContent(c.Resp, http.StatusOK, outName, false)\n\tc.FileContent(srcFile)\n}", "title": "" } ]
896eb501bda3f10f2ae5c5e4192e0844
/ Rel updates this request to point to a relative link from resp. Returns false if the link does not exist. Handy for paging.
[ { "docid": "6cf92b638174fc7822ad562090eae6c3", "score": "0.7849241", "text": "func (r *TeamsUpdateInOrgReq) Rel(link RelName, resp *TeamsUpdateInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" } ]
[ { "docid": "08419586c2ed959c7516fc731754bdac", "score": "0.8187518", "text": "func (r *UpdateInOrgReq) Rel(link string, resp *UpdateInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "9c740922db85db3b835b339b3a4e4234", "score": "0.80977225", "text": "func (r *UpdateLegacyReq) Rel(link string, resp *UpdateLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "873a3d05df1c68408424e45e003e7414", "score": "0.809101", "text": "func (r *UpdateImportReq) Rel(link string, resp *UpdateImportResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "7e93e6a1caa77dcac8b4bb0833cb2472", "score": "0.80530983", "text": "func (r *RenderRawReq) Rel(link string, resp *RenderRawResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "c10555b098b28dda79717fd20831a373", "score": "0.79566574", "text": "func (r *GetStatusForOrgReq) Rel(link string, resp *GetStatusForOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "44ec578b297be22c8d4342cb7bce6305", "score": "0.7947051", "text": "func (r *RenderReq) Rel(link string, resp *RenderResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "3c617afab3bfb1d5e1ed514a75a72081", "score": "0.7904695", "text": "func (r *GetImportStatusReq) Rel(link string, resp *GetImportStatusResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "92b0ebcf4c25ec4bd32eae6b84428fd2", "score": "0.78838754", "text": "func (r *StartForOrgReq) Rel(link string, resp *StartForOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "5060be82825b9f13e40fb88af8a92608", "score": "0.7879587", "text": "func (r *UpdateDiscussionInOrgReq) Rel(link string, resp *UpdateDiscussionInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "9e36b3e5810661376ac835fdc55052a3", "score": "0.7858821", "text": "func (r *GetMemberLegacyReq) Rel(link string, resp *GetMemberLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "e9d866618570a285b2f55c74a33f7307", "score": "0.7855315", "text": "func (r *GetLargeFilesReq) Rel(link string, resp *GetLargeFilesResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "003808fc275c777c815f1ff1efee2072", "score": "0.78508747", "text": "func (r *GetLegacyReq) Rel(link string, resp *GetLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "e151d4aa1afdb6dc97a6c42d50f8db38", "score": "0.7802826", "text": "func (r *MapCommitAuthorReq) Rel(link string, resp *MapCommitAuthorResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "07924e172e554ecb844df71dd7e8a1b3", "score": "0.78022975", "text": "func (r *StartImportReq) Rel(link string, resp *StartImportResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "aa1a550e0a3b61eeb4b57d1937d557e1", "score": "0.78005075", "text": "func (r *CreateReq) Rel(link string, resp *CreateResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "40ad40f45e2c727fa4e29f48554aa660", "score": "0.777246", "text": "func (r *DownloadArchiveForOrgReq) Rel(link string, resp *DownloadArchiveForOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "08682a0cdc1aedefa8aab0f5f5731533", "score": "0.7751211", "text": "func (r *UpdateAuthorizationReq) Rel(link string, resp *UpdateAuthorizationResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "b1498a6e1cafb370d52c6b55a1cbe7cb", "score": "0.77485776", "text": "func (r *ListReposLegacyReq) Rel(link string, resp *ListReposLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "a8e182bd771b6657ff3e0ca22759e085", "score": "0.77407837", "text": "func (r *ListReq) Rel(link string, resp *ListResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "7a541cc780f909b340848a1e10337046", "score": "0.77176917", "text": "func (r *CancelImportReq) Rel(link string, resp *CancelImportResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "2a955cace25e619667b5e1d606474773", "score": "0.77109957", "text": "func (r *AddOrUpdateMembershipForUserInOrgReq) Rel(link string, resp *AddOrUpdateMembershipForUserInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "f927940f09de9c440474c5e78ddc8b02", "score": "0.7709666", "text": "func (r *TeamsUpdateLegacyReq) Rel(link RelName, resp *TeamsUpdateLegacyResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "3e078808d265a19e11a926d4c9dbe41a", "score": "0.7704622", "text": "func (r *GetStatusForAuthenticatedUserReq) Rel(link string, resp *GetStatusForAuthenticatedUserResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "2479750ac83294fa11b6f4c8c29d64ad", "score": "0.77040255", "text": "func (r *OrgsUpdateReq) Rel(link RelName, resp *OrgsUpdateResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "2080a0ac97016fa5d691000004d34914", "score": "0.7688899", "text": "func (r *UpdateDiscussionCommentInOrgReq) Rel(link string, resp *UpdateDiscussionCommentInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "2c35dc91b20eecf821b72aac90e50ae6", "score": "0.76866674", "text": "func (r *AddMemberLegacyReq) Rel(link string, resp *AddMemberLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "8acae2ff9a20091f60420468d6470e30", "score": "0.7679674", "text": "func (r *ListForOrgReq) Rel(link string, resp *ListForOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "ee25289cdf8b9e249554fb1d619f57d1", "score": "0.7676133", "text": "func (r *ListReposInOrgReq) Rel(link string, resp *ListReposInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "a3837c3c39fa151becd11b0ea175fec1", "score": "0.76757807", "text": "func (r *OrgsPingWebhookReq) Rel(link RelName, resp *OrgsPingWebhookResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "57d3a831e55ee469d526d4dfca7eaf44", "score": "0.7673512", "text": "func (r *UpdateDiscussionLegacyReq) Rel(link string, resp *UpdateDiscussionLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "0037e43d50c291412421c129497e1fbf", "score": "0.76476604", "text": "func (r *ListChildInOrgReq) Rel(link string, resp *ListChildInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "d1a74bb8e7b5d27333a3d219c3b11b35", "score": "0.7640645", "text": "func (r *GetByNameReq) Rel(link string, resp *GetByNameResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "cad06947425f8bb3562bc632f2fc3801", "score": "0.76344573", "text": "func (r *DeleteLegacyReq) Rel(link string, resp *DeleteLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "8ccb444bb15e452909d26bf868b83337", "score": "0.76116556", "text": "func (r *DeleteInOrgReq) Rel(link string, resp *DeleteInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "d2ce208e3ec47c7113f625f34ca906d2", "score": "0.76094884", "text": "func (r *StartForAuthenticatedUserReq) Rel(link string, resp *StartForAuthenticatedUserResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "3c6710b8e0d0e3681c21fe1e05df1208", "score": "0.7606229", "text": "func (r *AddOrUpdateMembershipForUserLegacyReq) Rel(link string, resp *AddOrUpdateMembershipForUserLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "d947bb9708ccf73b9a7ee5d8aea6b64b", "score": "0.7603985", "text": "func (r *TeamsGetLegacyReq) Rel(link RelName, resp *TeamsGetLegacyResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "d81f35ae6d3dc33e755de967a12d6759", "score": "0.76001394", "text": "func (r *ListProjectsInOrgReq) Rel(link string, resp *ListProjectsInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "3df170f8c92d5c6cbc16bb934490ff13", "score": "0.7579143", "text": "func (r *AddOrUpdateProjectPermissionsInOrgReq) Rel(link string, resp *AddOrUpdateProjectPermissionsInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "f62d4a8896029edb617118930c92ddab", "score": "0.7575154", "text": "func (r *OrgsUpdateWebhookReq) Rel(link RelName, resp *OrgsUpdateWebhookResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "a554bc7b28377653175b7064e0d3dddd", "score": "0.75730044", "text": "func (r *ListReposForOrgReq) Rel(link string, resp *ListReposForOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "75c52dc0fcaaa03486273cdfa4ae9a69", "score": "0.7571813", "text": "func (r *GetGrantReq) Rel(link string, resp *GetGrantResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "c11bd82980473ec1c2e9550bea4f7d8c", "score": "0.7549169", "text": "func (r *GetDiscussionInOrgReq) Rel(link string, resp *GetDiscussionInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "6e377ed2bb4986287a96b1bbad145811", "score": "0.7545587", "text": "func (r *AddOrUpdateRepoPermissionsInOrgReq) Rel(link string, resp *AddOrUpdateRepoPermissionsInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "9cd98affe76a60b133a3787fc14d8d4b", "score": "0.75406396", "text": "func (r *CheckPermissionsForProjectInOrgReq) Rel(link string, resp *CheckPermissionsForProjectInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "0dedf2ba646bd2d2681d9f1063e87e73", "score": "0.7539503", "text": "func (r *GetArchiveForAuthenticatedUserReq) Rel(link string, resp *GetArchiveForAuthenticatedUserResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "f932afaab1802c276898767c0687b623", "score": "0.753939", "text": "func (r *ListMembersInOrgReq) Rel(link string, resp *ListMembersInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "d2534711ec6c17b04d2d5fd19025031e", "score": "0.75370055", "text": "func (r *TeamsListReposLegacyReq) Rel(link RelName, resp *TeamsListReposLegacyResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "15f932e10a4f83e0916616493f1429ba", "score": "0.7524801", "text": "func (r *GetMembershipForUserInOrgReq) Rel(link string, resp *GetMembershipForUserInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "5b268ee18b053e74a7ad8e07c1418910", "score": "0.7524236", "text": "func (r *CheckPermissionsForRepoLegacyReq) Rel(link string, resp *CheckPermissionsForRepoLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "2c1f3c4bc5587880907f999b2df93f6f", "score": "0.7519924", "text": "func (r *TeamsUpdateDiscussionInOrgReq) Rel(link RelName, resp *TeamsUpdateDiscussionInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "6eb4bcb2610f1c81051995f9579d29e4", "score": "0.75184745", "text": "func (r *ListPendingInvitationsInOrgReq) Rel(link string, resp *ListPendingInvitationsInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "2da0150beb34286ab274e436557215a6", "score": "0.7517689", "text": "func (r *GetCommitAuthorsReq) Rel(link string, resp *GetCommitAuthorsResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "ca16ead6fbb7fc6fd3fd75d455e91202", "score": "0.7516304", "text": "func (r *DeleteArchiveForOrgReq) Rel(link string, resp *DeleteArchiveForOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "70c760d5f9c4a8e49fb297e30a38ca17", "score": "0.75085366", "text": "func (r *RemoveRepoLegacyReq) Rel(link string, resp *RemoveRepoLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "d3086bcf39ca517f6c5721b9b00d6520", "score": "0.75069994", "text": "func (r *ListProjectsLegacyReq) Rel(link string, resp *ListProjectsLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "efbcbda12e6f3080fc04851234918030", "score": "0.75055116", "text": "func (r *CheckPermissionsForRepoInOrgReq) Rel(link string, resp *CheckPermissionsForRepoInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "33796c1606d07ce2339d7df9fa053652", "score": "0.74897945", "text": "func (r *UpdateDiscussionCommentLegacyReq) Rel(link string, resp *UpdateDiscussionCommentLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "cf68d6e1b99b103dc14a98ffe4ff391f", "score": "0.74893105", "text": "func (r *RemoveRepoInOrgReq) Rel(link string, resp *RemoveRepoInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "f2e3ef70f7678f7280af9808eb2ed7bf", "score": "0.74889654", "text": "func (r *ListChildLegacyReq) Rel(link string, resp *ListChildLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "0754c2f3e71b5daf2de699fa7bdaaf12", "score": "0.74828935", "text": "func (r *CreateDiscussionInOrgReq) Rel(link string, resp *CreateDiscussionInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "1912a4b5ce36e1bed6fa463a4cf01212", "score": "0.74828535", "text": "func (r *TeamsGetMemberLegacyReq) Rel(link RelName, resp *TeamsGetMemberLegacyResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "a2cc46f5ceccc0610180ae2ffd5b9a8b", "score": "0.74791735", "text": "func (r *AddOrUpdateRepoPermissionsLegacyReq) Rel(link string, resp *AddOrUpdateRepoPermissionsLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "3fec44894980792e9ecdf16d325b077c", "score": "0.74769926", "text": "func (r *CheckPermissionsForProjectLegacyReq) Rel(link string, resp *CheckPermissionsForProjectLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "3cfddf4c820fbc97e50661b4891dcf52", "score": "0.74690276", "text": "func (r *ListIdpGroupsInOrgReq) Rel(link string, resp *ListIdpGroupsInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "8e631d5bb71e0b818056a835eca5234e", "score": "0.74669385", "text": "func (r *ListReposForUserReq) Rel(link string, resp *ListReposForUserResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "6399ae1290a4caaff1ee5ead56570a97", "score": "0.7465912", "text": "func (r *TeamsListReposInOrgReq) Rel(link RelName, resp *TeamsListReposInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "612dcedd6761473479a275cc859f7725", "score": "0.7461084", "text": "func (r *RemoveProjectInOrgReq) Rel(link string, resp *RemoveProjectInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "920b27fc80127d4fef44eeabfd53f020", "score": "0.74522585", "text": "func (r *AddOrUpdateProjectPermissionsLegacyReq) Rel(link string, resp *AddOrUpdateProjectPermissionsLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "95447371296f2529f169024add71a0c0", "score": "0.7443871", "text": "func (r *ListPendingInvitationsLegacyReq) Rel(link string, resp *ListPendingInvitationsLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "6cbe7e056d505f5a42dbde236f7f7bd9", "score": "0.7443321", "text": "func (r *TeamsAddOrUpdateMembershipForUserInOrgReq) Rel(link RelName, resp *TeamsAddOrUpdateMembershipForUserInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "9b32d465ea095d7db14161e84d52b0e0", "score": "0.74311376", "text": "func (r *OrgsGetReq) Rel(link RelName, resp *OrgsGetResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "9b80b66e8101902c7de0ed89b669c492", "score": "0.7426815", "text": "func (r *ListAuthorizationsReq) Rel(link string, resp *ListAuthorizationsResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "2449c734d1c96999012be8cc831e783d", "score": "0.7415133", "text": "func (r *RemoveProjectLegacyReq) Rel(link string, resp *RemoveProjectLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "35c7191014bb84f910800ac3db96ff3d", "score": "0.7414072", "text": "func (r *ListDiscussionsInOrgReq) Rel(link string, resp *ListDiscussionsInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "8ea715a6c6d8d2b59c2b63f928aa6ea4", "score": "0.7413817", "text": "func (r *GetAuthorizationReq) Rel(link string, resp *GetAuthorizationResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "24fa9ed37ca144f041f1afa4aaf2b680", "score": "0.74123085", "text": "func (r *GetMembershipForUserLegacyReq) Rel(link string, resp *GetMembershipForUserLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "f1655f8c908031adcc7a82b4d9a810e2", "score": "0.74110657", "text": "func (r *GetDiscussionLegacyReq) Rel(link string, resp *GetDiscussionLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "1ae35ab313142d89c722ea52b95e7df0", "score": "0.7408134", "text": "func (r *TeamsDeleteInOrgReq) Rel(link RelName, resp *TeamsDeleteInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "c5b1b2d12b276325fdf877f1e71ee59b", "score": "0.74042356", "text": "func (r *TeamsListChildInOrgReq) Rel(link RelName, resp *TeamsListChildInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "59de45329da3625de9e9cf5eada03239", "score": "0.73671913", "text": "func (r *TeamsAddMemberLegacyReq) Rel(link RelName, resp *TeamsAddMemberLegacyResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "261c812f691613712bc6a8dab1b4137d", "score": "0.73632115", "text": "func (r *TeamsDeleteLegacyReq) Rel(link RelName, resp *TeamsDeleteLegacyResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "c4e528e34fa35996eb5b5253ff70e255", "score": "0.7360479", "text": "func (r *ListIdpGroupsForOrgReq) Rel(link string, resp *ListIdpGroupsForOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "de3b54a46d475a6af0be809a2709124d", "score": "0.7358468", "text": "func (r *TeamsCreateReq) Rel(link RelName, resp *TeamsCreateResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "cdd2d0b08d28ce35257f12cf6f3ca9f2", "score": "0.7352353", "text": "func (r *GetDiscussionCommentInOrgReq) Rel(link string, resp *GetDiscussionCommentInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "b2d89d0209f06ab0de75b2582d569549", "score": "0.7352294", "text": "func (r *TeamsListPendingInvitationsInOrgReq) Rel(link RelName, resp *TeamsListPendingInvitationsInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "a9c3e1ea8fb267e926e8332f4dc07f1b", "score": "0.7349933", "text": "func (r *UnlockRepoForOrgReq) Rel(link string, resp *UnlockRepoForOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "a94bc14bc69146b6c291fd272372a97a", "score": "0.7346388", "text": "func (r *TeamsGetMembershipForUserInOrgReq) Rel(link RelName, resp *TeamsGetMembershipForUserInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "87f837ce888d9999ae8b09176c3ec215", "score": "0.73375964", "text": "func (r *OrgsUpdateMembershipForAuthenticatedUserReq) Rel(link RelName, resp *OrgsUpdateMembershipForAuthenticatedUserResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "0271734bf2acf0b7091b578b30aa28f2", "score": "0.7334216", "text": "func (r *ListMembersLegacyReq) Rel(link string, resp *ListMembersLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "6e70ec829c1b243214b9645eba38a068", "score": "0.73306644", "text": "func (r *DeleteGrantReq) Rel(link string, resp *DeleteGrantResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "f69fc3655ea20bed6c87c10202654251", "score": "0.7329807", "text": "func (r *CreateDiscussionLegacyReq) Rel(link string, resp *CreateDiscussionLegacyResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "3f04b98c33ce6c2e794a5224ac14b051", "score": "0.7327324", "text": "func (r *CreateAuthorizationReq) Rel(link string, resp *CreateAuthorizationResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "aac4cf2a08f973aaa5307ccec9587110", "score": "0.7327166", "text": "func (r *CreateDiscussionCommentInOrgReq) Rel(link string, resp *CreateDiscussionCommentInOrgResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "345926d015769b4ce8b077301a01dac5", "score": "0.73084337", "text": "func (r *TeamsGetByNameReq) Rel(link RelName, resp *TeamsGetByNameResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "091e21bb6a71648996df8a23cbbc017b", "score": "0.7305995", "text": "func (r *SetLfsPreferenceReq) Rel(link string, resp *SetLfsPreferenceResponse) bool {\n\tu := getRelLink(resp.HTTPResponse(), link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "2e133fc7e856a68a64d0717d7244a68c", "score": "0.7300063", "text": "func (r *TeamsUpdateDiscussionCommentInOrgReq) Rel(link RelName, resp *TeamsUpdateDiscussionCommentInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "4afeec6973feb7676f7ef9ab9c3ac622", "score": "0.72997713", "text": "func (r *TeamsAddOrUpdateRepoPermissionsInOrgReq) Rel(link RelName, resp *TeamsAddOrUpdateRepoPermissionsInOrgResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "436f3c968e253d1a392ad91350de2cdb", "score": "0.72928685", "text": "func (r *TeamsAddOrUpdateMembershipForUserLegacyReq) Rel(link RelName, resp *TeamsAddOrUpdateMembershipForUserLegacyResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" }, { "docid": "9fd030ad61e0e17d36bf57ebe3c90a98", "score": "0.7291117", "text": "func (r *TeamsListReq) Rel(link RelName, resp *TeamsListResponse) bool {\n\tu := resp.RelLink(link)\n\tif u == \"\" {\n\t\treturn false\n\t}\n\tr._url = u\n\treturn true\n}", "title": "" } ]
e1b3010834eababa95544efc05ffca99
XXX_OneofFuncs is for the internal use of the proto package.
[ { "docid": "b794cf1cb1103cd2d9fc2f7378343cac", "score": "0.0", "text": "func (*DoubleValue) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {\n\treturn _DoubleValue_OneofMarshaler, _DoubleValue_OneofUnmarshaler, _DoubleValue_OneofSizer, []interface{}{\n\t\t(*DoubleValue_Range)(nil),\n\t\t(*DoubleValue_List)(nil),\n\t}\n}", "title": "" } ]
[ { "docid": "15a632de9c9b2d41116ddaa5517e35a9", "score": "0.8907106", "text": "func (*EncapVal) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _EncapVal_OneofMarshaler, _EncapVal_OneofUnmarshaler, _EncapVal_OneofSizer, []interface{}{\n\t\t(*EncapVal_VlanId)(nil),\n\t\t(*EncapVal_MPLSTag)(nil),\n\t\t(*EncapVal_Vnid)(nil),\n\t\t(*EncapVal_QinQ)(nil),\n\t}\n}", "title": "" }, { "docid": "f73bfebe35c6a81469bb61ee26a9ba2b", "score": "0.890579", "text": "func (*FlowL4Info) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _FlowL4Info_OneofMarshaler, _FlowL4Info_OneofUnmarshaler, _FlowL4Info_OneofSizer, []interface{}{\n\t\t(*FlowL4Info_TcpUdpInfo)(nil),\n\t\t(*FlowL4Info_IcmpInfo)(nil),\n\t}\n}", "title": "" }, { "docid": "9aa41694fcc88192eab177f43142f436", "score": "0.8891233", "text": "func (*Msg) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Msg_OneofMarshaler, _Msg_OneofUnmarshaler, _Msg_OneofSizer, []interface{}{\n\t\t(*Msg_Request)(nil),\n\t\t(*Msg_Preprepare)(nil),\n\t\t(*Msg_Prepare)(nil),\n\t\t(*Msg_Commit)(nil),\n\t\t(*Msg_ViewChange)(nil),\n\t\t(*Msg_NewView)(nil),\n\t\t(*Msg_Checkpoint)(nil),\n\t\t(*Msg_Hello)(nil),\n\t}\n}", "title": "" }, { "docid": "da63802d2d088b3c39b33a553e21206c", "score": "0.88697135", "text": "func (*RuleL4Match) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _RuleL4Match_OneofMarshaler, _RuleL4Match_OneofUnmarshaler, _RuleL4Match_OneofSizer, []interface{}{\n\t\t(*RuleL4Match_Ports)(nil),\n\t\t(*RuleL4Match_TypeCode)(nil),\n\t}\n}", "title": "" }, { "docid": "a5288037764ea33a77e820f80ee10b8d", "score": "0.8868073", "text": "func (*Example) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Example_OneofMarshaler, _Example_OneofUnmarshaler, _Example_OneofSizer, []interface{}{\n\t\t(*Example_ImagePayload)(nil),\n\t\t(*Example_TextPayload)(nil),\n\t\t(*Example_VideoPayload)(nil),\n\t\t(*Example_AudioPayload)(nil),\n\t}\n}", "title": "" }, { "docid": "f014e97616bf2688143abaf4ba94f3bb", "score": "0.8863467", "text": "func (*Metric) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Metric_OneofMarshaler, _Metric_OneofUnmarshaler, _Metric_OneofSizer, []interface{}{\n\t\t(*Metric_StringData)(nil),\n\t\t(*Metric_Float32Data)(nil),\n\t\t(*Metric_Float64Data)(nil),\n\t\t(*Metric_Int32Data)(nil),\n\t\t(*Metric_Int64Data)(nil),\n\t\t(*Metric_BytesData)(nil),\n\t\t(*Metric_BoolData)(nil),\n\t\t(*Metric_Uint32Data)(nil),\n\t\t(*Metric_Uint64Data)(nil),\n\t}\n}", "title": "" }, { "docid": "28fd0a0d604415b2eb7dc64f8e800d29", "score": "0.8863115", "text": "func (*Interface) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Interface_OneofMarshaler, _Interface_OneofUnmarshaler, _Interface_OneofSizer, []interface{}{\n\t\t(*Interface_Sub)(nil),\n\t\t(*Interface_Memif)(nil),\n\t\t(*Interface_Afpacket)(nil),\n\t\t(*Interface_Tap)(nil),\n\t\t(*Interface_Vxlan)(nil),\n\t\t(*Interface_Ipsec)(nil),\n\t\t(*Interface_VmxNet3)(nil),\n\t}\n}", "title": "" }, { "docid": "1aecbf6c5776a4b9c32935295a620283", "score": "0.8862988", "text": "func (*Metadata) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Metadata_OneofMarshaler, _Metadata_OneofUnmarshaler, _Metadata_OneofSizer, []interface{}{\n\t\t(*Metadata_DevAddrPrefix)(nil),\n\t\t(*Metadata_AppId)(nil),\n\t\t(*Metadata_AppEui)(nil),\n\t}\n}", "title": "" }, { "docid": "3def40b04f96c65b86deafd01f747513", "score": "0.886209", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_ExecStarted)(nil),\n\t\t(*Message_ExecCompleted)(nil),\n\t\t(*Message_ExecOutput)(nil),\n\t\t(*Message_LogEntry)(nil),\n\t\t(*Message_Error)(nil),\n\t}\n}", "title": "" }, { "docid": "f91b3f8f1e372333988fc646d491cf45", "score": "0.8861827", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_Chunk)(nil),\n\t\t(*Message_Status)(nil),\n\t}\n}", "title": "" }, { "docid": "a7cf97298e79c47aa76dc1457aad1eaf", "score": "0.8859999", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_OpenPayload)(nil),\n\t\t(*Message_ClosePayload)(nil),\n\t\t(*Message_DataPayload)(nil),\n\t}\n}", "title": "" }, { "docid": "1e73e6bdc4dbe562f6de75cb860ebf1e", "score": "0.88558704", "text": "func (*BMRPCRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _BMRPCRequest_OneofMarshaler, _BMRPCRequest_OneofUnmarshaler, _BMRPCRequest_OneofSizer, []interface{}{\n\t\t(*BMRPCRequest_Newaddress)(nil),\n\t\t(*BMRPCRequest_Help)(nil),\n\t\t(*BMRPCRequest_Listaddresses)(nil),\n\t}\n}", "title": "" }, { "docid": "e7b552c69b8d765c5dd2799196ddf21d", "score": "0.88540995", "text": "func (*Interface) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Interface_OneofMarshaler, _Interface_OneofUnmarshaler, _Interface_OneofSizer, []interface{}{\n\t\t(*Interface_Sub)(nil),\n\t\t(*Interface_Memif)(nil),\n\t\t(*Interface_Afpacket)(nil),\n\t\t(*Interface_Tap)(nil),\n\t\t(*Interface_Vxlan)(nil),\n\t\t(*Interface_Ipsec)(nil),\n\t\t(*Interface_VmxNet3)(nil),\n\t\t(*Interface_Bond)(nil),\n\t}\n}", "title": "" }, { "docid": "54184794ae54cbab752baa4021314e8e", "score": "0.88527775", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "54184794ae54cbab752baa4021314e8e", "score": "0.88527775", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "54184794ae54cbab752baa4021314e8e", "score": "0.88527775", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "a8e36c3ee1e9e2dfbd8b18f08459efcd", "score": "0.88480514", "text": "func (*StatTable) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _StatTable_OneofMarshaler, _StatTable_OneofUnmarshaler, _StatTable_OneofSizer, []interface{}{\n\t\t(*StatTable_PodGroup_)(nil),\n\t}\n}", "title": "" }, { "docid": "730aa764b628638cad9a5fb64e79c363", "score": "0.8847366", "text": "func (*Bitmessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Bitmessage_OneofMarshaler, _Bitmessage_OneofUnmarshaler, _Bitmessage_OneofSizer, []interface{}{\n\t\t(*Bitmessage_Text)(nil),\n\t}\n}", "title": "" }, { "docid": "3819054f61d940c175e32c08bb6cce57", "score": "0.88448733", "text": "func (*WriteReq) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _WriteReq_OneofMarshaler, _WriteReq_OneofUnmarshaler, _WriteReq_OneofSizer, []interface{}{\n\t\t(*WriteReq_Name)(nil),\n\t\t(*WriteReq_Blob)(nil),\n\t}\n}", "title": "" }, { "docid": "2e6cc55e7f7e714ec9864d5be4035dd9", "score": "0.8844595", "text": "func (*RunnerMsg) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _RunnerMsg_OneofMarshaler, _RunnerMsg_OneofUnmarshaler, _RunnerMsg_OneofSizer, []interface{}{\n\t\t(*RunnerMsg_Acknowledged)(nil),\n\t\t(*RunnerMsg_ResultStart)(nil),\n\t\t(*RunnerMsg_Data)(nil),\n\t\t(*RunnerMsg_Finished)(nil),\n\t}\n}", "title": "" }, { "docid": "89d124eccb38d010231edc4a21a2a02b", "score": "0.8841944", "text": "func (*DiscoveryInfo) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _DiscoveryInfo_OneofMarshaler, _DiscoveryInfo_OneofUnmarshaler, _DiscoveryInfo_OneofSizer, []interface{}{\n\t\t(*DiscoveryInfo_Inflated)(nil),\n\t\t(*DiscoveryInfo_BlobAdded)(nil),\n\t\t(*DiscoveryInfo_BlobRemoved)(nil),\n\t}\n}", "title": "" }, { "docid": "47ff87b60afa5631aba7f6b252d2281b", "score": "0.8837193", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_Read_)(nil),\n\t\t(*Event_Write_)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.88370156", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.88370156", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.88370156", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "0631f7d9f1b1a40d45c3d8a2104f3f91", "score": "0.88370156", "text": "func (*OpenStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _OpenStatusUpdate_OneofMarshaler, _OpenStatusUpdate_OneofUnmarshaler, _OpenStatusUpdate_OneofSizer, []interface{}{\n\t\t(*OpenStatusUpdate_ChanPending)(nil),\n\t\t(*OpenStatusUpdate_Confirmation)(nil),\n\t\t(*OpenStatusUpdate_ChanOpen)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8835452", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8835452", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8835452", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8835452", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8835452", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "b7e8802516205aa11abbcbd6f329a7e9", "score": "0.8835452", "text": "func (*TwoOneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TwoOneofs_OneofMarshaler, _TwoOneofs_OneofUnmarshaler, _TwoOneofs_OneofSizer, []interface{}{\n\t\t(*TwoOneofs_Field1)(nil),\n\t\t(*TwoOneofs_Field2)(nil),\n\t\t(*TwoOneofs_Field3)(nil),\n\t\t(*TwoOneofs_Field34)(nil),\n\t\t(*TwoOneofs_Field35)(nil),\n\t\t(*TwoOneofs_SubMessage2)(nil),\n\t}\n}", "title": "" }, { "docid": "e70bb2f2b648d0b4d5ef605b2ded03ec", "score": "0.88341135", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_Signin)(nil),\n\t\t(*Message_Chatmsg)(nil),\n\t}\n}", "title": "" }, { "docid": "988a1e94ace79121995acd3874603a33", "score": "0.88305503", "text": "func (*LoggingPayloadData) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _LoggingPayloadData_OneofMarshaler, _LoggingPayloadData_OneofUnmarshaler, _LoggingPayloadData_OneofSizer, []interface{}{\n\t\t(*LoggingPayloadData_Msg)(nil),\n\t\t(*LoggingPayloadData_Raw)(nil),\n\t}\n}", "title": "" }, { "docid": "e7a4f77e12f6d8bff419766486ecd3c9", "score": "0.8830491", "text": "func (*EvalRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _EvalRequest_OneofMarshaler, _EvalRequest_OneofUnmarshaler, _EvalRequest_OneofSizer, []interface{}{\n\t\t(*EvalRequest_ParsedExpr)(nil),\n\t\t(*EvalRequest_CheckedExpr)(nil),\n\t}\n}", "title": "" }, { "docid": "484de4c3021965b31f173e82c22db691", "score": "0.8830415", "text": "func (*Header) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Header_OneofMarshaler, _Header_OneofUnmarshaler, _Header_OneofSizer, []interface{}{\n\t\t(*Header_Version)(nil),\n\t\t(*Header_SourceType)(nil),\n\t\t(*Header_EventType)(nil),\n\t}\n}", "title": "" }, { "docid": "9b6969d52ece94b4d45f856703a555ab", "score": "0.8830316", "text": "func (*ReadModifyWriteRule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ReadModifyWriteRule_OneofMarshaler, _ReadModifyWriteRule_OneofUnmarshaler, _ReadModifyWriteRule_OneofSizer, []interface{}{\n\t\t(*ReadModifyWriteRule_AppendValue)(nil),\n\t\t(*ReadModifyWriteRule_IncrementAmount)(nil),\n\t}\n}", "title": "" }, { "docid": "29763acf7d3006966937f353bde9093a", "score": "0.8829064", "text": "func (*BitmessageRPC) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _BitmessageRPC_OneofMarshaler, _BitmessageRPC_OneofUnmarshaler, _BitmessageRPC_OneofSizer, []interface{}{\n\t\t(*BitmessageRPC_Request)(nil),\n\t\t(*BitmessageRPC_Reply)(nil),\n\t\t(*BitmessageRPC_Push)(nil),\n\t}\n}", "title": "" }, { "docid": "65dba601d0e3b4fe8246837673305b4b", "score": "0.88287365", "text": "func (*SetConfigRequest_Entry) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _SetConfigRequest_Entry_OneofMarshaler, _SetConfigRequest_Entry_OneofUnmarshaler, _SetConfigRequest_Entry_OneofSizer, []interface{}{\n\t\t(*SetConfigRequest_Entry_ValueStr)(nil),\n\t\t(*SetConfigRequest_Entry_ValueInt32)(nil),\n\t\t(*SetConfigRequest_Entry_ValueBool)(nil),\n\t}\n}", "title": "" }, { "docid": "13f4377bf4c755f07d34f978db4226be", "score": "0.8827809", "text": "func (*HealthCheck_Payload) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _HealthCheck_Payload_OneofMarshaler, _HealthCheck_Payload_OneofUnmarshaler, _HealthCheck_Payload_OneofSizer, []interface{}{\n\t\t(*HealthCheck_Payload_Text)(nil),\n\t\t(*HealthCheck_Payload_Binary)(nil),\n\t}\n}", "title": "" }, { "docid": "2f7d91d5840ece9e9cd9f52948b91603", "score": "0.8824382", "text": "func (*FlowKey) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _FlowKey_OneofMarshaler, _FlowKey_OneofUnmarshaler, _FlowKey_OneofSizer, []interface{}{\n\t\t(*FlowKey_IPFlowKey)(nil),\n\t\t(*FlowKey_MACFlowKey)(nil),\n\t}\n}", "title": "" }, { "docid": "a6cf3032d800d171bd9a55ca2ec07098", "score": "0.8824265", "text": "func (*LeafStat) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {\n\treturn _LeafStat_OneofMarshaler, _LeafStat_OneofUnmarshaler, _LeafStat_OneofSizer, []interface{}{\n\t\t(*LeafStat_Classification)(nil),\n\t\t(*LeafStat_Regression)(nil),\n\t}\n}", "title": "" }, { "docid": "d0cd6a80492b3a39bd5d9b705d220ddf", "score": "0.8823733", "text": "func (*Metadata) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Metadata_OneofMarshaler, _Metadata_OneofUnmarshaler, _Metadata_OneofSizer, []interface{}{\n\t\t(*Metadata_GatewayID)(nil),\n\t\t(*Metadata_DevAddrPrefix)(nil),\n\t\t(*Metadata_AppID)(nil),\n\t\t(*Metadata_AppEUI)(nil),\n\t}\n}", "title": "" }, { "docid": "6a3c433823bb2552dbbc60445857f162", "score": "0.88221323", "text": "func (*BitcoinRules) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _BitcoinRules_OneofMarshaler, _BitcoinRules_OneofUnmarshaler, _BitcoinRules_OneofSizer, []interface{}{\n\t\t(*BitcoinRules_Address)(nil),\n\t\t(*BitcoinRules_String_)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.88188404", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.88188404", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.88188404", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "498ef6fcd97b5940b63d9748f9e83bbc", "score": "0.88188404", "text": "func (*PolicyUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PolicyUpdateRequest_OneofMarshaler, _PolicyUpdateRequest_OneofUnmarshaler, _PolicyUpdateRequest_OneofSizer, []interface{}{\n\t\t(*PolicyUpdateRequest_Global)(nil),\n\t\t(*PolicyUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "da625b23c7bd4681aef0779918ef785d", "score": "0.8814617", "text": "func (*TriggerMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TriggerMessage_OneofMarshaler, _TriggerMessage_OneofUnmarshaler, _TriggerMessage_OneofSizer, []interface{}{\n\t\t(*TriggerMessage_Topic)(nil),\n\t\t(*TriggerMessage_Type)(nil),\n\t\t(*TriggerMessage_Event)(nil),\n\t\t(*TriggerMessage_BodyBytes)(nil),\n\t\t(*TriggerMessage_Offset)(nil),\n\t\t(*TriggerMessage_Extensions)(nil),\n\t\t(*TriggerMessage_Uuid)(nil),\n\t\t(*TriggerMessage_Bid)(nil),\n\t}\n}", "title": "" }, { "docid": "18f5a27d13d694f321db607fc4f133e9", "score": "0.8813053", "text": "func (*Params) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Params_OneofMarshaler, _Params_OneofUnmarshaler, _Params_OneofSizer, []interface{}{\n\t\t(*Params_AppCredentials)(nil),\n\t\t(*Params_ApiKey)(nil),\n\t\t(*Params_ServiceAccountPath)(nil),\n\t}\n}", "title": "" }, { "docid": "cd78583990db8e396dd8a664df57985b", "score": "0.8811626", "text": "func (*Component) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Component_OneofMarshaler, _Component_OneofUnmarshaler, _Component_OneofSizer, []interface{}{\n\t\t(*Component_AppengineModule)(nil),\n\t\t(*Component_GkePod)(nil),\n\t}\n}", "title": "" }, { "docid": "8a9222455ac9bf76ad1c5c3b50c3f5a8", "score": "0.88105947", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_Register)(nil),\n\t\t(*Event_Block)(nil),\n\t\t(*Event_ChaincodeEvent)(nil),\n\t\t(*Event_Rejection)(nil),\n\t\t(*Event_Unregister)(nil),\n\t}\n}", "title": "" }, { "docid": "8a9222455ac9bf76ad1c5c3b50c3f5a8", "score": "0.88105947", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_Register)(nil),\n\t\t(*Event_Block)(nil),\n\t\t(*Event_ChaincodeEvent)(nil),\n\t\t(*Event_Rejection)(nil),\n\t\t(*Event_Unregister)(nil),\n\t}\n}", "title": "" }, { "docid": "032bdc3052926055dd014790b8641845", "score": "0.880831", "text": "func (*StateKey) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _StateKey_OneofMarshaler, _StateKey_OneofUnmarshaler, _StateKey_OneofSizer, []interface{}{\n\t\t(*StateKey_Runner_)(nil),\n\t\t(*StateKey_MultimapSideInput_)(nil),\n\t\t(*StateKey_BagUserState_)(nil),\n\t}\n}", "title": "" }, { "docid": "032bdc3052926055dd014790b8641845", "score": "0.880831", "text": "func (*StateKey) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _StateKey_OneofMarshaler, _StateKey_OneofUnmarshaler, _StateKey_OneofSizer, []interface{}{\n\t\t(*StateKey_Runner_)(nil),\n\t\t(*StateKey_MultimapSideInput_)(nil),\n\t\t(*StateKey_BagUserState_)(nil),\n\t}\n}", "title": "" }, { "docid": "93867c3fada9184ecae7aa0fca0fff20", "score": "0.88082665", "text": "func (*InternalRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _InternalRequest_OneofMarshaler, _InternalRequest_OneofUnmarshaler, _InternalRequest_OneofSizer, []interface{}{\n\t\t(*InternalRequest_PutReq)(nil),\n\t\t(*InternalRequest_GetReq)(nil),\n\t\t(*InternalRequest_DeleteReq)(nil),\n\t}\n}", "title": "" }, { "docid": "761e0db642b0e6b685fd148a94d16de6", "score": "0.8808227", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_Transfer)(nil),\n\t\t(*Message_Account)(nil),\n\t}\n}", "title": "" }, { "docid": "e0341f4fb6b4428d870508b3550b7a55", "score": "0.8805944", "text": "func (*VideoAdInfo) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _VideoAdInfo_OneofMarshaler, _VideoAdInfo_OneofUnmarshaler, _VideoAdInfo_OneofSizer, []interface{}{\n\t\t(*VideoAdInfo_InStream)(nil),\n\t}\n}", "title": "" }, { "docid": "ae707b37ffefdca001362f57ce44e110", "score": "0.8805914", "text": "func (*TapEvent) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TapEvent_OneofMarshaler, _TapEvent_OneofUnmarshaler, _TapEvent_OneofSizer, []interface{}{\n\t\t(*TapEvent_Http_)(nil),\n\t}\n}", "title": "" }, { "docid": "ae707b37ffefdca001362f57ce44e110", "score": "0.8805914", "text": "func (*TapEvent) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TapEvent_OneofMarshaler, _TapEvent_OneofUnmarshaler, _TapEvent_OneofSizer, []interface{}{\n\t\t(*TapEvent_Http_)(nil),\n\t}\n}", "title": "" }, { "docid": "ae707b37ffefdca001362f57ce44e110", "score": "0.8805914", "text": "func (*TapEvent) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TapEvent_OneofMarshaler, _TapEvent_OneofUnmarshaler, _TapEvent_OneofSizer, []interface{}{\n\t\t(*TapEvent_Http_)(nil),\n\t}\n}", "title": "" }, { "docid": "ad15292899447faa1fd5d40c3031095a", "score": "0.88056016", "text": "func (*UploadBinaryRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _UploadBinaryRequest_OneofMarshaler, _UploadBinaryRequest_OneofUnmarshaler, _UploadBinaryRequest_OneofSizer, []interface{}{\n\t\t(*UploadBinaryRequest_Key_)(nil),\n\t\t(*UploadBinaryRequest_Chunk_)(nil),\n\t}\n}", "title": "" }, { "docid": "e99ead2257b2a77d6d6a8cdb777ec1c9", "score": "0.88042617", "text": "func (*Metric) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Metric_OneofMarshaler, _Metric_OneofUnmarshaler, _Metric_OneofSizer, []interface{}{\n\t\t(*Metric_I64)(nil),\n\t\t(*Metric_U64)(nil),\n\t\t(*Metric_F64)(nil),\n\t\t(*Metric_String_)(nil),\n\t\t(*Metric_Bool)(nil),\n\t\t(*Metric_Duration)(nil),\n\t}\n}", "title": "" }, { "docid": "4b1f4e211f81fbdc77ef9778fc0ab10e", "score": "0.88038075", "text": "func (*SendBitmessageRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _SendBitmessageRequest_OneofMarshaler, _SendBitmessageRequest_OneofUnmarshaler, _SendBitmessageRequest_OneofSizer, []interface{}{\n\t\t(*SendBitmessageRequest_Text)(nil),\n\t}\n}", "title": "" }, { "docid": "70a9b791248ce4921a339ba90f3f0a7f", "score": "0.88034934", "text": "func (*Service) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Service_OneofMarshaler, _Service_OneofUnmarshaler, _Service_OneofSizer, []interface{}{\n\t\t(*Service_DstPort)(nil),\n\t\t(*Service_IcmpMsgType)(nil),\n\t}\n}", "title": "" }, { "docid": "61cf73183dd6a259c4c51e440c300948", "score": "0.88032365", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_Error)(nil),\n\t\t(*Event_Progress)(nil),\n\t\t(*Event_Match)(nil),\n\t\t(*Event_Pagination)(nil),\n\t}\n}", "title": "" }, { "docid": "a8bc5763de3861f4a3834f8eee821578", "score": "0.8802399", "text": "func (*Config) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {\n\treturn _Config_OneofMarshaler, _Config_OneofUnmarshaler, _Config_OneofSizer, []interface{}{\n\t\t(*Config_Custom)(nil),\n\t\t(*Config_Random)(nil),\n\t\t(*Config_Fixed)(nil),\n\t}\n}", "title": "" }, { "docid": "ce8301a8684bf5c5dd9238a2e4932fb5", "score": "0.880174", "text": "func (*FetchRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _FetchRequest_OneofMarshaler, _FetchRequest_OneofUnmarshaler, _FetchRequest_OneofSizer, []interface{}{\n\t\t(*FetchRequest_TagMatchers)(nil),\n\t}\n}", "title": "" }, { "docid": "737d9100961bf3fcfe3420162c5a6764", "score": "0.87993646", "text": "func (*Wrapper) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Wrapper_OneofMarshaler, _Wrapper_OneofUnmarshaler, _Wrapper_OneofSizer, []interface{}{\n\t\t(*Wrapper_Source)(nil),\n\t\t(*Wrapper_GherkinDocument)(nil),\n\t\t(*Wrapper_Pickle)(nil),\n\t\t(*Wrapper_Attachment)(nil),\n\t\t(*Wrapper_TestCaseStarted)(nil),\n\t\t(*Wrapper_TestStepStarted)(nil),\n\t\t(*Wrapper_TestStepFinished)(nil),\n\t\t(*Wrapper_TestCaseFinished)(nil),\n\t\t(*Wrapper_TestHookStarted)(nil),\n\t\t(*Wrapper_TestHookFinished)(nil),\n\t}\n}", "title": "" }, { "docid": "7e5c7027ad248d50f364ff3f9b3d57c8", "score": "0.8799361", "text": "func (*Message) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) {\n\treturn _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{\n\t\t(*Message_Bigint)(nil),\n\t\t(*Message_EcGroupElement)(nil),\n\t\t(*Message_Status)(nil),\n\t\t(*Message_PedersenFirst)(nil),\n\t\t(*Message_PedersenDecommitment)(nil),\n\t\t(*Message_SchnorrProofData)(nil),\n\t\t(*Message_SchnorrProofRandomData)(nil),\n\t\t(*Message_SchnorrEcProofRandomData)(nil),\n\t\t(*Message_PseudonymsysCaCertificate)(nil),\n\t\t(*Message_PseudonymsysNymGenProofRandomData)(nil),\n\t\t(*Message_PseudonymsysIssueProofRandomData)(nil),\n\t\t(*Message_DoubleBigint)(nil),\n\t\t(*Message_PseudonymsysTransferCredentialData)(nil),\n\t\t(*Message_PseudonymsysCaCertificateEc)(nil),\n\t\t(*Message_PseudonymsysNymGenProofRandomDataEc)(nil),\n\t\t(*Message_PseudonymsysIssueProofRandomDataEc)(nil),\n\t\t(*Message_PseudonymsysTransferCredentialDataEc)(nil),\n\t\t(*Message_SessionKey)(nil),\n\t}\n}", "title": "" }, { "docid": "c1dcb6996e18f98d1348edfe39713d4d", "score": "0.87975067", "text": "func (*StateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _StateRequest_OneofMarshaler, _StateRequest_OneofUnmarshaler, _StateRequest_OneofSizer, []interface{}{\n\t\t(*StateRequest_Get)(nil),\n\t\t(*StateRequest_Append)(nil),\n\t\t(*StateRequest_Clear)(nil),\n\t}\n}", "title": "" }, { "docid": "c1dcb6996e18f98d1348edfe39713d4d", "score": "0.87975067", "text": "func (*StateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _StateRequest_OneofMarshaler, _StateRequest_OneofUnmarshaler, _StateRequest_OneofSizer, []interface{}{\n\t\t(*StateRequest_Get)(nil),\n\t\t(*StateRequest_Append)(nil),\n\t\t(*StateRequest_Clear)(nil),\n\t}\n}", "title": "" }, { "docid": "02ce02f99146b4a00ca49ae4707935b5", "score": "0.8795369", "text": "func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Event_OneofMarshaler, _Event_OneofUnmarshaler, _Event_OneofSizer, []interface{}{\n\t\t(*Event_ResourceHeader)(nil),\n\t\t(*Event_CertAuthority)(nil),\n\t\t(*Event_StaticTokens)(nil),\n\t\t(*Event_ProvisionToken)(nil),\n\t\t(*Event_ClusterName)(nil),\n\t\t(*Event_ClusterConfig)(nil),\n\t\t(*Event_User)(nil),\n\t\t(*Event_Role)(nil),\n\t\t(*Event_Namespace)(nil),\n\t\t(*Event_Server)(nil),\n\t\t(*Event_ReverseTunnel)(nil),\n\t\t(*Event_TunnelConnection)(nil),\n\t\t(*Event_AccessRequest)(nil),\n\t}\n}", "title": "" }, { "docid": "0ebeec7ebf9f585c1da89f9b55ee7851", "score": "0.8795032", "text": "func (*NetworkAddress) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _NetworkAddress_OneofMarshaler, _NetworkAddress_OneofUnmarshaler, _NetworkAddress_OneofSizer, []interface{}{\n\t\t(*NetworkAddress_Ipv4Address)(nil),\n\t\t(*NetworkAddress_Ipv6Address)(nil),\n\t\t(*NetworkAddress_LocalAddress)(nil),\n\t}\n}", "title": "" }, { "docid": "0ebeec7ebf9f585c1da89f9b55ee7851", "score": "0.8795032", "text": "func (*NetworkAddress) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _NetworkAddress_OneofMarshaler, _NetworkAddress_OneofUnmarshaler, _NetworkAddress_OneofSizer, []interface{}{\n\t\t(*NetworkAddress_Ipv4Address)(nil),\n\t\t(*NetworkAddress_Ipv6Address)(nil),\n\t\t(*NetworkAddress_LocalAddress)(nil),\n\t}\n}", "title": "" }, { "docid": "f918744b356ef760d6638dc88c9c4b7b", "score": "0.8792591", "text": "func (*RPC) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _RPC_OneofMarshaler, _RPC_OneofUnmarshaler, _RPC_OneofSizer, []interface{}{\n\t\t(*RPC_Args)(nil),\n\t\t(*RPC_ByteArgs)(nil),\n\t}\n}", "title": "" }, { "docid": "9d5608c41bc2e883cf326f72b2a72538", "score": "0.8791414", "text": "func (*FeeUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _FeeUpdateRequest_OneofMarshaler, _FeeUpdateRequest_OneofUnmarshaler, _FeeUpdateRequest_OneofSizer, []interface{}{\n\t\t(*FeeUpdateRequest_Global)(nil),\n\t\t(*FeeUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "9d5608c41bc2e883cf326f72b2a72538", "score": "0.8791414", "text": "func (*FeeUpdateRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _FeeUpdateRequest_OneofMarshaler, _FeeUpdateRequest_OneofUnmarshaler, _FeeUpdateRequest_OneofSizer, []interface{}{\n\t\t(*FeeUpdateRequest_Global)(nil),\n\t\t(*FeeUpdateRequest_ChanPoint)(nil),\n\t}\n}", "title": "" }, { "docid": "4a1b52388f876d6b6ea9478d5191a4e4", "score": "0.8791351", "text": "func (*ServiceSpec) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ServiceSpec_OneofMarshaler, _ServiceSpec_OneofUnmarshaler, _ServiceSpec_OneofSizer, []interface{}{\n\t\t(*ServiceSpec_Replicated)(nil),\n\t\t(*ServiceSpec_Global)(nil),\n\t}\n}", "title": "" }, { "docid": "4a1b52388f876d6b6ea9478d5191a4e4", "score": "0.8791351", "text": "func (*ServiceSpec) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ServiceSpec_OneofMarshaler, _ServiceSpec_OneofUnmarshaler, _ServiceSpec_OneofSizer, []interface{}{\n\t\t(*ServiceSpec_Replicated)(nil),\n\t\t(*ServiceSpec_Global)(nil),\n\t}\n}", "title": "" }, { "docid": "4a1b52388f876d6b6ea9478d5191a4e4", "score": "0.8791351", "text": "func (*ServiceSpec) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ServiceSpec_OneofMarshaler, _ServiceSpec_OneofUnmarshaler, _ServiceSpec_OneofSizer, []interface{}{\n\t\t(*ServiceSpec_Replicated)(nil),\n\t\t(*ServiceSpec_Global)(nil),\n\t}\n}", "title": "" }, { "docid": "17f7c479094fa79251891c340fcde690", "score": "0.87900233", "text": "func (*TestUTF8) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TestUTF8_OneofMarshaler, _TestUTF8_OneofUnmarshaler, _TestUTF8_OneofSizer, []interface{}{\n\t\t(*TestUTF8_Field)(nil),\n\t}\n}", "title": "" }, { "docid": "17f7c479094fa79251891c340fcde690", "score": "0.87900233", "text": "func (*TestUTF8) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TestUTF8_OneofMarshaler, _TestUTF8_OneofUnmarshaler, _TestUTF8_OneofSizer, []interface{}{\n\t\t(*TestUTF8_Field)(nil),\n\t}\n}", "title": "" }, { "docid": "d97cc839f33ce124efcef04e23cc1cab", "score": "0.8788791", "text": "func (*Eos) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Eos_OneofMarshaler, _Eos_OneofUnmarshaler, _Eos_OneofSizer, []interface{}{\n\t\t(*Eos_GrpcStatusCode)(nil),\n\t\t(*Eos_ResetErrorCode)(nil),\n\t}\n}", "title": "" }, { "docid": "d97cc839f33ce124efcef04e23cc1cab", "score": "0.8788791", "text": "func (*Eos) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Eos_OneofMarshaler, _Eos_OneofUnmarshaler, _Eos_OneofSizer, []interface{}{\n\t\t(*Eos_GrpcStatusCode)(nil),\n\t\t(*Eos_ResetErrorCode)(nil),\n\t}\n}", "title": "" }, { "docid": "539f2a2da132fdae2020b8faafe9ccb8", "score": "0.8788189", "text": "func (*RecordKey) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _RecordKey_OneofMarshaler, _RecordKey_OneofUnmarshaler, _RecordKey_OneofSizer, []interface{}{\n\t\t(*RecordKey_DatastoreKey)(nil),\n\t\t(*RecordKey_BigQueryKey)(nil),\n\t}\n}", "title": "" }, { "docid": "9ed780a2fa990214a2334ce04a45bc3e", "score": "0.8787607", "text": "func (*WatchRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _WatchRequest_OneofMarshaler, _WatchRequest_OneofUnmarshaler, _WatchRequest_OneofSizer, []interface{}{\n\t\t(*WatchRequest_CreateRequest)(nil),\n\t\t(*WatchRequest_CancelRequest)(nil),\n\t}\n}", "title": "" }, { "docid": "29fde8bbdd72f228ec6d4fb653f45f8a", "score": "0.87870103", "text": "func (*Node) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Node_OneofMarshaler, _Node_OneofUnmarshaler, _Node_OneofSizer, []interface{}{\n\t\t(*Node_Src)(nil),\n\t\t(*Node_Snk)(nil),\n\t\t(*Node_ContentHash)(nil),\n\t}\n}", "title": "" }, { "docid": "b76ecaf609a0dfa32064d6dc28dfc55d", "score": "0.8787005", "text": "func (*FeedMapping) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _FeedMapping_OneofMarshaler, _FeedMapping_OneofUnmarshaler, _FeedMapping_OneofSizer, []interface{}{\n\t\t(*FeedMapping_PlaceholderType)(nil),\n\t\t(*FeedMapping_CriterionType)(nil),\n\t}\n}", "title": "" }, { "docid": "13966533c8864303430161700cc38be5", "score": "0.8786366", "text": "func (*Virtual) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Virtual_OneofMarshaler, _Virtual_OneofUnmarshaler, _Virtual_OneofSizer, []interface{}{\n\t\t(*Virtual_Genesis)(nil),\n\t\t(*Virtual_Child)(nil),\n\t\t(*Virtual_Jet)(nil),\n\t\t(*Virtual_IncomingRequest)(nil),\n\t\t(*Virtual_OutgoingRequest)(nil),\n\t\t(*Virtual_Result)(nil),\n\t\t(*Virtual_Type)(nil),\n\t\t(*Virtual_Code)(nil),\n\t\t(*Virtual_Activate)(nil),\n\t\t(*Virtual_Amend)(nil),\n\t\t(*Virtual_Deactivate)(nil),\n\t\t(*Virtual_PendingFilament)(nil),\n\t}\n}", "title": "" }, { "docid": "77543ac8a5f0e6ffc5edb59aff27d6f0", "score": "0.87856686", "text": "func (*CloseStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _CloseStatusUpdate_OneofMarshaler, _CloseStatusUpdate_OneofUnmarshaler, _CloseStatusUpdate_OneofSizer, []interface{}{\n\t\t(*CloseStatusUpdate_ClosePending)(nil),\n\t\t(*CloseStatusUpdate_Confirmation)(nil),\n\t\t(*CloseStatusUpdate_ChanClose)(nil),\n\t}\n}", "title": "" }, { "docid": "77543ac8a5f0e6ffc5edb59aff27d6f0", "score": "0.87856686", "text": "func (*CloseStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _CloseStatusUpdate_OneofMarshaler, _CloseStatusUpdate_OneofUnmarshaler, _CloseStatusUpdate_OneofSizer, []interface{}{\n\t\t(*CloseStatusUpdate_ClosePending)(nil),\n\t\t(*CloseStatusUpdate_Confirmation)(nil),\n\t\t(*CloseStatusUpdate_ChanClose)(nil),\n\t}\n}", "title": "" }, { "docid": "77543ac8a5f0e6ffc5edb59aff27d6f0", "score": "0.87856686", "text": "func (*CloseStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _CloseStatusUpdate_OneofMarshaler, _CloseStatusUpdate_OneofUnmarshaler, _CloseStatusUpdate_OneofSizer, []interface{}{\n\t\t(*CloseStatusUpdate_ClosePending)(nil),\n\t\t(*CloseStatusUpdate_Confirmation)(nil),\n\t\t(*CloseStatusUpdate_ChanClose)(nil),\n\t}\n}", "title": "" }, { "docid": "77543ac8a5f0e6ffc5edb59aff27d6f0", "score": "0.87856686", "text": "func (*CloseStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _CloseStatusUpdate_OneofMarshaler, _CloseStatusUpdate_OneofUnmarshaler, _CloseStatusUpdate_OneofSizer, []interface{}{\n\t\t(*CloseStatusUpdate_ClosePending)(nil),\n\t\t(*CloseStatusUpdate_Confirmation)(nil),\n\t\t(*CloseStatusUpdate_ChanClose)(nil),\n\t}\n}", "title": "" }, { "docid": "90535fbf843f4f054170edba0fdb3f40", "score": "0.8785405", "text": "func (*CloseStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _CloseStatusUpdate_OneofMarshaler, _CloseStatusUpdate_OneofUnmarshaler, _CloseStatusUpdate_OneofSizer, []interface{}{\n\t\t(*CloseStatusUpdate_ClosePending)(nil),\n\t\t(*CloseStatusUpdate_ChanClose)(nil),\n\t}\n}", "title": "" }, { "docid": "90535fbf843f4f054170edba0fdb3f40", "score": "0.8785405", "text": "func (*CloseStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _CloseStatusUpdate_OneofMarshaler, _CloseStatusUpdate_OneofUnmarshaler, _CloseStatusUpdate_OneofSizer, []interface{}{\n\t\t(*CloseStatusUpdate_ClosePending)(nil),\n\t\t(*CloseStatusUpdate_ChanClose)(nil),\n\t}\n}", "title": "" }, { "docid": "90535fbf843f4f054170edba0fdb3f40", "score": "0.8785405", "text": "func (*CloseStatusUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _CloseStatusUpdate_OneofMarshaler, _CloseStatusUpdate_OneofUnmarshaler, _CloseStatusUpdate_OneofSizer, []interface{}{\n\t\t(*CloseStatusUpdate_ClosePending)(nil),\n\t\t(*CloseStatusUpdate_ChanClose)(nil),\n\t}\n}", "title": "" }, { "docid": "23084b9bcfdb5520d0fd6f6c540b5d2e", "score": "0.8784138", "text": "func (*PrintKVRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _PrintKVRequest_OneofMarshaler, _PrintKVRequest_OneofUnmarshaler, _PrintKVRequest_OneofSizer, []interface{}{\n\t\t(*PrintKVRequest_ValueString)(nil),\n\t\t(*PrintKVRequest_ValueInt)(nil),\n\t}\n}", "title": "" }, { "docid": "cd1190d1b6ba655b2728c583ef39b2aa", "score": "0.87823385", "text": "func (*ChannelEventUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ChannelEventUpdate_OneofMarshaler, _ChannelEventUpdate_OneofUnmarshaler, _ChannelEventUpdate_OneofSizer, []interface{}{\n\t\t(*ChannelEventUpdate_OpenChannel)(nil),\n\t\t(*ChannelEventUpdate_ClosedChannel)(nil),\n\t\t(*ChannelEventUpdate_ActiveChannel)(nil),\n\t\t(*ChannelEventUpdate_InactiveChannel)(nil),\n\t}\n}", "title": "" }, { "docid": "cd1190d1b6ba655b2728c583ef39b2aa", "score": "0.87823385", "text": "func (*ChannelEventUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ChannelEventUpdate_OneofMarshaler, _ChannelEventUpdate_OneofUnmarshaler, _ChannelEventUpdate_OneofSizer, []interface{}{\n\t\t(*ChannelEventUpdate_OpenChannel)(nil),\n\t\t(*ChannelEventUpdate_ClosedChannel)(nil),\n\t\t(*ChannelEventUpdate_ActiveChannel)(nil),\n\t\t(*ChannelEventUpdate_InactiveChannel)(nil),\n\t}\n}", "title": "" }, { "docid": "cd1190d1b6ba655b2728c583ef39b2aa", "score": "0.87823385", "text": "func (*ChannelEventUpdate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ChannelEventUpdate_OneofMarshaler, _ChannelEventUpdate_OneofUnmarshaler, _ChannelEventUpdate_OneofSizer, []interface{}{\n\t\t(*ChannelEventUpdate_OpenChannel)(nil),\n\t\t(*ChannelEventUpdate_ClosedChannel)(nil),\n\t\t(*ChannelEventUpdate_ActiveChannel)(nil),\n\t\t(*ChannelEventUpdate_InactiveChannel)(nil),\n\t}\n}", "title": "" } ]
75fc7db3429fd4ec42712fb19695e4fb
GUMIFunction / GUMIRender > Define
[ { "docid": "e9b8b883acddb8c1f6e814f1135bd969", "score": "0.45354187", "text": "func (s *MTDropbox) GUMIRender(frame *image.RGBA) {\n\tvar baseColor, mainColor = s.GetMaterialColor().Color()\n\ts.boxCut = 0\n\ts.boxHeight = mtDropboxElemMargin*(s.Elems.Length()+1) + s.Elems.heightSum()\n\tif s.boxMaximum < s.boxHeight {\n\t\ts.boxCut += s.boxHeight - s.boxMaximum\n\t\ts.boxHeight = s.boxMaximum\n\t}\n\tif s.bound.Max.Y+s.boxHeight > frame.Rect.Max.Y {\n\t\ts.boxCut += (s.bound.Max.Y + s.boxHeight) - frame.Rect.Max.Y\n\t}\n\tvar val = s.stretch.Value()\n\tvar per = s.stretch.Percent()\n\tvar scr = s.scroll.Value()\n\tif val > 0 && s.Elems.Length() > 0 {\n\t\t// TODO : DEFERCALL\n\t\ts.scr.deferRequest(s.deferid, func(rgba *image.RGBA) {\n\t\t\tvar radius = float64(s.bound.Dy()) / 2\n\t\t\t// selecte, background, scrool\n\t\t\tfunc() {\n\t\t\t\tbd := s.bound\n\t\t\t\tbd.Max.Y += int(val)\n\t\t\t\tvar ctx = createContextRGBASub(rgba, bd)\n\t\t\t\ts.style.useContext(ctx)\n\t\t\t\tdefer s.style.releaseContext(ctx)\n\t\t\t\t//\n\t\t\t\tvar w, h = float64(ctx.Width()), float64(ctx.Height())\n\t\t\t\t// background\n\t\t\t\tctx.SetColor(baseColor)\n\t\t\t\tctx.DrawArc(radius, radius, radius, gg.Radians(180), gg.Radians(270))\n\t\t\t\tctx.DrawArc(radius, h-radius, radius, gg.Radians(90), gg.Radians(180))\n\t\t\t\tctx.DrawRectangle(radius-1, 0, w-radius*2+1, h)\n\t\t\t\tctx.DrawArc(w-radius, radius, radius, gg.Radians(-90), gg.Radians(0))\n\t\t\t\tctx.DrawArc(w-radius, h-radius, radius, gg.Radians(0), gg.Radians(90))\n\t\t\t\tctx.Fill()\n\t\t\t\t// outline\n\t\t\t\tctx.SetColor(Scale.Color(baseColor, mainColor, per))\n\t\t\t\tctx.DrawArc(radius, radius, radius, gg.Radians(180), gg.Radians(270))\n\t\t\t\tctx.DrawLine(radius, 0, w-radius, 0)\n\t\t\t\tctx.DrawArc(w-radius, radius, radius, gg.Radians(270), gg.Radians(360))\n\t\t\t\tctx.DrawLine(w, radius, w, h-radius)\n\t\t\t\tctx.DrawArc(w-radius, h-radius, radius, gg.Radians(0), gg.Radians(90))\n\t\t\t\tctx.DrawLine(w-radius, h, radius, h)\n\t\t\t\tctx.DrawArc(radius, h-radius, radius, gg.Radians(90), gg.Radians(180))\n\t\t\t\tctx.DrawLine(0, h-radius, 0, radius)\n\t\t\t\tctx.Stroke()\n\t\t\t\t// selected underline\n\t\t\t\tctx.SetColor(mainColor)\n\t\t\t\tctx.Push()\n\t\t\t\tctx.SetLineWidth(.25)\n\t\t\t\tctx.DrawLine(radius, float64(s.bound.Dy()), w-2*radius, float64(s.bound.Dy()))\n\t\t\t\tctx.Stroke()\n\t\t\t\t//\n\n\t\t\t\tctx.Pop()\n\t\t\t\t// selected\n\t\t\t\tselectedElem := s.Elems.getForDraw(s.selected)\n\t\t\t\tif len(selectedElem.content) > 0 {\n\t\t\t\t\tctx.DrawString(selectedElem.content, radius, (float64(s.bound.Dy())-float64(selectedElem.h))/2+float64(selectedElem.h))\n\t\t\t\t\tctx.Stroke()\n\t\t\t\t}\n\t\t\t\t// scroll\n\n\t\t\t\tpercent := float64(s.boxHeight-s.boxCut) / float64(s.boxHeight)\n\t\t\t\tscroolPercent := scr / float64(s.boxHeight)\n\t\t\t\tif percent < 0 {\n\t\t\t\t\tpercent = 0\n\t\t\t\t}\n\t\t\t\tif percent > 1 {\n\t\t\t\t\tpercent = 1\n\t\t\t\t}\n\n\t\t\t\tctx.DrawArc(w-radius, radius+(scroolPercent)*(h-radius*2), mtDropboxScroolWidth/2, gg.Radians(180), gg.Radians(360))\n\t\t\t\tctx.DrawRectangle(w-radius-mtDropboxScroolWidth/2, radius+(scroolPercent)*(h-radius*2), mtDropboxScroolWidth, percent*(h-radius*2))\n\t\t\t\tctx.DrawArc(w-radius, radius+(scroolPercent)*(h-radius*2)+percent*(h-radius*2), mtDropboxScroolWidth/2, gg.Radians(0), gg.Radians(180))\n\t\t\t\tctx.Fill()\n\t\t\t}()\n\t\t\t// elems, hover\n\t\t\tfunc() {\n\t\t\t\tbd := s.bound\n\t\t\t\tbd.Min.Y = s.bound.Max.Y\n\t\t\t\tbd.Max.Y = s.bound.Max.Y + int(val)\n\t\t\t\tvar ctx = createContextRGBASub(rgba, bd)\n\t\t\t\ts.style.useContext(ctx)\n\t\t\t\tdefer s.style.releaseContext(ctx)\n\t\t\t\tsum := mtDropboxElemMargin\n\t\t\t\tctx.SetColor(mainColor)\n\t\t\t\tfor i, v := range s.Elems.refer() {\n\t\t\t\t\tdrawY := float64(sum+v.h) - float64(s.scroll.Value())\n\t\t\t\t\tctx.DrawString(v.content, radius, drawY)\n\t\t\t\t\tctx.Stroke()\n\t\t\t\t\tif i == s.hover {\n\t\t\t\t\t\tctx.DrawLine(radius, drawY+mtDropboxElemUnderline, radius+float64(v.w), drawY+mtDropboxElemUnderline)\n\t\t\t\t\t\tctx.Stroke()\n\t\t\t\t\t}\n\t\t\t\t\tsum += v.h + mtDropboxElemMargin\n\t\t\t\t}\n\t\t\t}()\n\t\t})\n\t} else {\n\t\ts.scr.deferRequest(s.deferid, nil)\n\t\tvar ctx = createContextRGBASub(frame, s.bound)\n\t\ts.style.useContext(ctx)\n\t\tdefer s.style.releaseContext(ctx)\n\t\t//\n\t\tvar w, h = float64(ctx.Width()), float64(ctx.Height())\n\t\tvar radius = float64(s.bound.Dy()) / 2\n\t\t//\n\t\tctx.SetColor(baseColor)\n\t\tctx.DrawArc(radius, radius, radius, gg.Radians(90), gg.Radians(270))\n\t\tctx.DrawRectangle(radius, 0, w-radius*2, h)\n\t\tctx.DrawArc(w-radius, radius, radius, gg.Radians(-90), gg.Radians(90))\n\t\tctx.Fill()\n\t\t//\n\t\tctx.SetColor(mainColor)\n\t\telem := s.Elems.getForDraw(s.selected)\n\t\tif len(elem.content) > 0 {\n\t\t\tctx.DrawString(elem.content, radius, (h-float64(elem.h))/2+float64(elem.h))\n\t\t\tctx.Stroke()\n\t\t}\n\t\tctx.DrawCircle(w-radius, radius, mtDropboxScroolWidth/2)\n\t\tctx.Fill()\n\t}\n}", "title": "" } ]
[ { "docid": "103c0942c222ea6ba40c158016b9c57c", "score": "0.52167743", "text": "func (s *MTDropbox) GUMIDraw() {\n\ts.GUMIRender(s.frame)\n}", "title": "" }, { "docid": "f9b82957158c214c24d986842b88dd67", "score": "0.51798946", "text": "func (scw *scalewayCloudProvider) GPULabel() string {\n\tklog.V(6).Info(\"GPULabel,called\")\n\treturn GPULabel\n}", "title": "" }, { "docid": "43e16f6ebc098ced04a72208d4694a7e", "score": "0.5102962", "text": "func (u rancherProvider) GPULabel() string {\n\treturn \"gpu-image\"\n}", "title": "" }, { "docid": "e08dcaf9a5f3124dd9aae701f3f11819", "score": "0.50981474", "text": "func fuelGauge(fuel int){\n fmt.Printf(\"There is %v liters of fuel left\", fuel)\n}", "title": "" }, { "docid": "e352619ac4529df6e3f9e3a4ecaeb08b", "score": "0.5002512", "text": "func (azure *AzureCloudProvider) GPULabel() string {\n\treturn GPULabel\n}", "title": "" }, { "docid": "fced70d0649e1f59fb1621d6f5e5fbc3", "score": "0.49961844", "text": "func (ali *aliCloudProvider) GPULabel() string {\n\treturn GPULabel\n}", "title": "" }, { "docid": "eb1a81389dfffed302c0d2fb939e4529", "score": "0.49844006", "text": "func fuelGauge(fuel int) {\n\tfmt.Println(\"Amount of fuel left:\", fuel, \"gallon\")\n}", "title": "" }, { "docid": "0a168141eae3712ff3a196af76823189", "score": "0.4954409", "text": "func (mg *mockGauge) Add(float64) {\n\n}", "title": "" }, { "docid": "9252aa310e9a852e749937d88a3fbaa5", "score": "0.49291277", "text": "func (mg *mockGauge) Inc() {\n\n}", "title": "" }, { "docid": "c7e934bcb9034d608ce595c911584ebe", "score": "0.48735908", "text": "func GenerateGFunction(rm rbac.RoleManager) govaluate.ExpressionFunction {\n\tmemorized := sync.Map{}\n\treturn func(args ...interface{}) (interface{}, error) {\n\t\t// Like all our other govaluate functions, all args are strings.\n\n\t\t// Allocate and generate a cache key from the arguments...\n\t\ttotal := len(args)\n\t\tfor _, a := range args {\n\t\t\taStr := a.(string)\n\t\t\ttotal += len(aStr)\n\t\t}\n\t\tbuilder := strings.Builder{}\n\t\tbuilder.Grow(total)\n\t\tfor _, arg := range args {\n\t\t\tbuilder.WriteByte(0)\n\t\t\tbuilder.WriteString(arg.(string))\n\t\t}\n\t\tkey := builder.String()\n\n\t\t// ...and see if we've already calculated this.\n\t\tv, found := memorized.Load(key)\n\t\tif found {\n\t\t\treturn v, nil\n\t\t}\n\n\t\t// If not, do the calculation.\n\t\t// There are guaranteed to be exactly 2 or 3 arguments.\n\t\tname1, name2 := args[0].(string), args[1].(string)\n\t\tif rm == nil {\n\t\t\tv = name1 == name2\n\t\t} else if len(args) == 2 {\n\t\t\tv, _ = rm.HasLink(name1, name2)\n\t\t} else {\n\t\t\tdomain := args[2].(string)\n\t\t\tv, _ = rm.HasLink(name1, name2, domain)\n\t\t}\n\n\t\tmemorized.Store(key, v)\n\t\treturn v, nil\n\t}\n}", "title": "" }, { "docid": "5b28a6eb67dc8361fe81dc6222d4af42", "score": "0.4855744", "text": "func WriteFunction(info *GiInfo, owner *GiInfo) (g string, c string) {\n\tsymbol := info.GetSymbol()\n\tif blacklist[symbol] || cExports[symbol] {\n\t\treturn\n\t}\n\tcExports[symbol] = true\n\tprefix := GetPrefix(info)\n\n\tflags := info.GetFunctionFlags()\n\targc := info.GetNArgs()\n\targAndRetc := argc\n\tretc := 0\n\n\tfor i := 0; i < argAndRetc; i++ {\n\t\tdir := info.GetArg(i).GetDirection()\n\t\tswitch dir {\n\t\t\tcase In: // default, do nothing\n\t\t\tcase Out: argc-- ; retc++\n\t\t\tcase InOut: retc++\n\t\t}\n\t}\n\n\tvar ownerName string\n\tif owner != nil {\n\t\townerName = owner.GetName()\n\t\tcastFunc(prefix, ownerName, &c)\n\t}\n\n\tg += \"func \"\n\n\treturnType := info.GetReturnType() ; defer returnType.Free()\n\t{\n\t\tctype, cp := CType(returnType)\n\t\tif ctype == \"\" {\n\t\t\treturn \"\", \"\"\n\t\t} else if (ctype == \"gchar\" && cp != \"\" && returnType.GetTag() != ArrayTag) {\n\t\t\t// ???: add this for arrays or not?\n\t\t\tctype = \"const \" + ctype\n\t\t}\n\n\t\tc += ctype + \" \" + cp\n\t}\n\n\tif owner != nil {\n\t\tg += ownerName\n\t}\n\tg += CamelCase(info.GetName()) + \"(\"\n\tc += \"gogi_\" + symbol + \"(\"\n\n\tcParamLine := make([]string, 0)\n\tgParamLine := make([]string, 0)\n\n\tif owner != nil && flags.IsMethod {\n\t\tcParamLine = append(cParamLine, prefix + ownerName + \" *self\")\n\t\tgArg := \"self \"\n\t\tif owner.Type == Struct {\n\t\t\tgArg += \"*\"\n\t\t}\n\t\tgArg += ownerName\n\t\tgParamLine = append(gParamLine, gArg)\n\t}\n\n\tarrayArgs := make([]*GiInfo, 0) // so we can ignore array length parameters\n\tvar arrayLengthMarshal string\n\n\targs := make([]Argument, 0)\n\trets := make([]Argument, 0)\n\targsAndRets := make([]Argument, 0)\n\tfor i := 0; i < argAndRetc; i++ {\n\t\targ := info.GetArg(i)\n\t\tdir := arg.GetDirection()\n\t\ttyp := arg.GetType()\n\t\tgotype, gp := GoType(typ)\n\t\tctype, cp := CType(typ)\n\t\tif gotype == \"\" || ctype == \"\" || blacklist[gotype] {\n\t\t\t// argument failed to marshal\n\t\t\treturn \"\", \"\"\n\t\t}\n\n\t\tarray_length := typ.GetArrayLength()\n\t\tif array_length != -1 {\n\t\t\tarrayArgs = append(arrayArgs, arg)\n\t\t}\n\n\t\tname := arg.GetName()\n\t\tif symbol == \"gtk_init\" && name == \"argv\" {\n\t\t\tfmt.Printf(\"%s (%s):\\n\", name, TypeTagToString(typ.GetTag()))\n\t\t\tfmt.Printf(\"direction: %d\\n\", dir)\n\t\t\tfmt.Printf(\"caller allocates: %t\\n\", arg.IsCallerAllocates())\n\t\t\tfmt.Printf(\"is return value: %t\\n\", arg.IsReturnValue())\n\t\t\tfmt.Printf(\"is optional: %t\\n\", arg.IsOptional())\n\t\t\tfmt.Printf(\"may be null: %t\\n\", arg.MayBeNull())\n\t\t\tfmt.Printf(\"ownership transfer: %d\\n\", arg.GetOwnershipTransfer())\n\t\t\tfmt.Printf(\"is pointer: %t\\n\", arg.GetType().IsPointer())\n\t\t\tfmt.Printf(\"array length: %d\\n\", arg.GetType().GetArrayLength())\n\t\t\tfmt.Printf(\"array fixed size: %d\\n\", arg.GetType().GetArrayFixedSize())\n\t\t\tfmt.Println()\n\t\t}\n\t\tnewArg := Argument{arg,arg.GetType(),dir,name,\"c_\"+name,\"\"}\n\t\targsAndRets = append(argsAndRets, newArg)\n\t\tif dir == In {\n\t\t\targs = append(args, newArg)\n\t\t\tif needsConst(arg, typ, ctype, cp) {\n\t\t\t\tctype = \"const \" + ctype\n\t\t\t}\n\t\t\tgParamLine = append(gParamLine, fmt.Sprintf(\"%s %s\", noKeywords(name), gp + gotype))\n\t\t\tcParamLine = append(cParamLine, fmt.Sprintf(\"%s %s\", ctype, cp + name))\n\t\t} else if dir == Out {\n\t\t\trets = append(rets, newArg)\n\t\t\tcp += \"*\"\n\t\t\tcParamLine = append(cParamLine, fmt.Sprintf(\"%s %s\", ctype, cp + name))\n\t\t} else if dir == InOut {\n\t\t\targs = append(args, newArg)\n\t\t\trets = append(rets, newArg)\n\t\t\tcp += \"*\"\n\t\t\tgParamLine = append(gParamLine, fmt.Sprintf(\"%s %s\", noKeywords(name), gp + gotype))\n\t\t\tcParamLine = append(cParamLine, fmt.Sprintf(\"%s %s\", ctype, cp + name))\n\t\t}\n\t}\n\tvar arrayArgOffset int\n\tfor _, arg := range arrayArgs {\n\t\t// TODO: update this if methods actually become invoked from the object\n\t\ta := arg.GetType().GetArrayLength() + 1 - arrayArgOffset\n\t\tarrayLengthMarshal += fmt.Sprintf(\"\\t%s := len(%s)\\n\", info.GetArg(a-1).GetName(), arg.GetName())\n\t\tgParamLine = append(gParamLine[:a], gParamLine[a+1:]...)\n\t\tarrayArgOffset++\n\t}\n\tif flags.Throws {\n\t\tcParamLine = append(cParamLine, \"GError **error\")\n\t}\n\tg += strings.Join(gParamLine, \", \") + \") \"\n\tc += strings.Join(cParamLine, \", \") + \") \"\n\n\tvar returns bool\n\tif returnType.GetTag() != VoidTag || returnType.IsPointer() {\n\t\tretc++\n\t\trets = append(rets, Argument{nil,returnType,In,\"retval\",\"c_retval\",\"\"})\n\t\treturns = true\n\t}\n\n\tgParamLine = make([]string, 0)\n\tfor i, ret := range rets {\n\t\tretType, retMarshal := MarshalToGo(ret)\n\t\tif retType == \"\" {\n\t\t\treturn \"\", \"\"\n\t\t}\n\t\tif blacklist[strings.Trim(retType, \"*\")] {\n\t\t\treturn \"\", \"\"\n\t\t}\n\t\tgParamLine = append(gParamLine, retType)\n\t\trets[i].marshal = retMarshal\n\t}\n\tif flags.Throws {\n\t\tgParamLine = append(gParamLine, \"error\")\n\t}\n\tif len(gParamLine) > 0 {\n\t\tg += \"(\" + strings.Join(gParamLine, \", \") + \") \"\n\t}\n\n\tg += \"{\\n\"\n\tc += \"{\\n\"\n\n\t// marshal\n\tg += arrayLengthMarshal\n\tfor _, arg := range args {\n\t\tctype, marshal := MarshalToC(arg)\n\t\t// TODO: remove the check for \"C.\", it shouldn't be needed\n\t\tif ctype == \"\" || ctype == \"C.\" {\n\t\t\treturn \"\", \"\"\n\t\t}\n\t\tg += fmt.Sprintf(\"\\tvar %s %s\\n\", arg.cname, ctype)\n\t\tg += fmt.Sprintf(\"\\t%s\\n\", marshal)\n\t}\n\n\tfor i, ret := range rets {\n\t\tif i == len(rets)-1 && returns {\n\t\t\tbreak\n\t\t}\n\t\tif ret.dir == Out {\n\t\t\tctype, cp := CType(ret.typ)\n\t\t\t/*\n\t\t\tif ret.info.IsCallerAllocates() && cp != \"\" {\n\t\t\t\tcp = cp[1:]\n\t\t\t}\n\t\t\t*/\n\t\t\tg += fmt.Sprintf(\"\\tvar %s %sC.%s\\n\", ret.cname, cp, ctype)\n\t\t}\n\t}\n\tif flags.Throws {\n\t\tg += \"\\tvar c_error *C.GError\\n\"\n\t}\n\tg += \"\\t\"\n\tif returns {\n\t\t// TODO: catch and use errno here\n\t\tg += \"c_retval, _ := \"\n\t}\n\n\tgParamLine = make([]string, 0)\n\tif owner != nil && flags.IsMethod {\n\t\tswitch owner.Type {\n\t\t\tcase Object:\n\t\t\t\tgParamLine = append(gParamLine, fmt.Sprintf(\"self.As%s()\", ownerName))\n\t\t\tcase Struct:\n\t\t\t\tgParamLine = append(gParamLine, \"self.ptr\")\n\t\t}\n\t}\n\tfor _, arg := range argsAndRets {\n\t\tname := arg.cname\n\t\tif arg.dir == Out {\n\t\t\tname = \"&\" + name\n\t\t}\n\t\tgParamLine = append(gParamLine, name)\n\t}\n\tif flags.Throws {\n\t\tgParamLine = append(gParamLine, \"&c_error\")\n\t}\n\tg += fmt.Sprintf(\"C.gogi_%s(%s)\\n\", symbol, strings.Join(gParamLine, \", \"))\n\n\tfor _, ret := range rets {\n\t\tg += \"\\t\" + ret.marshal + \"\\n\"\n\t}\n\tif retc > 0 || flags.Throws {\n\t\tgParamLine = make([]string, 0)\n\t\tfor _, ret := range rets {\n\t\t\tgParamLine = append(gParamLine, ret.name)\n\t\t}\n\t\tif flags.Throws {\n\t\t\te := \"GError{Code:(int)((*c_error).code), Message:C.GoString((*C.char)((*c_error).message))}\"\n\t\t\tg += \"\\tif c_error != nil {\\n\"\n\t\t\tg += \"\\t\\treturn \" + strings.Join(append(gParamLine, e), \", \") + \"\\n\"\n\t\t\tg += \"\\t}\\n\"\n\t\t\tg += \"\\treturn \" + strings.Join(append(gParamLine, \"nil\"), \", \") + \"\\n\"\n\t\t} else {\n\t\t\tg += \"\\treturn \" + strings.Join(gParamLine, \", \") + \"\\n\"\n\t\t}\n\t}\n\n\tc += \"\\t\"\n\tif returns {\n\t\tc += \"return \"\n\t}\n\tc += info.GetSymbol()\n\n\tcParamLine = make([]string, 0)\n\tif owner != nil && flags.IsMethod {\n\t\tcParamLine = append(cParamLine, \"self\")\n\t}\n\n\tfor _, arg := range argsAndRets {\n\t\tcParamLine = append(cParamLine, arg.name)\n\t}\n\n\tif flags.Throws {\n\t\tcParamLine = append(cParamLine, \"error\")\n\t}\n\tc += \"(\" + strings.Join(cParamLine, \", \") + \");\\n\"\n\n\tg += \"}\\n\"\n\tc += \"}\\n\"\n\n\treturn\n}", "title": "" }, { "docid": "94419149747480209281e6024cee9863", "score": "0.48425156", "text": "func (mrb *MrbState) DefineGlobalFunction(name string, f MrbFuncT, argc MrbAspec) {\n\tmrb.DefineMethod(mrb.KernelModule(), name, f, argc)\n}", "title": "" }, { "docid": "83da64a4116e35cefa04d335262d06e4", "score": "0.47899398", "text": "func (tcp *TestCloudProvider) GPULabel() string {\n\treturn \"TestGPULabel/accelerator\"\n}", "title": "" }, { "docid": "e19d03272738a870ad9383eb05de355f", "score": "0.47524238", "text": "func (_m *Metrics) Gauge(bucket string, value interface{}) {\n\t_m.Called(bucket, value)\n}", "title": "" }, { "docid": "e8d7618cc6bbaa7d3698ed2f0e5fc745", "score": "0.47386914", "text": "func (_m *MetricsReporter) Gauge(name string, value float64, tags ...monitoring.Tag) {\n\t_va := make([]interface{}, len(tags))\n\tfor _i := range tags {\n\t\t_va[_i] = tags[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, name, value)\n\t_ca = append(_ca, _va...)\n\t_m.Called(_ca...)\n}", "title": "" }, { "docid": "5ac064d508c635a4e02cc028881a8b2e", "score": "0.47260207", "text": "func SVGFeFuncG(renders ...Mounter) *Node {\n\treturn Element(\"feFuncG\", renders...)\n}", "title": "" }, { "docid": "04b0d3df84334b96d565f6e58d85f0c9", "score": "0.4697312", "text": "func (mg *mockGauge) Sub(float64) {\n\n}", "title": "" }, { "docid": "1528f1bd77e956f7c1a3247f33f47210", "score": "0.46743286", "text": "func (w *Worker) UserGPULog(ctx context.Context, period time.Duration) {\n\tcontrolFan := true\n\tif err := w.updateFanControlState(ctx, 1); err != nil {\n\t\tlog.Printf(\"Mine: device %d: error updating fan control state\", w.Device)\n\t\tcontrolFan = false\n\t} else if fanControlState, err := w.getFanControlState(ctx); err != nil {\n\t\tlog.Printf(\"Mine: device %d: error setting GPUFanControlState=1; emrys will not update your fan speed: %v\", w.Device, err)\n\t\tcontrolFan = false\n\t} else if fanControlState != 1 {\n\t\tlog.Printf(\"Mine: device %d: error setting GPUFanControlState=1; emrys will not update your fan speed: please ensure your cards don't overheat. If you would like emrys to control your fans, please visit https://docs.emrys.io/docs/suppliers/installation and follow the instructions under 'GPU cooling'. Please contact support@emrys.io if you think there is a mistake.\", w.Device)\n\t\tcontrolFan = false\n\t}\n\n\t// TODO: may need to dynamically determine number of fans w/ nvidia-settings -q fans or something\n\t// (apparently some cards can have multiple fans (/controllers) per card)\n\t// nvidia-settings -q fans | sed -n 's/\\s*FAN/FAN/p' | wc -l\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-time.After(period):\n\t\t}\n\n\t\ttemp, err := w.gonvmlDevice.Temperature()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Mine: device %d: error getting gpu temperature\", w.Device)\n\t\t}\n\n\t\tfanSpeed, err := w.gonvmlDevice.FanSpeed()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Mine: device %d: error getting gpu fan speed\", w.Device)\n\t\t}\n\n\t\tlog.Printf(\"Mine: device %d: temperature: %v; fan: %v\", w.Device, temp, fanSpeed)\n\n\t\tif controlFan {\n\t\t\tfs := int(fanSpeed)\n\t\t\tvar newFanSpeed int\n\t\t\tif temp > maxTemp {\n\t\t\t\tnewFanSpeed = maxFan\n\t\t\t} else if temp > targetTemp {\n\t\t\t\tnewFanSpeed = fs + incFan\n\t\t\t\tif newFanSpeed > maxFan {\n\t\t\t\t\tnewFanSpeed = maxFan\n\t\t\t\t}\n\t\t\t} else if temp > minTemp {\n\t\t\t\tnewFanSpeed = fs - incFan\n\t\t\t\tif newFanSpeed < minFan {\n\t\t\t\t\tnewFanSpeed = minFan\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewFanSpeed = minFan\n\t\t\t}\n\t\t\tif err := w.updateFan(ctx, newFanSpeed); err != nil {\n\t\t\t\tlog.Printf(\"Mine: device %d: error updating fan speed: %v\", w.Device, err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4c45867d1f993f9abd5c6245aa9903d3", "score": "0.46664953", "text": "func (s *AutoScalerServerApp) GPULabel(ctx context.Context, request *apigrpc.CloudProviderServiceRequest) (*apigrpc.GPULabelReply, error) {\n\tglog.V(5).Infof(\"Call server GPULabel: %v\", request)\n\n\tif request.GetProviderID() != s.Configuration.ProviderID {\n\t\tglog.Errorf(constantes.ErrMismatchingProvider)\n\t\treturn nil, fmt.Errorf(constantes.ErrMismatchingProvider)\n\t}\n\n\treturn &apigrpc.GPULabelReply{\n\t\tResponse: &apigrpc.GPULabelReply_Gpulabel{\n\t\t\tGpulabel: \"\",\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "5f4ac86309129dccddb07d52cad91cd3", "score": "0.4646223", "text": "func (*ANSISQLDriver) Define(k ANSISQLFieldKind, name string) (string, bool) {\n\tv, ok := ansiTypes[k]\n\tif ok {\n\t\tv = fmt.Sprintf(baseTemplate, name, v)\n\t}\n\treturn v, ok\n}", "title": "" }, { "docid": "333cb3a669941a7829779162f57d40e6", "score": "0.46385834", "text": "func Uniform1ui(location int32, v0 uint32) {\n\tC.glowUniform1ui(gpUniform1ui, (C.GLint)(location), (C.GLuint)(v0))\n}", "title": "" }, { "docid": "4cc52e3f60e180c5b361fa0a73022691", "score": "0.4631903", "text": "func (self *RetroFont) _updateUvs() {\n self.Object.Call(\"_updateUvs\")\n}", "title": "" }, { "docid": "deb1ecb0ac6809e0dbd3eb65a85d8596", "score": "0.46316522", "text": "func GlobalFunc() {\n\tfmt2.Println(\"GlobalFunc\")\n}", "title": "" }, { "docid": "da0c5639a92e2538414424c128cc0ab4", "score": "0.4628606", "text": "func (m *ApplicationMutation) Gosum() (r string, exists bool) {\n\tv := m.gosum\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "63cc5a0eb044d828ddff7a46ecdee266", "score": "0.46226144", "text": "func (f Fmt) Fg(c Color) Fmt {\n f.fg = c\n return f\n}", "title": "" }, { "docid": "43819d38ba2b5726f66db78c6d03534a", "score": "0.460401", "text": "func Gauge(name string, value int) {\n\tdriver.Gauge(name, value)\n}", "title": "" }, { "docid": "cdfbb2fedef84402725bf94e33642ada", "score": "0.45904785", "text": "func Refresh() {\n\n}", "title": "" }, { "docid": "93e5e7272ac88bfd2442e390a39aeea5", "score": "0.45784342", "text": "func (t *Ti18n) UserFunc(name string, f func(lang *Tlang) func([]interface{}) []byte) {\n\tfor _, v := range t.lang {\n\t\tv.F[name] = f(v)\n\t}\n}", "title": "" }, { "docid": "5df9b83674851acf2bad5008c047d0e8", "score": "0.45531145", "text": "func updateDataDogGuagefromValue(myNameSpace string, myTag string, myGuage string, myValue float64) bool {\n\t// get a pointer to the datadog agent\n\tddClient, err := statsd.New(\"127.0.0.1:8125\")\n\tdefer ddClient.Close()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to contact DataDog Agent: %v. Check the DataDog agent is installed and running \\n\", err)\n\t\treturn false\n\t}\n\t// prefix every metric with the app name\n\tddClient.Namespace = myNameSpace\n\t// send a tag with every metric\n\tddClient.Tags = append(ddClient.Tags, \"port:\"+myTag)\n\n\t// send value to DataDog agent\n\terr = ddClient.Gauge(myGuage, myValue, nil, 1)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to send new Guage value to DataDog Agent: %v. Check the DataDog agent is installed and running \\n\", err)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "038052be9e67763b509e434da0794a0c", "score": "0.4534845", "text": "func (is *InternalStatser) Gauge(name string, value float64, tags gostatsd.Tags) {\n\tg := &gostatsd.Metric{\n\t\tName: name,\n\t\tValue: value,\n\t\tTags: tags,\n\t\tHostname: is.hostname,\n\t\tType: gostatsd.GAUGE,\n\t}\n\tis.dispatchInternal(g)\n}", "title": "" }, { "docid": "d9ecfd628f396b4bd6bd91ee1b71fbb8", "score": "0.45338395", "text": "func (self *RetroFont) _updateUvsI(args ...interface{}) {\n self.Object.Call(\"_updateUvs\", args)\n}", "title": "" }, { "docid": "810c1d17f18d175c7527f7a6223198d2", "score": "0.45251027", "text": "func Germ(w *mfm.Window) {\n\tme := w.Self()\n\ta := w.Atom()\n\tvar seenGerm bool\n\tswitch {\n\tcase a.Type == nil:\n\t\tif w.Roll(65535) {\n\t\t\tw.Set(newGerm)\n\t\t\tw.Stop()\n\t\t}\n\tcase w.Site() == 0 && germCount.ReadUint64(me) >= 8:\n\t\tw.Set(mfm.Atom{Type: &FernInfo, Value: 0})\n\tcase a.Type.ID == GermInfo.ID:\n\t\tseenGerm = true\n\t\t// w.SetValue(me.Value)\n\t}\n\tif seenGerm {\n\t\tgermCount.CountUint64(&me, 1, 8)\n\t} else {\n\t\tgermCount.CountUint64(&me, 0, 8)\n\t}\n}", "title": "" }, { "docid": "a7fa7a54a5c13c74abbe589be6b2805b", "score": "0.45213675", "text": "func predefined() {\n\n\tvar diameter float64 = 15\n\n\t/* untuk menampung return 2 value maka variabel penampungnya juga harus 2 */\n\tvar area, circumference = calculate2(diameter)\n\n\tfmt.Printf(\"luas lingkaran\\t\\t: %.2f \\n\", area)\n\tfmt.Printf(\"keliling lingkaran\\t: %.2f \\n\", circumference)\n}", "title": "" }, { "docid": "89985de155830f10f7ef06214ee7f21e", "score": "0.45144555", "text": "func (s *BaseMySqlParserListener) EnterUdfFunctionCall(ctx *UdfFunctionCallContext) {}", "title": "" }, { "docid": "82bc50351697c1e1143d936c878023ee", "score": "0.45038357", "text": "func Uniform1uiv(location int32, count int32, value *uint32) {\n\tC.glowUniform1uiv(gpUniform1uiv, (C.GLint)(location), (C.GLsizei)(count), (*C.GLuint)(unsafe.Pointer(value)))\n}", "title": "" }, { "docid": "111aa17ac2af5a21ee6072a3a709ddaf", "score": "0.44936123", "text": "func (is *InternalStatser) Gauge(name string, value float64, tags gostatsd.Tags) {\n\tg := &gostatsd.Metric{\n\t\tName: name,\n\t\tValue: value,\n\t\tTags: tags,\n\t\tSource: is.hostname,\n\t\tRate: 1,\n\t\tType: gostatsd.GAUGE,\n\t}\n\tis.dispatchMetric(g)\n}", "title": "" }, { "docid": "59a7a297ae6dbff2cdf951376866e898", "score": "0.44894317", "text": "func (dh *DiffieHellman) SetgBaseValue(value int) {\n\tfmt.Print(\"-> Setting Base Value... \")\n\tdh.gBaseValue = value\n\tfmt.Println(\"OK\")\n\n}", "title": "" }, { "docid": "e2867190ce02ae43217436c584549585", "score": "0.4483125", "text": "func (m *ServiceHealthIssue) SetFeatureGroup(value *string)() {\n m.featureGroup = value\n}", "title": "" }, { "docid": "6d674af4b408615b284487ae17885ead", "score": "0.44769487", "text": "func (r *Gain) Definition() (name string, inputs []string, outputs []string, parameters []processor.Parameter) {\n\treturn \"Gain\", []string{\"In\",\"Gai\"}, []string{\"Out\"},\n\t[]processor.Parameter{\n\t\tprocessor.Parameter{Name: \"Level\", Min: 0, Max: 2, Default: 1, Value: float32(r.Level)},\n\t}\n}", "title": "" }, { "docid": "e1e78cef5763c7dd7269c205c872d4de", "score": "0.44687304", "text": "func (c *Commands) Guru(args []string, eval *funcGuruEval) interface{} {\n\tdefer nvimutil.Profile(time.Now(), \"Guru\")\n\n\tmode := args[0]\n\tif len(args) > 1 {\n\t\treturn guruHelp(c.Nvim, mode)\n\t}\n\n\tdir := filepath.Dir(eval.File)\n\tdefer c.ctx.SetContext(dir)()\n\n\tdefer func() (err error) {\n\t\tif r := recover(); r != nil {\n\t\t\terr = errors.Errorf(\"guru internal panic.\\nMaybe your set 'g:go#guru#reflection' to 1. Please retry with disable it option.\\nOriginal panic message:\\n\\t%v\", r.(error))\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\treturn nil\n\t}()\n\n\tvar (\n\t\tb nvim.Buffer\n\t\tw nvim.Window\n\t)\n\tc.Pipeline.CurrentBuffer(&b)\n\tc.Pipeline.CurrentWindow(&w)\n\tif err := c.Pipeline.Wait(); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tguruContext := &build.Default\n\n\t// https://github.com/golang/tools/blob/master/cmd/guru/main.go\n\tif eval.Modified != 0 {\n\t\toverlay := make(map[string][]byte)\n\t\tvar buf [][]byte\n\n\t\tc.Pipeline.BufferLines(b, 0, -1, true, &buf)\n\t\tif err := c.Pipeline.Wait(); err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\n\t\toverlay[eval.File] = bytes.Join(buf, []byte{'\\n'})\n\t\tguruContext = buildutil.OverlayContext(guruContext, overlay)\n\t}\n\n\tvar loclist []*nvim.QuickfixError\n\tquery := guru.Query{\n\t\tPos: fmt.Sprintf(\"%s:#%d\", eval.File, eval.Offset),\n\t\tBuild: guruContext,\n\t\tReflection: config.GuruReflection,\n\t}\n\n\tif mode == \"definition\" {\n\t\tobj, err := definition(&query)\n\t\tif err != nil {\n\t\t\treturn nvimutil.ErrorWrap(c.Nvim, errors.WithStack(err))\n\t\t}\n\t\tfname, line, col := nvimutil.SplitPos(obj.ObjPos, eval.Cwd)\n\n\t\tc.Pipeline.Command(\"normal! m'\")\n\t\t// TODO(zchee): should change nvimutil.SplitPos behavior\n\t\tf := strings.Split(obj.ObjPos, \":\")\n\t\tif f[0] != eval.File {\n\t\t\tc.Pipeline.Command(fmt.Sprintf(\"keepjumps edit %s\", pathutil.Rel(eval.Cwd, fname)))\n\t\t}\n\t\tc.Pipeline.SetWindowCursor(w, [2]int{line, col - 1})\n\t\tif err := c.Pipeline.Wait(); err != nil {\n\t\t\treturn nvimutil.ErrorWrap(c.Nvim, errors.WithStack(err))\n\t\t}\n\n\t\treturn c.Nvim.Command(`lclose | normal! zz`)\n\t}\n\n\tvar scope string\n\tswitch c.ctx.Build.Tool {\n\tcase \"go\":\n\t\tpkgID, err := pathutil.PackageID(dir)\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\tscope = pkgID\n\tcase \"gb\":\n\t\tscope = pathutil.GbProjectName(c.ctx.Build.ProjectRoot)\n\t}\n\tquery.Scope = append(query.Scope, filepath.Join(scope, \"...\"))\n\n\tvar (\n\t\toutputMu sync.Mutex\n\t\terr error\n\t)\n\toutput := func(fset *token.FileSet, qr guru.QueryResult) {\n\t\tvar err error\n\t\toutputMu.Lock()\n\t\tdefer outputMu.Unlock()\n\n\t\tres := qr.Result(fset)\n\t\tif loclist, err = parseResult(mode, res, eval.Cwd); err != nil {\n\t\t\terr = errors.WithStack(err)\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tquery.Output = output\n\n\tnvimutil.EchoProgress(c.Nvim, \"Guru\", fmt.Sprintf(\"analysing %s\", mode))\n\tif err := guru.Run(mode, &query); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tif len(loclist) == 0 {\n\t\treturn fmt.Errorf(\"%s not fount\", mode)\n\t}\n\n\tdefer nvimutil.ClearMsg(c.Nvim)\n\tif err := nvimutil.SetLoclist(c.Nvim, loclist); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// jumpfirst or definition mode\n\tif config.GuruJumpFirst {\n\t\tc.Pipeline.Command(`silent ll 1`)\n\t\tc.Pipeline.Command(`normal! zz`)\n\t\treturn c.Pipeline.Wait()\n\t}\n\n\tvar keepCursor bool\n\tif int64(1) == config.GuruKeepCursor[mode] {\n\t\tkeepCursor = true\n\t}\n\treturn nvimutil.OpenLoclist(c.Nvim, w, loclist, keepCursor)\n}", "title": "" }, { "docid": "ef9aa4562219927d9d0e12f7b3aef025", "score": "0.44681063", "text": "func (orb *Orbit) Def(name string, item interface{}) {\n\tobj, _ := orb.Get(\"global\")\n\tobj.Object().Set(name, item)\n\torb.Set(name, item)\n}", "title": "" }, { "docid": "23fc0452b71ec0bc130b2c08542bce00", "score": "0.4464451", "text": "func (self *RetroFont) TEXT_SET6() string{\n return self.Object.Get(\"TEXT_SET6\").String()\n}", "title": "" }, { "docid": "f45a31154d3a1ae149577a828e8f50d1", "score": "0.44625014", "text": "func (p *Parser) parseAggregatorFunction(tok Token, pos Pos, lit string, instruction *Instruction) (*Instruction, error) {\n\top := &FrameworkStatement{}\n\top.pos = pos\n\top.operator = tok\n\top.attributes = make(map[PrefixAttributes]InternalField)\n\top.unNamedAttributes = make(map[int]InternalField)\n\n\tminField := 1\n\tmaxField := 2\n\n\t// Instantiate a single time oprerator\n\tzeroFields := []InternalField{\n\t\t{tokenType: STRING, prefixName: Aggregator, hasPrefixName: true},\n\t\t{tokenType: SUM},\n\t\t{tokenType: DELTA},\n\t\t{tokenType: MEAN},\n\t\t{tokenType: MEDIAN},\n\t\t{tokenType: MIN},\n\t\t{tokenType: MAX},\n\t\t{tokenType: COUNT},\n\t\t{tokenType: STDDEV},\n\t\t{tokenType: STDVAR},\n\t\t{tokenType: FIRST},\n\t\t{tokenType: JOIN},\n\t\t{tokenType: ANDL},\n\t\t{tokenType: ORL},\n\t\t{tokenType: PERCENTILE},\n\t\t{tokenType: LAST}}\n\n\tparamsFields := map[int][]InternalField{0: zeroFields}\n\n\tif tok == WINDOW {\n\t\t// Load first window field\n\t\tpreField := []InternalField{\n\t\t\t{tokenType: INTEGER, prefixName: MapperPre, hasPrefixName: true},\n\t\t\t{tokenType: DURATIONVAL, prefixName: MapperPre, hasPrefixName: true},\n\t\t\t{tokenType: DURATIONVAL, prefixName: MapperSampling, hasPrefixName: true},\n\t\t\t{tokenType: INTEGER, prefixName: MapperPost, hasPrefixName: true},\n\t\t\t{tokenType: DURATIONVAL, prefixName: MapperPost, hasPrefixName: true},\n\t\t\t{tokenType: INTEGER, prefixName: MapperOccurences, hasPrefixName: true},\n\t\t\t{tokenType: INTEGER},\n\t\t\t{tokenType: STRING},\n\t\t\t{tokenType: DURATIONVAL}}\n\n\t\tparamsFields[1] = preField\n\t\tparamsFields[2] = preField\n\t\tparamsFields[3] = preField\n\t\tmaxField = 4\n\t} else {\n\t\tpercentileField := []InternalField{{tokenType: INTEGER}}\n\t\tparamsFields[1] = percentileField\n\t}\n\n\t// Instantiate Mapper with no field expected\n\tfields, err := p.ParseFields(tok.String(), paramsFields, maxField)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Check field size number\n\tif len(fields) < minField {\n\t\terrMessage := fmt.Sprintf(\"The %q function expects at least %d parameter\", tok.String(), minField)\n\t\treturn nil, p.NewTslError(errMessage, pos)\n\t}\n\n\tif tok == CUMULATIVE {\n\t\top.attributes[MapperPre] = InternalField{lit: \"max.tick.sliding.window\", tokenType: INTEGER}\n\t} else {\n\t\top.attributes[MapperPre] = InternalField{lit: \"0\", tokenType: INTEGER}\n\t}\n\top.attributes[MapperPost] = InternalField{lit: \"0\", tokenType: INTEGER}\n\n\t// Index to skip (aggregators parameters)\n\tskippedIndex := make(map[int]bool)\n\n\tfor index, field := range fields {\n\n\t\t// Skip aggregator parameter\n\t\tif _, exists := skippedIndex[index]; exists {\n\t\t\tcontinue\n\t\t}\n\n\t\tif field.hasPrefixName {\n\t\t\top.attributes[field.prefixName] = field\n\t\t\tcontinue\n\t\t}\n\n\t\tif index == 0 {\n\t\t\top.attributes[Aggregator] = field\n\n\t\t\tif field.tokenType == JOIN || field.tokenType == PERCENTILE {\n\n\t\t\t\tvar err error\n\t\t\t\top, skippedIndex, err = p.manageValueAggregator(op, pos, tok, field, fields, index, skippedIndex)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t} else if tok != WINDOW && len(fields) > 1 {\n\t\t\t\terrMessage := fmt.Sprintf(\"Found %q, %q does not expected a field with type %q\", lit, tok.String(), fields[1].tokenType.String())\n\t\t\t\treturn nil, p.NewTslError(errMessage, pos)\n\t\t\t}\n\t\t} else if index == 2 {\n\t\t\tfield.prefixName = MapperPre\n\t\t\tfield.hasPrefixName = true\n\t\t\top.attributes[MapperPre] = field\n\t\t} else if index == 3 {\n\t\t\tfield.prefixName = MapperPost\n\t\t\tfield.hasPrefixName = true\n\t\t\top.attributes[MapperPost] = field\n\t\t}\n\t}\n\n\tinstruction.selectStatement.frameworks = append(instruction.selectStatement.frameworks, *op)\n\treturn instruction, nil\n}", "title": "" }, { "docid": "cca89de3af21a176eda6ed584eaa073f", "score": "0.44518232", "text": "func Level40(d data) {\n\t\n}", "title": "" }, { "docid": "214f25c56e823943cb3bc0d31052600b", "score": "0.44469246", "text": "func bgeu(rs1, rs2, imm uint32) (code uint32) {\n\tcode = (imm>>12&0b1<<6|imm>>5&(1<<6-1))<<25 | rs2<<20 | rs1<<15 | 0b111<<12 | (imm&0b11110|imm>>11&0b1)<<7 | 0b1100011\n\treturn code\n}", "title": "" }, { "docid": "de5818bea5c8d22379972d0f011025e6", "score": "0.44401753", "text": "func (cc *configCC) functionSet() string {\n\tvar functionNames string\n\tfor name := range cc.functionRegistry {\n\t\tif functionNames != \"\" {\n\t\t\tfunctionNames += \", \"\n\t\t}\n\t\tfunctionNames += name\n\t}\n\treturn functionNames\n}", "title": "" }, { "docid": "fb2c90a3ee5a56158e04a0437864bf27", "score": "0.44391143", "text": "func (self *RetroFont) TEXT_SET5() string{\n return self.Object.Get(\"TEXT_SET5\").String()\n}", "title": "" }, { "docid": "f878f2911e779d7d914302fbc28ddc6b", "score": "0.44358742", "text": "func (attr FullGround) attrName() string { return attr.Name }", "title": "" }, { "docid": "3d597e004832f344cc7e5b5803cdd3a1", "score": "0.44327465", "text": "func MEFatigue(col *db.Col, params map[string]interface{}) map[string]interface{} {\n\n\tFatigue := params[\"Fatigue\"].(float64)\n\tCADefeat := params[\"CADefeat\"].(float64)\n\tFF := params[\"FF\"].(float64)\n\tBBM := params[\"BBM\"].(float64)\n\tLostColor := params[\"LostColor\"].(float64)\n\tCFatigue := params[\"CFatigue\"].(float64)\n\tLeadership := params[\"Leadership\"].(float64)\n\tBBOnly := params[\"BBOnly\"].(bool)\n\tTookStandard := params[\"TookStandard\"].(bool)\n\tNoLoss := params[\"NoLoss\"].(bool)\n\tTookSP := params[\"TookSP\"].(bool)\n\tTookST := params[\"TookST\"].(bool)\n\tFirstBlood := params[\"FirstBlood\"].(bool)\n\tForcedMarch := params[\"ForcedMarch\"].(bool)\n\tBonusImpulse := params[\"BonusImpulse\"].(bool)\n\tLeaderKilled := params[\"LeaderKilled\"].(bool)\n\tLeaderWounded := params[\"LeaderWounded\"].(bool)\n\tCorpsCmdKilled := params[\"CorpsCmdKilled\"].(bool)\n\tMud := params[\"Mud\"].(bool)\n\tCold := params[\"Cold\"].(bool)\n\tLastTurn := params[\"LastTurn\"].(bool)\n\n\tparams[\"Dice\"] = \"\"\n\tparams[\"Result\"] = \"\"\n\n\tadder := float64(0)\n\tMods, _ := list.Get(col, \"MEFatigueMod\")\n\tfor _, mod := range Mods.Data.([]interface{}) {\n\t\tmyMod := mod.(map[string]interface{})\n\n\t\tcode := myMod[\"Code\"].(string)\n\t\tval := myMod[\"Value\"].(float64)\n\t\tswitch code {\n\t\tcase \"1ST\":\n\t\t\tif FirstBlood {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"BB\":\n\t\t\tif BBOnly {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"BI\":\n\t\t\tif BonusImpulse {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"BM\":\n\t\t\tadder += val * BBM\n\t\tcase \"CD\":\n\t\t\tadder += val * CADefeat\n\t\tcase \"CF\":\n\t\t\tadder += val * CFatigue\n\t\tcase \"CK\":\n\t\t\tif CorpsCmdKilled {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"EC\":\n\t\t\tif Cold {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"F1\":\n\t\t\tif TookStandard {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"FF\":\n\t\t\tadder += val * FF\n\t\tcase \"FM\":\n\t\t\tif ForcedMarch {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"LK\":\n\t\t\tif LeaderKilled {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"LS\":\n\t\t\tadder += val * LostColor\n\t\tcase \"LW\":\n\t\t\tif LeaderWounded {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"MUD\":\n\t\t\tif Mud {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"NL\":\n\t\t\tif NoLoss {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"S1\":\n\t\t\tif TookSP {\n\t\t\t\tadder += val\n\t\t\t}\n\t\tcase \"TS\":\n\t\t\tif TookST {\n\t\t\t\tadder += val\n\t\t\t}\n\t\t}\n\t}\n\n\tadder += Leadership\n\n\t// Roll the Dice\n\tDice := dice.DieRoll()\n\tTotalDice := Dice + int(adder)\n\tparams[\"Dice\"] = fmt.Sprintf(\"%d +%d (%d)\", Dice, int(adder), TotalDice)\n\n\tparams[\"Result\"] = \"No new Fatigue\"\n\tnewFatigue := 0\n\tif TotalDice >= 11 {\n\t\tif LastTurn {\n\t\t\tparams[\"Result\"] = \"No new fatigue (since incurred last turn)\"\n\t\t} else {\n\t\t\tparams[\"Result\"] = \"Incurs 1 Fatigue Level (since none last turn)\"\n\t\t\tFatigue++\n\t\t\tnewFatigue = 1\n\t\t}\n\t\tif TotalDice >= 15 {\n\t\t\tparams[\"Result\"] = \"Incurs 1 Fatigue Level\"\n\t\t\tFatigue++\n\t\t\tnewFatigue = 1\n\t\t}\n\t}\n\n\tif Fatigue > 4 {\n\t\tFatigue = 4\n\t}\n\tparams[\"Fatigue\"] = Fatigue\n\tparams[\"ResultFatigue\"] = newFatigue\n\tparams[\"LastTurn\"] = newFatigue > 0\n\n\treturn params\n}", "title": "" }, { "docid": "1004548e275ca5c555aeebc76dbae1aa", "score": "0.44326577", "text": "func (c cellphone) gulge() float32 {\n\treturn c.price * float32(c.boomLevel)\n}", "title": "" }, { "docid": "f1fcc620865fb0707d9e4bebef1ac408", "score": "0.4431369", "text": "func addUICRef(ctx *filter.Context, feature *geojson.Feature) {\n\tref := strings.TrimSpace(ctx.Tags[\"uic_ref\"])\n\tif ref == \"\" {\n\t\treturn\n\t}\n\n\tif len(ref) != 7 {\n\t\treturn\n\t}\n\n\ti, err := strconv.Atoi(ref)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfeature.Properties[\"uic_ref\"] = i\n}", "title": "" }, { "docid": "111ba07909bb0f10fd2210d34b58c3b1", "score": "0.44190767", "text": "func Status() {\n}", "title": "" }, { "docid": "79ef7722a54ff8fe55450f6a076cc232", "score": "0.44163492", "text": "func (s *MTDropbox) GUMIUpdate() {\n\t// TODO\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "7078828a1807314d86aaa45ed51fd743", "score": "0.441134", "text": "func (o *StaffRole) UpdateG(ctx context.Context, columns boil.Columns) (int64, error) {\n\treturn o.Update(ctx, boil.GetContextDB(), columns)\n}", "title": "" }, { "docid": "8548414ec3ef406b0d80a3fcfdbc6ac7", "score": "0.44090983", "text": "func (attr Ground) attrName() string { return attr.Name }", "title": "" }, { "docid": "80068c404862644d2efdde4b50666b9d", "score": "0.4402222", "text": "func (c *Client) Gauge(name string, value float64, tags []string, rate float64) error {\n\tstat := fmt.Sprintf(\"%f|g\", value)\n\treturn c.send(name, stat, tags, rate)\n}", "title": "" }, { "docid": "24ee67bfffe9c147450b12b09d8373f6", "score": "0.43979406", "text": "func (r *InMemoryStatsCollector) UpdateGauge(name string, tags map[string]string, value int64) {}", "title": "" }, { "docid": "3555fbed4c9ac981844448f0df5ccad3", "score": "0.4393166", "text": "func (g *Gauge) Set(value float64) {\n\tg.mutex.Lock()\n\tg.value = value\n\tg.eng.Set(g.name, value, g.tags...)\n\tg.mutex.Unlock()\n}", "title": "" }, { "docid": "0b34a27675c631c61548652ebde3d4f5", "score": "0.43897226", "text": "func (o *DMetum) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...)\n}", "title": "" }, { "docid": "aabaed3e233d9a51d4abefc26be44dc7", "score": "0.43840066", "text": "func (wfs *wavefrontSender) Gauge(stat string, value float64, tags ...string) {\n\twfs.s.Gauge(mkStatName(stat, tags), value)\n}", "title": "" }, { "docid": "b68d843e3d082de14fe11c55a66d7330", "score": "0.43818098", "text": "func Define(flow *faasflow.Workflow, context *faasflow.Context) (err error) {\n\tflow.SyncNode().Apply(\"func1\").Apply(\"func2\").\n\t\tModify(func(data []byte) ([]byte, error) {\n\t\t\tdata = []byte(string(data) + \"modifier\")\n\t\t\treturn data, nil\n\t\t})\n\treturn\n}", "title": "" }, { "docid": "2bd2a4db3476c7c31f2389b71ae62c91", "score": "0.4379014", "text": "func (m *metricStage) recordGauge(name string, gauge *metric.Gauges, labels model.LabelSet, v interface{}) {\n\t// If value matching is defined, make sure value matches.\n\tif gauge.Cfg.Value != nil {\n\t\tstringVal, err := getString(v)\n\t\tif err != nil {\n\t\t\tif Debug {\n\t\t\t\tlevel.Debug(m.logger).Log(\"msg\", \"failed to convert extracted value to string, \"+\n\t\t\t\t\t\"can't perform value comparison\", \"metric\", name, \"err\",\n\t\t\t\t\tfmt.Sprintf(\"can't convert %v to string\", reflect.TypeOf(v).String()))\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif *gauge.Cfg.Value != stringVal {\n\t\t\treturn\n\t\t}\n\t}\n\n\tswitch gauge.Cfg.Action {\n\tcase metric.GaugeSet:\n\t\tf, err := getFloat(v)\n\t\tif err != nil || f < 0 {\n\t\t\tif Debug {\n\t\t\t\tlevel.Debug(m.logger).Log(\"msg\", \"failed to convert extracted value to positive float\", \"metric\", name, \"err\", err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgauge.With(labels).Set(f)\n\tcase metric.GaugeInc:\n\t\tgauge.With(labels).Inc()\n\tcase metric.GaugeDec:\n\t\tgauge.With(labels).Dec()\n\tcase metric.GaugeAdd:\n\t\tf, err := getFloat(v)\n\t\tif err != nil || f < 0 {\n\t\t\tif Debug {\n\t\t\t\tlevel.Debug(m.logger).Log(\"msg\", \"failed to convert extracted value to positive float\", \"metric\", name, \"err\", err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgauge.With(labels).Add(f)\n\tcase metric.GaugeSub:\n\t\tf, err := getFloat(v)\n\t\tif err != nil || f < 0 {\n\t\t\tif Debug {\n\t\t\t\tlevel.Debug(m.logger).Log(\"msg\", \"failed to convert extracted value to positive float\", \"metric\", name, \"err\", err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgauge.With(labels).Sub(f)\n\t}\n}", "title": "" }, { "docid": "1bacaf8f1fb8a6ea4660169c012ee642", "score": "0.43748605", "text": "func (m *ServiceHealthIssue) SetFeature(value *string)() {\n m.feature = value\n}", "title": "" }, { "docid": "b3f90ee6fee64ffc0b929873c226c53e", "score": "0.43664312", "text": "func setGlobal(i *interpreter, pkg *ssa.Package, name string, v value) {\n\tif g, ok := i.globals[pkg.Var(name)]; ok {\n\t\t*g = v\n\t\treturn\n\t}\n\tpanic(\"no global variable: \" + pkg.Types.Path() + \".\" + name)\n}", "title": "" }, { "docid": "a063bc1b3821a71140c6743473212c9b", "score": "0.43643844", "text": "func init() {\n\tif err := mb.Registry.AddMetricSet(\"thermostat\", \"status\", New); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "65550163d0eb8d4930a7a6e380c087f4", "score": "0.43630233", "text": "func (o *OperationUintMinOrMax)F(r *Row) error {\n\tv, _ := r.Cell(o.colName)\n\tutype, _ := v.UintType()\n\n\tif utype.Compare(o.Total) == o.cvalue {\n\t\to.Total = utype.Value()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0df668f4d8ff6bbbb08a6b88a7458fea", "score": "0.4362899", "text": "func GetUniformfv(program uint32, location int32, params *float32) {\n\tC.glowGetUniformfv(gpGetUniformfv, (C.GLuint)(program), (C.GLint)(location), (*C.GLfloat)(unsafe.Pointer(params)))\n}", "title": "" }, { "docid": "0fa72568f6d209a542053ac559400d79", "score": "0.43612432", "text": "func wordToUCUMOrDefault(unit string) string {\n\tif promUnit, ok := wordToUCUM[unit]; ok {\n\t\treturn promUnit\n\t}\n\treturn unit\n}", "title": "" }, { "docid": "6b84faa4f35b357a46588ccd823921e5", "score": "0.4355717", "text": "func GNUSyntax(inst Inst) string {\n\treturn \"\"\n}", "title": "" }, { "docid": "21a40bb5a0a1b5e7e69b2d7c724303f2", "score": "0.43499944", "text": "func (e Env) GethashDef(key In, table Value, def Value) (Value, error) {\n\treturn e.Call(\"gethash\", key, table, def)\n}", "title": "" }, { "docid": "698cf3b2ec31e2d007fb4d34cb27f93d", "score": "0.43461293", "text": "func (t AggType) AggFunc() AggFunc {\n\tswitch t {\n\tcase Sum:\n\t\treturn sumAggregator\n\tcase Count:\n\t\treturn countAggregator\n\tcase Min:\n\t\treturn minAggregator\n\tcase Max:\n\t\treturn maxAggregator\n\tcase Replace:\n\t\treturn replaceAggregator\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "c850e35a946419edd306784a15ad9d54", "score": "0.43376297", "text": "func init() {\n\tRegister(\"GRPCOutput\", newSGRPCOutput)\n}", "title": "" }, { "docid": "eb8a3ef8f7ddff6837aad43d2984350e", "score": "0.4337281", "text": "func (attr MinimapColor) attrName() string { return attr.Name }", "title": "" }, { "docid": "a42f0b8380dc733a4df3297fd0d9bca8", "score": "0.43202087", "text": "func generateIntensity() string {\n\trnd := generateNumber(1, 3)\n\tswitch rnd {\n\tcase 1:\n\t\treturn \"Slightly\"\n\tcase 2:\n\t\treturn \"Somewhat\"\n\tcase 3:\n\t\treturn \"Extremely\"\n\t}\n\n\treturn \"Error: generateIntensity()\"\n}", "title": "" }, { "docid": "1f30e1265b01172ab0add96c78006565", "score": "0.43173128", "text": "func ChangingDeclaredGloballyVar() {\r\n\tDeclaredGlobally = \"It's so tight here\"\r\n}", "title": "" }, { "docid": "c10ff57eb855e1adb692d2e96f056e03", "score": "0.43149376", "text": "func (o *PersonI18n) UserG(mods ...qm.QueryMod) userQuery {\n\treturn o.User(boil.GetDB(), mods...)\n}", "title": "" }, { "docid": "9126cbbab1cade744680c94b385120ef", "score": "0.43072626", "text": "func Allium() FlowerType {\n\treturn FlowerType{flower(3)}\n}", "title": "" }, { "docid": "55f591f447ff4c451f7f84b688fd23b8", "score": "0.43063545", "text": "func (o *RoleCommand) UpdateG(ctx context.Context, columns boil.Columns) (int64, error) {\n\treturn o.Update(ctx, boil.GetContextDB(), columns)\n}", "title": "" }, { "docid": "a619a758ecd0c6cc5ad85e1ab6c96021", "score": "0.4299989", "text": "func G(name string, tags ...Tag) *Gauge {\n\treturn DefaultEngine.Gauge(name, tags...)\n}", "title": "" }, { "docid": "78b2edf47373b0d4ac152e8fcdbf9724", "score": "0.42931807", "text": "func Level30(d data) {\n\t\n}", "title": "" }, { "docid": "3ce75a5eff39b2b1bf924ebb3b4d0a13", "score": "0.4291471", "text": "func (fn *GaussDecayFunction) Name() string {\n\treturn \"gauss\"\n}", "title": "" }, { "docid": "2e69a0f7da7f5a24d2e41030988d15eb", "score": "0.4290394", "text": "func (self *RetroFont) TEXT_SET10() string{\n return self.Object.Get(\"TEXT_SET10\").String()\n}", "title": "" }, { "docid": "1e00c3d243507601963a6e59fb9fe881", "score": "0.42889416", "text": "func (g *Gauge) Add(value float64) {\n\tg.mutex.Lock()\n\tg.value += value\n\tg.eng.Set(g.name, g.value, g.tags...)\n\tg.mutex.Unlock()\n}", "title": "" }, { "docid": "0bf6d6d7de13751e4ae1f6ee951ff2ae", "score": "0.42886937", "text": "func Uniform2uiv(location int32, count int32, value *uint32) {\n\tC.glowUniform2uiv(gpUniform2uiv, (C.GLint)(location), (C.GLsizei)(count), (*C.GLuint)(unsafe.Pointer(value)))\n}", "title": "" }, { "docid": "a737d2211857089a6924a873b66d7295", "score": "0.4287536", "text": "func DefineWorkFlow() {\n\n}", "title": "" }, { "docid": "84ac586a1a210b7f30e69a0cc6c369be", "score": "0.4286383", "text": "func StructFunc() {\n\tinterests := []string{\"k8s\", \"go\", \"java\", \"spring\", \"aws\"}\n\tndg := syntax.CreateUsers(\"남동길\", 30, interests)\n\tfmt.Println(ndg)\n}", "title": "" }, { "docid": "2e569c5c45673539aff68330f26ac24d", "score": "0.4285285", "text": "func (self *RetroFont) TEXT_SET4() string{\n return self.Object.Get(\"TEXT_SET4\").String()\n}", "title": "" }, { "docid": "8a43b2ad30369b6cb30e300256167fff", "score": "0.42852268", "text": "func (self *RetroFont) TEXT_SET7() string{\n return self.Object.Get(\"TEXT_SET7\").String()\n}", "title": "" }, { "docid": "acafce8becb03070993956f71e2904a7", "score": "0.42847434", "text": "func (col *PdfColorDeviceRGB) G() float64 {\n\treturn float64(col[1])\n}", "title": "" }, { "docid": "b70a61e069dad51d1f92c110638388a4", "score": "0.42834926", "text": "func getGravConst(name Gravity) (grav GravConst) {\n\tswitch name {\n\tcase GravityWGS72Old:\n\t\tgrav.mu = 398600.79964\n\t\tgrav.radiusearthkm = 6378.135\n\t\tgrav.xke = 0.0743669161\n\t\tgrav.tumin = 1.0 / grav.xke\n\t\tgrav.j2 = 0.001082616\n\t\tgrav.j3 = -0.00000253881\n\t\tgrav.j4 = -0.00000165597\n\t\tgrav.j3oj2 = grav.j3 / grav.j2\n\tcase GravityWGS72:\n\t\tgrav.mu = 398600.8\n\t\tgrav.radiusearthkm = 6378.135\n\t\tgrav.xke = 60.0 / math.Sqrt(grav.radiusearthkm*grav.radiusearthkm*grav.radiusearthkm/grav.mu)\n\t\tgrav.tumin = 1.0 / grav.xke\n\t\tgrav.j2 = 0.001082616\n\t\tgrav.j3 = -0.00000253881\n\t\tgrav.j4 = -0.00000165597\n\t\tgrav.j3oj2 = grav.j3 / grav.j2\n\tcase GravityWGS84:\n\t\tgrav.mu = 398600.5\n\t\tgrav.radiusearthkm = 6378.137\n\t\tgrav.xke = 60.0 / math.Sqrt(grav.radiusearthkm*grav.radiusearthkm*grav.radiusearthkm/grav.mu)\n\t\tgrav.tumin = 1.0 / grav.xke\n\t\tgrav.j2 = 0.00108262998905\n\t\tgrav.j3 = -0.00000253215306\n\t\tgrav.j4 = -0.00000161098761\n\t\tgrav.j3oj2 = grav.j3 / grav.j2\n\tdefault:\n\t\tlog.Fatal(name, \"is not a valid gravity model\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "1ced8b94852a0a06bec80757441fc140", "score": "0.4280136", "text": "func (p PumaPlugin) GraphDefinition() map[string]mp.Graphs {\n\tgraphdef := graphdefStats\n\n\tif p.Single == true {\n\t\tgraphdef = graphdefStatsSingle\n\t}\n\n\tif p.WithGC == false {\n\t\treturn graphdef\n\t}\n\n\tfor k, v := range graphdefGC {\n\t\tgraphdef[k] = v\n\t}\n\treturn graphdef\n}", "title": "" }, { "docid": "5bb2af35a7c60020e776b6e0d130021d", "score": "0.42800254", "text": "func (r *RG) Float(min, max float64, precision int) float64 {\n\tv := min + rand.Float64()*(max-min)\n\tr.sb.WriteString(strconv.FormatFloat(v, 'f', precision, 64))\n\tr.Space()\n\treturn v\n}", "title": "" }, { "docid": "d8349ec43266858e8d7218dc6b7cfae8", "score": "0.42780295", "text": "func Uniform4ui(location int32, v0 uint32, v1 uint32, v2 uint32, v3 uint32) {\n\tC.glowUniform4ui(gpUniform4ui, (C.GLint)(location), (C.GLuint)(v0), (C.GLuint)(v1), (C.GLuint)(v2), (C.GLuint)(v3))\n}", "title": "" }, { "docid": "e3c4ff6a1a96f3ca5f80d84fbe686686", "score": "0.4277341", "text": "func (r *Function) Default() {\n}", "title": "" }, { "docid": "b81ccd9229f97ec7b8964054edcb1452", "score": "0.42764643", "text": "func (f FPGAConfigured) Number() uint8 { return uint8(f) }", "title": "" }, { "docid": "5e88aaf29f0ae872430fe60bc8e4c5da", "score": "0.42736307", "text": "func (s *LVertical) GUMISize() gcore.Size {\n\tvar minMax, sum uint16 = 0, 0\n\tfor _, v := range s.child{\n\t\tsz := v.GUMISize()\n\t\tif sz.Horizontal.Min > minMax{\n\t\t\tminMax = sz.Horizontal.Min\n\t\t}\n\t\tsum += sz.Vertical.Min\n\t}\n\treturn gcore.Size{\n\t\tgcore.MinLength(sum),\n\t\tgcore.MinLength(minMax),\n\t}\n}", "title": "" }, { "docid": "1968c791c1b91f436f4163f75638cabe", "score": "0.427331", "text": "func (f *Function) Update(g *Function) error {\n\t// lock both f and g\n\n\tg.Lock() // write lock\n\tdefer g.Unlock()\n\tf.RLock() // read lock\n\tdefer f.RUnlock()\n\n\t// DEBUGGING\n\t// fmt.Printf(\"read lock %s write lock %s\\n\", f.Name, g.Name)\n\t// defer fmt.Printf(\"releasing read %s write %s\\n\", f.Name, g.Name)\n\n\tvar pf = FunctionsToPath(f)\n\tvar pgf = FunctionsToPath(g, f)\n\n\t// 1) If f is a child of g, try to match g's call to f with the declaration\n\t// of f\n\tif f.Parents[g] {\n\t\t// match f() with g(f())\n\t\tfor funcarg, typevar := range f.Atlas[pf] {\n\t\t\t/*if g.Atlas[pgf][funcarg] == nil {\n\t\t\t\tfmt.Printf(\"%+v %+v %+v %+v %+v %+v\\n\", funcarg, typevar, pgf, g.Name, f.Name, g.Atlas[pgf][funcarg])\n\t\t\t}*/\n\t\t\terr := g.updateTypevar(pgf, funcarg, f, typevar)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Replace any type variables that f has replaced elsewhere before.\n\t// This way, type variables \"trickle up\" the call tree\n\tfor path, atlasentry := range g.Atlas {\n\t\tfor funcarg, typevar := range atlasentry {\n\t\t\tif f.TypeVarMap[typevar] != nil {\n\t\t\t\terr := g.updateTypevar(path, funcarg, f, f.TypeVarMap[typevar])\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\tfor tv, typ := range f.TypeMap {\n\t\tif g.TypeMap[tv] == nil && typ != nil{\n\t\t\tg.TypeMap[tv] = typ\n\t\t}\n\t}\n\n\t// merge error types: E_g = E_g union E_f\n\tfor errorType := range f.Errors {\n\t\tg.Errors[errorType] = true\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "71852fd81725675c3657e03a8edaa05c", "score": "0.42702514", "text": "func (self *RetroFont) TEXT_SET9() string{\n return self.Object.Get(\"TEXT_SET9\").String()\n}", "title": "" }, { "docid": "97b1122cfb7f7d6eb34e1df6dcb2f7c8", "score": "0.4269573", "text": "func (s *MTButton) GUMISize() gcore.Size {\n\n\ts.style.Default.Font.Use()\n\tdefer s.style.Default.Font.Release()\n\tvar hori, vert = s.style.Default.Font.CalculateSize(s.text)\n\t//\n\treturn gcore.Size{\n\t\tVertical: gcore.MinLength(uint16(vert + mtButtonMinPadding*2)),\n\t\tHorizontal: gcore.MinLength(uint16(hori + mtButtonMinPadding*2)),\n\t}\n}", "title": "" }, { "docid": "7aaa802498be24bcfc1d62609e8d0c96", "score": "0.426951", "text": "func (p UWSGIVassalPlugin) GraphDefinition() map[string]mp.Graphs {\n\tlabelPrefix := cases.Title(language.Und, cases.NoLower).String(p.Prefix)\n\n\tvar graphdef = map[string]mp.Graphs{\n\t\t(p.Prefix + \".workers\"): {\n\t\t\tLabel: labelPrefix + \" Workers\",\n\t\t\tUnit: \"integer\",\n\t\t\tMetrics: []mp.Metrics{\n\t\t\t\t{Name: \"busy\", Label: \"Busy\", Diff: false, Stacked: true},\n\t\t\t\t{Name: \"idle\", Label: \"Idle\", Diff: false, Stacked: true},\n\t\t\t\t{Name: \"cheap\", Label: \"Cheap\", Diff: false, Stacked: true},\n\t\t\t\t{Name: \"pause\", Label: \"Pause\", Diff: false, Stacked: true},\n\t\t\t},\n\t\t},\n\t\t(p.Prefix + \".req\"): {\n\t\t\tLabel: labelPrefix + \" Requests\",\n\t\t\tUnit: \"float\",\n\t\t\tMetrics: []mp.Metrics{\n\t\t\t\t{Name: \"requests\", Label: \"Requests\", Diff: true},\n\t\t\t},\n\t\t},\n\t}\n\n\treturn graphdef\n}", "title": "" } ]
4fe6111e010a36889d9ea9f03cbe60af
Delete controller, delegates to PlayerDAO for database deletion
[ { "docid": "f53b995da81591e0a23d56999aa0411d", "score": "0.7656864", "text": "func DeletePlayer(w http.ResponseWriter, r *http.Request) {\n\t//----------------------------------------------------------------------------\n\t// Retrieve the parameter from the request using hte mux\n\t//----------------------------------------------------------------------------\n\tvars := mux.Vars(r)\n\t\n\t//----------------------------------------------------------------------------\n\t// Locate the value for the ID key\n\t//----------------------------------------------------------------------------\t\n\tid := vars[\"id\"]\n\n\t//----------------------------------------------------------------------------\n\t// Parse the value into an integer if provided as such\n\t//----------------------------------------------------------------------------\t\n\tID, err:= strconv.ParseUint(id, 10, 64)\n\tif err != nil {\n\t\tfmt.Println(\"Error while parsing\")\n\t}\n\n\t//----------------------------------------------------------------------------\n\t// Delegate to the Player data access object\n\t// delete the one with the matching identifier\n\t//----------------------------------------------------------------------------\t\n\trequestResult := PlayerDAO.DeletePlayer(ID)\n\n\t//----------------------------------------------------------------------------\n\t// Marshal the model into a JSON object\n\t//----------------------------------------------------------------------------\n\tres, _ := json.Marshal(requestResult)\n\t\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(res)\n}", "title": "" } ]
[ { "docid": "5a4f8057530143ba45220d880e6a6984", "score": "0.7226767", "text": "func (h *Handle) DeletePlayer(w http.ResponseWriter, r *http.Request) {\n\tplayer, ok := h.getPlayer(w, r)\n\tif !ok {\n\t\treturn\n\t}\n\n\tif err := h.Repository.Delete(player.ID); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "fa44667ddefd2857ef5c9b33cdb92427", "score": "0.7032312", "text": "func (player *Player) Delete() {\n\tdatabase.Connection.Delete(&player)\n}", "title": "" }, { "docid": "950ee19767a50847d4be0a192169de25", "score": "0.6883784", "text": "func DeletePlayerEndpoint(w http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\n\tfor i, item := range DB {\n\t\tif strings.ToLower(item.Username) == strings.ToLower(params[\"name\"]) {\n\t\t\tDB = append(DB[:i], DB[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "6cbe9ede82274c17b203889bbcfe80ed", "score": "0.6857445", "text": "func DeletePlayer(c *gin.Context) {\n\n}", "title": "" }, { "docid": "022abb84dc20ac9269c62b9223fbb0c0", "score": "0.6800716", "text": "func DeletePlayer(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t// parse the id from the url\n\tparams := mux.Vars(r)\n\tid, err := strconv.Atoi(params[\"id\"])\n\tif err != nil {\n\t\thttpBadRequest(w, err)\n\t\treturn\n\t}\n\n\t// check to see if the player is already there.\n\texistingPlayer, err := dbGetPlayerByID(id)\n\tif err != nil {\n\t\tif err == ErrNoPlayer {\n\t\t\t// expected error indicating there is no player.\n\t\t\t// TODO: Security through obscurity - we shouldn't return a different error message.\n\t\t\thttpError(w, http.StatusUnprocessableEntity, Exception{Code: 105, Message: \"Invalid player\"})\n\t\t\treturn\n\t\t}\n\n\t\t// some other error went down.\n\t\thttpUnknownError(w, err)\n\t\treturn\n\t}\n\n\tif !VerifyPlayerEmail(w, r, existingPlayer.Email) {\n\t\treturn\n\t}\n\n\t// deactivate player.\n\texistingPlayer.Active = false\n\n\t// TODO: Audit\n\terr = dbUpdatePlayer(existingPlayer)\n\tif err != nil {\n\t\t// some other error went down.\n\t\thttpUnknownError(w, err)\n\t\treturn\n\t}\n\n\t// successfully updated! Return the newly created player, or should we just return their ID?\n\tlog.Printf(\"Deactivated player: %s\\n\", existingPlayer.ToString())\n\tjson.NewEncoder(w).Encode(existingPlayer)\n}", "title": "" }, { "docid": "660a10d20c30727bdd9acdeec3f5a9a1", "score": "0.67320675", "text": "func (s *Server) Delete(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r) //vars will store parameters from URL\n\tID := vars[\"id\"]\n\n\t//Delete Query for database\n\t_, err := s.dbConn.Exec(\"DELETE FROM goals.main WHERE uid=?\", ID)\n\tif err != nil {\n\t\tfmt.Println(\"problem with deleting goals index from DB: \", err)\n\t}\n\thttp.Redirect(w, r, \"/goals\", http.StatusSeeOther) //redirect back to goals page\n}", "title": "" }, { "docid": "98e8e02b9d68ebfcf1ebcb7ca2ce0fbd", "score": "0.66828793", "text": "func (pc *Players) delete(playerID int) error {\n\terr := pc.RemoveId(playerID)\n\tif err != nil {\n\t\treturn dbError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "edb2d3745a61bdb425220fd62eaf6ab9", "score": "0.6648103", "text": "func (con *Controller) Delete(w http.ResponseWriter, r *http.Request) {\n\tHelpers.Headers(w)\n\n\tparams := mux.Vars(r)\n\n\tid, err := strconv.Atoi(params[\"id\"])\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tHelpers.Status400(w, \"Invalid Id format\")\n\t\treturn\n\t}\n\n\terr = con.DataStore.Delete(id)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tHelpers.Status500(w, \"Could not connect to database\")\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "df4c5c190620720278149f968b5d1330", "score": "0.62720156", "text": "func DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tid := params[\"id\"]\n\tiid, err := strconv.Atoi(id)\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif err := Delete(r.Context(), repo.DB, int64(iid)); err != nil {\n\t\tlog.Println(\"error:\", err)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "73ea2bc59486fc85b857d01d8c3095de", "score": "0.6268471", "text": "func videoDeleteHandler(w http.ResponseWriter, r *http.Request) {\n vars := mux.Vars(r)\n id := vars[\"id\"]\n c := appengine.NewContext(r)\n key := datastore.NewKey(c, \"Video\", id, 0, nil)\n err := datastore.Delete(c, key)\n if err != nil {\n http.Error(w, \"internal server error\", http.StatusInternalServerError)\n return\n }\n w.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "a51a614552cf11f4e5baf1da34e17cdc", "score": "0.6196669", "text": "func (b *Backend) DeletePlayer(id *uuid.UUID) (*uuid.UUID, error) {\n\t// prepares the query\n\tstmt, err := b.db.Prepare(\"DELETE FROM player WHERE uuid = $1 returning uuid;\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer stmt.Close()\n\n\t// executes the query and gets the uuid returned\n\tvar returnedUUID uuid.UUID\n\tif err = stmt.QueryRow(id).Scan(&returnedUUID); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &returnedUUID, nil\n}", "title": "" }, { "docid": "d473eeb6821fe38cc35f394efe8b9a03", "score": "0.6181084", "text": "func (s *GenericRestController) Delete(rw http.ResponseWriter, r *http.Request) {\n\tfmt.Fprint(rw, \"delete\", s.reqVarsFunc(r)[\"id\"])\n}", "title": "" }, { "docid": "8a82d7511011995e42bded8c2b5333f5", "score": "0.61739874", "text": "func (c *Controller)Delete(){\n\n}", "title": "" }, { "docid": "d04d6de58c2273b41df2a4b89e399e55", "score": "0.6156967", "text": "func (db *mockDB) DeletePlayer(id string) error {\n\tif _, ok := db.players[id]; ok {\n\t\tdelete(db.players, id)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a8a15cf5d633efdaaed026ff67a74dc3", "score": "0.6146835", "text": "func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {\n\tif err := h.srv.Delete(r.Context(), mux.Vars(r)[\"id\"]); err != nil {\n\t\trespond.Error(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\trespond.JSON(w, http.StatusOK, map[string]string{\"status\": \"success\"})\n}", "title": "" }, { "docid": "a8a15cf5d633efdaaed026ff67a74dc3", "score": "0.6146835", "text": "func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {\n\tif err := h.srv.Delete(r.Context(), mux.Vars(r)[\"id\"]); err != nil {\n\t\trespond.Error(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\trespond.JSON(w, http.StatusOK, map[string]string{\"status\": \"success\"})\n}", "title": "" }, { "docid": "f91d76b6bfeaf3ac2e277615fe33c300", "score": "0.6135936", "text": "func Delete(c *gin.Context) {\n\tvar (\n\t\tp deleteTeam\n\t)\n\tid := c.Params.ByName(\"teamId\")\n\tif id == \"\" {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"teamId is missing in uri\"})\n\t\treturn\n\t}\n\tvID, err := strconv.Atoi(id)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Error occured while converting string to int\")\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Internal Server Error\"})\n\t\treturn\n\t}\n\n\tp.TeamID = vID\n\n\terr = p.delete()\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Error occured while performing db query\")\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Internal Server Error\"})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, \"OK\")\n}", "title": "" }, { "docid": "884772fb48e4c2797b99419902df0842", "score": "0.60322046", "text": "func (t *Todo) Delete(res http.ResponseWriter, req *http.Request, params httprouter.Params) {\n\n setHeaders(res)\n\n note := t.getNoteById(res, req, params)\n\n if note != nil {\n note.Delete()\n res.WriteHeader(http.StatusOK)\n } else {\n res.WriteHeader(http.StatusNotFound)\n }\n}", "title": "" }, { "docid": "e098051b3257f51c45c61a35dfef033c", "score": "0.6016346", "text": "func (ctrl *Controller) Delete(c *gin.Context) {\n\tvar service Service\n\tid := c.Query(\"id\")\n\tif err := service.DeleteByID(id); err != nil {\n\t\tlog.Println(err)\n\t\tc.AbortWithStatus(http.StatusForbidden)\n\t}\n\tc.JSON(http.StatusNoContent, gin.H{\"id #\" + id: \"deleted successfully\"})\n}", "title": "" }, { "docid": "dff5270854511980a6a1132cdd91b729", "score": "0.6015821", "text": "func (o *Competitor) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Competitor provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), competitorPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"competitor\\\" WHERE \\\"competitor_id\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from competitor\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e293624bc32f17cfa308559fed87b315", "score": "0.6000287", "text": "func (m *mockUserDAO) Delete(rs app.RequestScope, id int) error {\n\treturn nil\n}", "title": "" }, { "docid": "fb94edbd83f65f1c4600e423397a3774", "score": "0.59928685", "text": "func DeleteUserController(c echo.Context) error {\n\t// your solution here\n\tid, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn c.String(http.StatusBadRequest, \"invalid id\")\n\t}\n\tvar user model.User\n\tif err := model.DB.First(&user, id).Error; err != nil {\n\t\treturn c.String(http.StatusInternalServerError, \"id not found\")\n\t}\n\tif user.ID == 0 {\n\t\treturn c.String(http.StatusNotFound, \"id not found\")\n\t}\n\tif err := model.DB.Delete(&user).Error; err != nil {\n\t\treturn c.String(http.StatusInternalServerError, \"internal server error\")\n\t}\n\treturn c.JSON(http.StatusOK, user)\n}", "title": "" }, { "docid": "02e4a48aba7b78f86c69157783602c1a", "score": "0.597829", "text": "func (c *UserController) Delete(ctx *app.DeleteUserContext) error {\n\t// UserController_Delete: start_implement\n\n\t// Put your logic here\n\tappCtx := appengine.NewContext(ctx.Request)\n\tudb := model.UserDB{}\n\tint64ID, err := model.ConvertIdIntoInt64(ctx.ID)\n\tif err != nil {\n\t\treturn ctx.BadRequest(goa.ErrBadRequest(err))\n\t}\n\terr = udb.Delete(appCtx, int64ID)\n\tif err == datastore.ErrNoSuchEntity {\n\t\treturn ctx.NotFound(goa.ErrNotFound(err))\n\t} else if err != nil {\n\t\treturn ctx.BadRequest(goa.ErrBadRequest(err))\n\t}\n\n\t// UserController_Delete: end_implement\n\treturn nil\n}", "title": "" }, { "docid": "b1fcc5ddbd1d9b0018edefa247df53ef", "score": "0.5976248", "text": "func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\t_, id, err := httpflow.ExtractSession(ctx)\n\tif err != nil {\n\t\thttpflow.RespondError(h.log, w, r, err)\n\t\treturn\n\t}\n\n\tvar cInp CoreInput\n\tif err = httpflow.DecodeJSON(r, &cInp); err != nil {\n\t\thttpflow.RespondError(h.log, w, r, err)\n\t\treturn\n\t}\n\n\tusr, err := h.db.FetchUserByID(ctx, id)\n\tif err != nil {\n\t\thttpflow.RespondError(h.log, w, r, err)\n\t\treturn\n\t}\n\n\tif err = h.ext.deleteCheck(ctx, usr); err != nil {\n\t\thttpflow.RespondError(h.log, w, r, err)\n\t\treturn\n\t}\n\n\tusrC := usr.ExposeCore()\n\n\tif !usrC.IsPasswordCorrect(cInp.Password) {\n\t\thttpflow.RespondError(h.log, w, r, ErrInvalidCredentials)\n\t\treturn\n\t}\n\n\tif err = h.session.manager.RevokeAll(ctx, w); err != nil {\n\t\thttpflow.RespondError(h.log, w, r, err)\n\t\treturn\n\t}\n\n\tif err = h.db.DeleteUserByID(ctx, id); err != nil {\n\t\thttpflow.RespondError(h.log, w, r, err)\n\t\treturn\n\t}\n\n\tgo h.email.SendAccountDeleted(ctx, usrC.Email)\n\n\thttpflow.Respond(h.log, w, r, nil, http.StatusNoContent)\n}", "title": "" }, { "docid": "caec20d10e2997f904773b90714c9d5b", "score": "0.594532", "text": "func Delete(w http.ResponseWriter, r *http.Request) {\n\tid := chi.URLParam(r, \"id\")\n\n\tquery, err := db.Prepare(\"delete from posts where id=?\")\n\thelpers.Catch(err)\n\t_, er := query.Exec(id)\n\thelpers.Catch(er)\n\tdefer query.Close()\n\n\thelpers.RespondwithJSON(w, http.StatusOK, map[string]string{\"message\": \"successfully deleted\"})\n}", "title": "" }, { "docid": "5041c3127f1b7b6e6903569e2a9b959c", "score": "0.59218544", "text": "func Delete(writer http.ResponseWriter, request *http.Request) {\n\tvar customerId int\n\tvar customerIdStr string\n\tcustomerIdStr = request.FormValue(\"id\")\n\tfmt.Sscanf(customerIdStr, \"%d\", &customerId)\n\tvar customer Customer\n\tcustomer = GetCustomerById(customerId)\n\tDeleteCustomer(customer)\n\tvar customers []Customer\n\tcustomers = GetCustomers()\n\ttemplate_html.ExecuteTemplate(writer, \"Home\", customers)\n\n}", "title": "" }, { "docid": "f7f57060a2c9affc1e05d519c9ff5a8d", "score": "0.59194297", "text": "func (repo *SimpleRepo) Delete(o *object.Object) error {\n\tdb := repo.getDbConnection()\n\tdefer db.Close()\n\n\t_, err := db.Query(\"delete from objects where id = ?\", o.Id)\n\n\treturn err\n}", "title": "" }, { "docid": "780e22519c21c28f2f6c09b7bea8d065", "score": "0.59168017", "text": "func (c *EntityController[T]) delete(ctx iris.Context) {\n\tid := c.GetID(ctx)\n\n\tok, err := c.repository.DeleteByID(ctx, id)\n\tif c.handleError(ctx, err) {\n\t\treturn\n\t}\n\n\tif !ok {\n\t\terrors.NotFound.Details(ctx, \"resource not found\", err.Error())\n\t\treturn\n\t}\n\n\tctx.StatusCode(iris.StatusNoContent)\n}", "title": "" }, { "docid": "eb03a6f0afcd0c45f525ed80c0343d62", "score": "0.5914341", "text": "func handleDelete(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\n\tpicture := r.FormValue(\"pic\")\n\t//album := r.FormValue(\"album\")\n\t//owner := r.FormValue(\"owner\")\n\tcType := r.FormValue(\"cType\")\n\n\t//deletes from tag collection and recent/trending collections\n\tdeleteFromOthers(picture, cType)\n\n\tdbConnection = NewMongoDBConn()\n\tsess := dbConnection.connect()\n\n\tif cType == \"image\" {\n\t\terr := sess.DB(db_name).C(\"photos\").Remove(bson.M{\"photoId\": picture})\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tdefer sess.Close()\n\t\t\tfmt.Fprintf(w, \"No\")\n\t\t\treturn\n\t\t}\n\t} else {\n\t\terr := sess.DB(db_name).C(\"videos\").Remove(bson.M{\"videoId\": picture})\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tdefer sess.Close()\n\t\t\tfmt.Fprintf(w, \"No\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tdeleteFromOthers(picture, cType)\n\tresp := \"Yes_\" + picture\n\n\tdefer sess.Close()\n\n\tfmt.Fprintf(w, resp)\n\n}", "title": "" }, { "docid": "ede31d8106f9db00fc1521c2406d3b6c", "score": "0.59120196", "text": "func (h *SoundControlHandler) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tid := ps.ByName(\"id\")\n\th.Context.Sound.Remove(id)\n\tout, _ := json.Marshal(h.Context.Sound.List())\n\tw.Write(out)\n}", "title": "" }, { "docid": "9226b2bb08afb9af16de14c3d8a6a86f", "score": "0.59070736", "text": "func (c *Controller) Delete(id int) error {\n\treturn nil\n}", "title": "" }, { "docid": "9c4dcf5ed7a64fd1fe0890ff3efeb96c", "score": "0.58939254", "text": "func DeleteMatchup(w http.ResponseWriter, r *http.Request) {\n\t//----------------------------------------------------------------------------\n\t// Retrieve the parameter from the request using hte mux\n\t//----------------------------------------------------------------------------\n\tvars := mux.Vars(r)\n\t\n\t//----------------------------------------------------------------------------\n\t// Locate the value for the ID key\n\t//----------------------------------------------------------------------------\t\n\tid := vars[\"id\"]\n\n\t//----------------------------------------------------------------------------\n\t// Parse the value into an integer if provided as such\n\t//----------------------------------------------------------------------------\t\n\tID, err:= strconv.ParseUint(id, 10, 64)\n\tif err != nil {\n\t\tfmt.Println(\"Error while parsing\")\n\t}\n\n\t//----------------------------------------------------------------------------\n\t// Delegate to the Matchup data access object\n\t// delete the one with the matching identifier\n\t//----------------------------------------------------------------------------\t\n\trequestResult := MatchupDAO.DeleteMatchup(ID)\n\n\t//----------------------------------------------------------------------------\n\t// Marshal the model into a JSON object\n\t//----------------------------------------------------------------------------\n\tres, _ := json.Marshal(requestResult)\n\t\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(res)\n}", "title": "" }, { "docid": "f1ffaacaad46008cc748b26012905236", "score": "0.5891367", "text": "func (tc TodoController) Delete(id int) {\n\terr := tc.dao.Delete(id)\n\tif err != nil {\n\t\treturn\n\t}\n\tfmt.Printf(\"--- Suppression de la ligne %d ---\\n\", id)\n\ttc.GetAll()\n}", "title": "" }, { "docid": "bdb83c16b50d434f5cdf0a8507bef262", "score": "0.58741456", "text": "func (db Database) Delete(ctx iris.Context) {\n\tid, err := strconv.ParseInt(ctx.Params().Get(\"id\"), 10, 64)\n\n\tif err != nil {\n\t\tctx.StopWithStatus(iris.StatusBadRequest)\n\t\thelper.CreateErrorResponse(ctx, err).BadRequest().JSON()\n\t\treturn\n\t}\n\n\terr = todo.Delete(db.engine, id)\n\tif err != nil {\n\t\tctx.StopWithStatus(iris.StatusInternalServerError)\n\t\thelper.CreateErrorResponse(ctx, err).InternalServer().JSON()\n\t\treturn\n\t}\n\n\thelper.CreateResponse(ctx).Ok().SetMessage(fmt.Sprintf(\"%d deleted\", id)).JSON()\n}", "title": "" }, { "docid": "3ab6d7597253b74b91c438282b007d3a", "score": "0.58678335", "text": "func (c *TrackerController) Delete(ctx *app.DeleteTrackerContext) error {\n\t_, err := login.ContextIdentity(ctx)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))\n\t}\n\terr = application.Transactional(c.db, func(appl application.Application) error {\n\t\ttracker, err := appl.Trackers().Load(ctx.Context, ctx.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn appl.Trackers().Delete(ctx.Context, tracker.ID)\n\t})\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t}\n\taccessTokens := GetAccessTokens(c.configuration) //configuration.GetGithubAuthToken()\n\tc.scheduler.ScheduleAllQueries(ctx, accessTokens)\n\treturn ctx.NoContent()\n}", "title": "" }, { "docid": "094a935e1fee37629de9cb60ed03d527", "score": "0.5866986", "text": "func (m *MongoHandler) Delete(res http.ResponseWriter, req *http.Request) {\n\tdefer req.Body.Close()\n\treqDecoder := json.NewDecoder(req.Body)\n\tdata := &DeleteData{}\n\treqErr := reqDecoder.Decode(data)\n\tif reqErr != nil {\n\t\tlog.Fatal(reqErr)\n\t}\n\tdErr := m.Manager.Remove(data.Zone, data.Name)\n\tif dErr != nil {\n\t\tlog.Fatal(dErr)\n\t}\n\tres.Write([]byte(\"{\\\"message\\\":\\\"200 OK\\\"}\"))\n}", "title": "" }, { "docid": "f594652882a75b24d91d0c19e5182736", "score": "0.5860755", "text": "func (cc DeckController) Delete(c *gin.Context) {\n\tc.JSON(200, deck0)\n}", "title": "" }, { "docid": "486e15832a5390859de4ec9589ab6e99", "score": "0.585038", "text": "func (o *Wuut) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no Wuut provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), wuutPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"wuut\\\" WHERE \\\"id\\\"=$1\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from wuut\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by delete for wuut\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "6497fced35f293d27d3c9f71b70e22c0", "score": "0.5844105", "text": "func (m *PVC) Delete(db DB) error {\n\tm.SetPk()\n\treturn Table{db}.Delete(m)\n}", "title": "" }, { "docid": "2b91cfebe2b6c11b0673a912365916d4", "score": "0.5833297", "text": "func (h *GuestListHandler) Delete(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tname := vars[\"name\"]\n\tg := data.Guest{}\n\tg.Name = name\n\n\tif err := model.DeleteGuest(g); err != nil{\n\t\tlog.Println(err)\n\t\trespondWithError(err, http.StatusBadRequest, w)\n\t\treturn\n\t}\n\trespondWithMessage(\"Guest removed\", http.StatusAccepted, w)\n}", "title": "" }, { "docid": "a5b9a5bb234eda360ddbf038694e2387", "score": "0.5805445", "text": "func (server *Server) Delete(responseWrite http.ResponseWriter, request *http.Request, params httprouter.Params) {\n\n\tserverId := request.FormValue(\"server_id\")\n\n\tif serverId == \"\" {\n\t\tjsonError(responseWrite, \"server_id 错误\", nil)\n\t\treturn\n\t}\n\n\tdb := G.DB()\n\tvar rs *mysql.ResultSet\n\trs, err := db.Query(db.AR().From(\"server\").Where(map[string]interface{}{\n\t\t\"server_id\": serverId,\n\t\t\"is_delete\": 0,\n\t}).Limit(0, 1))\n\tif err != nil {\n\t\tjsonError(responseWrite, err.Error(), nil)\n\t\treturn\n\t}\n\tif rs.Len() == 0 {\n\t\tjsonError(responseWrite, \"server 不存在\", nil)\n\t\treturn\n\t}\n\n\tserverValues := map[string]interface{}{\n\t\t\"is_delete\": 1,\n\t\t\"update_time\": time.Now().Unix(),\n\t}\n\trs, err = db.Exec(db.AR().Update(\"server\", serverValues, map[string]interface{}{\n\t\t\"server_id\": serverId,\n\t}))\n\tif err != nil {\n\t\tjsonError(responseWrite, err.Error(), nil)\n\t\treturn\n\t}\n\n\tjsonSuccess(responseWrite, \"删除 server 成功\", nil)\n}", "title": "" }, { "docid": "08510814a378d13e51cd805f87c1978f", "score": "0.57963526", "text": "func (d *Database) Delete(c context.Context, id *url.URL) error {\n\t// TODO\n\tlog.Println(\"delete\")\n\treturn nil\n}", "title": "" }, { "docid": "0a3c3f108a64edb580faa68df4b9e4d9", "score": "0.57933193", "text": "func (m *CardsDAO) Delete(card Card) error {\n\terr := db.C(COLLECTION).Remove(&card)\n\treturn err\n}", "title": "" }, { "docid": "601352fda6c2b9d6fd207587ff58e00b", "score": "0.579297", "text": "func Delete(redisConn redis.Conn, playerID string) (err error) {\n\tresults, err := Retrieve(redisConn, playerID)\n\tredisConn.Send(\"MULTI\")\n\tredisConn.Send(\"DEL\", playerID)\n\n\t// Remove playerID from indices\n\tfor iName := range results {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"field\": iName,\n\t\t\t\"key\": playerID}).Debug(\"De-Indexing field\")\n\t\tredisConn.Send(\"ZREM\", iName, playerID)\n\t}\n\t_, err = redisConn.Do(\"EXEC\")\n\tcheck(err, \"\")\n\treturn\n}", "title": "" }, { "docid": "89dbac1d8c67853941d083f45465bd0b", "score": "0.5779727", "text": "func (pb *PBServer) Delete(args *DeleteArgs, reply *DeleteReply) error {\n\n\tif !pb.connected { // lose connection with viewserver\n\t\treply.Err = ErrWrongServer\n\t\treturn nil\n\t}\n\n\tif pb.view.Primary == pb.me {\n\t\tpb.mu.Lock()\n\t\treply.Err = OK\n\t\tdelete(pb.db, args.Key)\n\t\t// send to backup\n\t\tfor i := 0; i < viewservice.BackupNums; i++ {\n\t\t\tok := false\n\t\t\tfor !ok {\n\t\t\t\tif pb.view.Backup[i] == \"\" {\n\t\t\t\t\tbreak // no backup\n\t\t\t\t}\n\t\t\t\tok = call(pb.view.Backup[i], \"PBServer.ForwardDelete\", args, reply)\n\t\t\t}\n\t\t}\n\t\tpb.mu.Unlock()\n\t} else {\n\t\t// fmt.Println(\"I am not primary\")\n\t\tok := false\n\t\tfor !ok {\n\t\t\tok = call(pb.view.Primary, \"PBServer.Remove\", args, reply)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "05e742ad710315d69358b13975c8f762", "score": "0.5776203", "text": "func (db *Database) Delete(id uint64, model interface{}) *gorm.DB {\n return db.Connector.Unscoped().Where(\"id = ?\", id).Delete(model)\n}", "title": "" }, { "docid": "2c3b617444c727611b8bab9d78c2a4af", "score": "0.57750654", "text": "func Delete(response http.ResponseWriter, request *http.Request) {\n\tswitch request.Method {\n\t//Code for POST requests\n\tcase \"POST\":\n\t\t//Get username details from blogpost module then use it to get user details from DB\n\t\tuserName := blogpost.GetUserName(request)\n\t\tuser, err := model.GetUser(userName)\n\t\t//check if any error in getting user details\n\t\tif err != nil {\n\t\t\t//respond with link to login if username is not in blogpost module memory\n\t\t\tfmt.Fprint(response, `<p>You are not currently Logged in, Click <a href=\"/login\">Here</a> to Log in </p>`)\n\t\t\treturn\n\t\t}\n\t\t//check if user state is true (logged in)\n\t\tif user.LoginState {\n\t\t\t//next the form is parse and relevant information are extracted\n\t\t\trequest.ParseForm()\n\t\t\tpostId, _ := primitive.ObjectIDFromHex(request.FormValue(\"postId\"))\n\t\t\taction := request.FormValue(\"action\")\n\t\t\t//check the action type\n\t\t\tswitch action {\n\t\t\tcase \"categorydelete\":\n\t\t\t\tif user.Adminrights {\n\t\t\t\t\tremovedCategory, err := model.DeleteCategory(postId)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Println(err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcategorycount, _ := model.GetCounterByName(\"Categories\")\n\t\t\t\t\t\tmodel.DeleteCount(categorycount.Name, categorycount.Number-1)\n\t\t\t\t\t\tmodel.ChangeCategorytoDefault(removedCategory)\n\t\t\t\t\t\thttp.Redirect(response, request, \"/admin/categories\", http.StatusFound)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tcase \"postdelete\":\n\t\t\t\tif user.Adminrights {\n\t\t\t\t\tpost, err := model.DeletePost(postId)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\tos.Remove(\"upload/\" + post.FeaturedImage)\n\t\t\t\t\tpostcount, _ := model.GetCounterByName(\"Posts\")\n\t\t\t\t\tif postcount.Number <= 0 {\n\t\t\t\t\t\tpostcount.Number = 0\n\t\t\t\t\t\tmodel.DeleteCount(postcount.Name, postcount.Number)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmodel.DeleteCount(postcount.Name, postcount.Number-1)\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thttp.Redirect(response, request, \"/admin/all-post\", http.StatusFound)\n\n\t\t\tcase \"taskdelete\":\n\t\t\t\tif user.Adminrights {\n\t\t\t\t\tmodel.DeleteTask(postId)\n\t\t\t\t\ttaskcount, err := model.GetCounterByName(\"Tasks\")\n\t\t\t\t\tif err == nil {\n\t\t\t\t\tmodel.DeleteCount(taskcount.Name, taskcount.Number-1)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\thttp.Redirect(response, request, \"/admin/dashboard\", http.StatusFound)\n\n\t\t\tcase \"commentdelete\":\n\t\t\t\tif user.Adminrights {\n\t\t\t\t\tmodel.DeleteComment(postId)\n\t\t\t\t\tcommentcount, _ := model.GetCounterByName(\"Comments\")\n\t\t\t\t\tmodel.DeleteCount(commentcount.Name, commentcount.Number-1)\n\t\t\t\t}\n\n\t\t\t\thttp.Redirect(response, request, \"/admin/comments\", http.StatusFound)\n\n\t\t\tcase \"pagedelete\":\n\t\t\t\tif user.Adminrights {\n\t\t\t\t\tmodel.DeletePage(postId)\n\t\t\t\t\tpagescount, _ := model.GetCounterByName(\"Pages\")\n\t\t\t\t\tmodel.DeleteCount(pagescount.Name, pagescount.Number-1)\n\t\t\t\t}\n\n\t\t\t\thttp.Redirect(response, request, \"/admin/all-pages\", http.StatusFound)\n\t\t\tcase \"userdelete\":\n\t\t\t\tif user.Adminrights {\n\t\t\t\t\tuser, _ := model.DeleteUser(postId)\n\t\t\t\t\tif user.Avatar != \"default.png\" {\n\t\t\t\t\t\tos.Remove(\"upload/\" + user.Avatar)\n\t\t\t\t\t}\n\t\t\t\t\tusercount, _ := model.GetCounterByName(\"Users\")\n\t\t\t\t\tmodel.DeleteCount(usercount.Name, usercount.Number-1)\n\t\t\t\t}\n\t\t\t\thttp.Redirect(response, request, \"/admin/all-users\", http.StatusFound)\n\t\t\tdefault:\n\t\t\t\tfmt.Fprint(response, \"method not allowed\")\n\t\t\t}\n\t\t\treturn\n\n\t\t} else {\n\t\t\t//If user is not logged in\n\t\t\thttp.Redirect(response, request, \"/login\", http.StatusSeeOther)\n\t\t}\n\n\tdefault:\n\t\t//if it is not a post request\n\t\thttp.Redirect(response, request, \"/\", http.StatusSeeOther)\n\n\t}\n}", "title": "" }, { "docid": "25f88ee040fd8c21dd09643694d27609", "score": "0.5758846", "text": "func (o *Scene) Delete(db *gorm.DB) error {\n\treturn db.Delete(o).Error\n}", "title": "" }, { "docid": "c187d2f3612e72714056b96cf5458a42", "score": "0.57559526", "text": "func (c *ListController) Delete() {\n\tid := c.Ctx.Request.URL.Query().Get(\"id\")\n\n\terr := deleteList(c.Db, id)\n\tif err != nil {\n\t\tc.Ctx.ResponseWriter.WriteHeader(500)\n\t\t_, _ = c.Ctx.ResponseWriter.Write([]byte(err.Error()))\n\t}\n\n\tc.Ctx.ResponseWriter.WriteHeader(200)\n\t_, _ = c.Ctx.ResponseWriter.Write([]byte(`SUCCESS`))\n}", "title": "" }, { "docid": "39b847d44107bde8f71e68c4bd54ece7", "score": "0.5753485", "text": "func (UserHandler) Delete(w http.ResponseWriter, r *http.Request) {\n\t// Get the variables from the url\n\tvars := mux.Vars(r)\n\n\tvar user model.User\n\terr := db.Delete(&user, \"id = ?\", vars[\"id\"]).Error\n\tif err != nil {\n\t\tutil.ErrorResponse(w, \"Unable to delete the user\")\n\t\treturn\n\t}\n\n\tutil.OKResponse(w, \"deleted\", true)\n}", "title": "" }, { "docid": "9c8926fba0c02ef658d735e6c453d7b8", "score": "0.575193", "text": "func DeleteUserController(c echo.Context) error {\n\tuser, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdelete(users, user)\n\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"messages\": \"delete success\",\n\t})\n}", "title": "" }, { "docid": "1837ab1efa9d1d9a0be8b96999fcef0a", "score": "0.5748251", "text": "func (d *DB) Delete(args ...interface{}) error {\n return d.exec(\"delete\", args...)\n}", "title": "" }, { "docid": "aa1906b32c83583cb4ed401153f1b08c", "score": "0.5746209", "text": "func (c *PlayerClient) Delete() *PlayerDelete {\n\tmutation := newPlayerMutation(c.config, OpDelete)\n\treturn &PlayerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "aad09a8f53a4ec64e31d7e240ac8e7c0", "score": "0.5741363", "text": "func DELETEHandler(db *sqlx.DB) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Handler errors after rendering\n\t\tvar errRender error\n\t\tdefer func() {\n\t\t\tif errRender != nil {\n\t\t\t\tlog.Fatalf(\"PUTHandler: render error %v\", errRender)\n\t\t\t}\n\t\t}()\n\n\t\tresourceoneIDstr := chi.URLParam(r, \"resourceoneID\")\n\t\tresourceoneID, errConv := strconv.ParseInt(resourceoneIDstr, 10, 64)\n\t\tif resourceoneIDstr == \"\" || errConv != nil {\n\t\t\terrRender = render.Render(w, r, renderer.ErrInvalidRequest(errConv))\n\t\t\treturn\n\t\t}\n\n\t\terrD := Delete(\n\t\t\tr.Context(),\n\t\t\tdb,\n\t\t\tresourceoneID,\n\t\t)\n\t\tif errD != nil && errD != ErrSQLNotFound {\n\t\t\terrRender = render.Render(w, r, renderer.ErrRender(errD))\n\t\t\treturn\n\t\t}\n\t\tif errD == ErrSQLNotFound {\n\t\t\terrRender = render.Render(w, r, renderer.ErrNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusNoContent)\n\t}\n}", "title": "" }, { "docid": "504952c883f211046c3a831c6ace4524", "score": "0.573897", "text": "func (this *ServerDatastoreHandlerSimulator) Delete() error {\n\tif this.entries == nil {\n\t\treturn ErrNotFound\n\t}\n\n\tthis.entries = nil\n\n\treturn nil\n}", "title": "" }, { "docid": "5e7185ab151119442c5a90844c4681eb", "score": "0.5736667", "text": "func Delete(c echo.Context) error {\n\tvar publisher Publisher\n\tvar code int\n\tvar data interface{}\n\tvar message string\n\tengine := db.Engine\n\tid, _ := strconv.Atoi(c.Param(\"id\"))\n\n\taffected, err := engine.Id(id).Delete(&publisher)\n\tcommon.CheckErr(err)\n\tif affected == 0 {\n\t\tcode = 50000\n\t\tdata = nil\n\t\tmessage = \"删除失败\"\n\t} else {\n\t\tcode = 200\n\t\tdata = affected\n\t\tmessage = \"ok\"\n\t}\n\treturn c.JSON(http.StatusOK, common.Response{Code: code, Message: message, Data: data})\n}", "title": "" }, { "docid": "4b0d8b27d6a0c1a69daaf09f717bca1d", "score": "0.5719731", "text": "func (ctrl ServiceController) Delete(w http.ResponseWriter, r *http.Request) {\n\tlogStartInfo(ctrl.Name, funcName(), time.Now())\n\n\tsession, err := Authenticate(r)\n\tif err != nil {\n\t\tresponseError(w, http.StatusInternalServerError, fmt.Sprintf(\"Error while deleting service: %v\", err))\n\t\treturn\n\t}\n\tserviceID := pat.Param(r, \"id\")\n\tservice := &model.Service{ID: serviceID}\n\tif err := service.Delete(session.TenantID); err != nil {\n\t\tresponseError(w, http.StatusInternalServerError, fmt.Sprintf(\"Error while deleting service: %v\", err))\n\t\treturn\n\t}\n\trespondSucceed(w, \"Deleting service successfully\")\n}", "title": "" }, { "docid": "9547307c53c55624dc099891bd538fed", "score": "0.5716517", "text": "func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {\n\tif err := h.repository.Delete(r.Context(), h.getResourceID(r)); err != nil {\n\t\tstatus := http.StatusInternalServerError\n\t\tif errRepo, ok := err.(flare.ResourceRepositoryError); ok && errRepo.NotFound() {\n\t\t\tstatus = http.StatusNotFound\n\t\t}\n\n\t\th.writer.Error(w, \"error during resource delete\", err, status)\n\t\treturn\n\t}\n\n\th.writer.Response(w, nil, http.StatusNoContent, nil)\n}", "title": "" }, { "docid": "7c762db15e661f63d30689538cc6c619", "score": "0.57101524", "text": "func (d DB) Delete(string) error { return errors.New(\"stub\") }", "title": "" }, { "docid": "1d89d885e0af49fb8f926448d281602c", "score": "0.5701873", "text": "func (h *PeopleHandler) Delete(w http.ResponseWriter, r *http.Request) {\n\tid := r.URL.Query().Get(\"id\")\n\tvar person Person\n\tif err := h.DB.First(&person, id).Error; err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\thttp.Error(w, err.Error(), http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif err := h.DB.Delete(&person).Error; err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "8d485ca7521bf63f5c709ab1c5f20478", "score": "0.56923926", "text": "func DeleteSong(w http.ResponseWriter, r *http.Request) {\n\n w.Header().Set(\"Context-Type\", \"application/x-www-form-urlencoded\")\n w.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n w.Header().Set(\"Access-Control-Allow-Methods\", \"DELETE\")\n w.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type\")\n\n // get the userid from the request params, key is \"id\"\n params := mux.Vars(r)\n\n // convert the id in string to int\n id, err := strconv.Atoi(params[\"id\"])\n\n if err != nil {\n log.Fatalf(\"Unable to convert the string into int. %v\", err)\n }\n\n // call the deleteUser, convert the int to int64\n deletedRows := deleteSong(int64(id))\n\n // format the message string\n msg := fmt.Sprintf(\"Song deleted successfully. Total rows/record affected %v\", deletedRows)\n\n // format the reponse message\n res := response{\n ID: int64(id),\n Message: msg,\n }\n\n // send the response\n json.NewEncoder(w).Encode(res)\n}", "title": "" }, { "docid": "95de11fad321cb05bfb84f4f3a50d438", "score": "0.5690921", "text": "func (m *BoardDAO) Delete(boardID bson.ObjectId) error {\n\terr := db.C(COLLECTION).Remove(bson.M{\"_id\": boardID})\n\treturn err\n}", "title": "" }, { "docid": "f3e7850ad2eb1a4399b2f433866bf0ab", "score": "0.5684693", "text": "func (m *PresentationDB) Delete(ctx context.Context, id int) error {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"presentation\", \"delete\"}, time.Now())\n\n\tvar obj Presentation\n\n\terr := m.Db.Delete(&obj, id).Error\n\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"error retrieving Presentation\", \"error\", err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4339cb3d37b884028b98419ebcdc8fc6", "score": "0.5682893", "text": "func (impl RoleDBBackendImpl) Delete(ctx context.Context, publicID string) error {\n\n\tret1 := impl.DeleteFunc(ctx, publicID)\n\treturn ret1\n\n}", "title": "" }, { "docid": "4e5f58b088106ef01c054435dbc0e504", "score": "0.5679583", "text": "func DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tf := r.URL.Path[len(\"/delete/\"):]\n\terr := os.Remove(DIR + f)\n\thtmltemplate.Head(w, r)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"error: %s (USE your BROWSERs BACK BUTTON)\", err)\n\t\treturn\n\t} else {\n\t\tfmt.Fprintf(w, \"%s was deleted successfully :) <a href='/list'>back</a> \", f)\n\t}\n\thtmltemplate.Foot(w, r)\n\n}", "title": "" }, { "docid": "b208c1db5b1e67ccfc03fbe12e33f6a1", "score": "0.56778795", "text": "func deleteHandler(res http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\tif !alreadyLoggedIn(res, req) {\n\t\thttp.Redirect(res, req, hostURI, http.StatusSeeOther)\n\t\treturn\n\t}\n\tusr := sessionGetKeys(req, \"session\")\n\tif usr == nil {\n\t\thttp.Error(res, \"Couldn't find user session\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tgo walletCmd(\"delete\", usr.Address)\n\tgo http.Get(usrURI + \"/delete/\" + usr.Username)\n\tcookie := &http.Cookie{\n\t\tName: \"session\",\n\t\tPath: \"/\",\n\t\tMaxAge: -1,\n\t}\n\thttp.SetCookie(res, cookie)\n\thttp.Redirect(res, req, hostURI, http.StatusSeeOther)\n}", "title": "" }, { "docid": "ce1a7aad2bdf3e38da57ae0215f4faff", "score": "0.567529", "text": "func Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Cache-Control\", \"no-cache, no-store, must-revalidate, private, max-age=0\")\n\tw.Header().Set(\"Pragma\", \"no-cache\")\n\tw.Header().Set(\"X-Accel-Expires\", \"0\")\n\tw.Header().Set(\"Expires\", \"0\")\n\n\tid := r.URL.Query().Get(\"id\")\n\n\tidOk, err := strconv.Atoi(id)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to convert id to integer\", err)\n\t}\n\n\tmodels.DeleteProduct(idOk)\n\n\thttp.Redirect(w, r, \"/\", 302)\n\t// For SQLite3, autoincrements will create the same id again by default.\n\t// If we use 301 redirect, it will permanently cache and wont remove\n\t// products agan.\n\t// 302 is temporary redirect so it doesn't cache it working as expected\n}", "title": "" }, { "docid": "74a3810e0faffa9564bcc6fce088277b", "score": "0.5672656", "text": "func (dao *Dao) Delete(deleteReqVo DeleteReqVo) error {\n\tvar g mysql.Gooq\n\tg.SQL.Delete(codemappo.Table).Where(c(codemappo.ID).Eq(\"?\"))\n\tg.AddValues(deleteReqVo.ID)\n\n\t_, err := g.Exec()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "166d736b41b6deb35dddcdbe44db1f97", "score": "0.5671754", "text": "func VerifyDeletePlayer() {\n\n\tfmt.Printf(config.Config.FVT.Topic, \"VerifyDeletePlayers\")\n\turl := fmt.Sprintf(\"http://0.0.0.0:8080/v1/players/%s\", testPlayerName)\n\treq, err := http.NewRequest(\"DELETE\", url, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(config.Config.FVT.Section, \"Existed Player\")\n\tfmt.Printf(config.Config.FVT.Detail, \"method and url\")\n\tfmt.Printf(\"```\\n$ DELETE %s\\n```\\n\", url)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(config.Config.FVT.Detail, \"example response\")\n\tfmt.Printf(\"```\\n%s\\n```\\n\", string(bodyBytes))\n\n\tfmt.Printf(config.Config.FVT.Section, \"Non-existed Player\")\n\tfmt.Printf(config.Config.FVT.Detail, \"method and url\")\n\tfmt.Printf(\"```\\n$ DELETE %s\\n```\\n\", url)\n\tresp, err = client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tbodyBytes, err = ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(config.Config.FVT.Detail, \"example response\")\n\tfmt.Printf(\"```\\n%s\\n```\\n\", string(bodyBytes))\n}", "title": "" }, { "docid": "6a103aa27d9f21299a0a72b796e6221d", "score": "0.56696707", "text": "func (m *matchRestHandler) Delete(w http.ResponseWriter, r *http.Request) {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "e484848def8d71e0d420b7eb319f88a4", "score": "0.56690794", "text": "func (c *PlayerCore) DeletePlayer(ID string) (*Player, error) {\n\tplayer, err := c.PlayerRepo.Delete(ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparsedCommunities := castPlayers([]models.Player{*player})\n\treturn &(parsedCommunities[0]), nil\n}", "title": "" }, { "docid": "378b68a3df1a931068c303a17db68a03", "score": "0.56475854", "text": "func (s *Service) Delete(c *gin.Context, id int) error {\n\tu, err := s.udb.View(c, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !s.rbac.IsLowerRole(c, u.Role.AccessLevel) {\n\t\treturn apperr.Forbidden\n\t}\n\tu.Delete()\n\treturn s.udb.Delete(c, u)\n}", "title": "" }, { "docid": "6c210e22f0b410fcb54a28f118f5f116", "score": "0.5646107", "text": "func (c *IDController) Delete() {\n\tvar (\n\t\tid = c.Ctx.Input.Param(\":id\")\n\t)\n\tif errorResps := c.TemplateImpl.Service().Delete(id); errorResps != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"resource\": c.TemplateImpl.ResourceName(),\n\t\t\t\"id\": id,\n\t\t\t\"errorResp\": errorResps[0].ID,\n\t\t}).Warn(\"IDController delete resource failed.\")\n\t\tc.Data[\"json\"] = &errorResps\n\t\tc.Ctx.Output.SetStatus(errorResps[0].StatusCode)\n\t\tc.ServeJSON()\n\t\treturn\n\t}\n\tlog.WithFields(log.Fields{\n\t\t\"resource\": c.TemplateImpl.ResourceName(),\n\t\t\"id\": id,\n\t}).Info(\"Delete resource done.\")\n\tc.Ctx.Output.SetStatus(http.StatusAccepted)\n\tc.ServeJSON()\n}", "title": "" }, { "docid": "fe3333a9af88719a0dd5ccf907aa021b", "score": "0.5643631", "text": "func (r *Resource) deleteHandler(c *gin.Context) {\n // parse ID from URL\n id, err := strconv.ParseInt(\n c.Param(\"id\"),\n 10,\n 64,\n )\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": \"Bad ID\"})\n return\n }\n\n // delete record and handle error\n if err := r.db.DeleteMenuMeal(id); err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // return 204 status\n c.Status(http.StatusNoContent)\n}", "title": "" }, { "docid": "2ab12c74c6710ac0fbb69ff16edcf0fe", "score": "0.5637698", "text": "func (*Users) Delete(login string) error {\n\n\t_, err := model.Get(login)\n\tif err != nil {\n\t\tlog.Println(\"(DeleteUser:Get)\", \"User doesn't exist\")\n\t\terr = errors.New(\"user doesn't exists\")\n\t\treturn err\n\t}\n\n\tstmt, err := db.Prepare(\n\t\t\"delete from users where login = $1\")\n\n\tif err != nil {\n\t\tlog.Println(\"(DeleteUser:Prepare)\", err)\n\t}\n\n\tdefer stmt.Close()\n\n\t_, err = stmt.Exec(login)\n\n\tif err != nil {\n\t\tlog.Println(\"(DeleteUser:Physical:Exec)\", err)\n\n\t\tstmt, err = db.Prepare(\n\t\t\t\"update users \" +\n\t\t\t\t\"set deleted = true, \" +\n\t\t\t\t\"date_updated = now() \" +\n\t\t\t\t\"where login = $1\")\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"(UpdateUser:Logical:Prepare)\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = stmt.Exec(login)\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"(DeleteUser:Logical:Exec)\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "a727e5a7789b9391a5afc7cf253ef8b9", "score": "0.56368154", "text": "func (challenge *Challenge) Delete() error {\n\treturn db.Delete(challenge).Error\n}", "title": "" }, { "docid": "ae838c3b5025dd8af53dcc3662e73333", "score": "0.56358373", "text": "func (h *CommandHandler) Delete(c *fiber.Ctx) error {\n\terr := h.repo.Delete(c.Params(\"id\"), GetUserID(c))\n\n\tif err != nil {\n\t\th.repo.Ctx.Logger.Error(err.Error())\n\t\treturn c.\n\t\t\tStatus(http.StatusNotFound).\n\t\t\tJSON(fiber.Map{\n\t\t\t\t\"error\": err.Error(),\n\t\t\t})\n\t}\n\n\treturn c.\n\t\tStatus(http.StatusOK).\n\t\tJSON(fiber.Map{\n\t\t\t\"message\": \"Command deleted!\",\n\t\t})\n}", "title": "" }, { "docid": "1006bb128c0fafc024606780862eebc5", "score": "0.5635034", "text": "func DeleteUser(w http.ResponseWriter, r *http.Request) {\n\t// Get User ID\n\t// Perform db stuff.\n\t// Return a response\n}", "title": "" }, { "docid": "0ec61327a18921e2fde15f5efe36995f", "score": "0.56280977", "text": "func (dao *UserDAO) Delete(model *models.User) error {\n\tsession := dao.Session.Copy()\n\tdefer session.Close()\n\n\tcount, _ := dao.Count(nil)\n\tif count < 2 {\n\t\treturn errors.New(\"You can't delete the only existing user.\")\n\t}\n\n\t// db write\n\terr := session.DB(\"\").C(dao.Collection).RemoveId(model.ID)\n\n\treturn err\n}", "title": "" }, { "docid": "99999811b3bbcd8ca8c5be99a28126d7", "score": "0.5627266", "text": "func (u repository) delete(id int) error {\n\ttx := u.db.Begin()\n\n\tuser := Model{ID: id}\n\tif err := tx.Delete(user).Error; err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\n\ttx.Commit()\n\treturn nil\n}", "title": "" }, { "docid": "51ba79c95960941ef7dd96e9e3a22f76", "score": "0.5614", "text": "func (c *Controller) CreatePlayer(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\tvar player models.Player\n\terr = json.NewDecoder(req.Body).Decode(&player)\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\terr = player.CreatePlayer(db)\n\tif err != nil {\n\t\terror := models.RespError{Error: \"Failed to create a new 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(player)\n\treturn\n}", "title": "" }, { "docid": "e7f638e2bfa1bed0d59f93b045b95c9e", "score": "0.5599855", "text": "func (kv *store) deleteHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"DELETE\" {\n\t\thttp.Error(w, \"Method is not supported.\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\tkv.mu.Lock()\n\tfmt.Fprintf(w, \"DELETE request successful\\n\")\n\tparams := mux.Vars(r)\n\tkey := params[\"key\"]\n\tok := kv.Delete(key)\n\n\tif ok == true {\n\t\tfmt.Fprintf(w, \"Removed Key = %s\\n\", key)\n\t} else {\n\t\tfmt.Fprintf(w, \"Invalid key value pair\\n\")\n\t}\n\tkv.mu.Unlock()\n}", "title": "" }, { "docid": "af640e7f7a4213d712c27010783417a6", "score": "0.55973125", "text": "func (o *Track) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no Track provided for delete\")\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), trackPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"tracks\\\" WHERE \\\"id\\\"=$1\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from tracks\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by delete for tracks\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "b189d463428c70ae2f25a7dc91303487", "score": "0.5597102", "text": "func deleteProduct(w http.ResponseWriter, r *http.Request){\n\tfmt.Println(\"delete\")\n\tdb:= dbConn()\n\tparams := mux.Vars(r)\n\tstmt, err := db.Prepare(\"DELETE FROM products WHERE id = ?\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\t_, err = stmt.Exec(params[\"id\"])\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Fprintf(w, `\n\t<h1>Post with ID = %s was deleted</h1>\n\t<p>The id with the given number is deleted and check the original data </p`, params[\"id\"])\n\t\n}", "title": "" }, { "docid": "e41df3f97249532f03f28b82cba3e894", "score": "0.55907124", "text": "func deleteHandler(w http.ResponseWriter, r *http.Request) {\n\tvar zMem []Page // Empty Database\n\tname := r.URL.Path[len(\"/delete/\"):]\n\tif name == \"ALL\" {\n\t\t// Process ALL\n\t\tdata, err := json.Marshal(zMem)\n\t\t// Marshal empty Database\n\t\tcheck(\"Marshalling Failed\", err)\n\t\twriteData(data)\n\t\t// Write Data Set to disk\n\t\terr = json.Unmarshal(data, &xMem) //Reload In-Memory Copy\n\t\tcheck(\"Unmarshal Failed\", err)\n\t\thttp.Redirect(w, r, \"/view/\", http.StatusFound)\n\t\t// Redirect to /view\n\t}\n\tp, ok := findExactName(xMem, string(name))\n\t// Not ALL - Find Name\n\tif !ok && name != \"ALL\" {\n\t\t// Report Failure\n\t\tfmt.Fprintf(w, \"<h1>Delete: '%s' %s</h1>\", name, \"not found!\")\n\t\treturn\n\t} else {\n\t\t// Deletion has to be done this way to insure that internal index updated!\n\t\ti := 0\n\t\tfor j, v := range xMem {\n\t\t\t// Walk old Database and Create new Database\n\t\t\tif j != p.Index {\n\t\t\t\tzMem = append(zMem, Page{Index: i, Name: v.Name, Body: v.Body})\n\t\t\t\ti++\n\t\t\t}\n\t\t}\n\t\tdata, err := json.Marshal(zMem)\n\t\t// Marshal new Database\n\t\tcheck(\"Marshalling Failed\", err)\n\t\twriteData(data)\n\t\t// Write to disk\n\t\terr = json.Unmarshal(data, &xMem)\n\t\t//Reload In-Memory Copy\n\t\tcheck(\"Unmarshal Failed\", err)\n\t\thttp.Redirect(w, r, \"/view/\", http.StatusFound)\n\t\t// Redirect to /view\n\t}\n}", "title": "" }, { "docid": "e0ccdc4c6e5f835009d1b35c23552c77", "score": "0.5582252", "text": "func (o *Autotransfer) Delete(db *gorm.DB) error {\n\treturn db.Delete(o).Error\n}", "title": "" }, { "docid": "893bfbbe3077e4a5fa9688b0bab6320e", "score": "0.55786186", "text": "func handleDelete(w http.ResponseWriter, r *http.Request, cr *data.ChatRoom) (err error) {\n\terr = data.CS.Delete(cr)\n\tif err != nil {\n\t\tWarning(\"error encountered deleting chat room:\", err.Error())\n\t\treturn\n\t}\n\t// report on status\n\tInfo(\"deleted chat room:\", cr.Title)\n\tReportStatus(w, true, nil)\n\treturn\n}", "title": "" }, { "docid": "18cc4389f70a73e25f23b68c2c135644", "score": "0.5565265", "text": "func (m *UsuarioDao) Delete(usuario models.UsuarioEmpresa) error {\n\terr := usuariodb.C(UsuarioCOLLECTION).Remove(&usuario)\n\treturn err\n}", "title": "" }, { "docid": "db0a1356e8b74518a7c45b0ab2d0aecb", "score": "0.5564605", "text": "func (s *Session) Delete(w http.ResponseWriter) error {\n\t// attempt to delete from database and from client.\n\t// if either one succeeds, the session is effectively deleted.\n\t// if a zombie database entry is left, back-end will eventually prune it.\n\terrDb := s.store.backEnd.Delete(s.sessID, s.userID)\n\terrClient := s.deleteFromClient(w)\n\n\t// if BOTH failed, return an error.\n\tif errDb != nil && errClient != nil {\n\t\treturn qsErr{\"Delete - database - \" + errDb.Error() + \" --AND-- client - \", errClient}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b075531c27f9cd0315ae275c3dde5e7a", "score": "0.5563821", "text": "func deleteHandler(w http.ResponseWriter, r *http.Request) {\n\tresponse := &HTTPResponseVM{\n\t\tStatus: http.StatusOK,\n\t\tSuccess: true,\n\t\tMessage: \"Successfully deleted post data.\",\n\t}\n\n\tresponse.JSON(w)\n}", "title": "" }, { "docid": "393a222c1c4009bd265627aa85643ab1", "score": "0.55615556", "text": "func NewDeleteController(ctx context.Context, config *config.ServerConfig, db *database.Database) http.Handler {\n\treturn &userDeleteController{config, db, logging.FromContext(ctx)}\n}", "title": "" }, { "docid": "52c7c4a978d91e67eae343824b59f508", "score": "0.55586886", "text": "func (dao *PlanetasDAO) Delete(planeta model.Planeta) error {\n\terr := banco.C(COLLECTION).Remove(&planeta)\n\treturn err\n}", "title": "" }, { "docid": "2df53b1b3d1ad8e36cf3a4386fe13648", "score": "0.55574346", "text": "func DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type,Authorization\")\n\n\tif r.Method == \"OPTIONS\" {\n\t\treturn\n\t}\n\n\tfmt.Println(\"Received a delete request\")\n\n\t// Retrieve the event id from the URL path parameter /post/{id}\n\tid, err := strconv.ParseInt(mux.Vars(r)[\"id\"], 10, 64)\n\tif err != nil || id <= 0 {\n\t\thttp.Error(w, fmt.Sprintf(\"invalid id: %v\", id), http.StatusBadRequest)\n\t\tlog.Printf(\"invalid id encountered: %v\", id)\n\t\treturn\n\t}\n\n\tuser, err := auth.UserFromContext(r.Context())\n\tif err != nil {\n\t\thttp.Error(w, \"missing user info in request context\", http.StatusInternalServerError)\n\t\tlog.Println(\"missing user info in request context\")\n\t\treturn\n\t}\n\n\t// Authorization - access control\n\t//client, _ := auth.NewGroupLiveAuthClient(\"auth.rpc.staging.allgame.fun:8000\")\n\t//hasPermission := client.HasPermission(user, permission.Permission{})\n\thasPermission := true\n\tif !hasPermission {\n\t\thttp.Error(w, fmt.Sprintf(\"%s has no permission\", user.Username), http.StatusForbidden)\n\t\treturn\n\t}\n\n\n\n\trowsDeleted, err := deleteEvent(id)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"server failed to delete: %v\", err), http.StatusInternalServerError)\n\t\tlog.Printf(\"failed to delete: %v\", err)\n\t\treturn\n\t}\n\n\tif rowsDeleted == 0 {\n\t\thttp.Error(w, fmt.Sprintf(\"unable to delete possibly due to nonexistent event id: %d\", id), http.StatusBadRequest)\n\t\tlog.Printf(\"unable to delete possibly due to nonexistent event id: %d\", id)\n\t\treturn\n\t}\n\n\tlog.Println(\"Event deleted successfully\")\n}", "title": "" }, { "docid": "14b1b14a6f36b378ec1e9b4058143d16", "score": "0.55560184", "text": "func (u utensilioRepository) Delete(id uint64) error {\n\tlog.Print(\"[UtensilioRepository]...Delete\")\n\n\terro := u.DB.Delete(&model.Utensilio{}, id).Error\n\n\treturn erro\n}", "title": "" }, { "docid": "9df2856e033d875617ddb4b644d82361", "score": "0.5544274", "text": "func (o *Platform) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Platform provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), platformPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"platforms\\\" WHERE \\\"id\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from platforms\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2deb8cbbeb1dfc91a0864841ccfbca57", "score": "0.5538968", "text": "func delete(c *gin.Context) {\n\t//creamos el cliente\n\tclient := newClient()\n\t//le pasamos la clave\n\tkey := c.Param(\"key\")\n\t//borramos la clave\n\tn, err := client.Del(key).Result()\n\t//si error\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\t//si ok, mostramos un mensaje\n\tc.JSON(200, gin.H{\"result\": n})\n\n}", "title": "" }, { "docid": "26becdccb4817bf6a82819d223bf67e2", "score": "0.553732", "text": "func (store MunicipioStore) Delete(codigo int64) error {\n\terr := store.C.Remove(bson.M{\"codigo\": codigo})\n\treturn err\n}", "title": "" }, { "docid": "7cec5a072a4c75e3cbd92c96df537d1d", "score": "0.5534155", "text": "func (gi *Video) Delete(db *pg.DB) error {\r\n\tlog.Printf(\"===>videoItem.Delete()\")\r\n\r\n\t_, deleteErr := db.Model(gi).\r\n\t\tWhere(\"videoname = ?0\", gi.VideoName).\r\n\t\tWhereOr(\"id = ?0\", gi.ID).\r\n\t\tDelete()\r\n\tif deleteErr != nil {\r\n\t\tlog.Printf(\"Error while deleting item in videoItem.Delete(), Reason %v\\n\", deleteErr)\r\n\t\treturn deleteErr\r\n\t}\r\n\tlog.Printf(\"Product %s deleted successfully from table\", gi.VideoName)\r\n\treturn nil\r\n}", "title": "" }, { "docid": "856eea9f3e36c6712198278ba029a9c7", "score": "0.55296", "text": "func (c *Controller) Delete(ctx context.Context, req *api.DeletePersonRequest) (*empty.Empty, error) {\n\tif req.Id < 0 {\n\t\treturn nil, errors.New(\"person id must be 0 or higher\")\n\t}\n\n\terr := c.repo.Delete(req.Id)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"deleting person with id %d\", req.Id)\n\t}\n\n\treturn &empty.Empty{}, nil\n}", "title": "" }, { "docid": "65b5e60ea403052e6bd4ace094781b1e", "score": "0.55188453", "text": "func Delete(id string, data interface{}) error {\n\tLogger.Trace(constants.LogBeginFunc)\n\n\tLogger.Debug(\"Deleting record with id : \", id)\n\tresult := SqliteInstance.Delete(data, \"ID = ? \", id)\n\n\terr := result.Error\n\tif err != nil {\n\t\tLogger.Warn(err.Error(), err)\n\t\treturn result.Error\n\t}\n\n\tLogger.Trace(constants.LogFinishFunc)\n\treturn nil\n}", "title": "" } ]
9506b7e97151d0e805743e18f00fb756
Clone the configuration in use of the given execution service
[ { "docid": "519f93cd91bbe8cd5af4d0479083aa4f", "score": "0.7344716", "text": "func (es *ExecutionService) CloneCfg() *ExecServiceCfg {\n\tclone := ExecServiceCfg{}\n\tcopier.Copy(&clone, es.ServiceCfgInUse)\n\treturn &clone\n}", "title": "" } ]
[ { "docid": "c6c41060afcbe5c1c67a00260c56d3c8", "score": "0.6557266", "text": "func (srv Service) Clone() (cSrv config.RextServiceDef, err error) {\n\tvar cAuth config.RextAuthDef\n\tif srv.auth != nil {\n\t\tif cAuth, err = srv.auth.Clone(); err != nil {\n\t\t\tlog.WithError(err).Errorln(\"can not clone auth in service\")\n\t\t\treturn cSrv, err\n\t\t}\n\t}\n\tvar cOpts config.RextKeyValueStore\n\tif cOpts, err = srv.GetOptions().Clone(); err != nil {\n\t\tlog.WithError(err).Errorln(\"can not clone options in service\")\n\t\treturn cSrv, err\n\t}\n\tvar cResources []config.RextResourceDef\n\tfor _, resource := range srv.GetResources() {\n\t\tvar cResource config.RextResourceDef\n\t\tif cResource, err = resource.Clone(); err != nil {\n\t\t\tlog.WithError(err).Errorln(\"can not clone resources in service\")\n\t\t\treturn cSrv, err\n\t\t}\n\t\tcResources = append(cResources, cResource)\n\t}\n\tcSrv = NewServiceConf(srv.basePath, srv.protocol, cAuth, cResources, cOpts)\n\treturn cSrv, err\n}", "title": "" }, { "docid": "679d375676e6a697a7ebf7d5a55f95f4", "score": "0.6384474", "text": "func copyService(service *grpc_application_go.Service, settings *OrganizationSettings) *grpc_application_go.Service {\n\n\tif service == nil {\n\t\treturn nil\n\t}\n\n\tstorage := make([]*grpc_application_go.Storage, 0)\n\tfor _, sto := range service.Storage {\n\t\tstorage = append(storage, copyStorage(sto, settings))\n\t}\n\n\tports := make([]*grpc_application_go.Port, 0)\n\tfor _, port := range service.ExposedPorts {\n\t\tports = append(ports, copyExposedPort(port))\n\t}\n\n\tfiles := make([]*grpc_application_go.ConfigFile, 0)\n\tfor _, file := range service.Configs {\n\t\tfiles = append(files, copyConfigFile(file))\n\t}\n\n\treturn &grpc_application_go.Service{\n\t\tOrganizationId: service.OrganizationId,\n\t\tAppDescriptorId: service.AppDescriptorId,\n\t\tServiceGroupId: service.ServiceGroupId,\n\t\tServiceId: service.ServiceId,\n\t\tName: service.Name,\n\t\tType: service.Type,\n\t\tImage: service.Image,\n\t\tCredentials: copyImageCredential(service.Credentials),\n\t\tSpecs: copyDeploySpec(service.Specs),\n\t\tStorage: storage,\n\t\tExposedPorts: ports,\n\t\tEnvironmentVariables: service.EnvironmentVariables,\n\t\tConfigs: files,\n\t\tLabels: service.Labels,\n\t\tDeployAfter: service.DeployAfter,\n\t\tRunArguments: service.RunArguments,\n\t}\n\n}", "title": "" }, { "docid": "8a3e012768a0b393f34ed620dd4af638", "score": "0.60954046", "text": "func TestCloneAppconfig(t *testing.T) {\n\tconfig := &Config{\n\t\tAppName: \"testcfg\",\n\t\tRawDefinition: map[string]any{\n\t\t\t\"mounts\": []Mount{\n\t\t\t\t{\n\t\t\t\t\tSource: \"src-raw\",\n\t\t\t\t\tDestination: \"dst-raw\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tSource: \"src2\",\n\t\t\t\t\tDestination: \"dst2\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tMounts: []Mount{{\n\t\t\tSource: \"src\",\n\t\t\tDestination: \"dst\",\n\t\t}},\n\t\tHTTPService: &HTTPService{\n\t\t\tInternalPort: 100,\n\t\t},\n\t\tdefaultGroupName: \"some-group\",\n\t}\n\n\tcloned := helpers.Clone(config)\n\n\tassert.Equal(t, config, cloned)\n\n\tconfig.HTTPService.InternalPort = 50\n\n\tassert.Equal(t, 100, cloned.HTTPService.InternalPort,\n\t\t\"expected deep copy, but cloned object was modified by change to original config\")\n}", "title": "" }, { "docid": "c8dc2734e4341178aa26816a894677e9", "score": "0.56569076", "text": "func (s *Service) Copy() *Service {\n\tif s == nil {\n\t\treturn nil\n\t}\n\tns := new(Service)\n\t*ns = *s\n\tns.Tags = helper.CopySliceString(ns.Tags)\n\tns.CanaryTags = helper.CopySliceString(ns.CanaryTags)\n\n\tif s.Checks != nil {\n\t\tchecks := make([]*ServiceCheck, len(ns.Checks))\n\t\tfor i, c := range ns.Checks {\n\t\t\tchecks[i] = c.Copy()\n\t\t}\n\t\tns.Checks = checks\n\t}\n\n\tns.Connect = s.Connect.Copy()\n\n\tns.Meta = helper.CopyMapStringString(s.Meta)\n\tns.CanaryMeta = helper.CopyMapStringString(s.CanaryMeta)\n\n\treturn ns\n}", "title": "" }, { "docid": "871f10d2a9982354b2ed5a920c368bdc", "score": "0.55775326", "text": "func (c *configuration) Clone() *configuration {\n\tvar clone = *c\n\treturn &clone\n}", "title": "" }, { "docid": "8e89af5360fd7792a2bd18ce66e1bef6", "score": "0.55507565", "text": "func (esc *ExecServiceCfg) MakeExecServiceFromCfg() *ExecutionService {\n\tnewEs := new(ExecutionService)\n\tnewEs.ServiceCfgInUse = esc\n\tnewEs.buildExecService()\n\treturn newEs\n}", "title": "" }, { "docid": "edc089d4006a81750a59f30bcb438abd", "score": "0.5502633", "text": "func (e *ExternalService) Clone() *ExternalService {\n\tclone := *e\n\treturn &clone\n}", "title": "" }, { "docid": "cf79aefb69559da067c63b4209e07c63", "score": "0.54332733", "text": "func (c *Config) clone() *Config {\n\tc2 := &Config{}\n\tconfigRaw, _ := yaml.Marshal(c)\n\t_ = yaml.Unmarshal(configRaw, c2)\n\treturn c2\n}", "title": "" }, { "docid": "d9ca951aceebbb4ab0337c6864ccb12e", "score": "0.5423916", "text": "func (c *Config) Copy() *Config {\n\tif c == nil {\n\t\treturn nil\n\t}\n\tvar o Config\n\n\to.Consul = c.Consul\n\n\tif c.Consul != nil {\n\t\to.Consul = c.Consul.Copy()\n\t}\n\n\tif c.Dedup != nil {\n\t\to.Dedup = c.Dedup.Copy()\n\t}\n\n\tif c.DefaultDelims != nil {\n\t\to.DefaultDelims = c.DefaultDelims.Copy()\n\t}\n\n\tif c.Exec != nil {\n\t\to.Exec = c.Exec.Copy()\n\t}\n\n\to.KillSignal = c.KillSignal\n\n\to.LogLevel = c.LogLevel\n\n\to.MaxStale = c.MaxStale\n\n\to.PidFile = c.PidFile\n\n\to.ReloadSignal = c.ReloadSignal\n\n\tif c.FileLog != nil {\n\t\to.FileLog = c.FileLog.Copy()\n\t}\n\n\tif c.Syslog != nil {\n\t\to.Syslog = c.Syslog.Copy()\n\t}\n\n\tif c.Templates != nil {\n\t\to.Templates = c.Templates.Copy()\n\t}\n\n\tif c.TemplateErrFatal != nil {\n\t\to.TemplateErrFatal = c.TemplateErrFatal\n\t}\n\n\tif c.Vault != nil {\n\t\to.Vault = c.Vault.Copy()\n\t}\n\n\tif c.Wait != nil {\n\t\to.Wait = c.Wait.Copy()\n\t}\n\n\to.Once = c.Once\n\to.ParseOnly = c.ParseOnly\n\n\to.BlockQueryWaitTime = c.BlockQueryWaitTime\n\n\tif c.Nomad != nil {\n\t\to.Nomad = c.Nomad.Copy()\n\t}\n\n\treturn &o\n}", "title": "" }, { "docid": "3df079fce2422fe20165a9b2a953dfcc", "score": "0.53759766", "text": "func (o *Config) Copy() *Config {\n\tnewConfig := &Config{\n\t\tCredentials: o.Credentials,\n\t\tEndpoint: o.Endpoint,\n\t\tHTTPClient: o.HTTPClient,\n\t}\n\treturn newConfig\n}", "title": "" }, { "docid": "da4d26b10a088d7d6a90063ede801678", "score": "0.536454", "text": "func (c *pyConfig) Copy() *pyConfig {\n\treturn &pyConfig{base: c.base}\n}", "title": "" }, { "docid": "e04161e70e7cec747189913f89dd0a85", "score": "0.5350158", "text": "func (ws *WorkloadServices) Copy() *WorkloadServices {\n\tnewTS := new(WorkloadServices)\n\t*newTS = *ws\n\n\t// Deep copy Services\n\tnewTS.Services = make([]*structs.Service, len(ws.Services))\n\tfor i := range ws.Services {\n\t\tnewTS.Services[i] = ws.Services[i].Copy()\n\t}\n\treturn newTS\n}", "title": "" }, { "docid": "af0e233b4ab2accf28dbdf237679229c", "score": "0.5341662", "text": "func (s *ConsulSidecarService) Copy() *ConsulSidecarService {\n\tif s == nil {\n\t\treturn nil\n\t}\n\treturn &ConsulSidecarService{\n\t\tTags: helper.CopySliceString(s.Tags),\n\t\tPort: s.Port,\n\t\tProxy: s.Proxy.Copy(),\n\t\tDisableDefaultTCPCheck: s.DisableDefaultTCPCheck,\n\t}\n}", "title": "" }, { "docid": "3c23b8e4b2ed968519938514f63f65e0", "score": "0.5337297", "text": "func cloneTerragruntOptionsForDependency(terragruntOptions *options.TerragruntOptions, targetConfig string) *options.TerragruntOptions {\n\ttargetOptions := terragruntOptions.Clone(targetConfig)\n\ttargetOptions.OriginalTerragruntConfigPath = targetConfig\n\t// Clear IAMRoleOptions in case if it is different from one passed through CLI to allow dependencies to define own iam roles\n\t// https://github.com/gruntwork-io/terragrunt/issues/1853#issuecomment-940102676\n\tif targetOptions.IAMRoleOptions != targetOptions.OriginalIAMRoleOptions {\n\t\ttargetOptions.IAMRoleOptions = options.IAMRoleOptions{}\n\t}\n\treturn targetOptions\n}", "title": "" }, { "docid": "b2a06682f49e9714b05a9dd580f0a653", "score": "0.52992845", "text": "func (c *Config) copyConf(programPath, programName, confName string) (*Config, error) {\n\n\tisTmp := false\n\tif programPath == \"/tmp\" {\n\t\tisTmp = true\n\t}\n\n\tnewConf := Config{programPath, programName, confName, isTmp, sync.RWMutex{}}\n\terr := newConf.read(c)\n\treturn &newConf, err\n}", "title": "" }, { "docid": "1b84fe32b16d6d3a34c39254bc569f5c", "score": "0.52677375", "text": "func copyConfigFile(configFile *grpc_application_go.ConfigFile) *grpc_application_go.ConfigFile {\n\tif configFile == nil {\n\t\treturn nil\n\t}\n\treturn &grpc_application_go.ConfigFile{\n\t\tOrganizationId: configFile.OrganizationId,\n\t\tAppDescriptorId: configFile.AppDescriptorId,\n\t\tConfigFileId: configFile.ConfigFileId,\n\t\tName: configFile.Name,\n\t\tContent: configFile.Content,\n\t\tMountPath: configFile.MountPath,\n\t}\n}", "title": "" }, { "docid": "b65a5e6c2cd4f2f91d174ecf02a3e3ab", "score": "0.52652305", "text": "func copyConfig(in *config.Beam) *config.Beam {\n\tbytes, err := json.Marshal(in)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to marshal Beam config for copy: %v\", err))\n\t}\n\tout := new(config.Beam)\n\terr = json.Unmarshal(bytes, out)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to unmarshal Beam config for copy: %v\", err))\n\t}\n\treturn out\n}", "title": "" }, { "docid": "1459140774825ebd48d3c57f22bfd018", "score": "0.52601725", "text": "func (c *Config) Clone() flagext.Registerer {\n\treturn func(c Config) *Config {\n\t\treturn &c\n\t}(*c)\n}", "title": "" }, { "docid": "16a6f2618499d7a19280a93cd5d02ff3", "score": "0.5250318", "text": "func (cfg Config) Copy() Config {\n\tres := cfg\n\tif res.Addresses != nil {\n\t\tres.Addresses = append([]netaddr.IPPrefix{}, res.Addresses...)\n\t}\n\tif res.DNS != nil {\n\t\tres.DNS = append([]netaddr.IP{}, res.DNS...)\n\t}\n\tpeers := make([]Peer, 0, len(res.Peers))\n\tfor _, peer := range res.Peers {\n\t\tpeers = append(peers, peer.Copy())\n\t}\n\tres.Peers = peers\n\treturn res\n}", "title": "" }, { "docid": "c22e2e19f02ee20f865f157cbcc9ff38", "score": "0.52266604", "text": "func newConfig(serviceName string, opts ...Option) config {\n\tcfg := config{Propagators: global.Propagators(), ServiceName: serviceName}\n\tfor _, opt := range opts {\n\t\topt(&cfg)\n\t}\n\tif cfg.Tracer == nil {\n\t\tcfg.Tracer = global.Tracer(defaultTracerName)\n\t}\n\treturn cfg\n}", "title": "" }, { "docid": "243c4cbadbbedc52cfd6205b21479c51", "score": "0.5217687", "text": "func (o RuntimeOptions) Clone() RuntimeOptions {\n\treturn o\n}", "title": "" }, { "docid": "3defcde7fc3995b0cf17b488a34b9a64", "score": "0.5211599", "text": "func (c *ReplicaConfig) Clone() *ReplicaConfig {\n\tstr, err := c.Marshal()\n\tif err != nil {\n\t\tlog.Panic(\"failed to marshal replica config\",\n\t\t\tzap.Error(cerror.WrapError(cerror.ErrDecodeFailed, err)))\n\t}\n\tclone := new(ReplicaConfig)\n\terr = clone.Unmarshal([]byte(str))\n\tif err != nil {\n\t\tlog.Panic(\"failed to unmarshal replica config\",\n\t\t\tzap.Error(cerror.WrapError(cerror.ErrDecodeFailed, err)))\n\t}\n\treturn clone\n}", "title": "" }, { "docid": "f1fee87ae1abe0c4f783c6231bf87e72", "score": "0.51948375", "text": "func (adminServiceApi *AdminServiceApiV1) Clone() *AdminServiceApiV1 {\n\tif core.IsNil(adminServiceApi) {\n\t\treturn nil\n\t}\n\tclone := *adminServiceApi\n\tclone.Service = adminServiceApi.Service.Clone()\n\treturn &clone\n}", "title": "" }, { "docid": "18299a0d8289bfdd84ca3007b9fbc101", "score": "0.5190036", "text": "func (configurationGovernance *ConfigurationGovernanceV1) Clone() *ConfigurationGovernanceV1 {\n\tif core.IsNil(configurationGovernance) {\n\t\treturn nil\n\t}\n\tclone := *configurationGovernance\n\tclone.Service = configurationGovernance.Service.Clone()\n\treturn &clone\n}", "title": "" }, { "docid": "b72503f5e39c90cc35a9a7fdda2df098", "score": "0.5189243", "text": "func (c *Config) Copy() *Config {\n\tif c == nil {\n\t\treturn nil\n\t}\n\treturn &Config{\n\t\tEndpoint: c.Endpoint,\n\t\tUsername: c.Username,\n\t\tPassword: c.Password,\n\t}\n}", "title": "" }, { "docid": "77e8b0321ecde50f411c7f6a032f45f6", "score": "0.5181675", "text": "func (es *EndpointSettings) Copy() *EndpointSettings {\n\tepCopy := *es\n\tif es.IPAMConfig != nil {\n\t\tepCopy.IPAMConfig = es.IPAMConfig.Copy()\n\t}\n\n\tif es.Links != nil {\n\t\tlinks := make([]string, 0, len(es.Links))\n\t\tepCopy.Links = append(links, es.Links...)\n\t}\n\n\tif es.Aliases != nil {\n\t\taliases := make([]string, 0, len(es.Aliases))\n\t\tepCopy.Aliases = append(aliases, es.Aliases...)\n\t}\n\treturn &epCopy\n}", "title": "" }, { "docid": "da7b090f004d6ee812b9b8b47d70de32", "score": "0.5179394", "text": "func (cfg *EndpointIPAMConfig) Copy() *EndpointIPAMConfig {\n\tcfgCopy := *cfg\n\tcfgCopy.LinkLocalIPs = make([]string, 0, len(cfg.LinkLocalIPs))\n\tcfgCopy.LinkLocalIPs = append(cfgCopy.LinkLocalIPs, cfg.LinkLocalIPs...)\n\treturn &cfgCopy\n}", "title": "" }, { "docid": "9e85c12b48f66bb9c2dca0ad0f58eda9", "score": "0.51525146", "text": "func (c *Config) Clone() *Config {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\treturn &Config{\n\t\tServerName: c.ServerName,\n\n\t\tSendSessionTickets: c.SendSessionTickets,\n\t\tTicketLifetime: c.TicketLifetime,\n\t\tTicketLen: c.TicketLen,\n\t\tEarlyDataLifetime: c.EarlyDataLifetime,\n\t\tAllowEarlyData: c.AllowEarlyData,\n\t\tRequireCookie: c.RequireCookie,\n\t\tCookieHandler: c.CookieHandler,\n\t\tCookieProtector: c.CookieProtector,\n\t\tExtensionHandler: c.ExtensionHandler,\n\t\tRequireClientAuth: c.RequireClientAuth,\n\t\tTime: c.Time,\n\t\tRootCAs: c.RootCAs,\n\t\tInsecureSkipVerify: c.InsecureSkipVerify,\n\n\t\tCertificates: c.Certificates,\n\t\tVerifyPeerCertificate: c.VerifyPeerCertificate,\n\t\tCipherSuites: c.CipherSuites,\n\t\tGroups: c.Groups,\n\t\tSignatureSchemes: c.SignatureSchemes,\n\t\tNextProtos: c.NextProtos,\n\t\tPSKs: c.PSKs,\n\t\tPSKModes: c.PSKModes,\n\t\tNonBlocking: c.NonBlocking,\n\t\tUseDTLS: c.UseDTLS,\n\t}\n}", "title": "" }, { "docid": "585181a09e89beadb9719641e26de6f6", "score": "0.5137178", "text": "func (e *ConsulExposeConfig) Copy() *ConsulExposeConfig {\n\tif e == nil {\n\t\treturn nil\n\t}\n\tpaths := make([]ConsulExposePath, len(e.Paths))\n\tcopy(paths, e.Paths)\n\treturn &ConsulExposeConfig{\n\t\tPaths: paths,\n\t}\n}", "title": "" }, { "docid": "e26b14d3c4596d836748752431bb502d", "score": "0.5130744", "text": "func (o *Config) Copy(s Config) {\n\to.Enable = s.Enable\n\to.RouterId = s.RouterId\n\to.RejectDefaultRoute = s.RejectDefaultRoute\n\to.AllowRedistributeDefaultRoute = s.AllowRedistributeDefaultRoute\n\to.Rfc1583 = s.Rfc1583\n\to.SpfCalculationDelay = s.SpfCalculationDelay\n\to.LsaInterval = s.LsaInterval\n\to.EnableGracefulRestart = s.EnableGracefulRestart\n\to.GracePeriod = s.GracePeriod\n\to.HelperEnable = s.HelperEnable\n\to.StrictLsaChecking = s.StrictLsaChecking\n\to.MaxNeighborRestartTime = s.MaxNeighborRestartTime\n\to.BfdProfile = s.BfdProfile\n}", "title": "" }, { "docid": "b7b5177b4e8c60e7142478a049a4a4d4", "score": "0.51237106", "text": "func (config Config) Clone() Config {\n\tclone := make(Config)\n\tfor key, value := range config {\n\t\tclone[key] = value\n\t}\n\treturn clone\n}", "title": "" }, { "docid": "46ea2c28032eb198e258143b12212874", "score": "0.5122086", "text": "func (d *dispatcher) Clone() Dispatcher {\n\tclone, _ := GenerateFromConfig(d.config)\n\treturn clone\n}", "title": "" }, { "docid": "a5872b9098c811fffd7733e042cce03c", "score": "0.5097253", "text": "func (kubernetesServiceApi *KubernetesServiceApiV1) Clone() *KubernetesServiceApiV1 {\n\tif core.IsNil(kubernetesServiceApi) {\n\t\treturn nil\n\t}\n\tclone := *kubernetesServiceApi\n\tclone.Service = kubernetesServiceApi.Service.Clone()\n\treturn &clone\n}", "title": "" }, { "docid": "aa4558a536a04fe0bc7b9592ef210ad1", "score": "0.50706446", "text": "func CloneAndUpdateServiceOauth(name string, serviceMetaData *model.ServiceMetaData) error {\r\n\tvar m bson.M\r\n\tconfig.ReadConfig()\r\n\tlink := viper.GetString(`mongo.link`)\r\n\ttemplateOauth := viper.GetString(`servicetemplate.oauth2`)\r\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\r\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(link))\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tdefer client.Disconnect(ctx)\r\n\tdatabase := client.Database(\"cas\")\r\n\tservice := database.Collection(\"casserviceregistry\")\r\n\terr = service.FindOne(ctx, bson.M{\"clientId\": templateOauth}).Decode(&m)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\t//generate random\r\n\trand.Seed(int64(time.Now().Nanosecond()))\r\n\tvalue := rand.Int()\r\n\t//\r\n\t//m[\"_id\"] = rand.Int31() + rand.Int31()\r\n\tm[\"_id\"] = value\r\n\tm[\"clientSecret\"] = serviceMetaData.Clientsecret\r\n\tm[\"clientId\"] = serviceMetaData.Clientid\r\n\tm[\"serviceId\"] = serviceMetaData.Serviceid\r\n\tm[\"name\"] = name\r\n\t_, err = service.InsertOne(context.TODO(), m)\r\n\tif err != nil {\r\n\t\t//log.Fatal(err)\r\n\t\treturn err\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "297c780d075e69c437995f1d238c1ad5", "score": "0.5033939", "text": "func (opts *Remote) Copy() *Remote {\n\toptsCopy := *opts\n\tif opts.Proxy != nil {\n\t\toptsCopy.Proxy = opts.Proxy.Copy()\n\t}\n\treturn &optsCopy\n}", "title": "" }, { "docid": "55a89ccff2da27d9d52c62b5ee1c0075", "score": "0.5025473", "text": "func (r *HeatReconciler) generateServiceConfigMaps(\n\tctx context.Context,\n\tinstance *heatv1beta1.Heat,\n\th *helper.Helper,\n\tenvVars *map[string]env.Setter,\n) error {\n\t//\n\t// create Configmap/Secret required for heat input\n\t// - %-scripts configmap holding scripts to e.g. bootstrap the service\n\t// - %-config configmap holding minimal heat config required to get the service up, user can add additional files to be added to the service\n\t// - parameters which has passwords gets added from the ospSecret via the init container\n\t//\n\n\tcmLabels := labels.GetLabels(instance, labels.GetGroupLabel(heat.ServiceName), map[string]string{})\n\n\t// customData hold any customization for the service.\n\t// custom.conf is going to /etc/heat/heat.conf.d\n\t// all other files get placed into /etc/heat to allow overwrite of e.g. policy.json\n\t// TODO: make sure custom.conf can not be overwritten\n\tcustomData := map[string]string{common.CustomServiceConfigFileName: instance.Spec.CustomServiceConfig}\n\tfor key, data := range instance.Spec.DefaultConfigOverwrite {\n\t\tcustomData[key] = data\n\t}\n\n\tvar err error\n\tkeystoneAPI, err = keystonev1.GetKeystoneAPI(ctx, h, instance.Namespace, map[string]string{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tauthURL, err := keystoneAPI.GetEndpoint(endpoint.EndpointPublic)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttemplateParameters := map[string]interface{}{\n\t\t\"KeystonePublicURL\": authURL,\n\t\t\"ServiceUser\": instance.Spec.ServiceUser,\n\t\t\"StackDomainAdminUsername\": heat.StackDomainAdminUsername,\n\t\t\"StackDomainName\": heat.StackDomainName,\n\t}\n\n\tcms := []util.Template{\n\t\t// ScriptsConfigMap\n\t\t{\n\t\t\tName: fmt.Sprintf(\"%s-scripts\", instance.Name),\n\t\t\tNamespace: instance.Namespace,\n\t\t\tType: util.TemplateTypeScripts,\n\t\t\tInstanceType: instance.Kind,\n\t\t\tAdditionalTemplate: map[string]string{\"common.sh\": \"/common/common.sh\"},\n\t\t\tLabels: cmLabels,\n\t\t},\n\t\t// ConfigMap\n\t\t{\n\t\t\tName: fmt.Sprintf(\"%s-config-data\", instance.Name),\n\t\t\tNamespace: instance.Namespace,\n\t\t\tType: util.TemplateTypeConfig,\n\t\t\tInstanceType: instance.Kind,\n\t\t\tCustomData: customData,\n\t\t\tConfigOptions: templateParameters,\n\t\t\tLabels: cmLabels,\n\t\t},\n\t}\n\treturn configmap.EnsureConfigMaps(ctx, h, instance, cms, envVars)\n}", "title": "" }, { "docid": "0ef888ba396805c02ff42dea593e9f8d", "score": "0.50216866", "text": "func (r *ProxyServiceReconciler) constructConfig(proxy *api.ProxyService) (*corev1.ConfigMap, error) {\n\tconfig := createConfig(*proxy)\n\tr.Log.Info(\"Config\", \"config\", config)\n\tif err := ctrl.SetControllerReference(proxy, config, r.Scheme); err != nil {\n\t\treturn nil, err\n\t}\n\treturn config, nil\n}", "title": "" }, { "docid": "6a52104ff3acb509566f4425a6a750d8", "score": "0.5010908", "text": "func (container *Container) Clone() *Container {\n\tcp := *container\n\tcp.Config.ExposedPorts = cloneMap(cp.Config.ExposedPorts)\n\tcp.Config.Env = cloneSlice(cp.Config.Env)\n\tcp.Config.Entrypoint = cloneSlice(cp.Config.Entrypoint)\n\tcp.Config.Cmd = cloneSlice(cp.Config.Cmd)\n\tcp.Config.Volumes = cloneMap(cp.Config.Volumes)\n\tcp.Config.Labels = cloneMap(cp.Config.Labels)\n\tcp.Mounts = cloneSlice(cp.Mounts)\n\tcp.Secrets = cloneSlice(cp.Secrets)\n\tcp.Sockets = cloneSlice(cp.Sockets)\n\tcp.Ports = cloneSlice(cp.Ports)\n\tcp.Services = cloneMap(cp.Services)\n\tcp.HostAliases = cloneSlice(cp.HostAliases)\n\tcp.Pipeline = cloneSlice(cp.Pipeline)\n\treturn &cp\n}", "title": "" }, { "docid": "2afc872ec485f509302dd24605c36e5e", "score": "0.5006863", "text": "func toJSON() IBotConfiguration {\nnewConfig:= new(IBotConfiguration)\nObject.assign(newConfig, this)\ndelete (<any>newConfig).internal\nnewConfig.services = this.services.slice().map((service: IConnectedService) => (<ConnectedService>service).toJSON())\n\nreturn newConfig\n}", "title": "" }, { "docid": "15b10f3d2c36c1135ffbab2a3f8a7062", "score": "0.4989437", "text": "func (cxt *ExecutionContext) Copy() Context {\n\tnewCxt := NewContext()\n\tvals := cxt.GetAll()\n\tds := cxt.Datasources()\n\n\tfor k, v := range vals {\n\t\tnewCxt.Add(k, v)\n\t}\n\n\tfor k, datasource := range ds {\n\t\tnewCxt.AddDatasource(k, datasource)\n\t}\n\n\treturn newCxt\n}", "title": "" }, { "docid": "5f72b36e0f38e5ccd334d7194001b3b6", "score": "0.4987197", "text": "func (t *TLSConfig) Copy() *TLSConfig {\n\tif t == nil {\n\t\treturn t\n\t}\n\n\tnew := &TLSConfig{}\n\tnew.EnableHTTP = t.EnableHTTP\n\tnew.EnableRPC = t.EnableRPC\n\tnew.VerifyServerHostname = t.VerifyServerHostname\n\tnew.CAFile = t.CAFile\n\tnew.CertFile = t.CertFile\n\n\t// Shallow copy the key loader as its GetOutgoingCertificate method is what\n\t// is used by the HTTP server to retrieve the certificate. If we create a new\n\t// KeyLoader struct, the HTTP server will still be calling the old\n\t// GetOutgoingCertificate method.\n\tt.keyloaderLock.Lock()\n\tnew.KeyLoader = t.KeyLoader\n\tt.keyloaderLock.Unlock()\n\n\tnew.KeyFile = t.KeyFile\n\tnew.RPCUpgradeMode = t.RPCUpgradeMode\n\tnew.VerifyHTTPSClient = t.VerifyHTTPSClient\n\n\tnew.TLSCipherSuites = t.TLSCipherSuites\n\tnew.TLSMinVersion = t.TLSMinVersion\n\n\tnew.TLSPreferServerCipherSuites = t.TLSPreferServerCipherSuites\n\n\tnew.SetChecksum()\n\n\treturn new\n}", "title": "" }, { "docid": "fb19b785056129da905f8fd5107cd574", "score": "0.4971752", "text": "func (t *Provider) GetConfigFromTrackerService(genesisHash, configFilePath string) error {\n\tt.init()\n\tt.ServiceURL = t.ServiceURL + \"/\" + genesisHash + \"/file\"\n\tconfigResp := CXApplicationConfig{}\n\terr := t.apiClient.Get(t.ServiceURL, &configResp)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while retreiving config with genesis hash: %s on service %s due to error: %s\", genesisHash, t.ServiceURL, err)\n\t}\n\n\tdata, err := json.MarshalIndent(configResp, \"\", \" \")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while marshal config with genesis hash: %s due to error: %s\", genesisHash, err)\n\t}\n\n\tf, err := os.Create(configFilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while creating file for config with genesis hash: %s due to error: %s\", genesisHash, err)\n\t}\n\n\tif _, err := f.Write(data); err != nil {\n\t\treturn fmt.Errorf(\"error while saving config to file with genesis hash: %s due to error: %s\", genesisHash, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dae19600358960295d49eaad3e60d625", "score": "0.4947123", "text": "func (p *ConsulProxy) Copy() *ConsulProxy {\n\tif p == nil {\n\t\treturn nil\n\t}\n\n\tnewP := &ConsulProxy{\n\t\tLocalServiceAddress: p.LocalServiceAddress,\n\t\tLocalServicePort: p.LocalServicePort,\n\t\tExpose: p.Expose.Copy(),\n\t}\n\n\tif n := len(p.Upstreams); n > 0 {\n\t\tnewP.Upstreams = make([]ConsulUpstream, n)\n\n\t\tfor i := range p.Upstreams {\n\t\t\tnewP.Upstreams[i] = *p.Upstreams[i].Copy()\n\t\t}\n\t}\n\n\tif n := len(p.Config); n > 0 {\n\t\tnewP.Config = make(map[string]interface{}, n)\n\n\t\tfor k, v := range p.Config {\n\t\t\tnewP.Config[k] = v\n\t\t}\n\t}\n\n\treturn newP\n}", "title": "" }, { "docid": "d88efb1c45277e97322b261fd80f1dc1", "score": "0.49353534", "text": "func (o *APIPodTaskContainerCreationOptions) BuildFromService(opts pod.TaskContainerCreationOptions) {\n\to.Image = utility.ToStringPtr(opts.Image)\n\to.RepoCredsExternalID = utility.ToStringPtr(opts.RepoCredsExternalID)\n\to.MemoryMB = utility.ToIntPtr(opts.MemoryMB)\n\to.CPU = utility.ToIntPtr(opts.CPU)\n\to.OS.BuildFromService(&opts.OS)\n\to.Arch.BuildFromService(&opts.Arch)\n\to.WindowsVersion.BuildFromService(&opts.WindowsVersion)\n\to.EnvVars = opts.EnvVars\n\tenvSecrets := map[string]APIPodSecret{}\n\tfor name, secret := range opts.EnvSecrets {\n\t\tvar s APIPodSecret\n\t\ts.BuildFromService(secret)\n\t\tenvSecrets[name] = s\n\t}\n\to.EnvSecrets = envSecrets\n\to.WorkingDir = utility.ToStringPtr(opts.WorkingDir)\n}", "title": "" }, { "docid": "1459a7233bc194f59e570b01c2ae936a", "score": "0.49339372", "text": "func (op *Operator) Clone(eraseCredentials bool) *Operator {\n\tclone := &Operator{\n\t\tID: op.ID,\n\t\tSites: []*Site{},\n\t}\n\n\t// Clone sites\n\tfor _, site := range op.Sites {\n\t\tclone.Sites = append(clone.Sites, site.Clone(eraseCredentials))\n\t}\n\n\treturn clone\n}", "title": "" }, { "docid": "9a54ce3602095920da6a690704c74b63", "score": "0.49269384", "text": "func copyHaproxyCfg() {\n\tdata, err := ioutil.ReadFile(\"/haproxy.cfg\")\n\tif err != nil {\n\t\tglog.Fatalf(\"unexpected error reading haproxy.cfg: %v\", err)\n\t}\n\terr = ioutil.WriteFile(\"/etc/haproxy/haproxy.cfg\", data, 0644)\n\tif err != nil {\n\t\tglog.Fatalf(\"unexpected error writing haproxy.cfg: %v\", err)\n\t}\n}", "title": "" }, { "docid": "8170dd58c7faa89c248a33b21deea977", "score": "0.4918262", "text": "func (e executor) Do(service string, sc requests.SetConfigRequest) responses.SetConfigResponse {\n\tcreateErrorResponse := func(message string) responses.SetConfigResponse {\n\t\te.loggingClient.Error(message)\n\t\treturn responses.SetConfigResponse{\n\t\t\tSuccess: false,\n\t\t\tDescription: message,\n\t\t}\n\t}\n\n\t// The SMA will set configuration via Consul if EdgeX has been launched with the \"--registry\" flag.\n\te.loggingClient.Info(fmt.Sprintf(\"the SMA has been requested to set (aka PUT/UPDATE) the config for: %s\", service))\n\te.loggingClient.Debug(fmt.Sprintf(\"key %s to use for config updated\", sc.Key))\n\te.loggingClient.Debug(fmt.Sprintf(\"value %s to use for config updated\", sc.Value))\n\n\t// create a registryClient specific to the service and connect to the registry as if we are that service so\n\t// that we can update the service's corresponding key based on the request we received.\n\tvar serviceSpecificRegistryClient registry.Client\n\tserviceSpecificRegistryClient, err := registry.NewRegistryClient(\n\t\ttypes.Config{\n\t\t\tHost: e.configuration.Registry.Host,\n\t\t\tPort: e.configuration.Registry.Port,\n\t\t\tType: e.configuration.Registry.Type,\n\t\t\tStem: internal.ConfigRegistryStemCore + internal.ConfigMajorVersion,\n\t\t\tServiceKey: service,\n\t\t})\n\tif err != nil {\n\t\treturn createErrorResponse(\"unable to create new registry client\")\n\t}\n\n\t// Validate whether the key exists.\n\tkey := strings.Replace(sc.Key, \".\", \"/\", -1)\n\texists, err := serviceSpecificRegistryClient.ConfigurationValueExists(key)\n\tswitch {\n\tcase err != nil:\n\t\treturn createErrorResponse(err.Error())\n\tcase !exists:\n\t\treturn createErrorResponse(\"key does not exist\")\n\tdefault:\n\t\tif err := serviceSpecificRegistryClient.PutConfigurationValue(key, []byte(sc.Value)); err != nil {\n\t\t\treturn createErrorResponse(\"unable to update key\")\n\t\t}\n\n\t\treturn responses.SetConfigResponse{\n\t\t\tSuccess: true,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "64e87019b60827cd8c231ae0b98a17c1", "score": "0.4889286", "text": "func (b *ServiceInfoBuilder) Copy(object *ServiceInfo) *ServiceInfoBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tb.fullname = object.fullname\n\tb.statusType = object.statusType\n\treturn b\n}", "title": "" }, { "docid": "11861392d250c962670e3d2647da6936", "score": "0.48860994", "text": "func (stls *ServerTLS) Clone() *ServerTLS {\n\tif stls == nil {\n\t\treturn nil\n\t}\n\tvar config *tls.Config\n\tif stls.Config != nil {\n\t\tconfig = stls.Config.Clone()\n\t}\n\treturn &ServerTLS{\n\t\tConfig: config,\n\t\tCertificateFilePath: stls.CertificateFilePath,\n\t\tPrivateKeyFilePath: stls.PrivateKeyFilePath,\n\t}\n}", "title": "" }, { "docid": "5a7d2e2d9765b61c4c528a9aa6de9c7c", "score": "0.48730263", "text": "func NewExecutionService(cfgFileName string, useDefault bool) *ExecutionService {\n\t// extract config details from the given config file\n\tcfg, err := util.ExtractCfgJsonEleFromFile(cfgFileName, ExecServiceCfgJsonElementName)\n\t// handle errors\n\tcfg = handleErrors(err, useDefault, cfgFileName, cfg)\n\t// read the config\n\tseCfg := readExecCfg(cfg)\n\t// before returning set the logging\n\tsetupLogging()\n\t// now that we got the configuration, let us make the service build on that\n\tes := seCfg.MakeExecServiceFromCfg()\n\t// return the populated service which caller will call Start on\n\treturn es\n}", "title": "" }, { "docid": "674b863054a8c31879a17cf553a05953", "score": "0.48725933", "text": "func (postureManagement *PostureManagementV2) Clone() *PostureManagementV2 {\n\tif core.IsNil(postureManagement) {\n\t\treturn nil\n\t}\n\tclone := *postureManagement\n\tclone.Service = postureManagement.Service.Clone()\n\treturn &clone\n}", "title": "" }, { "docid": "6badc3a69a33c9cd58ba18a142a30c95", "score": "0.48435476", "text": "func newConfig(workspace string) {\n\tif Op != nil {\n\t\treturn\n\t}\n\n\topConfig, err := readConfig(workspace)\n\tlog.CheckIfErrorMessage(err, \"Error when reading config.\")\n\n\tOp = &opConfig\n}", "title": "" }, { "docid": "882129441a98d696c40428094a467f01", "score": "0.48273784", "text": "func (ns *NetconfService) CopyConfig(\n\tprovider types.ServiceProvider,\n\ttarget, sourceDS datastore.DataStore,\n\tsourceEntity types.Entity,\n\turl string) bool {\n\n\t// target/source options: candidate | running | startup | url\n\tif (target == datastore.NotSet) {\n\t\terr := errors.YError{Msg: \"You must select target\"}\n\t\tpanic(err.Error())\n\t}\n\n\tif ((target == datastore.URL ||\n\t\tsourceDS == datastore.URL) && len(url) == 0){\n\t\terr := errors.YError{Msg: \"url must be specified\"}\n\t\tpanic(err.Error())\n\t}\n\tif ((sourceDS != datastore.NotSet && sourceEntity != nil) ||\n\t\tsourceDS == datastore.NotSet && sourceEntity == nil) {\n\t\terr := errors.YError{\n\t\t\tMsg: \"sourceDS OR sourceEntity must be valid, not neither nor both\"}\n\t\tpanic(err.Error())\n\t}\n\n\tdata := map[string]interface{} {}\n\tdsStr := target.String()\n\tdataValue := getDataValue(dsStr, url)\n\tdata[\"target/\" + dsStr] = dataValue\n\n\tif (sourceDS != datastore.NotSet){\n\t\tdsStr = sourceDS.String()\n\t\tdataValue = getDataValue(dsStr, url)\n\t\tdata[\"source/\" + dsStr] = dataValue\n\t} else {\n\t\tdata[\"source/config\"] = sourceEntity\n\t}\n\n\treadDataNode := path.ExecuteRPC(\n\t\tprovider, \"ietf-netconf:copy-config\", data, false)\n\treturn operationSucceeded(readDataNode)\n}", "title": "" }, { "docid": "ce6fdde5b54be48652486978deccf668", "score": "0.48213175", "text": "func (sc *ServiceCheck) Copy() *ServiceCheck {\n\tif sc == nil {\n\t\treturn nil\n\t}\n\tnsc := new(ServiceCheck)\n\t*nsc = *sc\n\tnsc.Args = helper.CopySliceString(sc.Args)\n\tnsc.Header = helper.CopyMapStringSliceString(sc.Header)\n\tnsc.CheckRestart = sc.CheckRestart.Copy()\n\treturn nsc\n}", "title": "" }, { "docid": "6b341f0a77cd3d60bad0507c65d56850", "score": "0.48095918", "text": "func (ep *Endpoint) clone() cloneable {\n\tif ep == nil {\n\t\treturn nil\n\t}\n\n\tvar endpoint *registry.NSERegistration\n\tif ep.Endpoint != nil {\n\t\tendpoint = proto.Clone(ep.Endpoint).(*registry.NSERegistration)\n\t}\n\n\treturn &Endpoint{\n\t\tEndpoint: endpoint,\n\t\tSocketLocation: ep.SocketLocation,\n\t\tWorkspace: ep.Workspace,\n\t}\n}", "title": "" }, { "docid": "9427d636dc6a46e7e632672c5efb9864", "score": "0.48046777", "text": "func (t Task) Clone() Task {\n\treturn Task{\n\t\tPeriod: t.Period,\n\t\tExpiredAt: t.ExpiredAt,\n\t\tMaxRetries: t.MaxRetries,\n\t\tMaxRuns: t.MaxRuns,\n\t\tZapConfig: t.ZapConfig,\n\t}\n}", "title": "" }, { "docid": "65a1be863222d564f287b770c51356eb", "score": "0.47997573", "text": "func (b *Boondoggle) configureServices(r RawBoondoggle) {\n\t// First get the service-state overrides provided by the user in a way that we can work with.\n\tserviceStates := getServiceStatesMap()\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\t\tif serviceStates[rawService.Name] != \"\" {\n\t\t\t// if we have a override in the serviceStates, get the state values based on that name.\n\t\t\tchosenStateKey, err = getRawStateKeyByName(rawService.Name, serviceStates[rawService.Name], r)\n\t\t} else {\n\t\t\t// if not, find the default\n\t\t\tchosenStateKey, err = getRawStateKeyByName(rawService.Name, \"default\", 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\tfmt.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: rawService.States[chosenStateKey].ContainerBuild,\n\t\t\t\tRepository: rawService.States[chosenStateKey].Repository,\n\t\t\t\tHelmValues: 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 == false {\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// Append to Boondoggle.Services\n\t\t\tb.Services = append(b.Services, completeService)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a1255abc1ec2cd677dc50e6713527017", "score": "0.4791998", "text": "func CloneTLSClientConfig(cfg *tls.Config) *tls.Config {\n\tif cfg == nil {\n\t\treturn &tls.Config{}\n\t}\n\treturn &tls.Config{\n\t\tRand: cfg.Rand,\n\t\tTime: cfg.Time,\n\t\tCertificates: cfg.Certificates,\n\t\tNameToCertificate: cfg.NameToCertificate,\n\t\tGetCertificate: cfg.GetCertificate,\n\t\tRootCAs: cfg.RootCAs,\n\t\tNextProtos: cfg.NextProtos,\n\t\tServerName: cfg.ServerName,\n\t\tClientAuth: cfg.ClientAuth,\n\t\tClientCAs: cfg.ClientCAs,\n\t\tInsecureSkipVerify: cfg.InsecureSkipVerify,\n\t\tCipherSuites: cfg.CipherSuites,\n\t\tPreferServerCipherSuites: cfg.PreferServerCipherSuites,\n\t\tClientSessionCache: cfg.ClientSessionCache,\n\t\tMinVersion: cfg.MinVersion,\n\t\tMaxVersion: cfg.MaxVersion,\n\t\tCurvePreferences: cfg.CurvePreferences,\n\t}\n}", "title": "" }, { "docid": "b26da14a2179c6baf08bf05e0152fed7", "score": "0.476617", "text": "func cloneTerragruntOptionsForDependencyOutput(terragruntOptions *options.TerragruntOptions, targetConfig string) (*options.TerragruntOptions, error) {\n\ttargetOptions := cloneTerragruntOptionsForDependency(terragruntOptions, targetConfig)\n\ttargetOptions.IncludeModulePrefix = false\n\t// just read outputs, so no need to check for dependent modules\n\ttargetOptions.CheckDependentModules = false\n\ttargetOptions.TerraformCommand = \"output\"\n\ttargetOptions.TerraformCliArgs = []string{\"output\", \"-json\"}\n\n\t// DownloadDir needs to be updated to be in the context of the new config, if using default\n\t_, originalDefaultDownloadDir, err := options.DefaultWorkingAndDownloadDirs(terragruntOptions.TerragruntConfigPath)\n\tif err != nil {\n\t\treturn nil, errors.WithStackTrace(err)\n\t}\n\n\t// Using default, so compute new download dir and update\n\tif terragruntOptions.DownloadDir == originalDefaultDownloadDir {\n\t\t_, downloadDir, err := options.DefaultWorkingAndDownloadDirs(targetConfig)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithStackTrace(err)\n\t\t}\n\t\ttargetOptions.DownloadDir = downloadDir\n\t}\n\n\t// Validate and use TerragruntVersionConstraints.TerraformBinary for dependency\n\tpartialTerragruntConfig, err := PartialParseConfigFile(\n\t\ttargetConfig,\n\t\ttargetOptions,\n\t\tnil,\n\t\t[]PartialDecodeSectionType{TerragruntVersionConstraints},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif partialTerragruntConfig.TerraformBinary != \"\" {\n\t\ttargetOptions.TerraformPath = partialTerragruntConfig.TerraformBinary\n\t}\n\n\t// If the Source is set, then we need to recompute it in the context of the target config.\n\tif terragruntOptions.Source != \"\" {\n\t\t// We need the terraform source of the target config to compute the actual source to use\n\t\tpartialParseIncludedConfig, err := PartialParseConfigFile(\n\t\t\ttargetConfig,\n\t\t\ttargetOptions,\n\t\t\tnil,\n\t\t\t[]PartialDecodeSectionType{TerraformBlock},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Update the source value to be everything before \"//\" so that it can be recomputed\n\t\tmoduleUrl, _ := getter.SourceDirSubdir(terragruntOptions.Source)\n\n\t\t// Finally, update the source to be the combined path between the terraform source in the target config, and the\n\t\t// value before \"//\" in the original terragrunt options.\n\t\ttargetSource, err := GetTerragruntSourceForModule(moduleUrl, filepath.Dir(targetConfig), partialParseIncludedConfig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttargetOptions.Source = targetSource\n\t}\n\n\treturn targetOptions, nil\n}", "title": "" }, { "docid": "3dda6bed3de89c28ac53ac6b914a2d51", "score": "0.47637045", "text": "func (c ConfigSet) Copy() ConfigSet {\n\tcfgs := make(map[Type]Config, len(c.cfgs))\n\tfor k, v := range c.cfgs {\n\t\tcfgs[k] = v\n\t}\n\treturn ConfigSet{cfgs}\n}", "title": "" }, { "docid": "92a7bafcb1277028864ab5ca2fff7e26", "score": "0.47623995", "text": "func buildServiceConfig(configMap map[string]string) (services map[string]string, referers map[string]string, serviceImpls map[string]string) {\n\tservices = make(map[string]string)\n\treferers = make(map[string]string)\n\tserviceImpls = make(map[string]string)\n\tfor k, v := range configMap {\n\t\tif k == serviceProtocolConfigName || k == serviceRegistryConfigName ||\n\t\t\tk == refererProtocolConfigName || k == refererRegistryConfigName || k == basicConfigName {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(k, defaultRegistryKeyPrefix) || strings.HasPrefix(k, defaultProtocolKeyPrefix) {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(k, refererConfigPrefix) { // client end\n\t\t\treferers[removePrefix(k, refererConfigPrefix)] = v\n\t\t} else if strings.HasPrefix(k, serviceConfigPrefix) { //server end\n\t\t\tservices[removePrefix(k, serviceConfigPrefix)] = v\n\t\t} else if strings.HasPrefix(k, serviceImplPrefix) { // service implement\n\t\t\tserviceImpls[removePrefix(k, serviceImplPrefix)] = v\n\t\t} else { // put in each config\n\t\t\treferers[k] = v\n\t\t\tservices[k] = v\n\t\t}\n\t}\n\treturn services, referers, serviceImpls\n}", "title": "" }, { "docid": "992f37f7fe61d7ad0b48d7b9c4072f68", "score": "0.47532874", "text": "func (as *APIAdminSettings) BuildFromService(h interface{}) error {\n\tswitch v := h.(type) {\n\tcase *evergreen.Settings:\n\t\tas.Banner = APIString(v.Banner)\n\t\tas.BannerTheme = APIString(v.BannerTheme)\n\t\terr := as.ServiceFlags.BuildFromService(v.ServiceFlags)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn errors.Errorf(\"%T is not a supported admin settings type\", h)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6e25f615ba2b30f5fa0678bf4d62c7b", "score": "0.47514793", "text": "func serviceConfigToEnvironment(service *Service) {\n\tif service == nil {\n\t\treturn\n\t}\n\tif service.AppId != \"\" {\n\t\tgenv.Set(EnvKey.AppId, service.AppId)\n\t}\n\tif service.Address != \"\" {\n\t\tgenv.Set(EnvKey.Address, service.Address)\n\t}\n\tif service.Version != \"\" {\n\t\tgenv.Set(EnvKey.Version, service.Version)\n\t}\n\tif service.Group != \"\" {\n\t\tgenv.Set(EnvKey.Group, service.Group)\n\t}\n\tif service.Deployment != \"\" {\n\t\tgenv.Set(EnvKey.Deployment, service.Deployment)\n\t}\n\tif len(service.Metadata) > 0 {\n\t\tb, _ := json.Marshal(service.Metadata)\n\t\tgenv.Set(EnvKey.Metadata, string(b))\n\t}\n}", "title": "" }, { "docid": "b4ae5c5226c5a708adde7b753cfe4f19", "score": "0.47511697", "text": "func processClone(){\n\terr := controllers.New(params.IsLocal)\n\tif err != nil{\n\t\tlogger.Info(\"Initialziation error. Error : \"+ err.Error())\n\t\tos.Exit(1)\n\t}\n oldSecret , err := controllers.GetSecret(secretData.Namespace,secretData.SecretName)\n if err != nil {\n \tlogger.Info(\"The secret with the name not found exiting \" + secretData.SecretName)\n \tlogger.Debug(err.Error())\n \tos.Exit(1)\n\t}\n\tannotations := map[string]string{\"janitor/ttl\":secretData.Ttl}\n\tmetaObject := metaV1.ObjectMeta{Name: secretData.SecretName+\"-\"+secretData.SecretSuffix , Annotations: annotations}\n newSecret := v1.Secret{Data: oldSecret.Data,ObjectMeta: metaObject}\n secret ,_ := controllers.GetSecret(secretData.Namespace,newSecret.GetName())\n if secret != nil {\n\t\terr := controllers.DeleteSecret(secretData.Namespace, newSecret.GetName())\n\t\tif err != nil {\n\t\t\tlogger.Info(\"The deletion of secret failed Error: \"+ err.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\terr = controllers.CreateSecret(secretData.Namespace, &newSecret)\n\tif err != nil {\n\t\tlogger.Info(\"The creation of secert failed Error: \"+err.Error())\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "a4ff78d0c2e11f5437a8ce8ad78a753d", "score": "0.4749542", "text": "func copyServiceGroup(group *grpc_application_go.ServiceGroup, settings *OrganizationSettings) *grpc_application_go.ServiceGroup {\n\n\tif group == nil {\n\t\treturn nil\n\t}\n\n\tservices := make([]*grpc_application_go.Service, 0)\n\tfor _, service := range group.Services {\n\t\tservices = append(services, copyService(service, settings))\n\t}\n\n\treturn &grpc_application_go.ServiceGroup{\n\t\tOrganizationId: group.OrganizationId,\n\t\tAppDescriptorId: group.AppDescriptorId,\n\t\tServiceGroupId: group.ServiceGroupId,\n\t\tName: group.Name,\n\t\tServices: services,\n\t\tPolicy: group.Policy,\n\t\tSpecs: copyServiceGroupSpecs(group.Specs),\n\t\tLabels: group.Labels,\n\t}\n}", "title": "" }, { "docid": "c9ec9de1863198ec3c187d1f5f85bc57", "score": "0.47473684", "text": "func (r OAuthFlows) Clone() (*OAuthFlows, error) {\n\trbytes, err := yaml.Marshal(r)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tvalue := OAuthFlows{}\n\tif err := yaml.Unmarshal(rbytes, &value); err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\treturn &value, nil\n}", "title": "" }, { "docid": "c6e790f1b9fdfefe4cdcda5f97a42e42", "score": "0.47465664", "text": "func (s *Service) DeepCopy() *Service {\n\tattrs := copyInternal(s.Attributes)\n\tports := copyInternal(s.Ports)\n\taccounts := copyInternal(s.ServiceAccounts)\n\tclusterVIPs := copyInternal(s.ClusterVIPs)\n\n\treturn &Service{\n\t\tAttributes: attrs.(ServiceAttributes),\n\t\tPorts: ports.(PortList),\n\t\tServiceAccounts: accounts.([]string),\n\t\tCreationTime: s.CreationTime,\n\t\tHostname: s.Hostname,\n\t\tAddress: s.Address,\n\t\tClusterVIPs: clusterVIPs.(map[string]string),\n\t\tResolution: s.Resolution,\n\t\tMeshExternal: s.MeshExternal,\n\t}\n}", "title": "" }, { "docid": "ee09ce19f7850cbc341a8ed84d8f2981", "score": "0.47423345", "text": "func (r *RoundRobinStrategy) Clone() LoadbalancingStrategy {\n\trs := &RoundRobinStrategy{}\n\trs.SetEndpoints(r.endpoints)\n\n\treturn rs\n}", "title": "" }, { "docid": "7498c75f8d10a0ced29ee4c3dd233328", "score": "0.47334167", "text": "func BindCopyConfigByKey(key string) (*Config, error) {\n\tvar cfg Config\n\t// NOTE: viper uses \"mapstructure\" tags instead of \"yaml\" tags\n\tif err := viper.UnmarshalKey(key, &cfg.Copy); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &cfg, nil\n}", "title": "" }, { "docid": "ef7ec43e8676f81bbb60e97723b57781", "score": "0.47292602", "text": "func (b *Builder) Clone() *Builder {\n\tc := &Builder{\n\t\toptions: make([]grpc.DialOption, len(b.options)),\n\t\tenabledBlocking: b.enabledBlocking,\n\t\tconnectParams: b.connectParams,\n\t\tcredentials: b.credentials,\n\t\tkeepAliveParams: b.keepAliveParams,\n\t\tuinterceptors: make([]grpc.UnaryClientInterceptor, len(b.uinterceptors)),\n\t\tsinterceptors: make([]grpc.StreamClientInterceptor, len(b.sinterceptors)),\n\t}\n\tcopy(c.options, b.options)\n\tcopy(c.uinterceptors, b.uinterceptors)\n\tcopy(c.sinterceptors, b.sinterceptors)\n\n\tif b.dns != nil {\n\t\tv := *b.dns\n\t\tc.dns = &v\n\t}\n\tif b.port != nil {\n\t\tv := *b.port\n\t\tc.port = &v\n\t}\n\tif b.tlsConfig != nil {\n\t\tc.tlsConfig = &tls.Config{\n\t\t\tCertificates: make([]tls.Certificate, len(b.tlsConfig.Certificates)),\n\t\t\tRootCAs: b.tlsConfig.RootCAs,\n\t\t}\n\t\tcopy(c.tlsConfig.Certificates, b.tlsConfig.Certificates)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "931be034facdf061a20a59b8d0b50176", "score": "0.47182655", "text": "func (instance *ServiceInstance) DeepCopy() *ServiceInstance {\n\treturn &ServiceInstance{\n\t\tService: instance.Service.DeepCopy(),\n\t\tEndpoint: instance.Endpoint.DeepCopy(),\n\t\tServicePort: &Port{\n\t\t\tName: instance.ServicePort.Name,\n\t\t\tPort: instance.ServicePort.Port,\n\t\t\tProtocol: instance.ServicePort.Protocol,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "79ad395cb82eaf10d5230d8c77794136", "score": "0.47028103", "text": "func (catalogManagement *CatalogManagementV1) Clone() *CatalogManagementV1 {\n\tif core.IsNil(catalogManagement) {\n\t\treturn nil\n\t}\n\tclone := *catalogManagement\n\tclone.Service = catalogManagement.Service.Clone()\n\treturn &clone\n}", "title": "" }, { "docid": "f73ab7af961ea03201bec4373a9245fa", "score": "0.47013012", "text": "func (postureManagement *PostureManagementV1) Clone() *PostureManagementV1 {\n\tif core.IsNil(postureManagement) {\n\t\treturn nil\n\t}\n\tclone := *postureManagement\n\tclone.Service = postureManagement.Service.Clone()\n\treturn &clone\n}", "title": "" }, { "docid": "50da19dc2897aecc277acbbe3278a099", "score": "0.47006464", "text": "func (es ExternalServices) Clone() ExternalServices {\n\to := make(ExternalServices, 0, len(es))\n\tfor _, r := range es {\n\t\to = append(o, r.Clone())\n\t}\n\treturn o\n}", "title": "" }, { "docid": "5559699980bfa533f242344f7126d198", "score": "0.46939498", "text": "func transferConfig() ([]byte, error) {\n\tconfigLock.RLock()\n\tdefer configLock.RUnlock()\n\n\twait2dump := conf.MosnConfig\n\tlisteners := make([]v2.Listener, 0, len(conf.Listener))\n\tfor _, l := range conf.Listener {\n\t\tlisteners = append(listeners, l)\n\t}\n\tclusters := make([]v2.Cluster, 0, len(conf.Cluster))\n\tfor _, c := range conf.Cluster {\n\t\tclusters = append(clusters, c)\n\t}\n\trouters := make([]*v2.RouterConfiguration, 0, len(conf.Routers))\n\t// get routers, should set the original path\n\tfor name := range conf.Routers {\n\t\trouterPath := conf.routerConfigPath[name]\n\t\tr := conf.Routers[name] // copy the value\n\t\tr.RouterConfigPath = routerPath\n\t\trouters = append(routers, &r)\n\t}\n\textends := make(map[string]json.RawMessage, len(conf.ExtendConfigs))\n\tfor k, v := range conf.ExtendConfigs {\n\t\textends[k] = v\n\t}\n\tif len(wait2dump.Servers) == 0 {\n\t\tlog.DefaultLogger.Errorf(\"no server config should only exists in test mode. mock an empty one\")\n\t\twait2dump.Servers = make([]v2.ServerConfig, 1)\n\t\twait2dump.Servers[0] = v2.ServerConfig{}\n\t}\n\twait2dump.Servers[0].Listeners = listeners\n\twait2dump.Servers[0].Routers = routers\n\twait2dump.ClusterManager.Clusters = clusters\n\twait2dump.ClusterManager.ClusterConfigPath = conf.clusterConfigPath\n\twait2dump.Extends = extends\n\tif transferExtensionFunc != nil {\n\t\ttransferExtensionFunc(&wait2dump)\n\t}\n\treturn json.MarshalIndent(wait2dump, \"\", \" \")\n}", "title": "" }, { "docid": "c51b158fbc5ac448961960cdc8617ac8", "score": "0.4691388", "text": "func (s *PodsToActivate) Clone() StateData {\n\treturn s\n}", "title": "" }, { "docid": "2fdcef7c4cc225b31be4701795315edd", "score": "0.46697208", "text": "func serviceConfig(serviceType string, c *cli.Context, args []string) *baobab.Config {\n\treturn &baobab.Config{\n\t\tName: fmt.Sprintf(\"%s_jasperd\", serviceType),\n\t\tDisplayName: fmt.Sprintf(\"Jasper %s service\", serviceType),\n\t\tDescription: \"Jasper is a service for process management\",\n\t\tExecutable: \"\", // No executable refers to the current executable.\n\t\tArguments: args,\n\t\tEnvironment: makeUserEnvironment(c.String(userFlagName), c.StringSlice(envFlagName)),\n\t\tUserName: c.String(userFlagName),\n\t\tForceInteractive: c.Bool(interactiveFlagName),\n\t\tOption: serviceOptions(c),\n\t}\n}", "title": "" }, { "docid": "c59ad7871afed4db56ebd77b602a9453", "score": "0.46500972", "text": "func (e *Executor) Config() *config.Config { return e.config }", "title": "" }, { "docid": "615dba7c504c6ec823ef7a43385d368d", "score": "0.4644326", "text": "func cloneCredentials(original map[string][]byte) map[string][]byte {\n\tcredsClone := make(map[string][]byte)\n\n\tfor key, value := range original {\n\t\t// Clone the value\n\t\tvalueClone := make([]byte, len(value))\n\t\tcopy(valueClone, value)\n\n\t\t// Set the key, value pair on the credentials clone\n\t\tcredsClone[key] = valueClone\n\t}\n\n\treturn credsClone\n}", "title": "" }, { "docid": "af09851c5beda1a5257d3b99aef8f1ff", "score": "0.46408924", "text": "func (c *Configurations) Copy() device.Resulter {\n\tif c == nil {\n\t\treturn nil\n\t}\n\treturn &Configurations{\n\t\tDirectionMask: c.DirectionMask,\n\t\tValueMask: c.ValueMask}\n}", "title": "" }, { "docid": "35983a9e8345aaaa5771ce5d13759bda", "score": "0.46295613", "text": "func (opts *Proxy) Copy() *Proxy {\n\toptsCopy := *opts\n\treturn &optsCopy\n}", "title": "" }, { "docid": "63480d21b8ee02fb5b50b9b1af135ccd", "score": "0.46256316", "text": "func (env *Bindings) Clone() *Bindings {\n\tn := NewBindings()\n\tfor _, b := range env.arr {\n\t\tn.arr = append(n.arr, b)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "7dd1cd6885d070e85b91a818764674e7", "score": "0.4611757", "text": "func LoadConfiguration() *ServiceConfig {\n\n\tvar cfg ServiceConfig\n\n\tcfg.InQueueName = ensureSetAndNonEmpty(\"VIRGO4_IIIF_MANIFEST_CACHE_IN_QUEUE\")\n\tcfg.OutQueueName = ensureSetAndNonEmpty(\"VIRGO4_IIIF_MANIFEST_CACHE_OUT_QUEUE\")\n\tcfg.MessageBucketName = ensureSetAndNonEmpty(\"VIRGO4_SQS_MESSAGE_BUCKET\")\n\tcfg.PollTimeOut = int64(envToInt(\"VIRGO4_IIIF_MANIFEST_CACHE_QUEUE_POLL_TIMEOUT\"))\n\n\tcfg.CacheBucketName = ensureSetAndNonEmpty(\"VIRGO4_IIIF_MANIFEST_CACHE_BUCKET\")\n\tcfg.IIIFServiceTimeout = envToInt(\"VIRGO4_IIIF_MANIFEST_CACHE_SERVICE_TIMEOUT\")\n\n\tcfg.WorkerQueueSize = envToInt(\"VIRGO4_IIIF_MANIFEST_CACHE_WORK_QUEUE_SIZE\")\n\tcfg.Workers = envToInt(\"VIRGO4_IIIF_MANIFEST_CACHE_WORKERS\")\n\n\tlog.Printf(\"[CONFIG] InQueueName = [%s]\", cfg.InQueueName)\n\tlog.Printf(\"[CONFIG] OutQueueName = [%s]\", cfg.OutQueueName)\n\tlog.Printf(\"[CONFIG] PollTimeOut = [%d]\", cfg.PollTimeOut)\n\tlog.Printf(\"[CONFIG] MessageBucketName = [%s]\", cfg.MessageBucketName)\n\n\tlog.Printf(\"[CONFIG] CacheBucketName = [%s]\", cfg.CacheBucketName)\n\tlog.Printf(\"[CONFIG] IIIFServiceTimeout = [%d]\", cfg.IIIFServiceTimeout)\n\n\tlog.Printf(\"[CONFIG] WorkerQueueSize = [%d]\", cfg.WorkerQueueSize)\n\tlog.Printf(\"[CONFIG] Workers = [%d]\", cfg.Workers)\n\n\treturn &cfg\n}", "title": "" }, { "docid": "98252e6d0b24b6dffa28b5cd6de42a10", "score": "0.46087357", "text": "func clone(c *tls.Config) *tls.Config {\n\treturn &tls.Config{\n\t\tRand: c.Rand,\n\t\tTime: c.Time,\n\t\tCertificates: c.Certificates,\n\t\tNameToCertificate: c.NameToCertificate,\n\t\tGetCertificate: c.GetCertificate,\n\t\tRootCAs: c.RootCAs,\n\t\tNextProtos: c.NextProtos,\n\t\tServerName: c.ServerName,\n\t\tClientAuth: c.ClientAuth,\n\t\tClientCAs: c.ClientCAs,\n\t\tInsecureSkipVerify: c.InsecureSkipVerify,\n\t\tCipherSuites: c.CipherSuites,\n\t\tPreferServerCipherSuites: c.PreferServerCipherSuites,\n\t\tSessionTicketsDisabled: c.SessionTicketsDisabled,\n\t\tSessionTicketKey: c.SessionTicketKey,\n\t\tClientSessionCache: c.ClientSessionCache,\n\t\tMinVersion: c.MinVersion,\n\t\tMaxVersion: c.MaxVersion,\n\t\tCurvePreferences: c.CurvePreferences,\n\t\tDynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled,\n\t\tRenegotiation: c.Renegotiation,\n\t}\n}", "title": "" }, { "docid": "c37697dff72ab3e9217cabf150820d4a", "score": "0.4607559", "text": "func (pc *peerCredentials) Clone() credentials.TransportCredentials {\n\tc := *pc\n\treturn &c\n}", "title": "" }, { "docid": "72590ee616c033dd49ac91efb068e5b1", "score": "0.46069032", "text": "func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigurationData) *config.Config {\n\tresult := &config.Config{}\n\n\tresult.EtcdHost = fromCRD.EtcdHost\n\tresult.DockerImage = fromCRD.DockerImage\n\tresult.Workers = fromCRD.Workers\n\tresult.MinInstances = fromCRD.MinInstances\n\tresult.MaxInstances = fromCRD.MaxInstances\n\tresult.ResyncPeriod = time.Duration(fromCRD.ResyncPeriod)\n\tresult.RepairPeriod = time.Duration(fromCRD.RepairPeriod)\n\tresult.Sidecars = fromCRD.Sidecars\n\n\tresult.SuperUsername = fromCRD.PostgresUsersConfiguration.SuperUsername\n\tresult.ReplicationUsername = fromCRD.PostgresUsersConfiguration.ReplicationUsername\n\n\tresult.PodServiceAccountName = fromCRD.Kubernetes.PodServiceAccountName\n\tresult.PodServiceAccountDefinition = fromCRD.Kubernetes.PodServiceAccountDefinition\n\tresult.PodServiceAccountRoleBindingDefinition = fromCRD.Kubernetes.PodServiceAccountRoleBindingDefinition\n\tresult.PodTerminateGracePeriod = time.Duration(fromCRD.Kubernetes.PodTerminateGracePeriod)\n\tresult.WatchedNamespace = fromCRD.Kubernetes.WatchedNamespace\n\tresult.PDBNameFormat = fromCRD.Kubernetes.PDBNameFormat\n\tresult.SecretNameTemplate = fromCRD.Kubernetes.SecretNameTemplate\n\tresult.OAuthTokenSecretName = fromCRD.Kubernetes.OAuthTokenSecretName\n\tresult.InfrastructureRolesSecretName = fromCRD.Kubernetes.InfrastructureRolesSecretName\n\tresult.PodRoleLabel = fromCRD.Kubernetes.PodRoleLabel\n\tresult.ClusterLabels = fromCRD.Kubernetes.ClusterLabels\n\tresult.ClusterNameLabel = fromCRD.Kubernetes.ClusterNameLabel\n\tresult.NodeReadinessLabel = fromCRD.Kubernetes.NodeReadinessLabel\n\tresult.PodPriorityClassName = fromCRD.Kubernetes.PodPriorityClassName\n\n\tresult.DefaultCPURequest = fromCRD.PostgresPodResources.DefaultCPURequest\n\tresult.DefaultMemoryRequest = fromCRD.PostgresPodResources.DefaultMemoryRequest\n\tresult.DefaultCPULimit = fromCRD.PostgresPodResources.DefaultCPULimit\n\tresult.DefaultMemoryLimit = fromCRD.PostgresPodResources.DefaultMemoryLimit\n\n\tresult.ResourceCheckInterval = time.Duration(fromCRD.Timeouts.ResourceCheckInterval)\n\tresult.ResourceCheckTimeout = time.Duration(fromCRD.Timeouts.ResourceCheckTimeout)\n\tresult.PodLabelWaitTimeout = time.Duration(fromCRD.Timeouts.PodLabelWaitTimeout)\n\tresult.PodDeletionWaitTimeout = time.Duration(fromCRD.Timeouts.PodDeletionWaitTimeout)\n\tresult.ReadyWaitInterval = time.Duration(fromCRD.Timeouts.ReadyWaitInterval)\n\tresult.ReadyWaitTimeout = time.Duration(fromCRD.Timeouts.ReadyWaitTimeout)\n\n\tresult.DbHostedZone = fromCRD.LoadBalancer.DbHostedZone\n\tresult.EnableMasterLoadBalancer = fromCRD.LoadBalancer.EnableMasterLoadBalancer\n\tresult.EnableReplicaLoadBalancer = fromCRD.LoadBalancer.EnableReplicaLoadBalancer\n\tresult.MasterDNSNameFormat = fromCRD.LoadBalancer.MasterDNSNameFormat\n\tresult.ReplicaDNSNameFormat = fromCRD.LoadBalancer.ReplicaDNSNameFormat\n\n\tresult.WALES3Bucket = fromCRD.AWSGCP.WALES3Bucket\n\tresult.AWSRegion = fromCRD.AWSGCP.AWSRegion\n\tresult.LogS3Bucket = fromCRD.AWSGCP.LogS3Bucket\n\tresult.KubeIAMRole = fromCRD.AWSGCP.KubeIAMRole\n\n\tresult.DebugLogging = fromCRD.OperatorDebug.DebugLogging\n\tresult.EnableDBAccess = fromCRD.OperatorDebug.EnableDBAccess\n\tresult.EnableTeamsAPI = fromCRD.TeamsAPI.EnableTeamsAPI\n\tresult.TeamsAPIUrl = fromCRD.TeamsAPI.TeamsAPIUrl\n\tresult.TeamAPIRoleConfiguration = fromCRD.TeamsAPI.TeamAPIRoleConfiguration\n\tresult.EnableTeamSuperuser = fromCRD.TeamsAPI.EnableTeamSuperuser\n\tresult.TeamAdminRole = fromCRD.TeamsAPI.TeamAdminRole\n\tresult.PamRoleName = fromCRD.TeamsAPI.PamRoleName\n\tresult.PostgresSuperuserTeams = fromCRD.TeamsAPI.PostgresSuperuserTeams\n\n\tresult.APIPort = fromCRD.LoggingRESTAPI.APIPort\n\tresult.RingLogLines = fromCRD.LoggingRESTAPI.RingLogLines\n\tresult.ClusterHistoryEntries = fromCRD.LoggingRESTAPI.ClusterHistoryEntries\n\n\tresult.ScalyrAPIKey = fromCRD.Scalyr.ScalyrAPIKey\n\tresult.ScalyrImage = fromCRD.Scalyr.ScalyrImage\n\tresult.ScalyrServerURL = fromCRD.Scalyr.ScalyrServerURL\n\tresult.ScalyrCPURequest = fromCRD.Scalyr.ScalyrCPURequest\n\tresult.ScalyrMemoryRequest = fromCRD.Scalyr.ScalyrMemoryRequest\n\tresult.ScalyrCPULimit = fromCRD.Scalyr.ScalyrCPULimit\n\tresult.ScalyrMemoryLimit = fromCRD.Scalyr.ScalyrMemoryLimit\n\n\treturn result\n}", "title": "" }, { "docid": "49ca9307dcab27703cebe2109e67925b", "score": "0.46064743", "text": "func (b bindings) clone() bindings {\n\tout := make(bindings, len(b))\n\tfor k, v := range b {\n\t\tout[k] = v\n\t}\n\treturn out\n}", "title": "" }, { "docid": "c41d07be88bfbadaa2036f75296ebb80", "score": "0.46048203", "text": "func (c *SourceConfig) Clone() *SourceConfig {\n\tclone := &SourceConfig{}\n\t*clone = *c\n\treturn clone\n}", "title": "" }, { "docid": "92f32779fee3814151f89b6251829da6", "score": "0.46045214", "text": "func (r *InstancesService) Clone(project string, instance string, instancesclonerequest *InstancesCloneRequest) *InstancesCloneCall {\n\tc := &InstancesCloneCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.project = project\n\tc.instance = instance\n\tc.instancesclonerequest = instancesclonerequest\n\treturn c\n}", "title": "" }, { "docid": "9886433a1a3ecf0677d6aa0a98e25a89", "score": "0.4602784", "text": "func SetConf(conf *Configuration) { servicesCache.setConf(conf) }", "title": "" }, { "docid": "dffde1457d3bf1dba7d1f5cdc6a9d643", "score": "0.45920426", "text": "func (c *client) Duplicate() compiler.Engine {\n\tcc := new(client)\n\n\t// copy the essential fields from the existing client\n\tcc.Github = c.Github\n\tcc.PrivateGithub = c.PrivateGithub\n\tcc.UsePrivateGithub = c.UsePrivateGithub\n\tcc.ModificationService = c.ModificationService\n\tcc.CloneImage = c.CloneImage\n\tcc.TemplateDepth = c.TemplateDepth\n\tcc.StarlarkExecLimit = c.StarlarkExecLimit\n\n\treturn cc\n}", "title": "" }, { "docid": "2754f8ffaeaf95c8a9c001f611d10b7b", "score": "0.45897165", "text": "func cfg_Set(cur *Interactor, m []string) error {\n\tif m[1] == \"\" {\n\t\t// Not specified, use current.\n\t\tif cur == nil {\n\t\t\treturn errors.New(\"attempt to set, but no service defined\")\n\t\t}\n\t\treturn (*cur).Set(m[2], m[3])\n\t}\n\n\t// Specified, load specific service.\n\tmcur, ok := services[m[1]]\n\tif !ok {\n\t\treturn errors.New(fmt.Sprintf(\"service '%s' not found\", m[1]))\n\t}\n\treturn mcur.Set(m[2], m[3])\n}", "title": "" }, { "docid": "84652afbcedda814eb0b4120a4ffc6dd", "score": "0.45811522", "text": "func (b *GitlabIdentityProviderBuilder) Copy(object *GitlabIdentityProvider) *GitlabIdentityProviderBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tb.ca = object.ca\n\tb.url = object.url\n\tb.clientID = object.clientID\n\tb.clientSecret = object.clientSecret\n\treturn b\n}", "title": "" }, { "docid": "dab7eba10d8e66ca4041b2f6d6a8e619", "score": "0.45800528", "text": "func (c *HTTPClientConfig) Clone() *HTTPClientConfig {\n\treturn &HTTPClientConfig{\n\t\tTLS: c.TLS.Clone(),\n\t\tMaxIdleConns: c.MaxIdleConns,\n\t\tMaxIdleConnsPerHost: c.MaxIdleConnsPerHost,\n\t\tMaxConnsPerHost: c.MaxConnsPerHost,\n\t\tRequestTimeout: c.RequestTimeout,\n\t\tIdleConnTimeout: c.IdleConnTimeout,\n\t\tResponseHeaderTimeout: c.ResponseHeaderTimeout,\n\t\tDialer: c.Dialer,\n\t\tALPNSNIAuthDialClusterName: c.ALPNSNIAuthDialClusterName,\n\t\tCircuitBreakerConfig: c.CircuitBreakerConfig,\n\t}\n}", "title": "" }, { "docid": "6ee27b7aa4e3d76f6457758ddc301348", "score": "0.45732468", "text": "func (i *BaseInstance) InitConfig(ctx context.Context, e ctxt.Executor, opt GlobalOptions, user string, paths meta.DirPaths) (err error) {\n\tcomp := i.ComponentName()\n\thost := i.GetHost()\n\tport := i.GetPort()\n\tsysCfg := filepath.Join(paths.Cache, fmt.Sprintf(\"%s-%s-%d.service\", comp, host, port))\n\n\t// insert checkpoint\n\tpoint := checkpoint.Acquire(ctx, CopyConfigFile, map[string]any{\"config-file\": sysCfg})\n\tdefer func() {\n\t\tpoint.Release(err, zap.String(\"config-file\", sysCfg))\n\t}()\n\n\tif point.Hit() != nil {\n\t\treturn nil\n\t}\n\n\tresource := MergeResourceControl(opt.ResourceControl, i.ResourceControl())\n\tsystemCfg := system.NewConfig(comp, user, paths.Deploy).\n\t\tWithMemoryLimit(resource.MemoryLimit).\n\t\tWithCPUQuota(resource.CPUQuota).\n\t\tWithLimitCORE(resource.LimitCORE).\n\t\tWithIOReadBandwidthMax(resource.IOReadBandwidthMax).\n\t\tWithIOWriteBandwidthMax(resource.IOWriteBandwidthMax)\n\n\t// For not auto start if using binlogctl to offline.\n\t// bad design\n\tif comp == ComponentPump || comp == ComponentDrainer {\n\t\tsystemCfg.Restart = \"on-failure\"\n\t}\n\n\tif err := systemCfg.ConfigToFile(sysCfg); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\ttgt := filepath.Join(\"/tmp\", comp+\"_\"+uuid.New().String()+\".service\")\n\tif err := e.Transfer(ctx, sysCfg, tgt, false, 0, false); err != nil {\n\t\treturn errors.Annotatef(err, \"transfer from %s to %s failed\", sysCfg, tgt)\n\t}\n\tcmd := fmt.Sprintf(\"mv %s /etc/systemd/system/%s-%d.service\", tgt, comp, port)\n\tif _, _, err := e.Execute(ctx, cmd, true); err != nil {\n\t\treturn errors.Annotatef(err, \"execute: %s\", cmd)\n\t}\n\n\t// doesn't work\n\tif _, err := i.setTLSConfig(ctx, false, nil, paths); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "368c301f025a8f08b1736a747aeb69c6", "score": "0.4573142", "text": "func (webhooks *WebhooksV1) Clone() *WebhooksV1 {\n\tif core.IsNil(webhooks) {\n\t\treturn nil\n\t}\n\tclone := *webhooks\n\tclone.Service = webhooks.Service.Clone()\n\treturn &clone\n}", "title": "" }, { "docid": "e4ab4ce96ac64356b6e5ac40bd5019e2", "score": "0.45674118", "text": "func (d *Server) Clone(ctx context.Context, m *pb.CloneRequest) (*pb.CloneResponse, error) {\n ref := ReferenceId(m.ReferenceId)\n newResource, e := d.database.Clone(ref)\n if e != nil {\n return &pb.CloneResponse{Status:&pb.Status{Success:false, ErrorType:e.Error()}}, nil\n }\n return &pb.CloneResponse{\n Status:&pb.Status{Success:true},\n ResourceId: string(newResource.Id()),\n ResourceKey: string(newResource.Key()),\n }, nil\n}", "title": "" }, { "docid": "df5a1892929f872e9d2fcda3ebe0dd0d", "score": "0.45664763", "text": "func setConfig() Config {\n\tflag.Parse()\n\tconfig, err := parseConfig(*configPath)\n\tconfig.ScriptPath = *scriptPath\n\tif err != nil {\n\t\tlog.Fatal(\"Config not parsed correctly:\\t\", err)\n\t}\n\treturn config\n}", "title": "" }, { "docid": "e43c7594a8d7984528a3f0a5d3b6640d", "score": "0.45598796", "text": "func (sm *ShardMaster) copyConfig(index int, config *Config) {\n\tif index == -1 || index >= len(sm.configs) {\n\t\tindex = len(sm.configs) - 1\n\t}\n\tconfig.Num = sm.configs[index].Num\n\tconfig.Shards = sm.configs[index].Shards\n\tconfig.Groups = make(map[int][]string)\n\tfor k, v := range sm.configs[index].Groups {\n\t\tvar servers = make([]string, len(v))\n\t\tcopy(servers, v)\n\t\tconfig.Groups[k] = servers\n\t}\n}", "title": "" }, { "docid": "b9fc47c2f3bc3fcaf351413db6079e38", "score": "0.45584923", "text": "func LoadConfiguration() *ServiceConfig {\n\tlog.Printf(\"Loading configuration...\")\n\tvar cfg ServiceConfig\n\tflag.IntVar(&cfg.Port, \"port\", 8080, \"JRML pool service port (default 8080)\")\n\tflag.StringVar(&cfg.WCAPI, \"wcapi\", \"\", \"WorldCat API base URL\")\n\tflag.StringVar(&cfg.WCKey, \"wckey\", \"\", \"WordCat WSKey\")\n\tflag.StringVar(&cfg.JWTKey, \"jwtkey\", \"\", \"JWT signature key\")\n\tflag.StringVar(&cfg.OCLCKey, \"oclckey\", \"\", \"OCLC API key\")\n\tflag.StringVar(&cfg.OCLCSecret, \"oclcsecret\", \"\", \"OCLC API secret\")\n\tflag.StringVar(&cfg.OCLCAuthURL, \"oclcauth\", \"https://oauth.oclc.org/token?grant_type=client_credentials&scope=WorldCatMetadataAPI\", \"OCLC Auth endpoint\")\n\tflag.StringVar(&cfg.OCLCMetadataAPI, \"oclcmetadata\", \"https://americas.metadata.api.oclc.org/worldcat/search/v1/brief-bibs\", \"OCLC metadata API\")\n\n\tflag.Parse()\n\n\tif cfg.WCAPI == \"\" {\n\t\tlog.Fatal(\"Parameter -wcapi is required\")\n\t}\n\tif cfg.WCKey == \"\" {\n\t\tlog.Fatal(\"Parameter -wckey is required\")\n\t}\n\tif cfg.JWTKey == \"\" {\n\t\tlog.Fatal(\"jwtkey param is required\")\n\t}\n\tif cfg.OCLCKey == \"\" {\n\t\tlog.Fatal(\"oclckey param is required\")\n\t}\n\tif cfg.OCLCSecret == \"\" {\n\t\tlog.Fatal(\"oclcsecret param is required\")\n\t}\n\n\tlog.Printf(\"[CONFIG] port = [%d]\", cfg.Port)\n\tlog.Printf(\"[CONFIG] wcapi = [%s]\", cfg.WCAPI)\n\tlog.Printf(\"[CONFIG] oclckey = [%s]\", cfg.OCLCKey)\n\tlog.Printf(\"[CONFIG] oclcauth = [%s]\", cfg.OCLCAuthURL)\n\tlog.Printf(\"[CONFIG] oclcmetadata = [%s]\", cfg.OCLCMetadataAPI)\n\n\treturn &cfg\n}", "title": "" } ]
a5fb118b3dda3221056f9f95f20c0e5a
ReadSpaceAndNodeFromIndexLink reads a symlink and parses space and node id if the link has the correct format, eg: ../../spaces/4c/510adac86b4815882042cdf82c3d51/nodes/4c/51/0a/da/c86b4815882042cdf82c3d51 ../../spaces/4c/510adac86b4815882042cdf82c3d51/nodes/4c/51/0a/da/c86b4815882042cdf82c3d51.T.20220224T12:35:18.196484592Z
[ { "docid": "8807d81f633b7166ba269ee5aad5f98f", "score": "0.83881164", "text": "func ReadSpaceAndNodeFromIndexLink(link string) (string, string, error) {\n\t// ../../../spaces/sp/ace-id/nodes/sh/or/tn/od/eid\n\t// 0 1 2 3 4 5 6 7 8 9 10 11\n\tparts := strings.Split(link, string(filepath.Separator))\n\tif len(parts) != 12 || parts[0] != \"..\" || parts[1] != \"..\" || parts[2] != \"..\" || parts[3] != \"spaces\" || parts[6] != \"nodes\" {\n\t\treturn \"\", \"\", errtypes.InternalError(\"malformed link\")\n\t}\n\treturn strings.Join(parts[4:6], \"\"), strings.Join(parts[7:12], \"\"), nil\n}", "title": "" } ]
[ { "docid": "1a9bab66cf061cbc0ab2d6c92ff6cb9f", "score": "0.56333905", "text": "func link(fs FileSystem, path, rev string) string {\n\n\t// TODO revert to fs.Info()\n\tb, err := fs.File(path+\"/index.link\", rev)\n\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\treturn strings.TrimSpace(string(b))\n}", "title": "" }, { "docid": "a76c4fe03d6e9bd3eeb855c79122130d", "score": "0.5597177", "text": "func ReadLink(par *tp.Par, links map[int]*tp.Link, nodes map[int]*tp.Node, wr io.Writer) {\r\n\tfile, err := os.Open(par.Link)\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tvar i int\r\n\ti = 0\r\n\tscanner := bufio.NewScanner(file)\r\n\tfor scanner.Scan() {\r\n\t\tif i > 0 {\r\n\t\t\ttxt := strings.Split(scanner.Text(), \",\")\r\n\t\t\ta, err := strconv.ParseInt(strings.TrimSpace(txt[0]), 10, 0)\r\n\t\t\tb, err := strconv.ParseInt(strings.TrimSpace(txt[1]), 10, 0)\r\n\t\t\tdist, err := strconv.ParseFloat(strings.TrimSpace(txt[2]), 64)\r\n\t\t\tcapacity, err := strconv.ParseInt(strings.TrimSpace(txt[3]), 10, 0)\r\n\t\t\tlanes, err := strconv.ParseInt(strings.TrimSpace(txt[4]), 10, 0)\r\n\t\t\tftype, err := strconv.ParseInt(strings.TrimSpace(txt[5]), 10, 0)\r\n\t\t\tffspeed, err := strconv.ParseFloat(strings.TrimSpace(txt[6]), 64)\r\n\t\t\talpha, err := strconv.ParseFloat(strings.TrimSpace(txt[7]), 64)\r\n\t\t\tbeta, err := strconv.ParseFloat(strings.TrimSpace(txt[8]), 64)\r\n\t\t\ttimefactor, err := strconv.ParseFloat(strings.TrimSpace(txt[9]), 64)\r\n\t\t\ttollpolicy, err := strconv.ParseInt(strings.TrimSpace(txt[11]), 10, 0)\r\n\t\t\ttoll, err := strconv.ParseFloat(strings.TrimSpace(txt[12]), 64)\r\n\t\t\ttolldist, err := strconv.ParseFloat(strings.TrimSpace(txt[13]), 64)\r\n\t\t\tif err != nil {\r\n\t\t\t\tlog.Fatal(err)\r\n\t\t\t}\r\n\t\t\t//EL min toll. if TOLL attribute > 0, use TOLL; else use toll policy\r\n\t\t\tif tlp, ok := par.TollPolicy[int(tollpolicy)]; ok {\r\n\t\t\t\tif toll == 0 {\r\n\t\t\t\t\ttoll = tlp[\"MinToll\"]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//CgTime\r\n\t\t\tvar cgtimes [96]float64\r\n\t\t\tvar tolls [96]float64\r\n\t\t\tvar weight [96]float64\r\n\t\t\tfor j := 0; j <= 95; j++ {\r\n\t\t\t\tcgtimes[j] = dist / ffspeed * 60\r\n\t\t\t\ttolls[j] = toll\r\n\t\t\t\tweight[j] = 1\r\n\t\t\t}\r\n\t\t\t//EL\r\n\t\t\telentry := false\r\n\t\t\tif int(ftype) == par.ELEntry {\r\n\t\t\t\telentry = true\r\n\t\t\t}\r\n\t\t\telexit := false\r\n\t\t\tif int(ftype) == par.ELExit {\r\n\t\t\t\telexit = true\r\n\t\t\t}\r\n\t\t\tlink := tp.Link{\r\n\t\t\t\tID: i,\r\n\t\t\t\tA: int(a),\r\n\t\t\t\tB: int(b),\r\n\t\t\t\tDIST: dist,\r\n\t\t\t\tCAPACITY: int(capacity),\r\n\t\t\t\tNUMLANES: int(lanes),\r\n\t\t\t\tFTYPE: int(ftype),\r\n\t\t\t\tFFSPEED: ffspeed,\r\n\t\t\t\tALPHA: alpha,\r\n\t\t\t\tBETA: beta,\r\n\t\t\t\tTIMEFACTOR: timefactor,\r\n\t\t\t\tTOLLPOLICY: int(tollpolicy),\r\n\t\t\t\tTOLL: toll,\r\n\t\t\t\tTOLLSEGDIST: tolldist,\r\n\t\t\t\tNODEA: nodes[int(a)],\r\n\t\t\t\tNODEB: nodes[int(b)],\r\n\t\t\t\tCgTime: cgtimes,\r\n\t\t\t\tFFTime: dist / ffspeed * 60,\r\n\t\t\t\tTimeWeight: weight,\r\n\t\t\t\tTollRate: tolls,\r\n\t\t\t\tIsELEntry: elentry,\r\n\t\t\t\tIsELExit: elexit,\r\n\t\t\t\tVolCls: make(map[string]*[96]float64),\r\n\t\t\t\tVolClsPre: make(map[string]*[96]float64),\r\n\t\t\t}\r\n\t\t\t//init link vols\r\n\t\t\tmodes := []string{\"AUTOVOT1\", \"AUTOVOT2\", \"AUTOVOT3\", \"AUTOVOT4\", \"AUTOVOT5\", \"TRK\"}\r\n\t\t\tfor _, cls := range modes {\r\n\t\t\t\tvar vol [96]float64\r\n\t\t\t\tvar volpre [96]float64\r\n\t\t\t\tlink.VolCls[cls] = &vol\r\n\t\t\t\tlink.VolClsPre[cls] = &volpre\r\n\t\t\t}\r\n\t\t\tlinks[i] = &link\r\n\t\t\tnodes[int(a)].DNLINKS = append(nodes[int(a)].DNLINKS, &link) //add down links to node A\r\n\t\t}\r\n\t\ti = i + 1\r\n\t}\r\n\tfile.Close()\r\n\tfmt.Fprintf(wr, \"Read link file. Total of %+v links.\\n\", i-1)\r\n}", "title": "" }, { "docid": "35a9f2ce4a8dc3955ce4fa12f2b50c53", "score": "0.54340804", "text": "func (serde ORecordSerializerV0) readLink(buf io.Reader) (*oschema.OLink, error) {\n\tclusterID, err := varint.ReadVarIntAndDecode64(buf)\n\tif err != nil {\n\t\treturn nil, oerror.NewTrace(err)\n\t}\n\n\tclusterPos, err := varint.ReadVarIntAndDecode64(buf)\n\tif err != nil {\n\t\treturn nil, oerror.NewTrace(err)\n\t}\n\n\torid := oschema.ORID{ClusterID: int16(clusterID), ClusterPos: clusterPos}\n\treturn &oschema.OLink{RID: orid}, nil\n}", "title": "" }, { "docid": "99d011c18be1ddbab8583daeab486e05", "score": "0.54205537", "text": "func (n *Node) readlink(dirfd int, cName string) (out []byte, errno syscall.Errno) {\n\tcTarget, err := syscallcompat.Readlinkat(dirfd, cName)\n\tif err != nil {\n\t\treturn nil, fs.ToErrno(err)\n\t}\n\trn := n.rootNode()\n\tif rn.args.PlaintextNames {\n\t\treturn []byte(cTarget), 0\n\t}\n\t// Symlinks are encrypted like file contents (GCM) and base64-encoded\n\ttarget, err := rn.decryptSymlinkTarget(cTarget)\n\tif err != nil {\n\t\ttlog.Warn.Printf(\"Readlink %q: decrypting target failed: %v\", cName, err)\n\t\treturn nil, syscall.EIO\n\t}\n\treturn []byte(target), 0\n}", "title": "" }, { "docid": "7d0b6de6053f3e0408b7f217daf17a17", "score": "0.54111075", "text": "func readLink(s string) (*link, int) {\n\ttitle, n := readPair(s, '[', ']')\n\tif title == \"\" {\n\t\treturn nil, 0\n\t}\n\thref, m := readPair(s[n:], '(', ')')\n\tif href == \"\" {\n\t\treturn nil, 0\n\t}\n\tl := &link{title: title, href: href, raw: s[:n+m]}\n\treturn l, n + m\n}", "title": "" }, { "docid": "89f6e52cc1d6ffb62e4c83833d48b173", "score": "0.54008996", "text": "func readTrashLink(path string) (string, string, string, error) {\n\tlink, err := os.Readlink(path)\n\tif err != nil {\n\t\treturn \"\", \"\", \"\", err\n\t}\n\tresolved, err := filepath.EvalSymlinks(path)\n\tif err != nil {\n\t\treturn \"\", \"\", \"\", err\n\t}\n\t// ../../../../../nodes/e5/6c/75/a8/-d235-4cbb-8b4e-48b6fd0f2094.T.2022-02-16T14:38:11.769917408Z\n\t// TODO use filepath.Separator to support windows\n\tlink = strings.ReplaceAll(link, \"/\", \"\")\n\t// ..........nodese56c75a8-d235-4cbb-8b4e-48b6fd0f2094.T.2022-02-16T14:38:11.769917408Z\n\tif link[0:15] != \"..........nodes\" || link[51:54] != node.TrashIDDelimiter {\n\t\treturn \"\", \"\", \"\", errtypes.InternalError(\"malformed trash link\")\n\t}\n\treturn resolved, link[15:51], link[54:], nil\n}", "title": "" }, { "docid": "6a79c2fc9de1dfc4d27b817ed40ac53b", "score": "0.53438824", "text": "func (nld *netlinkDevice) getLinkIndex() int {\n\treturn nld.link.Attrs().Index\n}", "title": "" }, { "docid": "b3d0344e571f1c6c15e477359d70efda", "score": "0.5318978", "text": "func (fs *FS) Readlink(link string) (target string, err error) {\n\tfs.log.CDebugf(fs.ctx, \"Readlink %s\", fs.PathForLogging(link))\n\tdefer func() {\n\t\tfs.deferLog.CDebugf(fs.ctx, \"Readlink done: %+v\", err)\n\t\terr = translateErr(err)\n\t}()\n\n\tif err := fs.chooseErrorIfEmpty(onFsEmptyErrNotExist); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tn, _, base, err := fs.lookupParent(link)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t_, ei, err := fs.config.KBFSOps().Lookup(fs.ctx, n, n.ChildName(base))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif ei.Type != data.Sym {\n\t\treturn \"\", errors.Errorf(\"%s is not a symlink\", link)\n\t}\n\treturn ei.SymPath, nil\n}", "title": "" }, { "docid": "6af7bf9db8d4823ab7680677d0884d03", "score": "0.5257038", "text": "func Readlink(path string, buf []byte) (n int, err error)", "title": "" }, { "docid": "05beda0a2c85f01dfa8a6201c42e7c3f", "score": "0.5226995", "text": "func (fsys *FS) Readlink(path string) (errc int, linkPath string) {\n\tdefer log.Trace(path, \"\")(\"linkPath=%q, errc=%d\", &linkPath, &errc)\n\treturn -fuse.ENOSYS, \"\"\n}", "title": "" }, { "docid": "c596652be693e910daaa2c43c463fe4b", "score": "0.5211514", "text": "func (self *Dpfs) Readlink(path string) (errc int, link string) {\n\terrc = NoSuchFileOrDirectory\n\n\tinfo := self.newpathInfo(path)\n\tlogger := log.WithFields(log.Fields{\n\t\t\"path\": path,\n\t\t\"op\": \"Readlink\",\n\t\t\"uuid\": uuid.NewV4().String(),\n\t\t\"snapshotid\": info.snapshotid,\n\t\t\"revision\": info.revision,\n\t\t\"filepath\": info.filepath,\n\t\t\"id\": uuid.NewV4().String(),\n\t})\n\n\tif info.filepath == \"\" || info.filepath == \"/\" {\n\t\t// root and first level can't be symlinks\n\t\treturn\n\t}\n\n\tentry, err := self.findFile(info.snapshotid, info.revision, info.filepath)\n\tif err != nil {\n\t\tlogger.WithError(err).Debug()\n\t\treturn\n\t}\n\n\tif !entry.IsLink() {\n\t\treturn\n\t}\n\n\treturn 0, entry.Link\n}", "title": "" }, { "docid": "046ddc4c52356c6c87de65058f70c43b", "score": "0.5200088", "text": "func (f *tempFileSystemImpl) readLink(rel string) string {\n\tval, err := os.Readlink(f.join(rel))\n\tf.c.So(err, ShouldBeNil)\n\treturn val\n}", "title": "" }, { "docid": "7a22aeb7b6264034abc477abf4aab8e5", "score": "0.506644", "text": "func (i *Inode) Readlink(ctx context.Context) (string, error) {\n\tif i.overlay != nil {\n\t\treturn overlayReadlink(ctx, i.overlay)\n\t}\n\treturn i.InodeOperations.Readlink(ctx, i)\n}", "title": "" }, { "docid": "7d568f8f1562bb19c668e559e7765045", "score": "0.50215155", "text": "func Link(ifname string) Node {\n\treturn &link{ifname: ifname}\n}", "title": "" }, { "docid": "9714e01bcd9fcfb761b07cd77ea06029", "score": "0.5021346", "text": "func Readlink(path string, buf []byte) (n int, err error) {\n\treturn syscall.Readlink(path, buf)\n}", "title": "" }, { "docid": "8c63bda08a72c2bcabc1815c6aee0c68", "score": "0.49919617", "text": "func (tn *TrieNode) GetLink(r rune) *TrieNode {\n\treturn tn.link[r]\n}", "title": "" }, { "docid": "d6ca57d839c649aced31a64ae87b6833", "score": "0.49463102", "text": "func (ds *HamtShard) linkNamePrefix(idx int) string {\n\treturn fmt.Sprintf(ds.prefixPadStr, idx)\n}", "title": "" }, { "docid": "78e04c8612d4e03d77089040fa77cd34", "score": "0.4914248", "text": "func Readlink(name string) (string, error) {\n\treturn name, nil\n}", "title": "" }, { "docid": "b1fb23865d8ec207193a0d9022fd9c6f", "score": "0.4863636", "text": "func parseLink(node *html.Node) Link {\n\tlink := Link{}\n\tfor _, a := range node.Attr {\n\t\tif a.Key == \"href\" {\n\t\t\tlink.Href = a.Val\n\t\t\tbreak\n\t\t}\n\t}\n\tlink.Text = text(node)\n\treturn link\n}", "title": "" }, { "docid": "baec20738d13d183eeecddbdc2e30f67", "score": "0.48447195", "text": "func Readlink(path string, buf []byte) (n int, err error) {\n\t_p0 := uintptr(unsafe.Pointer(C.CString(path)))\n\tvar _p1 *byte\n\tif len(buf) > 0 {\n\t\t_p1 = &buf[0]\n\t}\n\tvar _p2 int\n\t_p2 = len(buf)\n\tr0, er := C.readlink(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(_p1))), C.size_t(_p2))\n\tn = int(r0)\n\tif r0 == -1 && er != nil {\n\t\terr = er\n\t}\n\treturn\n}", "title": "" }, { "docid": "337a50d151b6c99710adce4ba02a3c0d", "score": "0.48248753", "text": "func MatchingNodeIndex(line []byte, n []NodeInfo) int {\n\tfor i, node := range n {\n\t\tif strings.Contains(string(line), node.Name) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "4b902f71eda3a57d8bfdc015eb85ce60", "score": "0.48197702", "text": "func parseLink(w http.ResponseWriter, r *http.Request, fileName string, lineno int, text string) (Elem, error) {\n\t//c := appengine.NewContext(r)\n\t\n defer func() { //catch or finally\n if err := recover(); err != nil { //catch\n log.Panicf(\"panic error in procesing: %q\", text)\n\t\t\tos.Exit(1)\n }\n }()\n\t\n\targs := strings.Fields(text)\n\t//D0106\n\t//log.Printf(\"parseLink: text: %v<br>\", text)\n\t//log.Printf(\"parseLink: fileName: %v<br>\", fileName)\n\t//url := \"\"\n\turl, err := url.Parse(args[1])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlabel := \"\"\n\tif len(args) > 2 {\n\t\tlabel = strings.Join(args[2:], \" \")\n\t} else {\n\t\tscheme := url.Scheme + \"://\"\n\t\tif url.Scheme == \"mailto\" {\n\t\t\tscheme = \"mailto:\"\n\t\t}\n\t\tlabel = strings.Replace(url.String(), scheme, \"\", 1)\n\t}\n\treturn Link{url, label}, nil\n}", "title": "" }, { "docid": "87d3854a80c5a37e63b511508d71afb0", "score": "0.47530526", "text": "func ReadSymlink(p string) (string, error) {\n\tconst attempts = 4\n\tsleep := 10 * time.Millisecond\n\tvar errs []error\n\tfor i := 0; i < attempts; i++ {\n\t\tt, err := filepath.EvalSymlinks(p)\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t\ttime.Sleep(sleep)\n\t\t\tsleep *= 2\n\t\t\tcontinue\n\t\t}\n\t\treturn t, nil\n\t}\n\terr := errors.MultiError(errs)\n\treturn \"\", errors.Annotate(err, \"read inventory symlink %s: too many tries\", p).Err()\n}", "title": "" }, { "docid": "8fd070e774930ddb184ebdf1bb06ff80", "score": "0.47363865", "text": "func Readlink(path string, buf []byte) (n int, err error) {\n\tvar _p0 *byte\n\t_p0, err = BytePtrFromString(path)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar _p1 *byte\n\tif len(buf) > 0 {\n\t\t_p1 = &buf[0]\n\t}\n\tr0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_Readlink)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(len(buf)), 0, 0, 0)\n\tn = int(r0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "838fe628f156c2691aac0c42e385366b", "score": "0.47231454", "text": "func (pfs ProfileFS) Readlink(_ string) (string, error) {\n\treturn \"\", errors.New(\"Readlink not supported\")\n}", "title": "" }, { "docid": "c632f8e35b245f61862d90c6c9f60b8b", "score": "0.47203875", "text": "func (serde ORecordSerializerV0) readLinkMap(buf io.Reader) (map[string]*oschema.OLink, error) {\n\tnentries, err := varint.ReadVarIntAndDecode32(buf)\n\tif err != nil {\n\t\treturn nil, oerror.NewTrace(err)\n\t}\n\n\tlinkMap := make(map[string]*oschema.OLink)\n\n\tfor i := 0; i < int(nentries); i++ {\n\t\t/* ---[ read map key ]--- */\n\t\tdatatype, err := rw.ReadByte(buf)\n\t\tif err != nil {\n\t\t\treturn nil, oerror.NewTrace(err)\n\t\t}\n\t\tif datatype != byte(oschema.STRING) {\n\t\t\t// FIXME: even though all keys are currently strings, it would be easy to allow other types\n\t\t\t// using serde.readDataValue(dbc, buf, serde)\n\t\t\treturn nil, fmt.Errorf(\"readLinkMap: datatype for key is NOT string but type: %v\", datatype)\n\t\t}\n\n\t\tmapkey, err := varint.ReadString(buf)\n\t\tif err != nil {\n\t\t\treturn nil, oerror.NewTrace(err)\n\t\t}\n\n\t\t/* ---[ read map value (always a RID) ]--- */\n\t\tmapval, err := serde.readLink(buf)\n\t\tif err != nil {\n\t\t\treturn nil, oerror.NewTrace(err)\n\t\t}\n\t\tlinkMap[mapkey] = mapval\n\t}\n\n\treturn linkMap, nil\n}", "title": "" }, { "docid": "c74f955adf24602a18cc4cef507a587f", "score": "0.46936175", "text": "func UnmarshalLinkNLRI(b []byte) (*LinkNLRI, error) {\n\tglog.V(6).Infof(\"LinkNLRI Raw: %s\", internal.MessageHex(b))\n\tl := LinkNLRI{}\n\tp := 0\n\tl.ProtocolID = b[p]\n\tp++\n\t// Skip 3 reserved bytes\n\t//\tp += 3\n\tl.Identifier = binary.BigEndian.Uint64(b[p : p+8])\n\tp += 8\n\t// Local Node Descriptor\n\t// Get Node Descriptor's length, skip Node Descriptor Type\n\tndl := binary.BigEndian.Uint16(b[p+2 : p+4])\n\tln, err := UnmarshalNodeDescriptor(b[p : p+int(ndl)])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl.LocalNode = ln\n\t// Skip Node Type and Length 4 bytes\n\tp += 4\n\tp += int(ndl)\n\t// Remote Node Descriptor\n\t// Get Node Descriptor's length, skip Node Descriptor Type\n\tndl = binary.BigEndian.Uint16(b[p+2 : p+4])\n\trn, err := UnmarshalNodeDescriptor(b[p : p+int(ndl)])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl.RemoteNode = rn\n\tp += int(ndl)\n\t// Skip Node Type and Length 4 bytes\n\tp += 4\n\t// Link Descriptor\n\tld, err := UnmarshalLinkDescriptor(b[p:len(b)])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl.Link = ld\n\n\treturn &l, nil\n}", "title": "" }, { "docid": "d659b8fdc432a3427674b1b4b108a075", "score": "0.46863464", "text": "func (o VkPipelineCache) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.PipelineCaches().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"PipelineCaches\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "ae3d5c9d2fb70291488d64e996da1f1b", "score": "0.46840528", "text": "func (parseTz *ParseIanaTzData) extractLink(\n\tfMgr pathfileops.FileMgr ,\n\trawString string,\n\ttzStats *tzdatastructs.TimeZoneStatsDto,\n\tePrefix string) error {\n\n\tePrefix += \"ParseIanaTzData.extractLink() \"\n\n\tstartIdx := 0\n// Extract Field 1 - Canonical Field\n\tdFProfile,\n\terr :=\n\t\tstrops.StrOps{}.ExtractDataField(\n\t\t\trawString,\n\t\t\t[]string{tzdatastructs.LinkLabel},\n\t\t\tstartIdx,\n\t\t\ttzdatastructs.LeadingFieldSeparators,\n\t\t\ttzdatastructs.TrailingFieldSeparators,\n\t\t\ttzdatastructs.CommentDelimiters,\n\t\t\ttzdatastructs.EndOfLineDelimiters)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(ePrefix + \"\\n\" +\n\t\t\t\"Error returned by StrOps{}.ExtractDataField()\\n\" +\n\t\t\t\"Error='%v'\\n\", err.Error())\n\t}\n\n\tif dFProfile.DataFieldLength < 1 {\n\t\treturn nil\n\t}\n\n\tif strings.Index(dFProfile.DataFieldStr, tzdatastructs.ZoneSeparator) == -1 {\n\t\treturn nil\n\t}\n\n\ttzCanonical := dFProfile.DataFieldStr\n\tstartIdx = dFProfile.NextTargetStrIndex\n\n\t// Extract Field 2 - Link Field\n\tdFProfile,\n\terr =\n\t\tstrops.StrOps{}.ExtractDataField(\n\t\t\trawString,\n\t\t\t[]string{},\n\t\t\tstartIdx,\n\t\t\ttzdatastructs.LeadingFieldSeparators,\n\t\t\ttzdatastructs.TrailingFieldSeparators,\n\t\t\ttzdatastructs.CommentDelimiters,\n\t\t\ttzdatastructs.EndOfLineDelimiters)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(ePrefix +\n\t\t\t\"\\nError returned by StrOps{}.ExtractDataField()\\n\" +\n\t\t\t\"Error='%v'\\n\", err.Error())\n\t}\n\n\tif dFProfile.DataFieldLength < 1 {\n\t\treturn nil\n\t}\n\n\ttzLink := dFProfile.DataFieldStr\n\n\tlinkZoneArray := strings.Split(tzLink, tzdatastructs.ZoneSeparator)\n\n\tlenZoneArray := len(linkZoneArray)\n\n\tif lenZoneArray < 1 ||\n\t\tlenZoneArray > 3 {\n\t\treturn fmt.Errorf(ePrefix + \"Invalid Link Time Zone!\\n\" +\n\t\t\t\"FileName: %v\\n\" +\n\t\t\t\"Tz Link String: %v\\n\" +\n\t\t\t\"Tz Canonical String: %v\\n\",\n\t\t\tfMgr.GetFileNameExt(), tzLink, tzCanonical)\n\t}\n\n\tif lenZoneArray == 1 {\n\t\t// Example: link -> canonical time zone\n\t\t// 'Egypt' -> 'Africa/Cairo'\n\t\t// Canonical = 'Africa/Cairo'\n\t\t// Link = 'Egypt'\n\t\treturn parseTz.linkCfgOneElement(fMgr, tzLink, tzCanonical, tzStats, ePrefix)\n\t}\n\n\tif lenZoneArray == 2 {\n\t\t// Example\n\t\t// Link -> Canonical -> Alias\n\t\t// Link America/Panama America/Cayman\n\t\t// Canonical = America/Panama\n\t\t// Link = America/Cayman\n\t\treturn parseTz.linkCfgTwoElements(fMgr, linkZoneArray, tzCanonical, tzStats, ePrefix)\n\t}\n\n\t// Zone Array Length MUST be 3\n\n\t// Example\n\t//\n\t// Link -> Canonical -> Alias\n\t// Link America/Argentina/Catamarca America/Argentina/ComodRivadavia\n\t// Canonical = America/Argentina/Catamarca\n\t// Link = America/Argentina/ComodRivadavia\n\n\treturn parseTz.linkCfgThreeElements(fMgr, linkZoneArray, tzCanonical, tzStats, ePrefix)\n}", "title": "" }, { "docid": "7f7fe9ca2009fe61c2802a1895caf290", "score": "0.46835855", "text": "func (serde ORecordSerializerV0) writeLink(buf *obuf.WriteBuf, lnk *oschema.OLink) error {\n\terr := varint.EncodeAndWriteVarInt32(buf, int32(lnk.RID.ClusterID))\n\tif err != nil {\n\t\treturn oerror.NewTrace(err)\n\t}\n\n\terr = varint.EncodeAndWriteVarInt64(buf, lnk.RID.ClusterPos)\n\tif err != nil {\n\t\treturn oerror.NewTrace(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27695fcbdae3d9a4dd148a51d5e6de6a", "score": "0.46829554", "text": "func findLink(r io.Reader, hits chan string) {\n\tscanner := bufio.NewScanner(r)\n\t// optionally, resize scanner's capacity for lines over 64K, see next example\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tindx := strings.Index(line, \"link.tidal.com\")\n\t\tif indx >= 0 {\n\t\t\tlink := line[indx:]\n\t\t\tif space := strings.Index(link, \" \"); space >= 0 {\n\t\t\t\tlink = link[:space]\n\t\t\t}\n\t\t\thits <- link\n\t\t}\n\t}\n}", "title": "" }, { "docid": "361097e909cdbcc76e56da7e7f4eac9e", "score": "0.46754116", "text": "func ParseLink(val string) (string, string, error) {\n\tif val == \"\" {\n\t\treturn \"\", \"\", fmt.Errorf(\"empty string specified for links\")\n\t}\n\tarr := strings.Split(val, \":\")\n\tif len(arr) > 2 {\n\t\treturn \"\", \"\", fmt.Errorf(\"bad format for links: %s\", val)\n\t}\n\tif len(arr) == 1 {\n\t\treturn val, val, nil\n\t}\n\t// This is kept because we can actually get a HostConfig with links\n\t// from an already created container and the format is not `foo:bar`\n\t// but `/foo:/c1/bar`\n\tif strings.HasPrefix(arr[0], \"/\") {\n\t\t_, alias := path.Split(arr[1])\n\t\treturn arr[0][1:], alias, nil\n\t}\n\treturn arr[0], arr[1], nil\n}", "title": "" }, { "docid": "8e8ed0fb272cfc7b1cbc9f47a8553caf", "score": "0.46646634", "text": "func Readlink(path string, buf []byte) (n int, err error) {\n\tvar _p0 *byte\n\t_p0, err = BytePtrFromString(path)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar _p1 *byte\n\tif len(buf) > 0 {\n\t\t_p1 = &buf[0]\n\t}\n\tr0, e1 := callreadlink(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), len(buf))\n\tn = int(r0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "543916a3fc8f8fb1e84c114e048ed4ae", "score": "0.46482834", "text": "func Link(dst, src string) error {\n\tvar err error\n\n\t// Open input file\n\tin, err := openMacho(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t/*\n\t * Create executable layout\n\t */\n\tvar addr, ncmd, cmdsz, entry uint32\n\n\t// Segment: __PAGEZERO\n\tpageZero := macho.Segment32{\n\t\tCmd: macho.LoadCmdSegment,\n\t\tLen: segment32Len,\n\t\tName: str16(\"__PAGEZERO\"),\n\t\tAddr: 0,\n\t\tMemsz: pageSize,\n\t\tOffset: 0,\n\t\tFilesz: 0,\n\t\tMaxprot: P_NONE,\n\t\tProt: P_NONE,\n\t\tNsect: 0,\n\t\tFlag: 0,\n\t}\n\taddr = pageZero.Addr + pageZero.Memsz\n\tncmd += 1\n\tcmdsz += pageZero.Len\n\n\t// Segment: __TEXT\n\t_, textContent, err := in.section(\"__text\")\n\tif err != nil {\n\t\treturn err\n\t}\n\ttextLen := uint32(len(textContent))\n\ttextSize := (textLen + pageSize - 1) & pageMask\n\ttextSeg := macho.Segment32{\n\t\tCmd: macho.LoadCmdSegment,\n\t\tLen: segment32Len + section32Len,\n\t\tName: str16(\"__TEXT\"),\n\t\tAddr: addr,\n\t\tMemsz: textSize,\n\t\tOffset: 0,\n\t\tFilesz: textSize,\n\t\tMaxprot: P_RDEXEC,\n\t\tProt: P_RDEXEC,\n\t\tNsect: 1,\n\t\tFlag: 0,\n\t}\n\ttextSect := macho.Section32{\n\t\tName: str16(\"__text\"),\n\t\tSeg: str16(\"__TEXT\"),\n\t\tAddr: textSeg.Addr + textSeg.Memsz - textLen,\n\t\tSize: textLen,\n\t\tOffset: textSeg.Filesz - textLen,\n\t\tAlign: 0,\n\t\tReloff: 0,\n\t\tNreloc: 0,\n\t\tFlags: S_PURE_INSTRUCTIONS | S_SOME_INSTRUCTIONS,\n\t\tReserve1: 0,\n\t\tReserve2: 0,\n\t}\n\taddr = textSeg.Addr + textSeg.Memsz\n\tncmd += 1\n\tcmdsz += textSeg.Len\n\n\t// Segment: __DATA\n\tdataStart, dataContent, _ := in.section(\"__data\")\n\tdataLen := uint32(len(dataContent))\n\tdataSize := (dataLen + pageSize - 1) & pageMask\n\tdataSeg := macho.Segment32{\n\t\tCmd: macho.LoadCmdSegment,\n\t\tLen: segment32Len + section32Len*2,\n\t\tName: str16(\"__DATA\"),\n\t\tAddr: addr,\n\t\tMemsz: dataSize,\n\t\tOffset: textSeg.Offset + textSeg.Filesz,\n\t\tFilesz: dataSize,\n\t\tMaxprot: P_RDWR,\n\t\tProt: P_RDWR,\n\t\tNsect: 2,\n\t\tFlag: 0,\n\t}\n\tdataSect := macho.Section32{\n\t\tName: str16(\"__data\"),\n\t\tSeg: str16(\"__DATA\"),\n\t\tAddr: dataSeg.Addr,\n\t\tSize: dataLen,\n\t\tOffset: dataSeg.Offset,\n\t\tAlign: 0,\n\t\tReloff: 0,\n\t\tNreloc: 0,\n\t\tFlags: S_REGULAR,\n\t\tReserve1: 0,\n\t\tReserve2: 0,\n\t}\n\t_, bssContent, _ := in.section(\"__bss\")\n\tbssLen := uint32(len(bssContent))\n\tbssSect := macho.Section32{\n\t\tName: str16(\"__bss\"),\n\t\tSeg: str16(\"__DATA\"),\n\t\tAddr: dataSeg.Addr,\n\t\tSize: bssLen,\n\t\tOffset: 0,\n\t\tAlign: 0,\n\t\tReloff: 0,\n\t\tNreloc: 0,\n\t\tFlags: S_ZEROFILL,\n\t\tReserve1: 0,\n\t\tReserve2: 0,\n\t}\n\taddr = dataSeg.Addr + dataSeg.Memsz\n\tncmd += 1\n\tcmdsz += dataSeg.Len\n\n\t// Relocate text symbols now that we got data layout\n\trelocs, err := in.relocs(\"__text\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, r := range relocs {\n\t\tcontent := textContent[r.Addr : r.Addr+1<<r.Len]\n\t\tvalue := binary.LittleEndian.Uint32(content)\n\t\tbinary.LittleEndian.PutUint32(content, dataSeg.Addr+(value-dataStart))\n\t}\n\n\t// Lookup entry address\n\tif entry, err = in.entry(); err != nil {\n\t\treturn err\n\t}\n\n\t// Unix Thread Command\n\tthread := unixThread{\n\t\tCmd: macho.LoadCmdUnixThread,\n\t\tLen: unixThreadLen,\n\t\tFlavor: 0x1, // i386_THREAD_STATE\n\t\tCount: 16,\n\t\tState: [16]uint32{\n\t\t\t0, // AX\n\t\t\t0, // BX\n\t\t\t0, // CX\n\t\t\t0, // DX\n\t\t\t0, // DI\n\t\t\t0, // SI\n\t\t\t0, // BP\n\t\t\t0, // SP\n\t\t\t0, // SS\n\t\t\t0, // FLAGS\n\t\t\ttextSect.Addr + entry, // IP\n\t\t\t0, // CS\n\t\t\t0, // DS\n\t\t\t0, // ES\n\t\t\t0, // FS\n\t\t\t0, // GS\n\t\t},\n\t}\n\tncmd += 1\n\tcmdsz += thread.Len\n\n\theader := macho.FileHeader{\n\t\tMagic: macho.Magic32,\n\t\tCpu: macho.Cpu386,\n\t\tSubCpu: CpuSubtypeX86All,\n\t\tType: macho.TypeExec,\n\t\tNcmd: ncmd,\n\t\tCmdsz: cmdsz,\n\t\tFlags: NoUndefs,\n\t}\n\n\t// Write output file\n\tout, err := os.OpenFile(dst, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0700)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write header and load commands\n\tbw := &binaryWriter{w: out, bo: binary.LittleEndian}\n\tbw.write(header)\n\tbw.write(pageZero)\n\tbw.write(textSeg)\n\tbw.write(textSect)\n\tbw.write(dataSeg)\n\tbw.write(dataSect)\n\tbw.write(bssSect)\n\tbw.write(thread)\n\n\t// Write text, data and bss contents\n\tbw.writeAt(textContent, int64(textSect.Offset))\n\tbw.writeAt(make([]byte, dataSeg.Memsz), int64(dataSeg.Offset))\n\tbw.writeAt(dataContent, int64(dataSeg.Offset))\n\n\tif bw.err != nil {\n\t\treturn bw.err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7fa6c94e5486ba03a91d238a0aef8152", "score": "0.46300277", "text": "func (fsys *FS) Link(oldpath string, newpath string) (errc int) {\n\tdefer log.Trace(oldpath, \"newpath=%q\", newpath)(\"errc=%d\", &errc)\n\treturn -fuse.ENOSYS\n}", "title": "" }, { "docid": "b6a8bcaed11ceab7a6e15df57ad45e56", "score": "0.46129686", "text": "func parseLink(resp *http.Response) (string, error) {\n\tlink := resp.Header.Get(\"Link\")\n\tif link == \"\" {\n\t\treturn \"\", errNoLink\n\t}\n\tif link[0] != '<' {\n\t\treturn \"\", fmt.Errorf(\"invalid next link %q: missing '<'\", link)\n\t}\n\tif i := strings.IndexByte(link, '>'); i == -1 {\n\t\treturn \"\", fmt.Errorf(\"invalid next link %q: missing '>'\", link)\n\t} else {\n\t\tlink = link[1:i]\n\t}\n\n\tlinkURL, err := resp.Request.URL.Parse(link)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn linkURL.String(), nil\n}", "title": "" }, { "docid": "08d88246568517fd6e0f77de7232945f", "score": "0.4595795", "text": "func TestLink(t *testing.T) {\n\n\texpectedLink := merkle.Digest{\n\t\t0xaa, 0x16, 0xda, 0xcf, 0xba, 0x34, 0x08, 0x29,\n\t\t0xc8, 0x57, 0x97, 0xb7, 0xb6, 0xa7, 0x88, 0x72,\n\t\t0xc8, 0xc7, 0xec, 0x48, 0x4b, 0xe1, 0x97, 0xc0,\n\t\t0xad, 0x2e, 0xa3, 0xa2, 0x1c, 0x13, 0xf8, 0x4b,\n\t}\n\n\ttextLink := \"4bf8131ca2a32eadc097e14b48ecc7c87288a7b6b79757c8290834bacfda16aa\"\n\n\tif expectedLink.String() != textLink {\n\t\tt.Errorf(\"link(%%s): %s expected: %s\", expectedLink, textLink)\n\t}\n\n\tif fmt.Sprintf(\"%v\", expectedLink) != textLink {\n\t\tt.Errorf(\"link(%%v): %v expected: %s\", expectedLink, textLink)\n\t}\n\n\tif fmt.Sprintf(\"%#v\", expectedLink) != \"<SHA3-256-BE:\"+textLink+\">\" {\n\t\tt.Errorf(\"link(%%#v): %#v expected: %#v\", expectedLink, expectedLink)\n\t}\n\n\tvar link merkle.Digest\n\tn, err := fmt.Sscan(\"4bf8131ca2a32eadc097e14b48ecc7c87288a7b6b79757c8290834bacfda16aa\", &link)\n\tif nil != err {\n\t\tt.Errorf(\"hex to link error: %s\", err)\n\t\treturn\n\t}\n\tif 1 != n {\n\t\tt.Errorf(\"hex to link scanned: %d expected: 1\", n)\n\t\treturn\n\t}\n\n\tif link != expectedLink {\n\t\tt.Errorf(\"link: %#v expected: %#v\", link, expectedLink)\n\t\tt.Errorf(\"*** GENERATED link:\\n%s\", util.FormatBytes(\"expectedLink\", link[:]))\n\t}\n\n\t// check JSON conversion\n\texpectedJSON := `{\"Link\":\"aa16dacfba340829c85797b7b6a78872c8c7ec484be197c0ad2ea3a21c13f84b\"}`\n\n\titem := struct {\n\t\tLink merkle.Digest\n\t}{\n\t\tlink,\n\t}\n\tconvertedJSON, err := json.Marshal(item)\n\tif nil != err {\n\t\tt.Errorf(\"marshal json error: %s\", err)\n\t\treturn\n\t}\n\tif expectedJSON != string(convertedJSON) {\n\t\tt.Errorf(\"JSON converted: %q\", convertedJSON)\n\t\tt.Errorf(\" expected: %q\", expectedJSON)\n\t}\n\n\t// test json unmarshal\n\tvar newItem struct {\n\t\tLink merkle.Digest\n\t}\n\terr = json.Unmarshal([]byte(expectedJSON), &newItem)\n\tif nil != err {\n\t\tt.Errorf(\"unmarshal json error: %s\", err)\n\t\treturn\n\t}\n\n\tif newItem.Link != expectedLink {\n\t\tt.Errorf(\"link: %#v expected: %#v\", newItem.Link, expectedLink)\n\t}\n\n}", "title": "" }, { "docid": "18fe033f20ee93be74e7e98b5da1ae92", "score": "0.45853022", "text": "func (o VkBuffer) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.Buffers().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"Buffers\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "33c8a10d5d9139c42e2633dbac08fe0c", "score": "0.45569664", "text": "func getMountsFromLink(link string) ([]*Mount, error) {\n\t// Use blkid_evaluate_spec to get the device name.\n\tcLink := C.CString(link)\n\tdefer C.string_free(cLink)\n\n\tcDeviceName := C.blkid_evaluate_spec(cLink, &cache)\n\tdefer C.string_free(cDeviceName)\n\tdeviceName := C.GoString(cDeviceName)\n\n\tlog.Printf(\"blkid_evaluate_spec(%q, <cache>) = %q\", link, deviceName)\n\n\tif deviceName == \"\" {\n\t\treturn nil, errors.Wrapf(ErrFollowLink, \"link %q is invalid\", link)\n\t}\n\tdeviceName, err := cannonicalizePath(deviceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmountMutex.Lock()\n\tdefer mountMutex.Unlock()\n\tif err := getMountInfo(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif mnts, ok := mountsByDevice[deviceName]; ok {\n\t\treturn mnts, nil\n\t}\n\n\treturn nil, errors.Wrapf(ErrFollowLink, \"device %q is invalid\", deviceName)\n}", "title": "" }, { "docid": "b51fcab13d8d76d49785d8991c1a5a43", "score": "0.4553613", "text": "func extractLink( g *graph.Graph, n1, n2 graph.Node ) []graph.Node {\n\tvar ret []graph.Node\n\n\t// same nodes\n\tif n1 == n2 {\n\t\tret = append(ret, n1)\n\t\treturn ret\n\t}\n\n\t// differing nodes\n\tneighbors := g.Neighbors(n1)\n\tfor i := range neighbors {\n\t\tcn := neighbors[i]\n\t\tif cn == n2 {\n\t\t\tret = append(ret, n1)\n\t\t\tret = append(ret, cn)\n\t\t\treturn ret\n\t\t} else {\n\t\t\t// recurse\n\t\t\tgns := extractLink( g, cn, n2 )\n\t\t\tif len(gns) > 0 {\n\t\t\t\tret = append(ret, n1)\n\t\t\t\tret = append(ret, gns...)\n\t\t\t\treturn ret\n\t\t\t}\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "bf671467b4d5b66e05fabb99516f3a4e", "score": "0.45428246", "text": "func (o *LinkSessionExitMetadata) GetLinkSessionId() string {\n\tif o == nil || o.LinkSessionId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LinkSessionId\n}", "title": "" }, { "docid": "f8228c65c59ce1451823561b2f55df28", "score": "0.453476", "text": "func (o VkCommandBuffer) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.CommandBuffers().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"CommandBuffers\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "3752e069b6a9bbf1b5f9617496e200ac", "score": "0.45320153", "text": "func (f *FakeNetlink) LinkByIndex(index int) (netlink.Link, error) {\n\tfor _, link := range f.Links {\n\t\tif link.Attrs().Index == index {\n\t\t\treturn link, nil\n\t\t}\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "c25f904c1e9da4a50bbb02a3ff195ee8", "score": "0.45240444", "text": "func (app *application) Link(linkHashStr string) (string, error) {\n\tlinkHash, err := app.hashAdapter.FromString(linkHashStr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlink, err := app.linkRepository.Retrieve(*linkHash)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tgen := link.Next().Block().Genesis()\n\tminingValue := gen.MiningValue()\n\tlinkDifficulty := gen.Difficulty().Link()\n\treturn app.mine(miningValue, linkDifficulty, link.Hash())\n}", "title": "" }, { "docid": "d392ea119752ab3cb0930f3607f81ac2", "score": "0.45012048", "text": "func resolveHardLink(p string, fi os.FileInfo) uint64 {\n\treturn uint64(utils.FileInfoStat(fi).Ino)\n}", "title": "" }, { "docid": "ae79af74cc118917dbabacc9c4e27a41", "score": "0.44857857", "text": "func (l *local) Readlink() (string, error) {\n\treturn os.Readlink(l.path)\n}", "title": "" }, { "docid": "0b44d1a50df7a218ad81a7345e4ac715", "score": "0.4479094", "text": "func linkID(conn *proxyproto.Conn) (string, error) {\n\th := conn.ProxyHeader()\n\tif h == nil {\n\t\treturn \"\", errors.New(\"nil ProxyHeader\")\n\t}\n\n\ttlvs, err := h.TLVs()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor _, tlv := range tlvs {\n\t\tif tlv.Type != pp2TypeAzure ||\n\t\t\tlen(tlv.Value) != 5 ||\n\t\t\ttlv.Value[0] != pp2SubtypeAzurePrivateEndpointLinkID {\n\t\t\tcontinue\n\t\t}\n\n\t\treturn strconv.FormatUint(uint64(binary.LittleEndian.Uint32(tlv.Value[1:])), 10), nil\n\t}\n\n\treturn \"\", errors.New(\"link id not found\")\n}", "title": "" }, { "docid": "bc913b4c824730a2cb8358ad897e6568", "score": "0.4469285", "text": "func (o VkPipeline) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif c.GraphicsPipelines().Contains(o) {\n\t\treturn path.NewField(\"GraphicsPipelines\", i).MapIndex(o), nil\n\t} else if c.ComputePipelines().Contains(o) {\n\t\treturn path.NewField(\"ComputePipelines\", i).MapIndex(o), nil\n\t} else {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n}", "title": "" }, { "docid": "4d324b41dc8c5f8825bbc422f5ecd8b6", "score": "0.44481054", "text": "func GetLinkRank(pageID int64) (rank float64) {\n\terr := pageInfo.View(func(tx *bolt.Tx) error {\n\t\tpageRankBucket := tx.Bucket([]byte(pageRankBuck))\n\t\tvalue := pageRankBucket.Get(IntToByte(pageID))\n\t\trank = ByteToFloat64(value)\n\t\treturn nil\n\t})\n\t// fmt.Println(\"err \", err)\n\tif err != nil {\n\t\treturn 0.0\n\t}\n\treturn rank\n\n}", "title": "" }, { "docid": "cf67a2a6b9ebcc11e2e9a4816857fe95", "score": "0.444044", "text": "func buildLink(n *html.Node) Link {\n\tvar ret Link\n\n\tfor _, attr := range n.Attr {\n\t\tif attr.Key == \"href\" {\n\t\t\tret.Href = attr.Val\n\t\t\tbreak\n\t\t}\n\t}\n\n\tret.Text = findText(n)\n\n\treturn ret\n}", "title": "" }, { "docid": "6a3b2cc85e8469785527e0ccabfcbab7", "score": "0.4438113", "text": "func TestSymLink(t *testing.T) {\n\tfh, err := GetHandle(\"/home/ubuntu/go/src/newfile_test_nfs\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tclient, err := GetNfsClient(host)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer client.Close()\n\tfmt.Println(fh)\n\tresult := SymLinkRes{}\n\terr = client.Call(\"NFS.SymLink\",\n\t\tSymLinkArgs{\n\t\t\tWhere: DirOpArgs3{*fh, \"newfile_test_nfs2\"},\n\t\t\tSymLink: SymLinkData3{SAttr3{}, \"newfile_test_nfs3\"},\n\t\t},\n\t\t&result)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tfmt.Println(\"Create: \", result)\n}", "title": "" }, { "docid": "4edd2f3fb88ad5a6be6c27ca44dfd608", "score": "0.44341666", "text": "func (o VkDeviceMemory) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.DeviceMemories().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"DeviceMemories\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "ac4c5794fd7b2f37954405e6dd14bfc0", "score": "0.44329193", "text": "func extractLink(node *html.Node) (string, error) {\n\t// TODO: Make use of querySelector for this, as it does most of what this function does as well.\n\tif node.Type == html.ElementNode && node.Data == \"a\" {\n\t\tfor _, a := range node.Attr {\n\t\t\tif a.Key == \"href\" {\n\t\t\t\tfindRedlink := regexp.MustCompile(\"redlink=1\")\n\t\t\t\tif findRedlink.MatchString(a.Val) {\n\t\t\t\t\treturn \"\", errors.New(\"Found link was a red link\")\n\t\t\t\t}\n\t\t\t\treturn a.Val, nil\n\t\t\t}\n\t\t}\n\t}\n\tif node.FirstChild == nil {\n\t\treturn \"\", errors.New(\"No link found\")\n\t}\n\treturn extractLink(node.FirstChild)\n}", "title": "" }, { "docid": "2bb6c01d66a82760ca2c26d5891b5c47", "score": "0.4429307", "text": "func (h *NetLinkHandler) GetLinkByIndex(ifIdx int) (netlink.Link, error) {\n\tlink, err := h.LinkByIndex(ifIdx)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"LinkByIndex %q\", ifIdx)\n\t}\n\treturn link, nil\n}", "title": "" }, { "docid": "fc25a490c0a9c3ebe18a6f113441c017", "score": "0.44274765", "text": "func chanLinkToID(link string) (id string, err error) {\n\tid = strings.Replace(strings.Replace(strings.Replace(link, \"<\", \"\", 1), \">\", \"\", 1), \"#\", \"\", 1)\n\t_, err = discord.Channel(id)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn id, nil\n}", "title": "" }, { "docid": "219f3c023f0deb8e5227432c521f76e5", "score": "0.4425725", "text": "func checkLink(n *html.Node, extension string, ignoreDirs []string) element {\n\thasRightStyles := false\n\tisTrackedFile := false\n\tisDir := false\n\n\tvar href string\n\tvar fname string\n\tvar dirname string\n\tvar filedirhref string\n\n\tfor _, a := range n.Attr {\n\t\tswitch a.Key {\n\t\tcase \"href\":\n\t\t\thref = \"https://github.com\" + a.Val\n\t\t\tfname = n.FirstChild.Data\n\t\tcase \"class\":\n\t\t\tif a.Val == \"js-navigation-open link-gray-dark\" {\n\t\t\t\thasRightStyles = true\n\t\t\t}\n\t\t}\n\t}\n\n\tif !hasRightStyles {\n\t\treturn nil\n\t}\n\n\tisDir, isTrackedFile, dirname = ParseHrefAttr(href, extension)\n\tif IsContains(ignoreDirs, dirname) {\n\t\treturn nil\n\t}\n\n\tif isDir {\n\t\treturn mdDir{\n\t\t\thref: href,\n\t\t\tname: dirname,\n\t\t}\n\t}\n\n\tfiledirhref = GetDirHref(href, dirname)\n\tif isTrackedFile {\n\t\treturn mdFile{\n\t\t\thref: href,\n\t\t\tname: fname[:len(fname)-len(extension)],\n\t\t\tdir: mdDir{\n\t\t\t\thref: filedirhref,\n\t\t\t\tname: dirname,\n\t\t\t},\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3fe8a1d87f2b8025443cd9d2e6d56534", "score": "0.44072634", "text": "func createLink(nodes *html.Node) Link {\n\tfor _, attribute := range nodes.Attr {\n\t\treturn Link{\n\t\t\tHref: attribute.Val,\n\t\t\tText: strings.TrimSpace(parseText(nodes)),\n\t\t}\n\t}\n\treturn Link{}\n}", "title": "" }, { "docid": "531865c1b09eb2611ba61b21ee88e7d8", "score": "0.44036603", "text": "func parseLink(n *html.Node, links *[]link) {\n\ta := n.FirstChild\n\tif isTag(a, \"a\") {\n\t\t*links = append(*links,\n\t\t\tlink{textContents(a), domain + attrValue(a, \"href\")})\n\t}\n}", "title": "" }, { "docid": "afed2b4d2627fbf813dd60c5dd537ed3", "score": "0.44008437", "text": "func linkParser(ctx context.Context, sbf *boom.ScalableBloomFilter, in <-chan IngestData) (\n\t<-chan IngestData, // new list of triples also containing links\n\t<-chan error, // emits errors encountered to the pipeline\n\terror) { // returns any errors when creating this component\n\n\tout := make(chan IngestData)\n\terrc := make(chan error, 1)\n\n\tgo func() {\n\t\tdefer close(out)\n\t\tdefer close(errc)\n\n\t\tfor igd := range in {\n\t\t\t//\n\t\t\t// extract the object (O:) members of any tuples that match the linking predicate\n\t\t\t//\n\t\t\t// these are links that should be made accessible to the graph\n\t\t\t// as they've been specified as linkable properties\n\t\t\t// so we add them to the bloom filter\n\t\t\t//\n\t\t\tlinkTraces := make([]string, 0)\n\t\t\tfor _, t := range igd.Triples {\n\t\t\t\tfor _, s := range igd.LinkSpecs {\n\t\t\t\t\tif strings.Contains(t.P, s) {\n\t\t\t\t\t\tlinkTrace := t.O\n\t\t\t\t\t\tlinkTraces = append(linkTraces, linkTrace)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//\n\t\t\t// if igd has a pseudo-unique key, add it to the traces\n\t\t\t//\n\t\t\tif len(igd.Unique) > 0 {\n\t\t\t\tlinkTraces = append(linkTraces, igd.Unique)\n\t\t\t}\n\t\t\t// add specified link attributes to sbf\n\t\t\tfor _, lt := range linkTraces {\n\t\t\t\tsbf.Add([]byte(lt))\n\t\t\t}\n\n\t\t\t// now do second pass to see if object contains any links\n\t\t\t// of interest to others or specified links\n\t\t\t//\n\t\t\t// did some other object leave a linkTrace that we should\n\t\t\t// observe becasue it is valid for our data properties\n\t\t\t//\n\t\t\tlinks := make([]Triple, 0)\n\t\t\tfor _, t := range igd.Triples {\n\t\t\t\tif t.O == igd.N3id {\n\t\t\t\t\tcontinue // ignore self-links\n\t\t\t\t}\n\t\t\t\t// see if anyone has registered an interest in this tuple's value\n\t\t\t\tif sbf.Test([]byte(t.O)) {\n\t\t\t\t\tlink := t\n\t\t\t\t\tlinks = append(links, link)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tigd.LinkCandidates = links\n\n\t\t\tselect {\n\t\t\tcase out <- igd: // pass the data on to the next stage\n\t\t\tcase <-ctx.Done(): // listen for pipeline shutdown\n\t\t\t\treturn\n\t\t\t}\n\n\t\t}\n\n\t}()\n\n\treturn out, errc, nil\n\n}", "title": "" }, { "docid": "f0da3c3a9fe4345677ab241cff95cd1d", "score": "0.4382666", "text": "func (d *Device) ProcessLink(ctrl *framework.DeviceControl) string {\n\t// This simply sets up console logging for our program.\n\t// Any time this logitem is use to print messages,\n\t// the key/value string \"deviceid=<device_id>\" is prepended to the line.\n\tlogitem := log.WithField(\"deviceid\", ctrl.Id())\n\tlogitem.Debug(\"Linking with config:\", ctrl.Config())\n\n\t// Subscribe to subtopic \"rawrx\"\n\tctrl.Subscribe(\"+\", nil)\n\n\tlogitem.Debug(\"Finished Linking\")\n\n\t// This message is sent to the service status for the linking device\n\treturn \"Success\"\n}", "title": "" }, { "docid": "66b1fb01aafca9f07acc030df594f2b2", "score": "0.4379071", "text": "func (o VkSemaphore) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.Semaphores().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"Semaphores\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "743d80b9ad541ef5d436878ce528fc20", "score": "0.43779916", "text": "func (o VkShaderModule) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.ShaderModules().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"ShaderModules\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "8a29f5666de4087979f014508152b730", "score": "0.43717474", "text": "func GetLink(isbn string) (Link, bool) {\n\tlink, found := links[isbn]\n\treturn link, found\n}", "title": "" }, { "docid": "8ff4aea62558a087dac0a8875c14a530", "score": "0.43677416", "text": "func (tn *TrieNode) PutLink(r rune, link *TrieNode) {\n\ttn.link[r] = link\n}", "title": "" }, { "docid": "2255a40a8211eaadf05a508d9ce0cd3e", "score": "0.43608317", "text": "func (ds *HamtShard) Link() (*node.Link, error) {\n\tnd, err := ds.Node()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = ds.dserv.Add(nd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn node.MakeLink(nd)\n}", "title": "" }, { "docid": "0191b7506fab833185fd3d681cc9a55c", "score": "0.4355004", "text": "func parseArticleLink(atag []byte) *Article {\n\tvar articleDate = regexp.MustCompile(\"201[0-9]/[0-9]+/[0-9]+\")\n\tvar articleURL = regexp.MustCompile(\"data-permalink=\\\"([^\\\"]+)\\\"\")\n\tvar articleTitle = regexp.MustCompile(\"data-shareTitle=\\\"([^\\\"]+)\\\"\")\n\n\tdate := articleDate.Find(atag)\n\turl := articleURL.FindSubmatch(atag)\n\ttitle := articleTitle.FindSubmatch(atag)\n\tloc, _ := time.LoadLocation(\"Asia/Tokyo\")\n\td, _ := time.ParseInLocation(\"2006/01/02\", string(date), loc)\n\n\treturn &Article{url: string(url[1]), title: string(title[1]), published: d}\n}", "title": "" }, { "docid": "8cce34408c52cbdb3b68daf818598e2f", "score": "0.43503833", "text": "func (o VkBufferView) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.BufferViews().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"BufferViews\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "46deb351d28507acc2e888b4f95e318b", "score": "0.4344701", "text": "func parseLinkMsg(msg *netlink.Message) (*LinkEntry, bool, error) {\n\tvar ifimsg iproute2.IfInfoMsg\n\tif err := ifimsg.UnmarshalBinary(msg.Data); err != nil {\n\t\treturn nil, false, err\n\t}\n\n\tvar e LinkEntry\n\te.init()\n\te.Ifindex = int(ifimsg.Index)\n\te.DeviceType = LinkType(ifimsg.Type)\n\te.DeviceFlags = LinkFlags(ifimsg.Flags)\n\n\tad, err := netlink.NewAttributeDecoder(msg.Data[iproute2.SizeofIfInfoMsg:])\n\tif err != nil {\n\t\treturn &e, false, err\n\t}\n\n\tfor ad.Next() {\n\t\tswitch ad.Type() {\n\t\tcase unix.IFLA_ADDRESS:\n\t\t\te.Addr = ad.Bytes()\n\t\tcase unix.IFLA_BROADCAST:\n\t\t\te.Broadcast = ad.Bytes()\n\t\tcase unix.IFLA_IFNAME:\n\t\t\te.Name = ad.String()\n\t\tcase unix.IFLA_MTU:\n\t\t\te.MTU = int(ad.Uint32())\n\t\tcase unix.IFLA_LINK:\n\t\t\te.Link = int(ad.Uint32())\n\t\tcase unix.IFLA_QDISC:\n\t\t\te.QDisc = ad.String()\n\t\tcase unix.IFLA_STATS:\n\t\t\te.Stat = ad.Bytes()\n\t\t\t// if err := e.Stat.UnmarshalBinary(ad.Bytes()); err != nil {\n\t\t\t// \treturn &e, false, err\n\t\t\t// }\n\t\tcase unix.IFLA_MASTER:\n\t\t\te.Master = int(ad.Uint32())\n\t\tcase unix.IFLA_TXQLEN:\n\t\t\te.TxQueue = int(ad.Uint32())\n\t\tcase unix.IFLA_MAP:\n\t\t\te.Map = ad.Bytes()\n\t\tcase unix.IFLA_OPERSTATE:\n\t\t\te.OperState = LinkOperState(ad.Bytes()[0])\n\t\tcase unix.IFLA_LINKMODE:\n\t\t\te.Mode = LinkMode(ad.Bytes()[0])\n\t\tcase unix.IFLA_STATS64:\n\t\t\te.Stat64 = ad.Bytes()\n\t\t\t// if err := e.Stat64.UnmarshalBinary(ad.Bytes()); err != nil {\n\t\t\t// \treturn &e, false, err\n\t\t\t// }\n\t\tcase unix.IFLA_AF_SPEC:\n\t\t\te.AFSpec = ad.Bytes()\n\t\tcase unix.IFLA_GROUP:\n\t\t\te.Group = LinkGroup(ad.Uint32())\n\t\tcase unix.IFLA_PROMISCUITY:\n\t\t\te.Promiscuity = int(ad.Uint32())\n\t\tcase unix.IFLA_NUM_TX_QUEUES:\n\t\t\te.TxQueueCount = int(ad.Uint32())\n\t\tcase unix.IFLA_CARRIER:\n\t\t\te.Carrier = ad.Bytes()[0]\n\t\tcase unix.IFLA_CARRIER_CHANGES:\n\t\t\te.CarrierChanges = int(ad.Uint32())\n\t\tcase unix.IFLA_LINK_NETNSID:\n\t\t\te.Namespace = int(ad.Uint32())\n\t\tcase unix.IFLA_PROTO_DOWN:\n\t\t\te.ProtoDown = ad.Bytes()[0]\n\t\tcase unix.IFLA_GSO_MAX_SEGS:\n\t\t\te.MaxGSOSegs = int(ad.Uint32())\n\t\tcase unix.IFLA_GSO_MAX_SIZE:\n\t\t\te.MaxGSOSize = int(ad.Uint32())\n\t\tcase unix.IFLA_XDP:\n\t\t\te.XDP = ad.Uint64()\n\t\tcase unix.IFLA_CARRIER_UP_COUNT:\n\t\t\te.CarrierUpCount = int(ad.Uint32())\n\t\tcase unix.IFLA_CARRIER_DOWN_COUNT:\n\t\t\te.CarrierDownCount = int(ad.Uint32())\n\t\tcase unix.IFLA_MIN_MTU:\n\t\t\te.MinMTU = int(ad.Uint32())\n\t\tcase unix.IFLA_MAX_MTU:\n\t\t\te.MaxMTU = int(ad.Uint32())\n\t\t}\n\t}\n\terr = ad.Err()\n\treturn &e, err == nil, err\n}", "title": "" }, { "docid": "94a7df5f13c881426eaac7c8b2bfa005", "score": "0.43356225", "text": "func (o VkSwapchainKHR) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.Swapchains().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"Swapchains\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "b4fa8e2252991a46ee39b4b684958e12", "score": "0.43325496", "text": "func getIndexLayout(config common.Config, hosts []string) ([]*IndexerNode, error) {\n\tcinfo := cinfoClient.GetClusterInfoCache()\n\tcinfo.RLock()\n\tdefer cinfo.RUnlock()\n\n\tlist := make([]*IndexerNode, 0)\n\tnumIndexes := 0\n\n\tresp, err := restHelperNoLock(getLocalMetadataResp, hosts, nil, cinfo, \"LocalMetadataResp\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar delTokens map[common.IndexDefnId]*mc.DeleteCommandToken\n\tdelTokens, err = mc.FetchIndexDefnToDeleteCommandTokensMap()\n\tif err != nil {\n\t\tlogging.Errorf(\"Planner::getIndexLayout: Error in FetchIndexDefnToDeleteCommandTokensMap %v\", err)\n\t\treturn nil, err\n\t}\n\n\tvar buildTokens map[common.IndexDefnId]*mc.BuildCommandToken\n\tbuildTokens, err = mc.FetchIndexDefnToBuildCommandTokensMap()\n\tif err != nil {\n\t\tlogging.Errorf(\"Planner::getIndexLayout: Error in FetchIndexDefnToBuildCommandTokensMap %v\", err)\n\t\treturn nil, err\n\t}\n\n\tfor nid, res := range resp {\n\n\t\t// create an empty indexer object using the indexer host name\n\t\tnode, err := createIndexerNode(cinfo, nid)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexLayout: Error from initializing indexer nodeId: %v, err: %v\", nid, err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlocalMeta := res.meta\n\n\t\t// assign server group\n\t\tnode.ServerGroup = cinfo.GetServerGroup(nid)\n\n\t\t// obtain the admin port for the indexer node\n\t\taddr, err := cinfo.GetServiceAddress(nid, common.INDEX_HTTP_SERVICE)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexLayout: Error from getting service address for node %v, err: = %v\", node.NodeId, err)\n\t\t\treturn nil, err\n\t\t}\n\t\tnode.RestUrl = addr\n\n\t\t// get the node UUID\n\t\tnode.NodeUUID = localMeta.NodeUUID\n\t\tnode.IndexerId = localMeta.IndexerId\n\t\tnode.StorageMode = localMeta.StorageMode\n\t\tnode.exclude = localMeta.LocalSettings[\"excludeNode\"]\n\n\t\t// convert from LocalIndexMetadata to IndexUsage\n\t\tindexes, err := ConvertToIndexUsages(config, localMeta, node, buildTokens, delTokens)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexLayout: Error for converting index metadata to index usage for node %v, err: %v\", node.NodeId, err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tnode.Indexes = indexes\n\t\tnumIndexes += len(indexes)\n\t\tlist = append(list, node)\n\t}\n\n\tif numIndexes != 0 {\n\t\tfor _, node := range list {\n\t\t\tif !common.IsValidIndexType(node.StorageMode) {\n\t\t\t\terr := errors.New(fmt.Sprintf(\"Fail to get storage mode\tfrom %v. Storage mode = %v\", node.RestUrl, node.StorageMode))\n\t\t\t\tlogging.Errorf(\"Planner::getIndexLayout: Error = %v\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "50847b744ce1591c5a25e1e170accfbf", "score": "0.43303612", "text": "func inodeFromNode(parent uint64, node *restic.Node) (inode uint64) {\n\tif node.Links > 1 && node.Type != \"dir\" {\n\t\t// If node has hard links, give them all the same inode,\n\t\t// irrespective of the parent.\n\t\tvar buf [16]byte\n\t\tbinary.LittleEndian.PutUint64(buf[:8], node.DeviceID)\n\t\tbinary.LittleEndian.PutUint64(buf[8:], node.Inode)\n\t\tinode = xxhash.Sum64(buf[:])\n\t} else {\n\t\t// Else, use the name and the parent inode.\n\t\t// node.{DeviceID,Inode} may not even be reliable.\n\t\tinode = prime*parent ^ xxhash.Sum64String(cleanupNodeName(node.Name))\n\t}\n\n\t// Inode 0 is invalid and 1 is the root. Remap those.\n\tif inode < 2 {\n\t\tinode += 2\n\t}\n\treturn inode\n}", "title": "" }, { "docid": "d934537f45f7b21568887e934156217f", "score": "0.43283683", "text": "func (r *objReader) readSymIndex() *sym.Symbol {\n\ti := r.readInt()\n\treturn r.refs[i]\n}", "title": "" }, { "docid": "d1add6bd682fa4c0a179a433923479b0", "score": "0.4327425", "text": "func ParseNSRLHashFile(f io.Reader, algo string) map[string]int {\n\t/*\n\t\tFirst line is useless\n\t\tHeader:\n\t\tSHA-1,MD5,CRC32,FileName,FileSize,ProductCode,OpSystemCode,SpecialCode\n\t*/\n\tfmt.Println(\"[*] Parsing NSRL file\")\n\tresults := make(map[string]int)\n\tscanner := bufio.NewScanner(f)\n\tscanner.Scan() // skipping the first line == header\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tlineSplitted := strings.Split(line, \",\")\n\t\tvar rawResult string\n\n\t\tswitch algo {\n\t\tcase \"sha1\":\n\t\t\trawResult = lineSplitted[0]\n\t\tcase \"md5\":\n\t\t\trawResult = lineSplitted[1]\n\t\tcase \"crc32\":\n\t\t\trawResult = lineSplitted[2]\n\t\t}\n\n\t\tresult := strings.ToLower(strings.Replace(rawResult, \"\\\"\", \"\", -1))\n\t\tresults[result] = 1\n\t}\n\n\treturn results\n}", "title": "" }, { "docid": "51bb09158475b91e81506dcb4db3e4eb", "score": "0.43166813", "text": "func (o VkPipelineLayout) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.PipelineLayouts().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"PipelineLayouts\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "cd4c81df74c8a5a5d8397d52d23e6393", "score": "0.43156028", "text": "func (o *LinkSessionExitMetadata) SetLinkSessionId(v string) {\n\to.LinkSessionId = &v\n}", "title": "" }, { "docid": "3e8b01092009649ab4fe612eed559d10", "score": "0.43079123", "text": "func (o VkImage) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.Images().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"Images\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "447f784415e12db4c091e89f4e20e2cc", "score": "0.43071994", "text": "func Link(x, y *Node) *Node {\n\tif x.Rank > y.Rank {\n\t\ty.Parent = x\n\t\treturn x\n\t}\n\n\tx.Parent = y\n\tif x.Rank == y.Rank {\n\t\ty.Rank++\n\t}\n\n\treturn y\n}", "title": "" }, { "docid": "1462adab49da1163885aebd7f330a5e0", "score": "0.4299439", "text": "func (o VkDevice) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.Devices().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"Devices\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "d30abce37d256dcc7c3591b2d4c8b734", "score": "0.4292394", "text": "func ProcessLink(doc *goquery.Document, level int) {\n\tdoc.Find(\"a[href]\").Each(func(i int, s *goquery.Selection) {\n\t\tval, exist := s.Attr(\"href\")\n\t\tif exist {\n\t\t\tu, _ := url.Parse(val)\n\t\t\tif u.Host == targetUrl.Host || u.Host == \"\" {\n\t\t\t\tnewTarget := targetUrl.Scheme + \"://\" + targetUrl.Host + u.Path\n\t\t\t\tProcessDoc(newTarget, level + 1)\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "711440844ea30ce975e984bd35761bd7", "score": "0.42911386", "text": "func (o VkQueue) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.Queues().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"Queues\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "de6ec3f37810e6c9357bf0d8faa63dfe", "score": "0.42835644", "text": "func PageLink(mediaID, n int, format string) string {\n\treturn fmt.Sprintf(\"https://i.nhentai.net/galleries/%d/%d.%s\", mediaID, n, format)\n}", "title": "" }, { "docid": "10dda1ea73b90054c8ae0271873f270a", "score": "0.42815107", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink) LinkId() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_LinkId {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_LinkId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"link-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "10dda1ea73b90054c8ae0271873f270a", "score": "0.42815107", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink) LinkId() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_LinkId {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_LinkId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"link-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a9b2b2eebf7c6062081506f293d89b66", "score": "0.42745188", "text": "func (o VkRenderPass) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.RenderPasses().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"RenderPasses\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "b5c5a0d10335e5800cae6dea3f8145c6", "score": "0.42647904", "text": "func (o VkPhysicalDevice) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.PhysicalDevices().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"PhysicalDevices\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "1aff140660c17ccf15c79155ef798f31", "score": "0.4264115", "text": "func goLinksFor(node ast.Node) (links []goLink) {\n\t// linkMap tracks link information for each ast.Ident node. Entries may\n\t// be created out of source order (for example, when we visit a parent\n\t// definition node). These links are appended to the returned slice when\n\t// their ast.Ident nodes are visited.\n\tlinkMap := make(map[*ast.Ident]goLink)\n\n\tast.Inspect(node, func(node ast.Node) bool {\n\t\tswitch n := node.(type) {\n\t\tcase *ast.Field:\n\t\t\tfor _, n := range n.Names {\n\t\t\t\tlinkMap[n] = goLink{}\n\t\t\t}\n\t\tcase *ast.ImportSpec:\n\t\t\tif name := n.Name; name != nil {\n\t\t\t\tlinkMap[name] = goLink{}\n\t\t\t}\n\t\tcase *ast.ValueSpec:\n\t\t\tfor _, n := range n.Names {\n\t\t\t\tlinkMap[n] = goLink{name: n.Name, isVal: true}\n\t\t\t}\n\t\tcase *ast.FuncDecl:\n\t\t\tlinkMap[n.Name] = goLink{}\n\t\tcase *ast.TypeSpec:\n\t\t\tlinkMap[n.Name] = goLink{}\n\t\tcase *ast.AssignStmt:\n\t\t\t// Short variable declarations only show up if we apply\n\t\t\t// this code to all source code (as opposed to exported\n\t\t\t// declarations only).\n\t\t\tif n.Tok == token.DEFINE {\n\t\t\t\t// Some of the lhs variables may be re-declared,\n\t\t\t\t// so technically they are not defs. We don't\n\t\t\t\t// care for now.\n\t\t\t\tfor _, x := range n.Lhs {\n\t\t\t\t\t// Each lhs expression should be an\n\t\t\t\t\t// ident, but we are conservative and check.\n\t\t\t\t\tif n, _ := x.(*ast.Ident); n != nil {\n\t\t\t\t\t\tlinkMap[n] = goLink{isVal: true}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ast.SelectorExpr:\n\t\t\t// Detect qualified identifiers of the form pkg.ident.\n\t\t\t// If anything fails we return true and collect individual\n\t\t\t// identifiers instead.\n\t\t\tif x, _ := n.X.(*ast.Ident); x != nil {\n\t\t\t\t// Create links only if x is a qualified identifier.\n\t\t\t\tif obj := x.Obj; obj != nil && obj.Kind == ast.Pkg {\n\t\t\t\t\tif spec, _ := obj.Decl.(*ast.ImportSpec); spec != nil {\n\t\t\t\t\t\t// spec.Path.Value is the import path\n\t\t\t\t\t\tif path, err := strconv.Unquote(spec.Path.Value); err == nil {\n\t\t\t\t\t\t\t// Register two links, one for the package\n\t\t\t\t\t\t\t// and one for the qualified identifier.\n\t\t\t\t\t\t\tlinkMap[x] = goLink{path: path}\n\t\t\t\t\t\t\tlinkMap[n.Sel] = goLink{path: path, name: n.Sel.Name}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ast.CompositeLit:\n\t\t\t// Detect field names within composite literals. These links should\n\t\t\t// be prefixed by the type name.\n\t\t\tfieldPath := \"\"\n\t\t\tprefix := \"\"\n\t\t\tswitch typ := n.Type.(type) {\n\t\t\tcase *ast.Ident:\n\t\t\t\tprefix = typ.Name + \".\"\n\t\t\tcase *ast.SelectorExpr:\n\t\t\t\tif x, _ := typ.X.(*ast.Ident); x != nil {\n\t\t\t\t\t// Create links only if x is a qualified identifier.\n\t\t\t\t\tif obj := x.Obj; obj != nil && obj.Kind == ast.Pkg {\n\t\t\t\t\t\tif spec, _ := obj.Decl.(*ast.ImportSpec); spec != nil {\n\t\t\t\t\t\t\t// spec.Path.Value is the import path\n\t\t\t\t\t\t\tif path, err := strconv.Unquote(spec.Path.Value); err == nil {\n\t\t\t\t\t\t\t\t// Register two links, one for the package\n\t\t\t\t\t\t\t\t// and one for the qualified identifier.\n\t\t\t\t\t\t\t\tlinkMap[x] = goLink{path: path}\n\t\t\t\t\t\t\t\tlinkMap[typ.Sel] = goLink{path: path, name: typ.Sel.Name}\n\t\t\t\t\t\t\t\tfieldPath = path\n\t\t\t\t\t\t\t\tprefix = typ.Sel.Name + \".\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, e := range n.Elts {\n\t\t\t\tif kv, ok := e.(*ast.KeyValueExpr); ok {\n\t\t\t\t\tif k, ok := kv.Key.(*ast.Ident); ok {\n\t\t\t\t\t\t// Note: there is some syntactic ambiguity here. We cannot determine\n\t\t\t\t\t\t// if this is a struct literal or a map literal without type\n\t\t\t\t\t\t// information. We assume struct literal.\n\t\t\t\t\t\tname := prefix + k.Name\n\t\t\t\t\t\tlinkMap[k] = goLink{path: fieldPath, name: name}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ast.Ident:\n\t\t\tif l, ok := linkMap[n]; ok {\n\t\t\t\tlinks = append(links, l)\n\t\t\t} else {\n\t\t\t\tl := goLink{name: n.Name}\n\t\t\t\tif n.Obj == nil && doc.IsPredeclared(n.Name) {\n\t\t\t\t\tl.path = \"builtin\"\n\t\t\t\t}\n\t\t\t\tlinks = append(links, l)\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n\treturn\n}", "title": "" }, { "docid": "7be2f8e57c888047b2d77ffaa2527ffd", "score": "0.42569286", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) LinkId() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_LinkId {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_LinkId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"link-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7be2f8e57c888047b2d77ffaa2527ffd", "score": "0.4253572", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) LinkId() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_LinkId {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_LinkId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"link-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f85b875a8330f4a9593f5a32e5d1792a", "score": "0.4253436", "text": "func (fn *FileNode) IsSymLink() bool {\n\treturn fn.HasFlag(int(FileNodeSymLink))\n}", "title": "" }, { "docid": "bfb785935eb34bd5366c53ce12c7f94a", "score": "0.42242378", "text": "func (o VkInstance) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.Instances().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"Instances\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "01771ea0a4bc30d6edb3379aeb1b9dac", "score": "0.42221344", "text": "func makeLink(mnt *Mount, token string) (string, error) {\n\t// The blkid cache may not always hold the canonical device path. To\n\t// solve this we first use blkid_evaluate_spec to find the right entry\n\t// in the cache. Then that name is used to get the token value.\n\tcDevice := C.CString(mnt.Device)\n\tdefer C.string_free(cDevice)\n\n\tcDeviceEntry := C.blkid_evaluate_spec(cDevice, &cache)\n\tdefer C.string_free(cDeviceEntry)\n\tdeviceEntry := C.GoString(cDeviceEntry)\n\n\tlog.Printf(\"blkid_evaluate_spec(%q, <cache>) = %q\", mnt.Device, deviceEntry)\n\n\tcToken := C.CString(token)\n\tdefer C.string_free(cToken)\n\n\tcValue := C.blkid_get_tag_value(cache, cToken, cDeviceEntry)\n\tdefer C.string_free(cValue)\n\tvalue := C.GoString(cValue)\n\n\tlog.Printf(\"blkid_get_tag_value(<cache>, %s, %s) = %s\", token, deviceEntry, value)\n\n\tif value == \"\" {\n\t\treturn \"\", errors.Wrapf(ErrMakeLink, \"no %s\", token)\n\t}\n\treturn fmt.Sprintf(\"%s=%s\", token, C.GoString(cValue)), nil\n}", "title": "" }, { "docid": "534a86e7434257c9886ffa73a6080469", "score": "0.42210174", "text": "func readTreeBasedLinkBag(buf io.Reader) (*oschema.OLinkBag, error) {\n\tfileID, err := rw.ReadLong(buf)\n\tif err != nil {\n\t\treturn nil, oerror.NewTrace(err)\n\t}\n\n\tpageIdx, err := rw.ReadLong(buf)\n\tif err != nil {\n\t\treturn nil, oerror.NewTrace(err)\n\t}\n\n\tpageOffset, err := rw.ReadInt(buf)\n\tif err != nil {\n\t\treturn nil, oerror.NewTrace(err)\n\t}\n\n\t// TODO: need to know how to handle the size and changes stuff => advanced feature not needed yet\n\tsize, err := rw.ReadInt(buf)\n\tif err != nil {\n\t\treturn nil, oerror.NewTrace(err)\n\t}\n\n\t_, err = rw.ReadInt(buf) // changes // TODO: is changes always an int32?\n\tif err != nil {\n\t\treturn nil, oerror.NewTrace(err)\n\t}\n\n\treturn oschema.NewTreeOLinkBag(fileID, pageIdx, pageOffset, size), nil\n}", "title": "" }, { "docid": "42727baf6bc1ae3f93c9fddb13733dea", "score": "0.422083", "text": "func (o VkCommandPool) Link(ctx context.Context, p path.Node, r *path.ResolveConfig) (path.Node, error) {\n\ti, c, err := state(ctx, p, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !c.CommandPools().Contains(o) {\n\t\treturn nil, fmt.Errorf(\"State does not contain link target\")\n\t}\n\treturn path.NewField(\"CommandPools\", i).MapIndex(o), nil\n}", "title": "" }, { "docid": "6cd071e49ea71c82875cf57b41c4688f", "score": "0.421779", "text": "func (o *FiltersNic) GetLinkNicDeviceNumbers() []int32 {\n\tif o == nil || o.LinkNicDeviceNumbers == nil {\n\t\tvar ret []int32\n\t\treturn ret\n\t}\n\treturn *o.LinkNicDeviceNumbers\n}", "title": "" }, { "docid": "7596e0cdb74625750a4f8fe496b496f7", "score": "0.4203649", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) LinkId() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_LinkId {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_LinkId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"link-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7596e0cdb74625750a4f8fe496b496f7", "score": "0.4203649", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) LinkId() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_LinkId {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_LinkId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"link-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9f85754a47a714241a2baabd059bee1e", "score": "0.41993138", "text": "func GetNodeIndex(node []*yaml.Node, key string) int {\n\tappIdx := -1\n\tfor i, k := range node {\n\t\tif i%2 == 0 && k.Value == key {\n\t\t\tappIdx = i + 1\n\t\t\tbreak\n\t\t}\n\t}\n\treturn appIdx\n}", "title": "" }, { "docid": "41e3a4097f1b8f3b3724162f0754ff8d", "score": "0.4196466", "text": "func displayLink(publicHost, dnsHost string, port *int32, link *models.V2FrontendLinkBackendMapItems0) string {\n\thost := displayHost(publicHost, dnsHost, port, link)\n\tpath := \"\"\n\tif link != nil {\n\t\tif len(link.PathReg) > 0 {\n\t\t\tpath = link.PathReg\n\t\t} else if len(link.PathBeg) > 0 || len(link.PathEnd) > 0 {\n\t\t\tpath = link.PathBeg + \"/*/\" + link.PathEnd\n\t\t}\n\t}\n\n\treturn fmt.Sprintf(\"%s%s\", host, path)\n}", "title": "" }, { "docid": "37382ec5bc1685899bd15490e1bdc7a9", "score": "0.419037", "text": "func Readlink(path string) (string, error) {\n\tvar target string\n\terr := Wrap(path, func(path string) error {\n\t\t// Fairly simple.\n\t\tvar err error\n\t\ttarget, err = os.Readlink(path)\n\t\treturn err\n\t})\n\treturn target, errors.Wrap(err, \"unpriv.readlink\")\n}", "title": "" }, { "docid": "9c80dfc6f006ab6d577178aa5bccefdd", "score": "0.41901886", "text": "func (g *Grove) nodeFromInfo(info os.FileInfo) (forest.Node, error) {\n\tnodeIDString := info.Name()\n\tnodeID := &fields.QualifiedHash{}\n\tif err := nodeID.UnmarshalText([]byte(nodeIDString)); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse %s as a node id: %w\", nodeIDString, err)\n\t}\n\tif node, present, _ := g.NodeCache.Get(nodeID); present {\n\t\treturn node, nil\n\t}\n\tnodeFile, err := g.Open(info.Name())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed opening node file %s: %w\", info.Name(), err)\n\t}\n\tdefer nodeFile.Close()\n\tnodeData, err := ioutil.ReadAll(nodeFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed reading node file %s: %w\", info.Name(), err)\n\t}\n\tnode, err := forest.UnmarshalBinaryNode(nodeData)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed parsing node file %s: %w\", info.Name(), err)\n\t}\n\t_ = g.NodeCache.Add(node)\n\treturn node, nil\n}", "title": "" } ]